Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-test-renderer

Package Overview
Dependencies
Maintainers
11
Versions
1963
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-test-renderer - npm Package Compare versions

Comparing version 0.0.0-c5b7d26c7 to 0.0.0-d1326f466

10

build-info.json
{
"branch": "pull/14383",
"buildNumber": "12850",
"checksum": "bbfa71d",
"commit": "c5b7d26c7",
"branch": "master",
"buildNumber": "13364",
"checksum": "ae8143f",
"commit": "d1326f466",
"environment": "ci",
"reactVersion": "16.6.1-canary-c5b7d26c7"
"reactVersion": "16.7.0-canary-d1326f466"
}

@@ -1,2 +0,2 @@

/** @license React v0.0.0-c5b7d26c7
/** @license React v0.0.0-d1326f466
* react-test-renderer-shallow.development.js

@@ -229,6 +229,2 @@ *

/*eslint-disable no-self-compare */
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**

@@ -239,14 +235,8 @@ * inlined Object.is polyfill to avoid requiring consumers ship their own

function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**

@@ -283,4 +273,39 @@ * Performs equality by iterating through keys on an object and returning false

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = warningWithoutStack$1;
{
warning = function (condition, format) {
if (condition) {
return;
}
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
// eslint-disable-next-line react-internal/warning-and-invariant-args
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
};
}
var warning$1 = warning;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var RE_RENDER_LIMIT = 25;
var emptyObject = {};

@@ -291,2 +316,25 @@ {

// In DEV, this is the name of the currently executing primitive hook
var currentHookNameInDev = void 0;
function areHookInputsEqual(nextDeps, prevDeps) {
if (prevDeps === null) {
warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
return false;
}
// Don't bother comparing lengths in prod because these arrays should be
// passed inline.
if (nextDeps.length !== prevDeps.length) {
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
}
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
if (is(nextDeps[i], prevDeps[i])) {
continue;
}
return false;
}
return true;
}
var Updater = function () {

@@ -358,2 +406,14 @@ function Updater(renderer) {

function createHook() {
return {
memoizedState: null,
queue: null,
next: null
};
}
function basicStateReducer(state, action) {
return typeof action === 'function' ? action(state) : action;
}
var ReactShallowRenderer = function () {

@@ -371,4 +431,229 @@ function ReactShallowRenderer() {

this._updater = new Updater(this);
this._dispatcher = this._createDispatcher();
this._workInProgressHook = null;
this._firstWorkInProgressHook = null;
this._isReRender = false;
this._didScheduleRenderPhaseUpdate = false;
this._renderPhaseUpdates = null;
this._currentlyRenderingComponent = null;
this._numberOfReRenders = 0;
this._previousComponentIdentity = null;
}
ReactShallowRenderer.prototype._validateCurrentlyRenderingComponent = function _validateCurrentlyRenderingComponent() {
!(this._currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
};
ReactShallowRenderer.prototype._createDispatcher = function _createDispatcher() {
var _this = this;
var useReducer = function (reducer, initialArg, init) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var workInProgressHook = _this._workInProgressHook;
if (_this._isReRender) {
// This is a re-render. Apply the new render phase updates to the previous
var _queue = workInProgressHook.queue;
var _dispatch = _queue.dispatch;
if (_this._renderPhaseUpdates !== null) {
// Render phase updates are stored in a map of queue -> linked list
var firstRenderPhaseUpdate = _this._renderPhaseUpdates.get(_queue);
if (firstRenderPhaseUpdate !== undefined) {
_this._renderPhaseUpdates.delete(_queue);
var newState = workInProgressHook.memoizedState;
var update = firstRenderPhaseUpdate;
do {
// Process this render phase update. We don't have to check the
// priority because it will always be the same as the current
// render's.
var _action = update.action;
newState = reducer(newState, _action);
update = update.next;
} while (update !== null);
workInProgressHook.memoizedState = newState;
return [newState, _dispatch];
}
}
return [workInProgressHook.memoizedState, _dispatch];
} else {
var initialState = void 0;
if (reducer === basicStateReducer) {
// Special case for `useState`.
initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
} else {
initialState = init !== undefined ? init(initialArg) : initialArg;
}
workInProgressHook.memoizedState = initialState;
var _queue2 = workInProgressHook.queue = {
last: null,
dispatch: null
};
var _dispatch2 = _queue2.dispatch = _this._dispatchAction.bind(_this, _this._currentlyRenderingComponent, _queue2);
return [workInProgressHook.memoizedState, _dispatch2];
}
};
var useState = function (initialState) {
return useReducer(basicStateReducer,
// useReducer has a special case to support lazy useState initializers
initialState);
};
var useMemo = function (nextCreate, deps) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var nextDeps = deps !== undefined ? deps : null;
if (_this._workInProgressHook !== null && _this._workInProgressHook.memoizedState !== null) {
var prevState = _this._workInProgressHook.memoizedState;
var prevDeps = prevState[1];
if (nextDeps !== null) {
if (areHookInputsEqual(nextDeps, prevDeps)) {
return prevState[0];
}
}
}
var nextValue = nextCreate();
_this._workInProgressHook.memoizedState = [nextValue, nextDeps];
return nextValue;
};
var useRef = function (initialValue) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var previousRef = _this._workInProgressHook.memoizedState;
if (previousRef === null) {
var ref = { current: initialValue };
{
Object.seal(ref);
}
_this._workInProgressHook.memoizedState = ref;
return ref;
} else {
return previousRef;
}
};
var readContext = function (context, observedBits) {
return context._currentValue;
};
var noOp = function () {
_this._validateCurrentlyRenderingComponent();
};
var identity = function (fn) {
return fn;
};
return {
readContext: readContext,
useCallback: identity,
useContext: function (context) {
_this._validateCurrentlyRenderingComponent();
return readContext(context);
},
useDebugValue: noOp,
useEffect: noOp,
useImperativeHandle: noOp,
useLayoutEffect: noOp,
useMemo: useMemo,
useReducer: useReducer,
useRef: useRef,
useState: useState
};
};
ReactShallowRenderer.prototype._dispatchAction = function _dispatchAction(componentIdentity, queue, action) {
!(this._numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
if (componentIdentity === this._currentlyRenderingComponent) {
// This is a render phase update. Stash it in a lazily-created map of
// queue -> linked list of updates. After this render pass, we'll restart
// and apply the stashed updates on top of the work-in-progress hook.
this._didScheduleRenderPhaseUpdate = true;
var update = {
action: action,
next: null
};
var renderPhaseUpdates = this._renderPhaseUpdates;
if (renderPhaseUpdates === null) {
this._renderPhaseUpdates = renderPhaseUpdates = new Map();
}
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (firstRenderPhaseUpdate === undefined) {
renderPhaseUpdates.set(queue, update);
} else {
// Append the update to the end of the list.
var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
while (lastRenderPhaseUpdate.next !== null) {
lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
}
lastRenderPhaseUpdate.next = update;
}
} else {
// This means an update has happened after the function component has
// returned. On the server this is a no-op. In React Fiber, the update
// would be scheduled for a future render.
}
};
ReactShallowRenderer.prototype._createWorkInProgressHook = function _createWorkInProgressHook() {
if (this._workInProgressHook === null) {
// This is the first hook in the list
if (this._firstWorkInProgressHook === null) {
this._isReRender = false;
this._firstWorkInProgressHook = this._workInProgressHook = createHook();
} else {
// There's already a work-in-progress. Reuse it.
this._isReRender = true;
this._workInProgressHook = this._firstWorkInProgressHook;
}
} else {
if (this._workInProgressHook.next === null) {
this._isReRender = false;
// Append to the end of the list
this._workInProgressHook = this._workInProgressHook.next = createHook();
} else {
// There's already a work-in-progress. Reuse it.
this._isReRender = true;
this._workInProgressHook = this._workInProgressHook.next;
}
}
return this._workInProgressHook;
};
ReactShallowRenderer.prototype._prepareToUseHooks = function _prepareToUseHooks(componentIdentity) {
if (this._previousComponentIdentity !== null && this._previousComponentIdentity !== componentIdentity) {
this._firstWorkInProgressHook = null;
}
this._currentlyRenderingComponent = componentIdentity;
this._previousComponentIdentity = componentIdentity;
};
ReactShallowRenderer.prototype._finishHooks = function _finishHooks(element, context) {
if (this._didScheduleRenderPhaseUpdate) {
// Updates were scheduled during the render phase. They are stored in
// the `renderPhaseUpdates` map. Call the component again, reusing the
// work-in-progress hooks and applying the additional updates on top. Keep
// restarting until no more updates are scheduled.
this._didScheduleRenderPhaseUpdate = false;
this._numberOfReRenders += 1;
// Start over from the beginning of the list
this._workInProgressHook = null;
this._rendering = false;
this.render(element, context);
} else {
this._currentlyRenderingComponent = null;
this._workInProgressHook = null;
this._renderPhaseUpdates = null;
this._numberOfReRenders = 0;
}
};
ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {

@@ -386,2 +671,3 @@ return this._instance;

!React.isValidElement(element) ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
element = element;
// Show a special message for host elements since it's a common case.

@@ -407,3 +693,8 @@ !(typeof element.type !== 'string') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : void 0;

this._updateStateFromStaticLifecycle(element.props);
if (typeof element.type.getDerivedStateFromProps === 'function') {
var partialState = element.type.getDerivedStateFromProps.call(null, element.props, this._instance.state);
if (partialState != null) {
this._instance.state = _assign({}, this._instance.state, partialState);
}
}

@@ -420,3 +711,11 @@ if (element.type.hasOwnProperty('contextTypes')) {

} else {
this._rendered = element.type.call(undefined, element.props, this._context);
var prevDispatcher = ReactCurrentDispatcher.current;
ReactCurrentDispatcher.current = this._dispatcher;
this._prepareToUseHooks(element.type);
try {
this._rendered = element.type.call(undefined, element.props, this._context);
} finally {
ReactCurrentDispatcher.current = prevDispatcher;
}
this._finishHooks(element, context);
}

@@ -438,2 +737,4 @@ }

this._firstWorkInProgressHook = null;
this._previousComponentIdentity = null;
this._context = null;

@@ -497,6 +798,11 @@ this._element = null;

}
this._updateStateFromStaticLifecycle(props);
// Read state after cWRP in case it calls setState
var state = this._newState || oldState;
if (typeof type.getDerivedStateFromProps === 'function') {
var partialState = type.getDerivedStateFromProps.call(null, props, state);
if (partialState != null) {
state = _assign({}, state, partialState);
}
}

@@ -529,2 +835,3 @@ var shouldUpdate = true;

this._instance.state = state;
this._newState = null;

@@ -538,17 +845,2 @@ if (shouldUpdate) {

ReactShallowRenderer.prototype._updateStateFromStaticLifecycle = function _updateStateFromStaticLifecycle(props) {
var type = this._element.type;
if (typeof type.getDerivedStateFromProps === 'function') {
var oldState = this._newState || this._instance.state;
var partialState = type.getDerivedStateFromProps.call(null, props, oldState);
if (partialState != null) {
var newState = _assign({}, oldState, partialState);
this._instance.state = this._newState = newState;
}
}
};
return ReactShallowRenderer;

@@ -595,3 +887,3 @@ }();

function getMaskedContext(contextTypes, unmaskedContext) {
if (!contextTypes) {
if (!contextTypes || !unmaskedContext) {
return emptyObject;

@@ -598,0 +890,0 @@ }

@@ -1,2 +0,2 @@

/** @license React v0.0.0-c5b7d26c7
/** @license React v0.0.0-d1326f466
* react-test-renderer-shallow.production.min.js

@@ -10,18 +10,26 @@ *

'use strict';var e=require("object-assign"),g=require("react"),n=require("react-is"),p=require("prop-types/checkPropTypes");function q(a,b,d,c,f,h,m,k){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[d,c,f,h,m,k],D=0;a=Error(b.replace(/%s/g,function(){return l[D++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
'use strict';var g=require("object-assign"),h=require("react"),m=require("react-is"),p=require("prop-types/checkPropTypes");function q(a,b,d,c,e,l,n,k){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[d,c,e,l,n,k],G=0;a=Error(b.replace(/%s/g,function(){return f[G++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
function r(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);q(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}
var t=/^(.*)[\\\/]/,u="function"===typeof Symbol&&Symbol.for,v=u?Symbol.for("react.portal"):60106,w=u?Symbol.for("react.fragment"):60107,x=u?Symbol.for("react.strict_mode"):60108,y=u?Symbol.for("react.profiler"):60114,z=u?Symbol.for("react.provider"):60109,A=u?Symbol.for("react.context"):60110,B=u?Symbol.for("react.concurrent_mode"):60111,C=u?Symbol.for("react.forward_ref"):60112,E=u?Symbol.for("react.suspense"):60113,F=u?Symbol.for("react.memo"):60115,G=u?Symbol.for("react.lazy"):60116;
function H(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case B:return"ConcurrentMode";case w:return"Fragment";case v:return"Portal";case y:return"Profiler";case x:return"StrictMode";case E:return"Suspense"}if("object"===typeof a)switch(a.$$typeof){case A:return"Context.Consumer";case z:return"Context.Provider";case C:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");
case F:return H(a.type);case G:if(a=1===a._status?a._result:null)return H(a)}return null}var I=Object.prototype.hasOwnProperty;function J(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function K(a,b){if(J(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var d=Object.keys(a),c=Object.keys(b);if(d.length!==c.length)return!1;for(c=0;c<d.length;c++)if(!I.call(b,d[c])||!J(a[d[c]],b[d[c]]))return!1;return!0}
var t=/^(.*)[\\\/]/,u="function"===typeof Symbol&&Symbol.for,v=u?Symbol.for("react.portal"):60106,w=u?Symbol.for("react.fragment"):60107,x=u?Symbol.for("react.strict_mode"):60108,y=u?Symbol.for("react.profiler"):60114,z=u?Symbol.for("react.provider"):60109,A=u?Symbol.for("react.context"):60110,B=u?Symbol.for("react.concurrent_mode"):60111,C=u?Symbol.for("react.forward_ref"):60112,D=u?Symbol.for("react.suspense"):60113,E=u?Symbol.for("react.memo"):60115,F=u?Symbol.for("react.lazy"):60116;
function H(a){if(null==a)return null;if("function"===typeof a)return a.displayName||a.name||null;if("string"===typeof a)return a;switch(a){case B:return"ConcurrentMode";case w:return"Fragment";case v:return"Portal";case y:return"Profiler";case x:return"StrictMode";case D:return"Suspense"}if("object"===typeof a)switch(a.$$typeof){case A:return"Context.Consumer";case z:return"Context.Provider";case C:var b=a.render;b=b.displayName||b.name||"";return a.displayName||(""!==b?"ForwardRef("+b+")":"ForwardRef");
case E:return H(a.type);case F:if(a=1===a._status?a._result:null)return H(a)}return null}function I(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var J=Object.prototype.hasOwnProperty;function K(a,b){if(I(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var d=Object.keys(a),c=Object.keys(b);if(d.length!==c.length)return!1;for(c=0;c<d.length;c++)if(!J.call(b,d[c])||!I(a[d[c]],b[d[c]]))return!1;return!0}
function L(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}
var M={},N=function(){function a(b){L(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a){this._enqueueCallback(a,b);this._renderer._forcedUpdate=
!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,c){this._enqueueCallback(c,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,c){this._enqueueCallback(c,b);c=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,c,b.props));null!==a&&void 0!==a&&(this._renderer._newState=e({},c,a),this._renderer.render(this._renderer._element,
this._renderer._context))};return a}(),Q=function(){function a(){L(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new N(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:M;g.isValidElement(b)?void 0:r("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":
"");"string"===typeof b.type?r("13",b.type):void 0;n.isForwardRef(b)||"function"===typeof b.type?void 0:r("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type);if(!this._rendering){this._rendering=!0;this._element=b;var c=b.type.contextTypes;if(c){var f={},h;for(h in c)f[h]=a[h];a=f}else a=M;this._context=a;this._instance?this._updateClassComponent(b,this._context):n.isForwardRef(b)?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=
new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes")&&(O=b,a=b.type,c=(c=this._instance)&&c.constructor,p(b.type.contextTypes,this._context,"context",a.displayName||c&&c.displayName||a.name||c&&c.name||null,P),O=null),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=
function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};a.prototype._mountClassComponent=function(a,d){this._instance.context=d;this._instance.props=a.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)d=
this._newState,"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),d!==this._newState&&(this._instance.state=this._newState||M);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,d){var b=a.props,f=a.type,h=this._instance.state||
M,m=this._instance.props;m!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,d),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,d));this._updateStateFromStaticLifecycle(b);var k=this._newState||h,l=!0;this._forcedUpdate?(l=!0,this._forcedUpdate=!1):"function"===
typeof this._instance.shouldComponentUpdate?l=!!this._instance.shouldComponentUpdate(b,k,d):f.prototype&&f.prototype.isPureReactComponent&&(l=!K(m,b)||!K(h,k));l&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,k,d),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,k,d));this._instance.context=
d;this._instance.props=b;this._instance.state=k;l&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=e({},c,a),this._instance.state=this._newState=c)}};return a}();Q.createRenderer=function(){return new Q};var O=null;
function P(){var a="";if(O){var b=null==O?"#empty":"string"===typeof O||"number"===typeof O?"#text":"string"===typeof O.type?O.type:O.type.displayName||O.type.name||"Unknown",d=O._owner,c=O._source;d=d&&H(d.type);var f="";c?f=" (at "+c.fileName.replace(t,"")+":"+c.lineNumber+")":d&&(f=" (created by "+d+")");a+="\n in "+(b||"Unknown")+f}return a}var R={default:Q},S=R&&Q||R;module.exports=S.default||S;
var M=h.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,N={},O=function(){function a(b){L(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(){return!!this._renderer._element};a.prototype.enqueueForceUpdate=
function(b,a){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,c){this._enqueueCallback(c,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,c){this._enqueueCallback(c,b);c=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,c,b.props));null!==a&&void 0!==a&&(this._renderer._newState=
g({},c,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}();function P(){return{memoizedState:null,queue:null,next:null}}function Q(a,b){return"function"===typeof b?b(a):b}
var T=function(){function a(){L(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new O(this);this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._currentlyRenderingComponent=this._renderPhaseUpdates=null;this._numberOfReRenders=0;this._previousComponentIdentity=null}a.prototype._validateCurrentlyRenderingComponent=
function(){null===this._currentlyRenderingComponent?r("307"):void 0};a.prototype._createDispatcher=function(){function b(){c._validateCurrentlyRenderingComponent()}function a(b,a,d){c._validateCurrentlyRenderingComponent();c._createWorkInProgressHook();var e=c._workInProgressHook;if(c._isReRender){var f=e.queue;a=f.dispatch;if(null!==c._renderPhaseUpdates&&(d=c._renderPhaseUpdates.get(f),void 0!==d)){c._renderPhaseUpdates.delete(f);f=e.memoizedState;do f=b(f,d.action),d=d.next;while(null!==d);e.memoizedState=
f;return[f,a]}return[e.memoizedState,a]}b=b===Q?"function"===typeof a?a():a:void 0!==d?d(a):a;e.memoizedState=b;b=e.queue={last:null,dispatch:null};b=b.dispatch=c._dispatchAction.bind(c,c._currentlyRenderingComponent,b);return[e.memoizedState,b]}var c=this;return{readContext:function(b){return b._currentValue},useCallback:function(b){return b},useContext:function(b){c._validateCurrentlyRenderingComponent();return b._currentValue},useDebugValue:b,useEffect:b,useImperativeHandle:b,useLayoutEffect:b,
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,e=d[1];if(null!==a){a:if(null===e)e=!1;else{for(var f=0;f<e.length&&f<a.length;f++)if(!I(a[f],e[f])){e=!1;break a}e=!0}if(e)return d[0]}}b=b();c._workInProgressHook.memoizedState=[b,a];return b},useReducer:a,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(b){return a(Q,b)}}};a.prototype._dispatchAction=function(b,a,c){25>this._numberOfReRenders?void 0:r("301");if(b===this._currentlyRenderingComponent){this._didScheduleRenderPhaseUpdate=!0;b={action:c,next:null};c=this._renderPhaseUpdates;null===c&&(this._renderPhaseUpdates=c=new Map);var d=c.get(a);if(void 0===d)c.set(a,b);else{for(a=d;null!==a.next;)a=a.next;a.next=
b}}};a.prototype._createWorkInProgressHook=function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=P()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=P()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};
a.prototype._prepareToUseHooks=function(b){null!==this._previousComponentIdentity&&this._previousComponentIdentity!==b&&(this._firstWorkInProgressHook=null);this._previousComponentIdentity=this._currentlyRenderingComponent=b};a.prototype._finishHooks=function(b,a){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(b,a)):(this._renderPhaseUpdates=this._workInProgressHook=this._currentlyRenderingComponent=
null,this._numberOfReRenders=0)};a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:N;h.isValidElement(b)?void 0:r("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?r("13",b.type):void 0;m.isForwardRef(b)||"function"===typeof b.type?
void 0:r("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type);if(!this._rendering){this._rendering=!0;this._element=b;var c;if((c=b.type.contextTypes)&&a){var e={},l;for(l in c)e[l]=a[l];c=e}else c=N;this._context=c;if(this._instance)this._updateClassComponent(b,this._context);else if(m.isForwardRef(b))this._rendered=b.type.render(b.props,b.ref);else if(c=b.type,c.prototype&&c.prototype.isReactComponent)this._instance=new b.type(b.props,this._context,this._updater),"function"===
typeof b.type.getDerivedStateFromProps&&(a=b.type.getDerivedStateFromProps.call(null,b.props,this._instance.state),null!=a&&(this._instance.state=g({},this._instance.state,a))),b.type.hasOwnProperty("contextTypes")&&(R=b,a=b.type,c=(c=this._instance)&&c.constructor,p(b.type.contextTypes,this._context,"context",a.displayName||c&&c.displayName||a.name||c&&c.name||null,S),R=null),this._mountClassComponent(b,this._context);else{c=M.current;M.current=this._dispatcher;this._prepareToUseHooks(b.type);try{this._rendered=
b.type.call(void 0,b.props,this._context)}finally{M.current=c}this._finishHooks(b,a)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=this._previousComponentIdentity=this._firstWorkInProgressHook=null};a.prototype._mountClassComponent=function(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)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&
this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||N);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,d){var b=a.props,e=a.type,l=this._instance.state||N,n=this._instance.props;n!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,d),"function"===
typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,d));var k=this._newState||l;if("function"===typeof e.getDerivedStateFromProps){var f=e.getDerivedStateFromProps.call(null,b,k);null!=f&&(k=g({},k,f))}f=!0;this._forcedUpdate?(f=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?f=!!this._instance.shouldComponentUpdate(b,k,d):e.prototype&&e.prototype.isPureReactComponent&&(f=!K(n,b)||!K(l,k));f&&"function"!==typeof a.type.getDerivedStateFromProps&&
"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,k,d),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,k,d));this._instance.context=d;this._instance.props=b;this._instance.state=k;this._newState=null;f&&(this._rendered=this._instance.render())};return a}();T.createRenderer=function(){return new T};var R=null;
function S(){var a="";if(R){var b=null==R?"#empty":"string"===typeof R||"number"===typeof R?"#text":"string"===typeof R.type?R.type:R.type.displayName||R.type.name||"Unknown",d=R._owner,c=R._source;d=d&&H(d.type);var e="";c?e=" (at "+c.fileName.replace(t,"")+":"+c.lineNumber+")":d&&(e=" (created by "+d+")");a+="\n in "+(b||"Unknown")+e}return a}var U={default:T},V=U&&T||U;module.exports=V.default||V;
{
"name": "react-test-renderer",
"version": "0.0.0-c5b7d26c7",
"version": "0.0.0-d1326f466",
"description": "React package for snapshot testing.",
"main": "index.js",
"repository": "facebook/react",
"repository": {
"type": "git",
"url": "https://github.com/facebook/react.git",
"directory": "packages/react-test-renderer"
},
"keywords": [

@@ -20,7 +24,7 @@ "react",

"prop-types": "^15.6.2",
"react-is": "0.0.0-c5b7d26c7",
"scheduler": "0.0.0-c5b7d26c7"
"react-is": "0.0.0-d1326f466",
"scheduler": "0.0.0-d1326f466"
},
"peerDependencies": {
"react": "0.0.0-c5b7d26c7"
"react": "0.0.0-d1326f466"
},

@@ -27,0 +31,0 @@ "files": [

@@ -1,2 +0,2 @@

/** @license React v0.0.0-c5b7d26c7
/** @license React v0.0.0-d1326f466
* react-test-renderer-shallow.development.js

@@ -116,2 +116,3 @@ *

case REACT_STRICT_MODE_TYPE:
case REACT_SUSPENSE_TYPE:
return type;

@@ -130,2 +131,3 @@ default:

}
case REACT_LAZY_TYPE:
case REACT_MEMO_TYPE:

@@ -153,2 +155,4 @@ case REACT_PORTAL_TYPE:

// AsyncMode should be deprecated

@@ -307,6 +311,2 @@

/*eslint-disable no-self-compare */
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**

@@ -317,14 +317,8 @@ * inlined Object.is polyfill to avoid requiring consumers ship their own

function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**

@@ -466,4 +460,39 @@ * Performs equality by iterating through keys on an object and returning false

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = warningWithoutStack$1;
{
warning = function (condition, format) {
if (condition) {
return;
}
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
// eslint-disable-next-line react-internal/warning-and-invariant-args
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
};
}
var warning$1 = warning;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
var RE_RENDER_LIMIT = 25;
var emptyObject = {};

@@ -474,2 +503,25 @@ {

// In DEV, this is the name of the currently executing primitive hook
var currentHookNameInDev = void 0;
function areHookInputsEqual(nextDeps, prevDeps) {
if (prevDeps === null) {
warning$1(false, '%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev);
return false;
}
// Don't bother comparing lengths in prod because these arrays should be
// passed inline.
if (nextDeps.length !== prevDeps.length) {
warning$1(false, 'The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, '[' + nextDeps.join(', ') + ']', '[' + prevDeps.join(', ') + ']');
}
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
if (is(nextDeps[i], prevDeps[i])) {
continue;
}
return false;
}
return true;
}
var Updater = function () {

@@ -541,2 +593,14 @@ function Updater(renderer) {

function createHook() {
return {
memoizedState: null,
queue: null,
next: null
};
}
function basicStateReducer(state, action) {
return typeof action === 'function' ? action(state) : action;
}
var ReactShallowRenderer = function () {

@@ -554,4 +618,229 @@ function ReactShallowRenderer() {

this._updater = new Updater(this);
this._dispatcher = this._createDispatcher();
this._workInProgressHook = null;
this._firstWorkInProgressHook = null;
this._isReRender = false;
this._didScheduleRenderPhaseUpdate = false;
this._renderPhaseUpdates = null;
this._currentlyRenderingComponent = null;
this._numberOfReRenders = 0;
this._previousComponentIdentity = null;
}
ReactShallowRenderer.prototype._validateCurrentlyRenderingComponent = function _validateCurrentlyRenderingComponent() {
!(this._currentlyRenderingComponent !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
};
ReactShallowRenderer.prototype._createDispatcher = function _createDispatcher() {
var _this = this;
var useReducer = function (reducer, initialArg, init) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var workInProgressHook = _this._workInProgressHook;
if (_this._isReRender) {
// This is a re-render. Apply the new render phase updates to the previous
var _queue = workInProgressHook.queue;
var _dispatch = _queue.dispatch;
if (_this._renderPhaseUpdates !== null) {
// Render phase updates are stored in a map of queue -> linked list
var firstRenderPhaseUpdate = _this._renderPhaseUpdates.get(_queue);
if (firstRenderPhaseUpdate !== undefined) {
_this._renderPhaseUpdates.delete(_queue);
var newState = workInProgressHook.memoizedState;
var update = firstRenderPhaseUpdate;
do {
// Process this render phase update. We don't have to check the
// priority because it will always be the same as the current
// render's.
var _action = update.action;
newState = reducer(newState, _action);
update = update.next;
} while (update !== null);
workInProgressHook.memoizedState = newState;
return [newState, _dispatch];
}
}
return [workInProgressHook.memoizedState, _dispatch];
} else {
var initialState = void 0;
if (reducer === basicStateReducer) {
// Special case for `useState`.
initialState = typeof initialArg === 'function' ? initialArg() : initialArg;
} else {
initialState = init !== undefined ? init(initialArg) : initialArg;
}
workInProgressHook.memoizedState = initialState;
var _queue2 = workInProgressHook.queue = {
last: null,
dispatch: null
};
var _dispatch2 = _queue2.dispatch = _this._dispatchAction.bind(_this, _this._currentlyRenderingComponent, _queue2);
return [workInProgressHook.memoizedState, _dispatch2];
}
};
var useState = function (initialState) {
return useReducer(basicStateReducer,
// useReducer has a special case to support lazy useState initializers
initialState);
};
var useMemo = function (nextCreate, deps) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var nextDeps = deps !== undefined ? deps : null;
if (_this._workInProgressHook !== null && _this._workInProgressHook.memoizedState !== null) {
var prevState = _this._workInProgressHook.memoizedState;
var prevDeps = prevState[1];
if (nextDeps !== null) {
if (areHookInputsEqual(nextDeps, prevDeps)) {
return prevState[0];
}
}
}
var nextValue = nextCreate();
_this._workInProgressHook.memoizedState = [nextValue, nextDeps];
return nextValue;
};
var useRef = function (initialValue) {
_this._validateCurrentlyRenderingComponent();
_this._createWorkInProgressHook();
var previousRef = _this._workInProgressHook.memoizedState;
if (previousRef === null) {
var ref = { current: initialValue };
{
Object.seal(ref);
}
_this._workInProgressHook.memoizedState = ref;
return ref;
} else {
return previousRef;
}
};
var readContext = function (context, observedBits) {
return context._currentValue;
};
var noOp = function () {
_this._validateCurrentlyRenderingComponent();
};
var identity = function (fn) {
return fn;
};
return {
readContext: readContext,
useCallback: identity,
useContext: function (context) {
_this._validateCurrentlyRenderingComponent();
return readContext(context);
},
useDebugValue: noOp,
useEffect: noOp,
useImperativeHandle: noOp,
useLayoutEffect: noOp,
useMemo: useMemo,
useReducer: useReducer,
useRef: useRef,
useState: useState
};
};
ReactShallowRenderer.prototype._dispatchAction = function _dispatchAction(componentIdentity, queue, action) {
!(this._numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0;
if (componentIdentity === this._currentlyRenderingComponent) {
// This is a render phase update. Stash it in a lazily-created map of
// queue -> linked list of updates. After this render pass, we'll restart
// and apply the stashed updates on top of the work-in-progress hook.
this._didScheduleRenderPhaseUpdate = true;
var update = {
action: action,
next: null
};
var renderPhaseUpdates = this._renderPhaseUpdates;
if (renderPhaseUpdates === null) {
this._renderPhaseUpdates = renderPhaseUpdates = new Map();
}
var firstRenderPhaseUpdate = renderPhaseUpdates.get(queue);
if (firstRenderPhaseUpdate === undefined) {
renderPhaseUpdates.set(queue, update);
} else {
// Append the update to the end of the list.
var lastRenderPhaseUpdate = firstRenderPhaseUpdate;
while (lastRenderPhaseUpdate.next !== null) {
lastRenderPhaseUpdate = lastRenderPhaseUpdate.next;
}
lastRenderPhaseUpdate.next = update;
}
} else {
// This means an update has happened after the function component has
// returned. On the server this is a no-op. In React Fiber, the update
// would be scheduled for a future render.
}
};
ReactShallowRenderer.prototype._createWorkInProgressHook = function _createWorkInProgressHook() {
if (this._workInProgressHook === null) {
// This is the first hook in the list
if (this._firstWorkInProgressHook === null) {
this._isReRender = false;
this._firstWorkInProgressHook = this._workInProgressHook = createHook();
} else {
// There's already a work-in-progress. Reuse it.
this._isReRender = true;
this._workInProgressHook = this._firstWorkInProgressHook;
}
} else {
if (this._workInProgressHook.next === null) {
this._isReRender = false;
// Append to the end of the list
this._workInProgressHook = this._workInProgressHook.next = createHook();
} else {
// There's already a work-in-progress. Reuse it.
this._isReRender = true;
this._workInProgressHook = this._workInProgressHook.next;
}
}
return this._workInProgressHook;
};
ReactShallowRenderer.prototype._prepareToUseHooks = function _prepareToUseHooks(componentIdentity) {
if (this._previousComponentIdentity !== null && this._previousComponentIdentity !== componentIdentity) {
this._firstWorkInProgressHook = null;
}
this._currentlyRenderingComponent = componentIdentity;
this._previousComponentIdentity = componentIdentity;
};
ReactShallowRenderer.prototype._finishHooks = function _finishHooks(element, context) {
if (this._didScheduleRenderPhaseUpdate) {
// Updates were scheduled during the render phase. They are stored in
// the `renderPhaseUpdates` map. Call the component again, reusing the
// work-in-progress hooks and applying the additional updates on top. Keep
// restarting until no more updates are scheduled.
this._didScheduleRenderPhaseUpdate = false;
this._numberOfReRenders += 1;
// Start over from the beginning of the list
this._workInProgressHook = null;
this._rendering = false;
this.render(element, context);
} else {
this._currentlyRenderingComponent = null;
this._workInProgressHook = null;
this._renderPhaseUpdates = null;
this._numberOfReRenders = 0;
}
};
ReactShallowRenderer.prototype.getMountedInstance = function getMountedInstance() {

@@ -569,2 +858,3 @@ return this._instance;

!React.isValidElement(element) ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
element = element;
// Show a special message for host elements since it's a common case.

@@ -590,3 +880,8 @@ !(typeof element.type !== 'string') ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : void 0;

this._updateStateFromStaticLifecycle(element.props);
if (typeof element.type.getDerivedStateFromProps === 'function') {
var partialState = element.type.getDerivedStateFromProps.call(null, element.props, this._instance.state);
if (partialState != null) {
this._instance.state = _assign({}, this._instance.state, partialState);
}
}

@@ -603,3 +898,11 @@ if (element.type.hasOwnProperty('contextTypes')) {

} else {
this._rendered = element.type.call(undefined, element.props, this._context);
var prevDispatcher = ReactCurrentDispatcher.current;
ReactCurrentDispatcher.current = this._dispatcher;
this._prepareToUseHooks(element.type);
try {
this._rendered = element.type.call(undefined, element.props, this._context);
} finally {
ReactCurrentDispatcher.current = prevDispatcher;
}
this._finishHooks(element, context);
}

@@ -621,2 +924,4 @@ }

this._firstWorkInProgressHook = null;
this._previousComponentIdentity = null;
this._context = null;

@@ -680,6 +985,11 @@ this._element = null;

}
this._updateStateFromStaticLifecycle(props);
// Read state after cWRP in case it calls setState
var state = this._newState || oldState;
if (typeof type.getDerivedStateFromProps === 'function') {
var partialState = type.getDerivedStateFromProps.call(null, props, state);
if (partialState != null) {
state = _assign({}, state, partialState);
}
}

@@ -712,2 +1022,3 @@ var shouldUpdate = true;

this._instance.state = state;
this._newState = null;

@@ -721,17 +1032,2 @@ if (shouldUpdate) {

ReactShallowRenderer.prototype._updateStateFromStaticLifecycle = function _updateStateFromStaticLifecycle(props) {
var type = this._element.type;
if (typeof type.getDerivedStateFromProps === 'function') {
var oldState = this._newState || this._instance.state;
var partialState = type.getDerivedStateFromProps.call(null, props, oldState);
if (partialState != null) {
var newState = _assign({}, oldState, partialState);
this._instance.state = this._newState = newState;
}
}
};
return ReactShallowRenderer;

@@ -778,3 +1074,3 @@ }();

function getMaskedContext(contextTypes, unmaskedContext) {
if (!contextTypes) {
if (!contextTypes || !unmaskedContext) {
return emptyObject;

@@ -781,0 +1077,0 @@ }

@@ -1,2 +0,2 @@

/** @license React v0.0.0-c5b7d26c7
/** @license React v0.0.0-d1326f466
* react-test-renderer-shallow.production.min.js

@@ -9,16 +9,23 @@ *

*/
'use strict';(function(g,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e(require("react")):"function"===typeof define&&define.amd?define(["react"],e):g.ReactShallowRenderer=e(g.React)})(this,function(g){function e(a,b,f,d,c,h,g,x){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var w=[f,d,c,h,g,x],e=0;a=Error(b.replace(/%s/g,function(){return w[e++]}));
a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function n(a){for(var b=arguments.length-1,f="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=0;d<b;d++)f+="&args[]="+encodeURIComponent(arguments[d+1]);e(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",f)}function q(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case y:switch(a=a.type,a){case z:case A:case B:case C:case D:return a;
default:switch(a=a&&a.$$typeof,a){case E:case p:case F:return a;default:return b}}case G:case H:return b}}}function r(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function t(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var f=Object.keys(a),d=Object.keys(b);if(f.length!==d.length)return!1;for(d=0;d<f.length;d++)if(!I.call(b,f[d])||!r(a[f[d]],b[f[d]]))return!1;return!0}function u(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}var v=g.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,c="function"===typeof Symbol&&Symbol.for,y=c?Symbol.for("react.element"):60103,H=c?Symbol.for("react.portal"):60106,B=c?Symbol.for("react.fragment"):60107,D=c?Symbol.for("react.strict_mode"):60108,C=c?Symbol.for("react.profiler"):60114,F=c?Symbol.for("react.provider"):60109,E=c?Symbol.for("react.context"):60110,z=c?Symbol.for("react.async_mode"):60111,A=c?Symbol.for("react.concurrent_mode"):60111,p=c?Symbol.for("react.forward_ref"):
60112;c&&Symbol.for("react.suspense");var G=c?Symbol.for("react.memo"):60115;c&&Symbol.for("react.lazy");var I=Object.prototype.hasOwnProperty,l={},J=function(){function a(b){u(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=
function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,d){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,d,c){this._enqueueCallback(d,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueSetState=function(b,a,d,c){this._enqueueCallback(d,b);d=this._renderer._newState||b.state;
"function"===typeof a&&(a=a.call(b,d,b.props));null!==a&&void 0!==a&&(this._renderer._newState=v({},d,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),m=function(){function a(){u(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new J(this)}a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=
function(b){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:l;g.isValidElement(b)?void 0:n("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?n("13",b.type):void 0;q(b)!==p&&"function"!==typeof b.type?n("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var d=b.type.contextTypes;if(d){var c=
{},h;for(h in d)c[h]=a[h];a=c}else a=l;this._context=a;this._instance?this._updateClassComponent(b,this._context):q(b)===p?this._rendered=b.type.render(b.props,b.ref):(a=b.type,a.prototype&&a.prototype.isReactComponent?(this._instance=new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,this._context)):this._rendered=b.type.call(void 0,b.props,this._context));this._rendering=!1;this._updater._invokeCallbacks();
return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=null};a.prototype._mountClassComponent=function(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)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||l);this._rendered=this._instance.render()};a.prototype._updateClassComponent=
function(a,c){var b=a.props,f=a.type,h=this._instance.state||l,g=this._instance.props;g!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&this._instance.componentWillReceiveProps(b,c),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,c));this._updateStateFromStaticLifecycle(b);var e=this._newState||h,
k=!0;this._forcedUpdate?(k=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?k=!!this._instance.shouldComponentUpdate(b,e,c):f.prototype&&f.prototype.isPureReactComponent&&(k=!t(g,b)||!t(h,e));k&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,e,c),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&
this._instance.UNSAFE_componentWillUpdate(b,e,c));this._instance.context=c;this._instance.props=b;this._instance.state=e;k&&(this._rendered=this._instance.render())};a.prototype._updateStateFromStaticLifecycle=function(a){var b=this._element.type;if("function"===typeof b.getDerivedStateFromProps){var c=this._newState||this._instance.state;a=b.getDerivedStateFromProps.call(null,a,c);null!=a&&(c=v({},c,a),this._instance.state=this._newState=c)}};return a}();m.createRenderer=function(){return new m};
c=(c={default:m},m)||c;return c.default||c});
'use strict';(function(k,l){"object"===typeof exports&&"undefined"!==typeof module?module.exports=l(require("react")):"function"===typeof define&&define.amd?define(["react"],l):k.ReactShallowRenderer=l(k.React)})(this,function(k){function l(a,b,d,c,e,A,f,h){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var g=[d,c,e,A,f,h],B=0;a=Error(b.replace(/%s/g,function(){return g[B++]}));
a.name="Invariant Violation"}a.framesToPop=1;throw a;}}function m(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);l(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}function v(a){if("object"===typeof a&&null!==a){var b=a.$$typeof;switch(b){case C:switch(a=a.type,a){case D:case E:case F:case G:case H:case I:return a;
default:switch(a=a&&a.$$typeof,a){case J:case q:case K:return a;default:return b}}case L:case M:case N:return b}}}function r(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}function w(a,b){if(r(a,b))return!0;if("object"!==typeof a||null===a||"object"!==typeof b||null===b)return!1;var d=Object.keys(a),c=Object.keys(b);if(d.length!==c.length)return!1;for(c=0;c<d.length;c++)if(!O.call(b,d[c])||!r(a[d[c]],b[d[c]]))return!1;return!0}function x(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function y(){return{memoizedState:null,queue:null,next:null}}function z(a,b){return"function"===typeof b?b(a):b}var t=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.assign,f="function"===typeof Symbol&&Symbol.for,C=f?Symbol.for("react.element"):60103,N=f?Symbol.for("react.portal"):60106,F=f?Symbol.for("react.fragment"):60107,H=f?Symbol.for("react.strict_mode"):60108,G=f?Symbol.for("react.profiler"):60114,K=f?Symbol.for("react.provider"):60109,J=f?Symbol.for("react.context"):60110,D=f?Symbol.for("react.async_mode"):
60111,E=f?Symbol.for("react.concurrent_mode"):60111,q=f?Symbol.for("react.forward_ref"):60112,I=f?Symbol.for("react.suspense"):60113,M=f?Symbol.for("react.memo"):60115,L=f?Symbol.for("react.lazy"):60116,O=Object.prototype.hasOwnProperty,u=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher,n={},P=function(){function a(b){x(this,a);this._renderer=b;this._callbacks=[]}a.prototype._enqueueCallback=function(b,a){"function"===typeof b&&a&&this._callbacks.push({callback:b,publicInstance:a})};
a.prototype._invokeCallbacks=function(){var b=this._callbacks;this._callbacks=[];b.forEach(function(b){b.callback.call(b.publicInstance)})};a.prototype.isMounted=function(b){return!!this._renderer._element};a.prototype.enqueueForceUpdate=function(b,a,c){this._enqueueCallback(a,b);this._renderer._forcedUpdate=!0;this._renderer.render(this._renderer._element,this._renderer._context)};a.prototype.enqueueReplaceState=function(b,a,c,e){this._enqueueCallback(c,b);this._renderer._newState=a;this._renderer.render(this._renderer._element,
this._renderer._context)};a.prototype.enqueueSetState=function(b,a,c,e){this._enqueueCallback(c,b);c=this._renderer._newState||b.state;"function"===typeof a&&(a=a.call(b,c,b.props));null!==a&&void 0!==a&&(this._renderer._newState=t({},c,a),this._renderer.render(this._renderer._element,this._renderer._context))};return a}(),p=function(){function a(){x(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new P(this);
this._dispatcher=this._createDispatcher();this._firstWorkInProgressHook=this._workInProgressHook=null;this._didScheduleRenderPhaseUpdate=this._isReRender=!1;this._currentlyRenderingComponent=this._renderPhaseUpdates=null;this._numberOfReRenders=0;this._previousComponentIdentity=null}a.prototype._validateCurrentlyRenderingComponent=function(){null===this._currentlyRenderingComponent?m("307"):void 0};a.prototype._createDispatcher=function(){var b=this,a=function(a,c,d){b._validateCurrentlyRenderingComponent();
b._createWorkInProgressHook();var e=b._workInProgressHook;if(b._isReRender){var g=e.queue;c=g.dispatch;if(null!==b._renderPhaseUpdates&&(d=b._renderPhaseUpdates.get(g),void 0!==d)){b._renderPhaseUpdates.delete(g);g=e.memoizedState;do g=a(g,d.action),d=d.next;while(null!==d);e.memoizedState=g;return[g,c]}return[e.memoizedState,c]}a=a===z?"function"===typeof c?c():c:void 0!==d?d(c):c;e.memoizedState=a;a=e.queue={last:null,dispatch:null};a=a.dispatch=b._dispatchAction.bind(b,b._currentlyRenderingComponent,
a);return[e.memoizedState,a]},c=function(){b._validateCurrentlyRenderingComponent()};return{readContext:function(b,a){return b._currentValue},useCallback:function(b){return b},useContext:function(a){b._validateCurrentlyRenderingComponent();return a._currentValue},useDebugValue:c,useEffect:c,useImperativeHandle:c,useLayoutEffect:c,useMemo:function(a,c){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();c=void 0!==c?c:null;if(null!==b._workInProgressHook&&null!==b._workInProgressHook.memoizedState){var d=
b._workInProgressHook.memoizedState,e=d[1];if(null!==c){a:if(null===e)e=!1;else{for(var g=0;g<e.length&&g<c.length;g++)if(!r(c[g],e[g])){e=!1;break a}e=!0}if(e)return d[0]}}a=a();b._workInProgressHook.memoizedState=[a,c];return a},useReducer:a,useRef:function(a){b._validateCurrentlyRenderingComponent();b._createWorkInProgressHook();var c=b._workInProgressHook.memoizedState;return null===c?(a={current:a},b._workInProgressHook.memoizedState=a):c},useState:function(b){return a(z,b)}}};a.prototype._dispatchAction=
function(b,a,c){25>this._numberOfReRenders?void 0:m("301");if(b===this._currentlyRenderingComponent){this._didScheduleRenderPhaseUpdate=!0;b={action:c,next:null};c=this._renderPhaseUpdates;null===c&&(this._renderPhaseUpdates=c=new Map);var d=c.get(a);if(void 0===d)c.set(a,b);else{for(a=d;null!==a.next;)a=a.next;a.next=b}}};a.prototype._createWorkInProgressHook=function(){null===this._workInProgressHook?null===this._firstWorkInProgressHook?(this._isReRender=!1,this._firstWorkInProgressHook=this._workInProgressHook=
y()):(this._isReRender=!0,this._workInProgressHook=this._firstWorkInProgressHook):null===this._workInProgressHook.next?(this._isReRender=!1,this._workInProgressHook=this._workInProgressHook.next=y()):(this._isReRender=!0,this._workInProgressHook=this._workInProgressHook.next);return this._workInProgressHook};a.prototype._prepareToUseHooks=function(b){null!==this._previousComponentIdentity&&this._previousComponentIdentity!==b&&(this._firstWorkInProgressHook=null);this._previousComponentIdentity=this._currentlyRenderingComponent=
b};a.prototype._finishHooks=function(b,a){this._didScheduleRenderPhaseUpdate?(this._didScheduleRenderPhaseUpdate=!1,this._numberOfReRenders+=1,this._workInProgressHook=null,this._rendering=!1,this.render(b,a)):(this._renderPhaseUpdates=this._workInProgressHook=this._currentlyRenderingComponent=null,this._numberOfReRenders=0)};a.prototype.getMountedInstance=function(){return this._instance};a.prototype.getRenderOutput=function(){return this._rendered};a.prototype.render=function(b){var a=1<arguments.length&&
void 0!==arguments[1]?arguments[1]:n;k.isValidElement(b)?void 0:m("12","function"===typeof b?" Instead of passing a component class, make sure to instantiate it by passing it to React.createElement.":"");"string"===typeof b.type?m("13",b.type):void 0;v(b)!==q&&"function"!==typeof b.type?m("249",Array.isArray(b.type)?"array":null===b.type?"null":typeof b.type):void 0;if(!this._rendering){this._rendering=!0;this._element=b;var c;if((c=b.type.contextTypes)&&a){var e={},f;for(f in c)e[f]=a[f];c=e}else c=
n;this._context=c;if(this._instance)this._updateClassComponent(b,this._context);else if(v(b)===q)this._rendered=b.type.render(b.props,b.ref);else if(c=b.type,c.prototype&&c.prototype.isReactComponent)this._instance=new b.type(b.props,this._context,this._updater),"function"===typeof b.type.getDerivedStateFromProps&&(a=b.type.getDerivedStateFromProps.call(null,b.props,this._instance.state),null!=a&&(this._instance.state=t({},this._instance.state,a))),b.type.hasOwnProperty("contextTypes"),this._mountClassComponent(b,
this._context);else{c=u.current;u.current=this._dispatcher;this._prepareToUseHooks(b.type);try{this._rendered=b.type.call(void 0,b.props,this._context)}finally{u.current=c}this._finishHooks(b,a)}this._rendering=!1;this._updater._invokeCallbacks();return this.getRenderOutput()}};a.prototype.unmount=function(){this._instance&&"function"===typeof this._instance.componentWillUnmount&&this._instance.componentWillUnmount();this._instance=this._rendered=this._newState=this._element=this._context=this._previousComponentIdentity=
this._firstWorkInProgressHook=null};a.prototype._mountClassComponent=function(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)a=this._newState,"function"!==typeof b.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillMount&&
this._instance.componentWillMount(),"function"===typeof this._instance.UNSAFE_componentWillMount&&this._instance.UNSAFE_componentWillMount()),a!==this._newState&&(this._instance.state=this._newState||n);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,d){var b=a.props,e=a.type,f=this._instance.state||n,k=this._instance.props;k!==b&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillReceiveProps&&
this._instance.componentWillReceiveProps(b,d),"function"===typeof this._instance.UNSAFE_componentWillReceiveProps&&this._instance.UNSAFE_componentWillReceiveProps(b,d));var h=this._newState||f;if("function"===typeof e.getDerivedStateFromProps){var g=e.getDerivedStateFromProps.call(null,b,h);null!=g&&(h=t({},h,g))}g=!0;this._forcedUpdate?(g=!0,this._forcedUpdate=!1):"function"===typeof this._instance.shouldComponentUpdate?g=!!this._instance.shouldComponentUpdate(b,h,d):e.prototype&&e.prototype.isPureReactComponent&&
(g=!w(k,b)||!w(f,h));g&&"function"!==typeof a.type.getDerivedStateFromProps&&"function"!==typeof this._instance.getSnapshotBeforeUpdate&&("function"===typeof this._instance.componentWillUpdate&&this._instance.componentWillUpdate(b,h,d),"function"===typeof this._instance.UNSAFE_componentWillUpdate&&this._instance.UNSAFE_componentWillUpdate(b,h,d));this._instance.context=d;this._instance.props=b;this._instance.state=h;this._newState=null;g&&(this._rendered=this._instance.render())};return a}();p.createRenderer=
function(){return new p};f=(f={default:p},p)||f;return f.default||f});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc