From 6afbe79107ead81888e89538c19c39791b686e8b Mon Sep 17 00:00:00 2001 From: Greg Myers Date: Sat, 10 Aug 2019 21:35:06 +0100 Subject: [PATCH 01/18] Update all versions --- CHANGELOG.md | 13 + VERSIONS.md | 3 +- .../react-source/development/react-server.js | 1212 +- lib/assets/react-source/development/react.js | 34387 +++++++++------- .../react-source/production/react-server.js | 8 +- lib/assets/react-source/production/react.js | 16 +- lib/react/rails/version.rb | 2 +- react-builds/yarn.lock | 240 +- 8 files changed, 20550 insertions(+), 15331 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cae3f14d0..0aa43ddc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,19 @@ #### Bug Fixes +## 2.6.1 + +#### Breaking Changes + +#### New Features + +- React 16.9.0 +- Sprockets users get React_UJS 2.6.0 + +#### Deprecation + +#### Bug Fixes + ## 2.6.0 #### Breaking Changes diff --git a/VERSIONS.md b/VERSIONS.md index 6d27c5922..3e47ad29e 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -9,7 +9,8 @@ You can control what version of React.js (and JSXTransformer) is used by `react- | Gem | React.js | |----------|----------| -| master | 16.8.6 | +| master | 16.9.0 | +| 2.6.1 | 16.9.0 | | 2.6.0 | 16.8.6 | | 2.5.0 | 16.8.6 | | 2.4.7 | 16.4.2 | diff --git a/lib/assets/react-source/development/react-server.js b/lib/assets/react-source/development/react-server.js index 20b6e0217..6bdded76d 100644 --- a/lib/assets/react-source/development/react-server.js +++ b/lib/assets/react-source/development/react-server.js @@ -264,7 +264,7 @@ /* 3 */ /***/ (function(module, exports, __webpack_require__) { - /** @license React v16.8.6 + /** @license React v16.9.0 * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -273,22 +273,22 @@ * LICENSE file in the root directory of this source tree. */ - 'use strict';var k=__webpack_require__(4),n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.concurrent_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112,z=n?Symbol.for("react.suspense"):60113,aa=n?Symbol.for("react.memo"): - 60115,ba=n?Symbol.for("react.lazy"):60116,A="function"===typeof Symbol&&Symbol.iterator;function ca(a,b,d,c,e,g,h,f){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,e,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}} - function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;cP.length&&P.push(a)} - function S(a,b,d,c){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;var g=!1;if(null===a)g=!0;else switch(e){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0}}if(g)return d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h'; + info = ' Did you accidentally export a JSX literal instead of a component?'; + } else { + typeString = typeof type; + } + + warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); + } + + var element = jsxDEV(type, props, key, source, self); + + // The result can be nullish if a mock or a custom function is used. + // TODO: Drop this when these are no longer allowed as the type argument. + if (element == null) { + return element; + } + + // Skip key warning if the type isn't valid since our key validation logic + // doesn't expect a non-string/function type and can throw confusing errors. + // We don't want exception behavior to differ between dev and prod. + // (Rendering will throw with a helpful message and as soon as the type is + // fixed, the key warnings will appear.) + if (validType) { + var children = props.children; + if (children !== undefined) { + if (isStaticChildren) { + for (var i = 0; i < children.length; i++) { + validateChildKeys(children[i], type); + } + } else { + validateChildKeys(children, type); + } + } + } + + if (props.key !== undefined) { + warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. '); + } + + if (type === REACT_FRAGMENT_TYPE) { + validateFragmentProps(element); + } else { + validatePropTypes(element); + } + + return element; + } + + // These two functions exist to still get child warnings in dev + // even with the prod transform. This means that jsxDEV is purely + // opt-in behavior for better messages but that we won't stop + // giving you warnings if you use production apis. + function jsxWithValidationStatic(type, props, key) { + return jsxWithValidation(type, props, key, true); + } + + function jsxWithValidationDynamic(type, props, key) { + return jsxWithValidation(type, props, key, false); + } + function createElementWithValidation(type, props, children) { var validType = isValidElementType(type); @@ -2101,7 +2315,7 @@ info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; } - var sourceInfo = getSourceInfoErrorAddendum(props); + var sourceInfo = getSourceInfoErrorAddendumForProps(props); if (sourceInfo) { info += sourceInfo; } else { @@ -2180,6 +2394,73 @@ return newElement; } + var hasBadMapPolyfill = void 0; + + { + hasBadMapPolyfill = false; + try { + var frozenObject = Object.freeze({}); + var testMap = new Map([[frozenObject, null]]); + var testSet = new Set([frozenObject]); + // This is necessary for Rollup to not consider these unused. + // https://github.com/rollup/rollup/issues/1771 + // TODO: we can remove these if Rollup fixes the bug. + testMap.set(0, 0); + testSet.add(0); + } catch (e) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; + } + } + + function createFundamentalComponent(impl) { + // We use responder as a Map key later on. When we have a bad + // polyfill, then we can't use it as a key as the polyfill tries + // to add a property to the object. + if (true && !hasBadMapPolyfill) { + Object.freeze(impl); + } + var fundamantalComponent = { + $$typeof: REACT_FUNDAMENTAL_TYPE, + impl: impl + }; + { + Object.freeze(fundamantalComponent); + } + return fundamantalComponent; + } + + function createEventResponder(displayName, responderConfig) { + var getInitialState = responderConfig.getInitialState, + onEvent = responderConfig.onEvent, + onMount = responderConfig.onMount, + onUnmount = responderConfig.onUnmount, + onOwnershipChange = responderConfig.onOwnershipChange, + onRootEvent = responderConfig.onRootEvent, + rootEventTypes = responderConfig.rootEventTypes, + targetEventTypes = responderConfig.targetEventTypes; + + var eventResponder = { + $$typeof: REACT_RESPONDER_TYPE, + displayName: displayName, + getInitialState: getInitialState || null, + onEvent: onEvent || null, + onMount: onMount || null, + onOwnershipChange: onOwnershipChange || null, + onRootEvent: onRootEvent || null, + onUnmount: onUnmount || null, + rootEventTypes: rootEventTypes || null, + targetEventTypes: targetEventTypes || null + }; + // We use responder as a Map key later on. When we have a bad + // polyfill, then we can't use it as a key as the polyfill tries + // to add a property to the object. + if (true && !hasBadMapPolyfill) { + Object.freeze(eventResponder); + } + return eventResponder; + } + // Helps identify side effects in begin-phase lifecycle hooks and setState reducers: @@ -2211,13 +2492,55 @@ // Only used in www builds. + // Disable javascript: URL strings in href for XSS protection. + + // React Fire: prevent the value and checked attributes from syncing // with their related DOM properties // These APIs will no longer be "unstable" in the upcoming 16.7 release, // Control this behavior with a flag to support 16.6 minor releases in the meanwhile. - var enableStableConcurrentModeAPIs = false; + + + + + // See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information + // This is a flag so we can fix warnings in RN core before turning it on + + + // Experimental React Flare event system and event components support. + var enableFlareAPI = false; + + // Experimental Host Component support. + var enableFundamentalAPI = false; + + // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 + var enableJSXTransformAPI = false; + + // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?) + // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version + + // Temporary flag to revert the fix in #15650 + + + // For tests, we flush suspense fallbacks in an act scope; + // *except* in some of our own tests, where we test incremental loading states. + + + // Changes priority of some events like mousemove to user-blocking priority, + // but without making them discrete. The flag exists in case it causes + // starvation problems. + + + // Add a callback property to suspense to notify which promises are currently + // in the update queue. This allows reporting and tracing of what is causing + // the user to see a loading state. + + + // Part of the simplification of React.createElement so we can eventually move + // from React.createElement to React.jsx + // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md var React = { Children: { @@ -2249,8 +2572,10 @@ useState: useState, Fragment: REACT_FRAGMENT_TYPE, + Profiler: REACT_PROFILER_TYPE, StrictMode: REACT_STRICT_MODE_TYPE, Suspense: REACT_SUSPENSE_TYPE, + unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE, createElement: createElementWithValidation, cloneElement: cloneElementWithValidation, @@ -2259,22 +2584,31 @@ version: ReactVersion, - unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE, - unstable_Profiler: REACT_PROFILER_TYPE, + unstable_withSuspenseConfig: withSuspenseConfig, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals }; + if (enableFlareAPI) { + React.unstable_useResponder = useResponder; + React.unstable_createResponder = createEventResponder; + } + + if (enableFundamentalAPI) { + React.unstable_createFundamental = createFundamentalComponent; + } + // Note: some APIs are added with feature flags. // Make sure that stable builds for open source // don't modify the React object to avoid deopts. // Also let's not expose their names in stable builds. - if (enableStableConcurrentModeAPIs) { - React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; - React.Profiler = REACT_PROFILER_TYPE; - React.unstable_ConcurrentMode = undefined; - React.unstable_Profiler = undefined; + if (enableJSXTransformAPI) { + { + React.jsxDEV = jsxWithValidation; + React.jsx = jsxWithValidationDynamic; + React.jsxs = jsxWithValidationStatic; + } } @@ -3633,7 +3967,7 @@ /* 25 */ /***/ (function(module, exports) { - /** @license React v16.8.6 + /** @license React v16.9.0 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -3643,18 +3977,18 @@ */ 'use strict';Object.defineProperty(exports,"__esModule",{value:!0}); - var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.memo"): - 60115,r=b?Symbol.for("react.lazy"):60116;function t(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case r:case q:case d:return u}}}function v(a){return t(a)===m}exports.typeOf=t;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n; - exports.Fragment=e;exports.Lazy=r;exports.Memo=q;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===r||a.$$typeof===q||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||t(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return t(a)===k}; - exports.isContextProvider=function(a){return t(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return t(a)===n};exports.isFragment=function(a){return t(a)===e};exports.isLazy=function(a){return t(a)===r};exports.isMemo=function(a){return t(a)===q};exports.isPortal=function(a){return t(a)===d};exports.isProfiler=function(a){return t(a)===g};exports.isStrictMode=function(a){return t(a)===f}; - exports.isSuspense=function(a){return t(a)===p}; + var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?Symbol.for("react.suspense_list"): + 60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.fundamental"):60117,w=b?Symbol.for("react.responder"):60118;function x(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return u}}case t:case r:case d:return u}}}function y(a){return x(a)===m}exports.typeOf=x;exports.AsyncMode=l; + exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p; + exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===v||a.$$typeof===w)};exports.isAsyncMode=function(a){return y(a)||x(a)===l};exports.isConcurrentMode=y;exports.isContextConsumer=function(a){return x(a)===k};exports.isContextProvider=function(a){return x(a)===h}; + exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return x(a)===n};exports.isFragment=function(a){return x(a)===e};exports.isLazy=function(a){return x(a)===t};exports.isMemo=function(a){return x(a)===r};exports.isPortal=function(a){return x(a)===d};exports.isProfiler=function(a){return x(a)===g};exports.isStrictMode=function(a){return x(a)===f};exports.isSuspense=function(a){return x(a)===p}; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.8.6 + /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.9.0 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -3684,17 +4018,22 @@ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; + // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; + var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; function isValidElementType(type) { return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. - type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE); + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE); } /** @@ -4570,7 +4909,7 @@ /* 30 */ /***/ (function(module, exports, __webpack_require__) { - /** @license React v16.8.6 + /** @license React v16.9.0 * react-dom-server.browser.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -4579,55 +4918,58 @@ * LICENSE file in the root directory of this source tree. */ - 'use strict';var p=__webpack_require__(4),q=__webpack_require__(1);function aa(a,b,d,c,f,e,h,g){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 D=[d,c,f,e,h,g],B=0;a=Error(b.replace(/%s/g,function(){return D[B++]}));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;cH;H++)G[H]=H+1;G[15]=0; - var ma=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,na=Object.prototype.hasOwnProperty,oa={},pa={}; - function qa(a){if(na.call(pa,a))return!0;if(na.call(oa,a))return!1;if(ma.test(a))return pa[a]=!0;oa[a]=!0;return!1}function ra(a,b,d,c){if(null!==d&&0===d.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(c)return!1;if(null!==d)return!d.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}} - function sa(a,b,d,c){if(null===b||"undefined"===typeof b||ra(a,b,d,c))return!0;if(c)return!1;if(null!==d)switch(d.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function I(a,b,d,c,f){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b}var J={}; - "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){J[a]=new I(a,0,!1,a,null)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];J[b]=new I(b,1,!1,a[1],null)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){J[a]=new I(a,2,!1,a.toLowerCase(),null)}); - ["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){J[a]=new I(a,2,!1,a,null)});"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){J[a]=new I(a,3,!1,a.toLowerCase(),null)});["checked","multiple","muted","selected"].forEach(function(a){J[a]=new I(a,3,!0,a,null)}); - ["capture","download"].forEach(function(a){J[a]=new I(a,4,!1,a,null)});["cols","rows","size","span"].forEach(function(a){J[a]=new I(a,6,!1,a,null)});["rowSpan","start"].forEach(function(a){J[a]=new I(a,5,!1,a.toLowerCase(),null)});var K=/[\-:]([a-z])/g;function L(a){return a[1].toUpperCase()} + 'use strict';var l=__webpack_require__(4),m=__webpack_require__(1);function r(a){for(var b=a.message,d="https://reactjs.org/docs/error-decoder.html?invariant="+b,c=1;cG;G++)E[G]=G+1;E[15]=0; + var na=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,oa=Object.prototype.hasOwnProperty,pa={},qa={}; + function ra(a){if(oa.call(qa,a))return!0;if(oa.call(pa,a))return!1;if(na.test(a))return qa[a]=!0;pa[a]=!0;return!1}function sa(a,b,d,c){if(null!==d&&0===d.type)return!1;switch(typeof b){case "function":case "symbol":return!0;case "boolean":if(c)return!1;if(null!==d)return!d.acceptsBooleans;a=a.toLowerCase().slice(0,5);return"data-"!==a&&"aria-"!==a;default:return!1}} + function ta(a,b,d,c){if(null===b||"undefined"===typeof b||sa(a,b,d,c))return!0;if(c)return!1;if(null!==d)switch(d.type){case 3:return!b;case 4:return!1===b;case 5:return isNaN(b);case 6:return isNaN(b)||1>b}return!1}function I(a,b,d,c,f,e){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=c;this.attributeNamespace=f;this.mustUseProperty=d;this.propertyName=a;this.type=b;this.sanitizeURL=e}var J={}; + "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){J[a]=new I(a,0,!1,a,null,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var b=a[0];J[b]=new I(b,1,!1,a[1],null,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){J[a]=new I(a,2,!1,a.toLowerCase(),null,!1)}); + ["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){J[a]=new I(a,2,!1,a,null,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(a){J[a]=new I(a,3,!1,a.toLowerCase(),null,!1)}); + ["checked","multiple","muted","selected"].forEach(function(a){J[a]=new I(a,3,!0,a,null,!1)});["capture","download"].forEach(function(a){J[a]=new I(a,4,!1,a,null,!1)});["cols","rows","size","span"].forEach(function(a){J[a]=new I(a,6,!1,a,null,!1)});["rowSpan","start"].forEach(function(a){J[a]=new I(a,5,!1,a.toLowerCase(),null,!1)});var K=/[\-:]([a-z])/g;function L(a){return a[1].toUpperCase()} "accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(a){var b=a.replace(K, - L);J[b]=new I(b,1,!1,a,null)});"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(K,L);J[b]=new I(b,1,!1,a,"http://www.w3.org/1999/xlink")});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(K,L);J[b]=new I(b,1,!1,a,"http://www.w3.org/XML/1998/namespace")});["tabIndex","crossOrigin"].forEach(function(a){J[a]=new I(a,1,!1,a.toLowerCase(),null)});var ta=/["'&<>]/; - function M(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ta.exec(a);if(b){var d="",c,f=0;for(c=b.index;cU?void 0:r("301");if(a===N)if(S=!0,a={action:d,next:null},null===T&&(T=new Map),d=T.get(b),void 0===d)T.set(b,a);else{for(b=d;null!==b.next;)b=b.next;b.next=a}}function za(){} - var X=0,Aa={readContext:function(a){var b=X;F(a,b);return a[b]},useContext:function(a){V();var b=X;F(a,b);return a[b]},useMemo:function(a,b){N=V();P=W();b=void 0===b?null:b;if(null!==P){var d=P.memoizedState;if(null!==d&&null!==b){a:{var c=d[1];if(null===c)c=!1;else{for(var f=0;f=e?void 0:r("304");var h=new Uint16Array(e);h.set(f);G=h;G[0]=c+1;for(f=c;f=g.children.length){var D=g.footer;""!==D&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===g.type)this.currentSelectValue=null;else if(null!=g.type&&null!=g.type.type&&g.type.type.$$typeof===z)this.popProvider(g.type);else if(g.type===A){this.suspenseDepth--;var B=f.pop();if(e){e=!1;var n=g.fallbackFrame;n?void 0:r("303");this.stack.push(n);continue}else f[this.suspenseDepth]+=B}f[this.suspenseDepth]+= - D}else{var l=g.children[g.childIndex++],k="";try{k+=this.render(l,g.context,g.domNamespace)}catch(t){throw t;}finally{}f.length<=this.suspenseDepth&&f.push("");f[this.suspenseDepth]+=k}}return f[0]}finally{Ia.current=c,X=b}};a.prototype.render=function(a,d,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return M(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+M(c);this.previousWasTextNode=!0;return M(c)}d=Ra(a,d,this.threadID);a=d.child;d=d.context; - if(null===a||!1===a)return"";if(!q.isValidElement(a)){if(null!=a&&null!=a.$$typeof){var b=a.$$typeof;b===ba?r("257"):void 0;r("258",b.toString())}a=Z(a);this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""});return""}b=a.type;if("string"===typeof b)return this.renderDOM(a,d,c);switch(b){case ca:case fa:case da:case x:return a=Z(a.props.children),this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case A:r("294")}if("object"=== - typeof b&&null!==b)switch(b.$$typeof){case ha:N={};var e=b.render(a.props,a.ref);e=va(b.render,a.props,e,a.ref);e=Z(e);this.stack.push({type:null,domNamespace:c,children:e,childIndex:0,context:d,footer:""});return"";case ia:return a=[q.createElement(b.type,p({ref:a.ref},a.props))],this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case z:return b=Z(a.props.children),c={type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""},this.pushProvider(a),this.stack.push(c), - "";case ea:b=a.type;e=a.props;var h=this.threadID;F(b,h);b=Z(e.children(b[h]));this.stack.push({type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""});return"";case ja:r("295")}r("130",null==b?b:typeof b,"")};a.prototype.renderDOM=function(a,d,c){var b=a.type.toLowerCase();c===Ba.html&&Ca(b);La.hasOwnProperty(b)||(Ka.test(b)?void 0:r("65",b),La[b]=!0);var e=a.props;if("input"===b)e=p({type:void 0},e,{defaultChecked:void 0,defaultValue:void 0,value:null!=e.value?e.value:e.defaultValue, - checked:null!=e.checked?e.checked:e.defaultChecked});else if("textarea"===b){var h=e.value;if(null==h){h=e.defaultValue;var g=e.children;null!=g&&(null!=h?r("92"):void 0,Array.isArray(g)&&(1>=g.length?void 0:r("93"),g=g[0]),h=""+g);null==h&&(h="")}e=p({},e,{value:void 0,children:""+h})}else if("select"===b)this.currentSelectValue=null!=e.value?e.value:e.defaultValue,e=p({},e,{value:void 0});else if("option"===b){g=this.currentSelectValue;var D=Na(e.children);if(null!=g){var B=null!=e.value?e.value+ - "":D;h=!1;if(Array.isArray(g))for(var n=0;n":(y+=">",h="");a:{g=e.dangerouslySetInnerHTML;if(null!=g){if(null!=g.__html){g=g.__html;break a}}else if(g=e.children,"string"===typeof g||"number"===typeof g){g=M(g);break a}g=null}null!=g?(e=[],Ja[b]&&"\n"===g.charAt(0)&&(y+="\n"),y+=g):e=Z(e.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"=== - c?Ca(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml":c;this.stack.push({domNamespace:c,type:b,children:e,childIndex:0,context:d,footer:h});this.previousWasTextNode=!1;return y};return a}(),Ta={renderToString:function(a){a=new Sa(a,!1);try{return a.read(Infinity)}finally{a.destroy()}},renderToStaticMarkup:function(a){a=new Sa(a,!0);try{return a.read(Infinity)}finally{a.destroy()}},renderToNodeStream:function(){r("207")},renderToStaticNodeStream:function(){r("208")}, - version:"16.8.6"},Ua={default:Ta},Va=Ua&&Ta||Ua;module.exports=Va.default||Va; + L);J[b]=new I(b,1,!1,a,null,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var b=a.replace(K,L);J[b]=new I(b,1,!1,a,"http://www.w3.org/1999/xlink",!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var b=a.replace(K,L);J[b]=new I(b,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1)});["tabIndex","crossOrigin"].forEach(function(a){J[a]=new I(a,1,!1,a.toLowerCase(),null,!1)}); + J.xlinkHref=new I("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0);["src","href","action","formAction"].forEach(function(a){J[a]=new I(a,1,!1,a.toLowerCase(),null,!0)});var ua=/["'&<>]/; + function M(a){if("boolean"===typeof a||"number"===typeof a)return""+a;a=""+a;var b=ua.exec(a);if(b){var d="",c,f=0;for(c=b.index;cU))throw r(Error(301));if(a===N)if(R=!0,a={action:d,next:null},null===T&&(T=new Map),d=T.get(b),void 0===d)T.set(b,a);else{for(b=d;null!==b.next;)b=b.next;b.next=a}}function Ba(){} + var X=0,Ca={readContext:function(a){var b=X;D(a,b);return a[b]},useContext:function(a){V();var b=X;D(a,b);return a[b]},useMemo:function(a,b){N=V();P=W();b=void 0===b?null:b;if(null!==P){var d=P.memoizedState;if(null!==d&&null!==b){a:{var c=d[1];if(null===c)c=!1;else{for(var f=0;f=e))throw r(Error(304));var h=new Uint16Array(e);h.set(f);E=h;E[0]=c+1;for(f=c;f=g.children.length){var H=g.footer;""!==H&&(this.previousWasTextNode=!1);this.stack.pop();if("select"===g.type)this.currentSelectValue=null;else if(null!=g.type&&null!=g.type.type&&g.type.type.$$typeof===x)this.popProvider(g.type);else if(g.type===A){this.suspenseDepth--;var F=f.pop();if(e){e=!1;var n=g.fallbackFrame;if(!n)throw r(Error(303));this.stack.push(n); + f[this.suspenseDepth]+="\x3c!--$!--\x3e";continue}else f[this.suspenseDepth]+=F}f[this.suspenseDepth]+=H}else{var w=g.children[g.childIndex++],p="";try{p+=this.render(w,g.context,g.domNamespace)}catch(k){throw k;}finally{}f.length<=this.suspenseDepth&&f.push("");f[this.suspenseDepth]+=p}}return f[0]}finally{Ka.current=c,X=b}};a.prototype.render=function(a,d,c){if("string"===typeof a||"number"===typeof a){c=""+a;if(""===c)return"";if(this.makeStaticMarkup)return M(c);if(this.previousWasTextNode)return"\x3c!-- --\x3e"+ + M(c);this.previousWasTextNode=!0;return M(c)}d=Ta(a,d,this.threadID);a=d.child;d=d.context;if(null===a||!1===a)return"";if(!m.isValidElement(a)){if(null!=a&&null!=a.$$typeof){c=a.$$typeof;if(c===aa)throw r(Error(257));throw r(Error(258),c.toString());}a=Z(a);this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""});return""}var b=a.type;if("string"===typeof b)return this.renderDOM(a,d,c);switch(b){case ba:case ea:case ca:case ha:case v:return a=Z(a.props.children),this.stack.push({type:null, + domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case A:throw r(Error(294));}if("object"===typeof b&&null!==b)switch(b.$$typeof){case fa:N={};var e=b.render(a.props,a.ref);e=xa(b.render,a.props,e,a.ref);e=Z(e);this.stack.push({type:null,domNamespace:c,children:e,childIndex:0,context:d,footer:""});return"";case ia:return a=[m.createElement(b.type,l({ref:a.ref},a.props))],this.stack.push({type:null,domNamespace:c,children:a,childIndex:0,context:d,footer:""}),"";case x:return b=Z(a.props.children), + c={type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""},this.pushProvider(a),this.stack.push(c),"";case da:b=a.type;e=a.props;var h=this.threadID;D(b,h);b=Z(e.children(b[h]));this.stack.push({type:a,domNamespace:c,children:b,childIndex:0,context:d,footer:""});return"";case ka:throw r(Error(338));case ja:throw r(Error(295));}throw r(Error(130),null==b?b:typeof b,"");};a.prototype.renderDOM=function(a,d,c){var b=a.type.toLowerCase();c===Da.html&&Ea(b);if(!Na.hasOwnProperty(b)){if(!Ma.test(b))throw r(Error(65), + b);Na[b]=!0}var e=a.props;if("input"===b)e=l({type:void 0},e,{defaultChecked:void 0,defaultValue:void 0,value:null!=e.value?e.value:e.defaultValue,checked:null!=e.checked?e.checked:e.defaultChecked});else if("textarea"===b){var h=e.value;if(null==h){h=e.defaultValue;var g=e.children;if(null!=g){if(null!=h)throw r(Error(92));if(Array.isArray(g)){if(!(1>=g.length))throw r(Error(93));g=g[0]}h=""+g}null==h&&(h="")}e=l({},e,{value:void 0,children:""+h})}else if("select"===b)this.currentSelectValue=null!= + e.value?e.value:e.defaultValue,e=l({},e,{value:void 0});else if("option"===b){g=this.currentSelectValue;var H=Pa(e.children);if(null!=g){var F=null!=e.value?e.value+"":H;h=!1;if(Array.isArray(g))for(var n=0;n":(z+=">",h="");a:{g=e.dangerouslySetInnerHTML;if(null!=g){if(null!=g.__html){g=g.__html;break a}}else if(g=e.children,"string"===typeof g||"number"===typeof g){g=M(g);break a}g=null}null!=g?(e=[],La[b]&&"\n"===g.charAt(0)&&(z+="\n"),z+=g):e=Z(e.children);a=a.type;c=null==c||"http://www.w3.org/1999/xhtml"===c?Ea(a):"http://www.w3.org/2000/svg"===c&&"foreignObject"===a?"http://www.w3.org/1999/xhtml": + c;this.stack.push({domNamespace:c,type:b,children:e,childIndex:0,context:d,footer:h});this.previousWasTextNode=!1;return z};return a}(),Va={renderToString:function(a){a=new Ua(a,!1);try{return a.read(Infinity)}finally{a.destroy()}},renderToStaticMarkup:function(a){a=new Ua(a,!0);try{return a.read(Infinity)}finally{a.destroy()}},renderToNodeStream:function(){throw r(Error(207));},renderToStaticNodeStream:function(){throw r(Error(208));},version:"16.9.0"},Wa={default:Va},Xa=Wa&&Va|| + Wa;module.exports=Xa.default||Xa; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.8.6 + /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.9.0 * react-dom-server.browser.development.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -4648,6 +4990,23 @@ var React = __webpack_require__(1); var checkPropTypes = __webpack_require__(6); + // Do not require this module directly! Use normal `invariant` calls with + // template literal strings. The messages will be converted to ReactError during + // build, and in production they will be minified. + + // Do not require this module directly! Use normal `invariant` calls with + // template literal strings. The messages will be converted to ReactError during + // build, and in production they will be minified. + + function ReactError(error) { + error.name = 'Invariant Violation'; + return error; + } + + // TODO: this is special because it gets imported during build. + + var ReactVersion = '16.9.0'; + /** * Use invariant() to assert state which your program assumes to be true. * @@ -4659,44 +5018,6 @@ * will remain to ensure logic does not differ in production. */ - var validateFormat = function () {}; - - { - validateFormat = function (format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; - } - - function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error = void 0; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - } - - // Relying on the `invariant()` implementation lets us - // preserve the format and params in the www builds. - - // TODO: this is special because it gets imported during build. - - var ReactVersion = '16.8.6'; - /** * 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 @@ -4758,12 +5079,16 @@ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; + // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; var Resolved = 1; @@ -4794,8 +5119,6 @@ return type; } switch (type) { - case REACT_CONCURRENT_MODE_TYPE: - return 'ConcurrentMode'; case REACT_FRAGMENT_TYPE: return 'Fragment'; case REACT_PORTAL_TYPE: @@ -4806,6 +5129,8 @@ return 'StrictMode'; case REACT_SUSPENSE_TYPE: return 'Suspense'; + case REACT_SUSPENSE_LIST_TYPE: + return 'SuspenseList'; } if (typeof type === 'object') { switch (type.$$typeof) { @@ -4824,6 +5149,7 @@ if (resolvedThenable) { return getComponentName(resolvedThenable); } + break; } } } @@ -4893,6 +5219,11 @@ current: null }; } + if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) { + ReactSharedInternals.ReactCurrentBatchConfig = { + suspense: null + }; + } /** * Similar to invariant but only logs a warning if the condition is not met. @@ -4964,7 +5295,7 @@ // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: - var warnAboutDeprecatedLifecycles = false; + var warnAboutDeprecatedLifecycles = true; // Gather advanced timing metrics for Profiler subtrees. @@ -4981,6 +5312,9 @@ // Only used in www builds. + // Disable javascript: URL strings in href for XSS protection. + var disableJavaScriptURLs = false; + // React Fire: prevent the value and checked attributes from syncing // with their related DOM properties @@ -4988,6 +5322,49 @@ // These APIs will no longer be "unstable" in the upcoming 16.7 release, // Control this behavior with a flag to support 16.6 minor releases in the meanwhile. + + + + // See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information + // This is a flag so we can fix warnings in RN core before turning it on + + + // Experimental React Flare event system and event components support. + var enableFlareAPI = false; + + // Experimental Host Component support. + var enableFundamentalAPI = false; + + // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 + + + // We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?) + // Till then, we warn about the missing mock, but still fallback to a sync mode compatible version + + // Temporary flag to revert the fix in #15650 + + + // For tests, we flush suspense fallbacks in an act scope; + // *except* in some of our own tests, where we test incremental loading states. + + + // Changes priority of some events like mousemove to user-blocking priority, + // but without making them discrete. The flag exists in case it causes + // starvation problems. + + + // Add a callback property to suspense to notify which promises are currently + // in the update queue. This allows reporting and tracing of what is causing + // the user to see a loading state. + + + // Part of the simplification of React.createElement so we can eventually move + // from React.createElement to React.jsx + // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md + + + var disableLegacyContext = false; + var ReactDebugCurrentFrame$1 = void 0; var didWarnAboutInvalidateContextType = void 0; { @@ -5032,45 +5409,72 @@ } } - function processContext(type, context, threadID) { - var contextType = type.contextType; - { - if ('contextType' in type) { - var isValid = - // Allow null for conditional declaration - contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a - - if (!isValid && !didWarnAboutInvalidateContextType.has(type)) { - didWarnAboutInvalidateContextType.add(type); - - var addendum = ''; - if (contextType === undefined) { - addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; - } else if (typeof contextType !== 'object') { - addendum = ' However, it is set to a ' + typeof contextType + '.'; - } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { - addendum = ' Did you accidentally pass the Context.Provider instead?'; - } else if (contextType._context !== undefined) { - // - addendum = ' Did you accidentally pass the Context.Consumer instead?'; - } else { - addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; + function processContext(type, context, threadID, isClass) { + if (isClass) { + var contextType = type.contextType; + { + if ('contextType' in type) { + var isValid = + // Allow null for conditional declaration + contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a + + if (!isValid && !didWarnAboutInvalidateContextType.has(type)) { + didWarnAboutInvalidateContextType.add(type); + + var addendum = ''; + if (contextType === undefined) { + addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; + } else if (typeof contextType !== 'object') { + addendum = ' However, it is set to a ' + typeof contextType + '.'; + } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { + addendum = ' Did you accidentally pass the Context.Provider instead?'; + } else if (contextType._context !== undefined) { + // + addendum = ' Did you accidentally pass the Context.Consumer instead?'; + } else { + addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; + } + warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum); } - warningWithoutStack$1(false, '%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentName(type) || 'Component', addendum); } } - } - if (typeof contextType === 'object' && contextType !== null) { - validateContextBounds(contextType, threadID); - return contextType[threadID]; + if (typeof contextType === 'object' && contextType !== null) { + validateContextBounds(contextType, threadID); + return contextType[threadID]; + } + if (disableLegacyContext) { + { + if (type.contextTypes) { + warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with static contextType instead.', getComponentName(type) || 'Unknown'); + } + } + return emptyObject; + } else { + var maskedContext = maskContext(type, context); + { + if (type.contextTypes) { + checkContextTypes(type.contextTypes, maskedContext, 'context'); + } + } + return maskedContext; + } } else { - var maskedContext = maskContext(type, context); - { - if (type.contextTypes) { - checkContextTypes(type.contextTypes, maskedContext, 'context'); + if (disableLegacyContext) { + { + if (type.contextTypes) { + warningWithoutStack$1(false, '%s uses the legacy contextTypes API which is no longer supported. ' + 'Use React.createContext() with React.useContext() instead.', getComponentName(type) || 'Unknown'); + } + } + return undefined; + } else { + var _maskedContext = maskContext(type, context); + { + if (type.contextTypes) { + checkContextTypes(type.contextTypes, _maskedContext, 'context'); + } } + return _maskedContext; } - return maskedContext; } } @@ -5088,7 +5492,13 @@ var oldArray = nextAvailableThreadIDs; var oldSize = oldArray.length; var newSize = oldSize * 2; - !(newSize <= 0x10000) ? invariant(false, 'Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.') : void 0; + (function () { + if (!(newSize <= 0x10000)) { + { + throw ReactError(Error('Maximum number of concurrent React renderers exceeded. This can happen if you are not properly destroying the Readable provided by React. Ensure that you call .destroy() on it if you no longer want to read from it, and did not read to the end. If you use .pipe() this should be automatic.')); + } + } + })(); var newArray = new Uint16Array(newSize); newArray.set(oldArray); nextAvailableThreadIDs = newArray; @@ -5247,13 +5657,14 @@ return properties.hasOwnProperty(name) ? properties[name] : null; } - function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) { + function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL) { this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; this.attributeName = attributeName; this.attributeNamespace = attributeNamespace; this.mustUseProperty = mustUseProperty; this.propertyName = name; this.type = type; + this.sanitizeURL = sanitizeURL; } // When adding attributes to this list, be sure to also add them to @@ -5269,8 +5680,9 @@ 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty name, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // A few React string attributes have a different name. @@ -5281,8 +5693,9 @@ properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty attributeName, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are "enumerated" HTML attributes that accept "true" and "false". @@ -5291,8 +5704,9 @@ ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name.toLowerCase(), // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are "enumerated" SVG attributes that accept "true" and "false". @@ -5302,21 +5716,23 @@ ['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty name, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are HTML boolean attributes. ['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM // on the client side because the browsers are inconsistent. Instead we call focus(). - 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', + 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata 'itemScope'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty name.toLowerCase(), // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are the few React props that we set as DOM properties @@ -5327,8 +5743,9 @@ 'multiple', 'muted', 'selected'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty name, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are HTML attributes that are "overloaded booleans": they behave like @@ -5336,24 +5753,27 @@ ['capture', 'download'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty name, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are HTML attributes that must be positive numbers. ['cols', 'rows', 'size', 'span'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty name, // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); // These are HTML attributes that must be numbers. ['rowSpan', 'start'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty name.toLowerCase(), // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); var CAMELIZE = /[\-\:]([a-z])/g; @@ -5369,23 +5789,26 @@ ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, null); - } // attributeNamespace + attributeName, null, // attributeNamespace + false); + } // sanitizeURL ); // String SVG attributes with the xlink namespace. - ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { + ['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/1999/xlink'); - }); + attributeName, 'http://www.w3.org/1999/xlink', false); + } // sanitizeURL + ); // String SVG attributes with the xml namespace. ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) { var name = attributeName.replace(CAMELIZE, capitalize); properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty - attributeName, 'http://www.w3.org/XML/1998/namespace'); - }); + attributeName, 'http://www.w3.org/XML/1998/namespace', false); + } // sanitizeURL + ); // These attribute exists both in HTML and SVG. // The attribute name is case-sensitive in SVG so we can't just use @@ -5393,10 +5816,59 @@ ['tabIndex', 'crossOrigin'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName - null); - } // attributeNamespace + null, // attributeNamespace + false); + } // sanitizeURL ); + // These attributes accept URLs. These must not allow javascript: URLS. + // These will also need to accept Trusted Types object in the future. + var xlinkHref = 'xlinkHref'; + properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty + 'xlink:href', 'http://www.w3.org/1999/xlink', true); + + ['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { + properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty + attributeName.toLowerCase(), // attributeName + null, // attributeNamespace + true); + } // sanitizeURL + ); + + var ReactDebugCurrentFrame$2 = null; + { + ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame; + } + + // A javascript: URL can contain leading C0 control or \u0020 SPACE, + // and any newline or tab are filtered out as if they're not part of the URL. + // https://url.spec.whatwg.org/#url-parsing + // Tab or newline are defined as \r\n\t: + // https://infra.spec.whatwg.org/#ascii-tab-or-newline + // A C0 control is a code point in the range \u0000 NULL to \u001F + // INFORMATION SEPARATOR ONE, inclusive: + // https://infra.spec.whatwg.org/#c0-control-or-space + + /* eslint-disable max-len */ + var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; + + var didWarn = false; + + function sanitizeURL(url) { + if (disableJavaScriptURLs) { + (function () { + if (!!isJavaScriptProtocol.test(url)) { + { + throw ReactError(Error('React has blocked a javascript: URL as a security precaution.' + (ReactDebugCurrentFrame$2.getStackAddendum()))); + } + } + })(); + } else if (true && !didWarn && isJavaScriptProtocol.test(url)) { + didWarn = true; + warning$1(false, 'A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); + } + } + // code copied and modified from escape-html /** * Module variables. @@ -5528,6 +6000,10 @@ if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) { return attributeName + '=""'; } else { + if (propertyInfo.sanitizeURL) { + value = '' + value; + sanitizeURL(value); + } return attributeName + '=' + quoteAttributeValueForBrowser(value); } } else if (isAttributeNameSafe(name)) { @@ -5578,7 +6054,13 @@ var currentHookNameInDev = void 0; function resolveCurrentlyRenderingComponent() { - !(currentlyRenderingComponent !== null) ? invariant(false, '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.') : void 0; + (function () { + if (!(currentlyRenderingComponent !== null)) { + { + throw ReactError(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.')); + } + } + })(); { !!isInHookUserCodeInDev ? warning$1(false, 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://fb.me/rules-of-hooks') : void 0; } @@ -5611,7 +6093,13 @@ function createHook() { if (numberOfReRenders > 0) { - invariant(false, 'Rendered more hooks than during the previous render'); + (function () { + { + { + throw ReactError(Error('Rendered more hooks than during the previous render')); + } + } + })(); } return { memoizedState: null, @@ -5845,7 +6333,13 @@ } function dispatchAction(componentIdentity, queue, action) { - !(numberOfReRenders < RE_RENDER_LIMIT) ? invariant(false, 'Too many re-renders. React limits the number of renders to prevent an infinite loop.') : void 0; + (function () { + if (!(numberOfReRenders < RE_RENDER_LIMIT)) { + { + throw ReactError(Error('Too many re-renders. React limits the number of renders to prevent an infinite loop.')); + } + } + })(); if (componentIdentity === currentlyRenderingComponent) { // This is a render phase update. Stash it in a lazily-created map of @@ -5882,6 +6376,13 @@ return callback; } + function useResponder(responder, props) { + return { + props: props, + responder: responder + }; + } + function noop() {} var currentThreadID = 0; @@ -5904,7 +6405,8 @@ // Effects are not run in the server environment. useEffect: noop, // Debugging effect - useDebugValue: noop + useDebugValue: noop, + useResponder: useResponder }; var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; @@ -5942,14 +6444,14 @@ return parentNamespace; } - var ReactDebugCurrentFrame$2 = null; + var ReactDebugCurrentFrame$3 = null; var ReactControlledValuePropTypes = { checkPropTypes: null }; { - ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame; + ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame; var hasReadOnlyValue = { button: true, @@ -5963,13 +6465,13 @@ var propTypes = { value: function (props, propName, componentName) { - if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null) { + if (hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) { return null; } return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); }, checked: function (props, propName, componentName) { - if (props.onChange || props.readOnly || props.disabled || props[propName] == null) { + if (props.onChange || props.readOnly || props.disabled || props[propName] == null || enableFlareAPI && props.listeners) { return null; } return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); @@ -5981,7 +6483,7 @@ * this outside of the ReactDOM controlled form components. */ ReactControlledValuePropTypes.checkPropTypes = function (tagName, props) { - checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$2.getStackAddendum); + checkPropTypes(propTypes, props, 'prop', tagName, ReactDebugCurrentFrame$3.getStackAddendum); }; } @@ -6018,9 +6520,9 @@ // or add stack by default to invariants where possible. var HTML = '__html'; - var ReactDebugCurrentFrame$3 = null; + var ReactDebugCurrentFrame$4 = null; { - ReactDebugCurrentFrame$3 = ReactSharedInternals.ReactDebugCurrentFrame; + ReactDebugCurrentFrame$4 = ReactSharedInternals.ReactDebugCurrentFrame; } function assertValidProps(tag, props) { @@ -6029,16 +6531,40 @@ } // Note the use of `==` which checks for null or undefined. if (voidElementTags[tag]) { - !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, ReactDebugCurrentFrame$3.getStackAddendum()) : void 0; + (function () { + if (!(props.children == null && props.dangerouslySetInnerHTML == null)) { + { + throw ReactError(Error(tag + ' is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.' + (ReactDebugCurrentFrame$4.getStackAddendum()))); + } + } + })(); } if (props.dangerouslySetInnerHTML != null) { - !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0; - !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0; + (function () { + if (!(props.children == null)) { + { + throw ReactError(Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.')); + } + } + })(); + (function () { + if (!(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML)) { + { + throw ReactError(Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.')); + } + } + })(); } { !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning$1(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : void 0; } - !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', ReactDebugCurrentFrame$3.getStackAddendum()) : void 0; + (function () { + if (!(props.style == null || typeof props.style === 'object')) { + { + throw ReactError(Error('The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.' + (ReactDebugCurrentFrame$4.getStackAddendum()))); + } + } + })(); } /** @@ -6539,6 +7065,7 @@ defer: 'defer', dir: 'dir', disabled: 'disabled', + disablepictureinpicture: 'disablePictureInPicture', download: 'download', draggable: 'draggable', enctype: 'encType', @@ -7245,6 +7772,7 @@ var didWarnInvalidOptionChildren = false; var didWarnAboutNoopUpdateForComponent = {}; var didWarnAboutBadClass = {}; + var didWarnAboutModulePatternComponent = {}; var didWarnAboutDeprecatedWillMount = {}; var didWarnAboutUndefinedDerivedState = {}; var didWarnAboutUninitializedState = {}; @@ -7262,7 +7790,13 @@ var validatedTagCache = {}; function validateDangerousTag(tag) { if (!validatedTagCache.hasOwnProperty(tag)) { - !VALID_TAG_REGEX.test(tag) ? invariant(false, 'Invalid tag: %s', tag) : void 0; + (function () { + if (!VALID_TAG_REGEX.test(tag)) { + { + throw ReactError(Error('Invalid tag: ' + tag)); + } + } + })(); validatedTagCache[tag] = true; } } @@ -7292,7 +7826,7 @@ } } if (styleValue != null) { - serialized += delimiter + processStyleName(styleName) + ':'; + serialized += delimiter + (isCustomProperty ? styleName : processStyleName(styleName)) + ':'; serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty); delimiter = ';'; @@ -7388,6 +7922,9 @@ if (!hasOwnProperty.call(props, propKey)) { continue; } + if (enableFlareAPI && propKey === 'listeners') { + continue; + } var propValue = props[propKey]; if (propValue == null) { continue; @@ -7422,7 +7959,13 @@ function validateRenderResult(child, type) { if (child === undefined) { - invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', getComponentName(type) || 'Component'); + (function () { + { + { + throw ReactError(Error((getComponentName(type) || 'Component') + '(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.')); + } + } + })(); } } @@ -7442,7 +7985,8 @@ // Extra closure so queue and replace can be captured properly function processChild(element, Component) { - var publicContext = processContext(Component, context, threadID); + var isClass = shouldConstruct(Component); + var publicContext = processContext(Component, context, threadID, isClass); var queue = []; var replace = false; @@ -7470,7 +8014,7 @@ }; var inst = void 0; - if (shouldConstruct(Component)) { + if (isClass) { inst = new Component(element.props, publicContext, updater); if (typeof Component.getDerivedStateFromProps === 'function') { @@ -7521,6 +8065,14 @@ validateRenderResult(child, Component); return; } + + { + var _componentName3 = getComponentName(Component) || 'Unknown'; + if (!didWarnAboutModulePatternComponent[_componentName3]) { + warningWithoutStack$1(false, 'The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName3, _componentName3, _componentName3); + didWarnAboutModulePatternComponent[_componentName3] = true; + } + } } inst.props = element.props; @@ -7535,11 +8087,13 @@ if (typeof inst.componentWillMount === 'function') { { if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) { - var _componentName3 = getComponentName(Component) || 'Unknown'; + var _componentName4 = getComponentName(Component) || 'Unknown'; - if (!didWarnAboutDeprecatedWillMount[_componentName3]) { - lowPriorityWarning$1(false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', _componentName3); - didWarnAboutDeprecatedWillMount[_componentName3] = true; + if (!didWarnAboutDeprecatedWillMount[_componentName4]) { + lowPriorityWarning$1(false, + // keep this warning in sync with ReactStrictModeWarning.js + 'componentWillMount has been renamed, and is not recommended for use. ' + 'See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n' + '* Move code from componentWillMount to componentDidMount (preferred in most cases) ' + 'or the constructor.\n' + '\nPlease update the following components: %s', _componentName4); + didWarnAboutDeprecatedWillMount[_componentName4] = true; } } } @@ -7596,19 +8150,34 @@ validateRenderResult(child, Component); var childContext = void 0; - if (typeof inst.getChildContext === 'function') { - var childContextTypes = Component.childContextTypes; - if (typeof childContextTypes === 'object') { - childContext = inst.getChildContext(); - for (var contextKey in childContext) { - !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0; + if (disableLegacyContext) { + { + var childContextTypes = Component.childContextTypes; + if (childContextTypes !== undefined) { + warningWithoutStack$1(false, '%s uses the legacy childContextTypes API which is no longer supported. ' + 'Use React.createContext() instead.', getComponentName(Component) || 'Unknown'); } - } else { - warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown'); } - } - if (childContext) { - context = _assign({}, context, childContext); + } else { + if (typeof inst.getChildContext === 'function') { + var _childContextTypes = Component.childContextTypes; + if (typeof _childContextTypes === 'object') { + childContext = inst.getChildContext(); + for (var contextKey in childContext) { + (function () { + if (!(contextKey in _childContextTypes)) { + { + throw ReactError(Error((getComponentName(Component) || 'Unknown') + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.')); + } + } + })(); + } + } else { + warningWithoutStack$1(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown'); + } + } + if (childContext) { + context = _assign({}, context, childContext); + } } } return { child: child, context: context }; @@ -7764,8 +8333,15 @@ suspended = false; // If rendering was suspended at this boundary, render the fallbackFrame var _fallbackFrame = frame.fallbackFrame; - !_fallbackFrame ? invariant(false, 'suspense fallback not found, something is broken') : void 0; + (function () { + if (!_fallbackFrame) { + { + throw ReactError(Error('suspense fallback not found, something is broken')); + } + } + })(); this.stack.push(_fallbackFrame); + out[this.suspenseDepth] += ''; // Skip flushing output since we're switching to the fallback continue; } else { @@ -7838,9 +8414,21 @@ if (nextChild != null && nextChild.$$typeof != null) { // Catch unexpected special types early. var $$typeof = nextChild.$$typeof; - !($$typeof !== REACT_PORTAL_TYPE) ? invariant(false, 'Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.') : void 0; + (function () { + if (!($$typeof !== REACT_PORTAL_TYPE)) { + { + throw ReactError(Error('Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.')); + } + } + })(); // Catch-all to prevent an infinite loop if React.Children.toArray() supports some new type. - invariant(false, 'Unknown element-like object type: %s. This is likely a bug in React. Please file an issue.', $$typeof.toString()); + (function () { + { + { + throw ReactError(Error('Unknown element-like object type: ' + $$typeof.toString() + '. This is likely a bug in React. Please file an issue.')); + } + } + })(); } var nextChildren = toArray(nextChild); var frame = { @@ -7869,6 +8457,7 @@ case REACT_STRICT_MODE_TYPE: case REACT_CONCURRENT_MODE_TYPE: case REACT_PROFILER_TYPE: + case REACT_SUSPENSE_LIST_TYPE: case REACT_FRAGMENT_TYPE: { var _nextChildren = toArray(nextChild.props.children); @@ -7915,8 +8504,7 @@ children: fallbackChildren, childIndex: 0, context: context, - footer: '', - out: '' + footer: '' }; var _frame2 = { fallbackFrame: _fallbackFrame2, @@ -7935,7 +8523,13 @@ this.suspenseDepth++; return ''; } else { - invariant(false, 'ReactDOMServer does not yet support Suspense.'); + (function () { + { + { + throw ReactError(Error('ReactDOMServer does not yet support Suspense.')); + } + } + })(); } } // eslint-disable-next-line-no-fallthrough @@ -8052,8 +8646,46 @@ this.stack.push(_frame7); return ''; } + // eslint-disable-next-line-no-fallthrough + case REACT_FUNDAMENTAL_TYPE: + { + if (enableFundamentalAPI) { + var fundamentalImpl = elementType.impl; + var open = fundamentalImpl.getServerSideString(null, nextElement.props); + var getServerSideStringClose = fundamentalImpl.getServerSideStringClose; + var close = getServerSideStringClose !== undefined ? getServerSideStringClose(null, nextElement.props) : ''; + var _nextChildren8 = fundamentalImpl.reconcileChildren !== false ? toArray(nextChild.props.children) : []; + var _frame8 = { + type: null, + domNamespace: parentNamespace, + children: _nextChildren8, + childIndex: 0, + context: context, + footer: close + }; + { + _frame8.debugElementStack = []; + } + this.stack.push(_frame8); + return open; + } + (function () { + { + { + throw ReactError(Error('ReactDOMServer does not yet support the fundamental API.')); + } + } + })(); + } + // eslint-disable-next-line-no-fallthrough case REACT_LAZY_TYPE: - invariant(false, 'ReactDOMServer does not yet support lazy-loaded components.'); + (function () { + { + { + throw ReactError(Error('ReactDOMServer does not yet support lazy-loaded components.')); + } + } + })(); } } @@ -8068,7 +8700,13 @@ info += '\n\nCheck the render method of `' + ownerName + '`.'; } } - invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', elementType == null ? elementType : typeof elementType, info); + (function () { + { + { + throw ReactError(Error('Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: ' + (elementType == null ? elementType : typeof elementType) + '.' + info)); + } + } + })(); } }; @@ -8131,9 +8769,21 @@ { warning$1(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on