react-test-renderer 16.5.2 → 16.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.2
1
+ /** @license React v16.6.0
2
2
  * react-test-renderer-shallow.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -193,17 +193,22 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
193
193
  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
194
194
  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
195
195
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
196
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
196
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
197
197
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
198
- var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
198
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
199
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
200
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
199
201
 
200
202
  var Resolved = 1;
201
203
 
202
204
 
205
+ function refineResolvedLazyComponent(lazyComponent) {
206
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
207
+ }
203
208
 
204
-
205
- function refineResolvedThenable(thenable) {
206
- return thenable._reactStatus === Resolved ? thenable._reactResult : null;
209
+ function getWrappedName(outerType, innerType, wrapperName) {
210
+ var functionName = innerType.displayName || innerType.name || '';
211
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
207
212
  }
208
213
 
209
214
  function getComponentName(type) {
@@ -223,8 +228,8 @@ function getComponentName(type) {
223
228
  return type;
224
229
  }
225
230
  switch (type) {
226
- case REACT_ASYNC_MODE_TYPE:
227
- return 'AsyncMode';
231
+ case REACT_CONCURRENT_MODE_TYPE:
232
+ return 'ConcurrentMode';
228
233
  case REACT_FRAGMENT_TYPE:
229
234
  return 'Fragment';
230
235
  case REACT_PORTAL_TYPE:
@@ -233,8 +238,8 @@ function getComponentName(type) {
233
238
  return 'Profiler';
234
239
  case REACT_STRICT_MODE_TYPE:
235
240
  return 'StrictMode';
236
- case REACT_PLACEHOLDER_TYPE:
237
- return 'Placeholder';
241
+ case REACT_SUSPENSE_TYPE:
242
+ return 'Suspense';
238
243
  }
239
244
  if (typeof type === 'object') {
240
245
  switch (type.$$typeof) {
@@ -243,16 +248,17 @@ function getComponentName(type) {
243
248
  case REACT_PROVIDER_TYPE:
244
249
  return 'Context.Provider';
245
250
  case REACT_FORWARD_REF_TYPE:
246
- var renderFn = type.render;
247
- var functionName = renderFn.displayName || renderFn.name || '';
248
- return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
249
- }
250
- if (typeof type.then === 'function') {
251
- var thenable = type;
252
- var resolvedThenable = refineResolvedThenable(thenable);
253
- if (resolvedThenable) {
254
- return getComponentName(resolvedThenable);
255
- }
251
+ return getWrappedName(type, type.render, 'ForwardRef');
252
+ case REACT_MEMO_TYPE:
253
+ return getComponentName(type.type);
254
+ case REACT_LAZY_TYPE:
255
+ {
256
+ var thenable = type;
257
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
258
+ if (resolvedThenable) {
259
+ return getComponentName(resolvedThenable);
260
+ }
261
+ }
256
262
  }
257
263
  }
258
264
  return null;
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.2
1
+ /** @license React v16.6.0
2
2
  * react-test-renderer-shallow.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -9,18 +9,18 @@
9
9
 
10
10
  '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;}}
11
11
  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)}
12
- 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.async_mode"):60111,C=u?Symbol.for("react.forward_ref"):60112,E=u?Symbol.for("react.placeholder"):60113;
13
- function F(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"AsyncMode";case w:return"Fragment";case v:return"Portal";case y:return"Profiler";case x:return"StrictMode";case E:return"Placeholder"}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")}if("function"===
14
- typeof a.then&&(a=1===a._reactStatus?a._reactResult:null))return F(a)}return null}var G=Object.prototype.hasOwnProperty;function H(a,b){return a===b?0!==a||0!==b||1/a===1/b:a!==a&&b!==b}function I(a,b){if(H(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(!G.call(b,d[c])||!H(a[d[c]],b[d[c]]))return!1;return!0}
15
- function J(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}
16
- var K={},L=function(){function a(b){J(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=
12
+ 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;
13
+ 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");
14
+ 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}
15
+ function L(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}
16
+ 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=
17
17
  !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,
18
- this._renderer._context))};return a}(),O=function(){function a(){J(this,a);this._rendered=this._newState=this._instance=this._element=this._context=null;this._forcedUpdate=this._rendering=!1;this._updater=new L(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]:K;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.":
19
- "");"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=K;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=
20
- new b.type(b.props,this._context,this._updater),this._updateStateFromStaticLifecycle(b.props),b.type.hasOwnProperty("contextTypes")&&(M=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,N),M=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=
18
+ 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.":
19
+ "");"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=
20
+ 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=
21
21
  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=
22
- 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||K);this._rendered=this._instance.render()};a.prototype._updateClassComponent=function(a,d){var b=a.props,f=a.type,h=this._instance.state||
23
- K,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"===
24
- typeof this._instance.shouldComponentUpdate?l=!!this._instance.shouldComponentUpdate(b,k,d):f.prototype&&f.prototype.isPureReactComponent&&(l=!I(m,b)||!I(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=
25
- 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}();O.createRenderer=function(){return new O};var M=null;
26
- function N(){var a="";if(M){var b=null==M?"#empty":"string"===typeof M||"number"===typeof M?"#text":"string"===typeof M.type?M.type:M.type.displayName||M.type.name||"Unknown",d=M._owner,c=M._source;d=d&&F(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 P={default:O},Q=P&&O||P;module.exports=Q.default||Q;
22
+ 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||
23
+ 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"===
24
+ 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=
25
+ 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;
26
+ 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;