react 0.0.0-experimental-8d7535e54 → 0.0.0-experimental-8b155d261

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build-info.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "branch": "master",
3
- "buildNumber": "90723",
4
- "checksum": "348207c",
5
- "commit": "8d7535e54",
3
+ "buildNumber": "100411",
4
+ "checksum": "8066f26",
5
+ "commit": "8b155d261",
6
6
  "environment": "ci",
7
- "reactVersion": "16.12.0-experimental-8d7535e54"
7
+ "reactVersion": "16.13.0-experimental-8b155d261"
8
8
  }
@@ -1,4 +1,4 @@
1
- /** @license React v0.0.0-experimental-8d7535e54
1
+ /** @license React v0.0.0-experimental-8b155d261
2
2
  * react.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -16,9 +16,9 @@ if (process.env.NODE_ENV !== "production") {
16
16
  'use strict';
17
17
 
18
18
  var _assign = require('object-assign');
19
- var checkPropTypes = require('prop-types/checkPropTypes');
20
19
 
21
- var ReactVersion = '16.12.0-experimental-8d7535e54';
20
+ // TODO: this is special because it gets imported during build.
21
+ var ReactVersion = '16.13.0-experimental-8b155d261';
22
22
 
23
23
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
24
24
  // nor polyfill, then a plain number is used for performance.
@@ -122,7 +122,9 @@ function describeComponentFrame (name, source, ownerName) {
122
122
  return '\n in ' + (name || 'Unknown') + sourceInfo;
123
123
  }
124
124
 
125
+ // TODO: Move this to "react" once we can import from externals.
125
126
  var Resolved = 1;
127
+
126
128
  function refineResolvedLazyComponent(lazyComponent) {
127
129
  return lazyComponent._status === Resolved ? lazyComponent._result : null;
128
130
  }
@@ -132,6 +134,10 @@ function getWrappedName(outerType, innerType, wrapperName) {
132
134
  return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
133
135
  }
134
136
 
137
+ function getContextName(type) {
138
+ return type.displayName || 'Context';
139
+ }
140
+
135
141
  function getComponentName(type) {
136
142
  if (type == null) {
137
143
  // Host root, text node or just invalid type.
@@ -175,10 +181,12 @@ function getComponentName(type) {
175
181
  if (typeof type === 'object') {
176
182
  switch (type.$$typeof) {
177
183
  case REACT_CONTEXT_TYPE:
178
- return 'Context.Consumer';
184
+ var context = type;
185
+ return getContextName(context) + '.Consumer';
179
186
 
180
187
  case REACT_PROVIDER_TYPE:
181
- return 'Context.Provider';
188
+ var provider = type;
189
+ return getContextName(provider._context) + '.Provider';
182
190
 
183
191
  case REACT_FORWARD_REF_TYPE:
184
192
  return getWrappedName(type, type.render, 'ForwardRef');
@@ -719,6 +727,70 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
719
727
 
720
728
  return element;
721
729
  };
730
+ /**
731
+ * https://github.com/reactjs/rfcs/pull/107
732
+ * @param {*} type
733
+ * @param {object} props
734
+ * @param {string} key
735
+ */
736
+
737
+ function jsxDEV(type, config, maybeKey, source, self) {
738
+ var propName; // Reserved names are extracted
739
+
740
+ var props = {};
741
+ var key = null;
742
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
743
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
744
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
745
+ // but as an intermediary step, we will use jsxDEV for everything except
746
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
747
+ // key is explicitly declared to be undefined or not.
748
+
749
+ if (maybeKey !== undefined) {
750
+ key = '' + maybeKey;
751
+ }
752
+
753
+ if (hasValidKey(config)) {
754
+ key = '' + config.key;
755
+ }
756
+
757
+ if (hasValidRef(config)) {
758
+ ref = config.ref;
759
+ warnIfStringRefCannotBeAutoConverted(config);
760
+ } // Remaining properties are added to a new props object
761
+
762
+
763
+ for (propName in config) {
764
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
765
+ props[propName] = config[propName];
766
+ }
767
+ } // Resolve default props
768
+
769
+
770
+ if (type && type.defaultProps) {
771
+ var defaultProps = type.defaultProps;
772
+
773
+ for (propName in defaultProps) {
774
+ if (props[propName] === undefined) {
775
+ props[propName] = defaultProps[propName];
776
+ }
777
+ }
778
+ }
779
+
780
+ if (key || ref) {
781
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
782
+
783
+ if (key) {
784
+ defineKeyPropWarningGetter(props, displayName);
785
+ }
786
+
787
+ if (ref) {
788
+ defineRefPropWarningGetter(props, displayName);
789
+ }
790
+ }
791
+
792
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
793
+ }
722
794
  /**
723
795
  * Create and return a new ReactElement of the given type.
724
796
  * See https://reactjs.org/docs/react-api.html#createelement
@@ -1289,6 +1361,7 @@ function createContext(defaultValue, calculateChangedBits) {
1289
1361
  };
1290
1362
  var hasWarnedAboutUsingNestedContextConsumers = false;
1291
1363
  var hasWarnedAboutUsingConsumerProvider = false;
1364
+ var hasWarnedAboutDisplayNameOnConsumer = false;
1292
1365
 
1293
1366
  {
1294
1367
  // A separate object, but proxies back to the original context object for
@@ -1349,6 +1422,18 @@ function createContext(defaultValue, calculateChangedBits) {
1349
1422
 
1350
1423
  return context.Consumer;
1351
1424
  }
1425
+ },
1426
+ displayName: {
1427
+ get: function () {
1428
+ return context.displayName;
1429
+ },
1430
+ set: function () {
1431
+ if (!hasWarnedAboutDisplayNameOnConsumer) {
1432
+ warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = 'NamedContext'.");
1433
+
1434
+ hasWarnedAboutDisplayNameOnConsumer = true;
1435
+ }
1436
+ }
1352
1437
  }
1353
1438
  }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
1354
1439
 
@@ -1366,16 +1451,16 @@ function createContext(defaultValue, calculateChangedBits) {
1366
1451
  function lazy(ctor) {
1367
1452
  var lazyType = {
1368
1453
  $$typeof: REACT_LAZY_TYPE,
1369
- _ctor: ctor,
1370
1454
  // React uses these fields to store the result.
1371
1455
  _status: -1,
1372
- _result: null
1456
+ _result: ctor
1373
1457
  };
1374
1458
 
1375
1459
  {
1376
1460
  // In production, this would just set it on the object.
1377
1461
  var defaultProps;
1378
- var propTypes;
1462
+ var propTypes; // $FlowFixMe
1463
+
1379
1464
  Object.defineProperties(lazyType, {
1380
1465
  defaultProps: {
1381
1466
  configurable: true,
@@ -1386,6 +1471,7 @@ function lazy(ctor) {
1386
1471
  error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1387
1472
 
1388
1473
  defaultProps = newDefaultProps; // Match production behavior more closely:
1474
+ // $FlowFixMe
1389
1475
 
1390
1476
  Object.defineProperty(lazyType, 'defaultProps', {
1391
1477
  enumerable: true
@@ -1401,6 +1487,7 @@ function lazy(ctor) {
1401
1487
  error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1402
1488
 
1403
1489
  propTypes = newPropTypes; // Match production behavior more closely:
1490
+ // $FlowFixMe
1404
1491
 
1405
1492
  Object.defineProperty(lazyType, 'propTypes', {
1406
1493
  enumerable: true
@@ -1480,15 +1567,21 @@ function block(query, render) {
1480
1567
  }
1481
1568
  }
1482
1569
 
1570
+ function initializer(args) {
1571
+ var data = query.apply(null, args);
1572
+ return [data, render];
1573
+ }
1574
+
1483
1575
  return function () {
1484
1576
  var args = arguments;
1485
- return {
1577
+ var blockComponent = {
1486
1578
  $$typeof: REACT_BLOCK_TYPE,
1487
- query: function () {
1488
- return query.apply(null, args);
1489
- },
1490
- render: render
1491
- };
1579
+ _status: -1,
1580
+ _data: args,
1581
+ _fn: initializer
1582
+ }; // $FlowFixMe
1583
+
1584
+ return blockComponent;
1492
1585
  };
1493
1586
  }
1494
1587
 
@@ -1573,6 +1666,10 @@ function useDeferredValue(value, config) {
1573
1666
  var dispatcher = resolveDispatcher();
1574
1667
  return dispatcher.useDeferredValue(value, config);
1575
1668
  }
1669
+ function useMutableSource(source, getSnapshot, subscribe) {
1670
+ var dispatcher = resolveDispatcher();
1671
+ return dispatcher.useMutableSource(source, getSnapshot, subscribe);
1672
+ }
1576
1673
 
1577
1674
  function withSuspenseConfig(scope, config) {
1578
1675
  var previousConfig = ReactCurrentBatchConfig.suspense;
@@ -1585,6 +1682,48 @@ function withSuspenseConfig(scope, config) {
1585
1682
  }
1586
1683
  }
1587
1684
 
1685
+ var loggedTypeFailures = {};
1686
+ function checkPropTypes(typeSpecs, values, location, componentName) {
1687
+ {
1688
+ // $FlowFixMe This is okay but Flow doesn't know it.
1689
+ var has = Function.call.bind(Object.prototype.hasOwnProperty);
1690
+
1691
+ for (var typeSpecName in typeSpecs) {
1692
+ if (has(typeSpecs, typeSpecName)) {
1693
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
1694
+ // fail the render phase where it didn't fail before. So we log it.
1695
+ // After these have been cleaned up, we'll let them throw.
1696
+
1697
+ try {
1698
+ // This is intentionally an invariant that gets caught. It's the same
1699
+ // behavior as without this statement except with a better message.
1700
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
1701
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
1702
+ err.name = 'Invariant Violation';
1703
+ throw err;
1704
+ }
1705
+
1706
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
1707
+ } catch (ex) {
1708
+ error$1 = ex;
1709
+ }
1710
+
1711
+ if (error$1 && !(error$1 instanceof Error)) {
1712
+ error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
1713
+ }
1714
+
1715
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
1716
+ // Only monitor this failure once because there tends to be a lot of the
1717
+ // same error.
1718
+ loggedTypeFailures[error$1.message] = true;
1719
+
1720
+ error('Failed %s type: %s', location, error$1.message);
1721
+ }
1722
+ }
1723
+ }
1724
+ }
1725
+ }
1726
+
1588
1727
  var propTypesMisspellWarningShown;
1589
1728
 
1590
1729
  {
@@ -1765,7 +1904,7 @@ function validatePropTypes(element) {
1765
1904
 
1766
1905
  if (propTypes) {
1767
1906
  setCurrentlyValidatingElement(element);
1768
- checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1907
+ checkPropTypes(propTypes, element.props, 'prop', name);
1769
1908
  setCurrentlyValidatingElement(null);
1770
1909
  } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1771
1910
  propTypesMisspellWarningShown = true;
@@ -1806,6 +1945,98 @@ function validateFragmentProps(fragment) {
1806
1945
  setCurrentlyValidatingElement(null);
1807
1946
  }
1808
1947
  }
1948
+
1949
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1950
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1951
+ // succeed and there will likely be errors in render.
1952
+
1953
+ if (!validType) {
1954
+ var info = '';
1955
+
1956
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1957
+ 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.";
1958
+ }
1959
+
1960
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1961
+
1962
+ if (sourceInfo) {
1963
+ info += sourceInfo;
1964
+ } else {
1965
+ info += getDeclarationErrorAddendum();
1966
+ }
1967
+
1968
+ var typeString;
1969
+
1970
+ if (type === null) {
1971
+ typeString = 'null';
1972
+ } else if (Array.isArray(type)) {
1973
+ typeString = 'array';
1974
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1975
+ typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
1976
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1977
+ } else {
1978
+ typeString = typeof type;
1979
+ }
1980
+
1981
+ {
1982
+ error('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);
1983
+ }
1984
+ }
1985
+
1986
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1987
+ // TODO: Drop this when these are no longer allowed as the type argument.
1988
+
1989
+ if (element == null) {
1990
+ return element;
1991
+ } // Skip key warning if the type isn't valid since our key validation logic
1992
+ // doesn't expect a non-string/function type and can throw confusing errors.
1993
+ // We don't want exception behavior to differ between dev and prod.
1994
+ // (Rendering will throw with a helpful message and as soon as the type is
1995
+ // fixed, the key warnings will appear.)
1996
+
1997
+
1998
+ if (validType) {
1999
+ var children = props.children;
2000
+
2001
+ if (children !== undefined) {
2002
+ if (isStaticChildren) {
2003
+ if (Array.isArray(children)) {
2004
+ for (var i = 0; i < children.length; i++) {
2005
+ validateChildKeys(children[i], type);
2006
+ }
2007
+
2008
+ if (Object.freeze) {
2009
+ Object.freeze(children);
2010
+ }
2011
+ } else {
2012
+ {
2013
+ error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
2014
+ }
2015
+ }
2016
+ } else {
2017
+ validateChildKeys(children, type);
2018
+ }
2019
+ }
2020
+ }
2021
+
2022
+ if (type === REACT_FRAGMENT_TYPE) {
2023
+ validateFragmentProps(element);
2024
+ } else {
2025
+ validatePropTypes(element);
2026
+ }
2027
+
2028
+ return element;
2029
+ } // These two functions exist to still get child warnings in dev
2030
+ // even with the prod transform. This means that jsxDEV is purely
2031
+ // opt-in behavior for better messages but that we won't stop
2032
+ // giving you warnings if you use production apis.
2033
+
2034
+ function jsxWithValidationStatic(type, props, key) {
2035
+ return jsxWithValidation(type, props, key, true);
2036
+ }
2037
+ function jsxWithValidationDynamic(type, props, key) {
2038
+ return jsxWithValidation(type, props, key, false);
2039
+ }
1809
2040
  function createElementWithValidation(type, props, children) {
1810
2041
  var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1811
2042
  // succeed and there will likely be errors in render.
@@ -1908,6 +2139,22 @@ function cloneElementWithValidation(element, props, children) {
1908
2139
  return newElement;
1909
2140
  }
1910
2141
 
2142
+ function createMutableSource(source, getVersion) {
2143
+ var mutableSource = {
2144
+ _getVersion: getVersion,
2145
+ _source: source,
2146
+ _workInProgressVersionPrimary: null,
2147
+ _workInProgressVersionSecondary: null
2148
+ };
2149
+
2150
+ {
2151
+ mutableSource._currentPrimaryRenderer = null;
2152
+ mutableSource._currentSecondaryRenderer = null;
2153
+ }
2154
+
2155
+ return mutableSource;
2156
+ }
2157
+
1911
2158
  {
1912
2159
 
1913
2160
  try {
@@ -1923,63 +2170,59 @@ function cloneElementWithValidation(element, props, children) {
1923
2170
  }
1924
2171
  }
1925
2172
 
1926
- var React = {
1927
- Children: {
1928
- map: mapChildren,
1929
- forEach: forEachChildren,
1930
- count: countChildren,
1931
- toArray: toArray,
1932
- only: onlyChild
1933
- },
1934
- createRef: createRef,
1935
- Component: Component,
1936
- PureComponent: PureComponent,
1937
- createContext: createContext,
1938
- forwardRef: forwardRef,
1939
- lazy: lazy,
1940
- memo: memo,
1941
- useCallback: useCallback,
1942
- useContext: useContext,
1943
- useEffect: useEffect,
1944
- useImperativeHandle: useImperativeHandle,
1945
- useDebugValue: useDebugValue,
1946
- useLayoutEffect: useLayoutEffect,
1947
- useMemo: useMemo,
1948
- useReducer: useReducer,
1949
- useRef: useRef,
1950
- useState: useState,
1951
- Fragment: REACT_FRAGMENT_TYPE,
1952
- Profiler: REACT_PROFILER_TYPE,
1953
- StrictMode: REACT_STRICT_MODE_TYPE,
1954
- Suspense: REACT_SUSPENSE_TYPE,
1955
- createElement: createElementWithValidation ,
1956
- cloneElement: cloneElementWithValidation ,
1957
- isValidElement: isValidElement,
1958
- version: ReactVersion,
1959
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1960
- };
1961
-
1962
- {
1963
- React.createFactory = createFactoryWithValidation ;
1964
- }
2173
+ var createElement$1 = createElementWithValidation ;
2174
+ var cloneElement$1 = cloneElementWithValidation ;
2175
+ var createFactory = createFactoryWithValidation ;
2176
+ var jsxDEV$1 = jsxWithValidation ;
2177
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
2178
+ // for now we can ship identical prod functions
1965
2179
 
1966
- {
1967
- React.useTransition = useTransition;
1968
- React.useDeferredValue = useDeferredValue;
1969
- React.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
1970
- React.unstable_withSuspenseConfig = withSuspenseConfig;
1971
- }
1972
-
1973
- {
1974
- React.block = block;
1975
- }
1976
-
1977
- // TODO: decide on the top-level export form.
1978
- // This is hacky but makes it work with both Rollup and Jest.
1979
-
1980
-
1981
- var react = React.default || React;
2180
+ var jsxs = jsxWithValidationStatic ;
2181
+ var Children = {
2182
+ map: mapChildren,
2183
+ forEach: forEachChildren,
2184
+ count: countChildren,
2185
+ toArray: toArray,
2186
+ only: onlyChild
2187
+ };
1982
2188
 
1983
- module.exports = react;
2189
+ exports.Children = Children;
2190
+ exports.Component = Component;
2191
+ exports.Fragment = REACT_FRAGMENT_TYPE;
2192
+ exports.Profiler = REACT_PROFILER_TYPE;
2193
+ exports.PureComponent = PureComponent;
2194
+ exports.StrictMode = REACT_STRICT_MODE_TYPE;
2195
+ exports.Suspense = REACT_SUSPENSE_TYPE;
2196
+ exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
2197
+ exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
2198
+ exports.block = block;
2199
+ exports.cloneElement = cloneElement$1;
2200
+ exports.createContext = createContext;
2201
+ exports.createElement = createElement$1;
2202
+ exports.createFactory = createFactory;
2203
+ exports.createMutableSource = createMutableSource;
2204
+ exports.createRef = createRef;
2205
+ exports.forwardRef = forwardRef;
2206
+ exports.isValidElement = isValidElement;
2207
+ exports.jsx = jsx;
2208
+ exports.jsxDEV = jsxDEV$1;
2209
+ exports.jsxs = jsxs;
2210
+ exports.lazy = lazy;
2211
+ exports.memo = memo;
2212
+ exports.unstable_withSuspenseConfig = withSuspenseConfig;
2213
+ exports.useCallback = useCallback;
2214
+ exports.useContext = useContext;
2215
+ exports.useDebugValue = useDebugValue;
2216
+ exports.useDeferredValue = useDeferredValue;
2217
+ exports.useEffect = useEffect;
2218
+ exports.useImperativeHandle = useImperativeHandle;
2219
+ exports.useLayoutEffect = useLayoutEffect;
2220
+ exports.useMemo = useMemo;
2221
+ exports.useMutableSource = useMutableSource;
2222
+ exports.useReducer = useReducer;
2223
+ exports.useRef = useRef;
2224
+ exports.useState = useState;
2225
+ exports.useTransition = useTransition;
2226
+ exports.version = ReactVersion;
1984
2227
  })();
1985
2228
  }