@khanacademy/perseus-linter 0.2.1 → 0.2.3

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/dist/index.js CHANGED
@@ -3,6 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var perseusError = require('@khanacademy/perseus-error');
6
+ var PropTypes = require('prop-types');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
6
11
 
7
12
  function _defineProperty(obj, key, value) {
8
13
  if (key in obj) {
@@ -1675,1194 +1680,12 @@ class Stack {
1675
1680
 
1676
1681
  }
1677
1682
 
1678
- var propTypes = {exports: {}};
1679
-
1680
- var reactIs = {exports: {}};
1681
-
1682
- var reactIs_production_min = {};
1683
-
1684
- /** @license React v16.13.1
1685
- * react-is.production.min.js
1686
- *
1687
- * Copyright (c) Facebook, Inc. and its affiliates.
1688
- *
1689
- * This source code is licensed under the MIT license found in the
1690
- * LICENSE file in the root directory of this source tree.
1691
- */
1692
-
1693
- var hasRequiredReactIs_production_min;
1694
-
1695
- function requireReactIs_production_min () {
1696
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
1697
- hasRequiredReactIs_production_min = 1;
1698
- 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?
1699
- 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.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
1700
- function z(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 t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
1701
- reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
1702
- reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
1703
- reactIs_production_min.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===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
1704
- return reactIs_production_min;
1705
- }
1706
-
1707
- var reactIs_development = {};
1708
-
1709
- /** @license React v16.13.1
1710
- * react-is.development.js
1711
- *
1712
- * Copyright (c) Facebook, Inc. and its affiliates.
1713
- *
1714
- * This source code is licensed under the MIT license found in the
1715
- * LICENSE file in the root directory of this source tree.
1716
- */
1717
-
1718
- var hasRequiredReactIs_development;
1719
-
1720
- function requireReactIs_development () {
1721
- if (hasRequiredReactIs_development) return reactIs_development;
1722
- hasRequiredReactIs_development = 1;
1723
-
1724
-
1725
-
1726
- if (process.env.NODE_ENV !== "production") {
1727
- (function() {
1728
-
1729
- // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
1730
- // nor polyfill, then a plain number is used for performance.
1731
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
1732
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
1733
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
1734
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
1735
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
1736
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
1737
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
1738
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
1739
- // (unstable) APIs that have been removed. Can we remove the symbols?
1740
-
1741
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
1742
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
1743
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
1744
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
1745
- var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
1746
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
1747
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
1748
- var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
1749
- var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
1750
- var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
1751
- var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
1752
-
1753
- function isValidElementType(type) {
1754
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1755
- 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 || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
1756
- }
1757
-
1758
- function typeOf(object) {
1759
- if (typeof object === 'object' && object !== null) {
1760
- var $$typeof = object.$$typeof;
1761
-
1762
- switch ($$typeof) {
1763
- case REACT_ELEMENT_TYPE:
1764
- var type = object.type;
1765
-
1766
- switch (type) {
1767
- case REACT_ASYNC_MODE_TYPE:
1768
- case REACT_CONCURRENT_MODE_TYPE:
1769
- case REACT_FRAGMENT_TYPE:
1770
- case REACT_PROFILER_TYPE:
1771
- case REACT_STRICT_MODE_TYPE:
1772
- case REACT_SUSPENSE_TYPE:
1773
- return type;
1774
-
1775
- default:
1776
- var $$typeofType = type && type.$$typeof;
1777
-
1778
- switch ($$typeofType) {
1779
- case REACT_CONTEXT_TYPE:
1780
- case REACT_FORWARD_REF_TYPE:
1781
- case REACT_LAZY_TYPE:
1782
- case REACT_MEMO_TYPE:
1783
- case REACT_PROVIDER_TYPE:
1784
- return $$typeofType;
1785
-
1786
- default:
1787
- return $$typeof;
1788
- }
1789
-
1790
- }
1791
-
1792
- case REACT_PORTAL_TYPE:
1793
- return $$typeof;
1794
- }
1795
- }
1796
-
1797
- return undefined;
1798
- } // AsyncMode is deprecated along with isAsyncMode
1799
-
1800
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
1801
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1802
- var ContextConsumer = REACT_CONTEXT_TYPE;
1803
- var ContextProvider = REACT_PROVIDER_TYPE;
1804
- var Element = REACT_ELEMENT_TYPE;
1805
- var ForwardRef = REACT_FORWARD_REF_TYPE;
1806
- var Fragment = REACT_FRAGMENT_TYPE;
1807
- var Lazy = REACT_LAZY_TYPE;
1808
- var Memo = REACT_MEMO_TYPE;
1809
- var Portal = REACT_PORTAL_TYPE;
1810
- var Profiler = REACT_PROFILER_TYPE;
1811
- var StrictMode = REACT_STRICT_MODE_TYPE;
1812
- var Suspense = REACT_SUSPENSE_TYPE;
1813
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
1814
-
1815
- function isAsyncMode(object) {
1816
- {
1817
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
1818
- hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
1819
-
1820
- console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
1821
- }
1822
- }
1823
-
1824
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
1825
- }
1826
- function isConcurrentMode(object) {
1827
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
1828
- }
1829
- function isContextConsumer(object) {
1830
- return typeOf(object) === REACT_CONTEXT_TYPE;
1831
- }
1832
- function isContextProvider(object) {
1833
- return typeOf(object) === REACT_PROVIDER_TYPE;
1834
- }
1835
- function isElement(object) {
1836
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1837
- }
1838
- function isForwardRef(object) {
1839
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
1840
- }
1841
- function isFragment(object) {
1842
- return typeOf(object) === REACT_FRAGMENT_TYPE;
1843
- }
1844
- function isLazy(object) {
1845
- return typeOf(object) === REACT_LAZY_TYPE;
1846
- }
1847
- function isMemo(object) {
1848
- return typeOf(object) === REACT_MEMO_TYPE;
1849
- }
1850
- function isPortal(object) {
1851
- return typeOf(object) === REACT_PORTAL_TYPE;
1852
- }
1853
- function isProfiler(object) {
1854
- return typeOf(object) === REACT_PROFILER_TYPE;
1855
- }
1856
- function isStrictMode(object) {
1857
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
1858
- }
1859
- function isSuspense(object) {
1860
- return typeOf(object) === REACT_SUSPENSE_TYPE;
1861
- }
1862
-
1863
- reactIs_development.AsyncMode = AsyncMode;
1864
- reactIs_development.ConcurrentMode = ConcurrentMode;
1865
- reactIs_development.ContextConsumer = ContextConsumer;
1866
- reactIs_development.ContextProvider = ContextProvider;
1867
- reactIs_development.Element = Element;
1868
- reactIs_development.ForwardRef = ForwardRef;
1869
- reactIs_development.Fragment = Fragment;
1870
- reactIs_development.Lazy = Lazy;
1871
- reactIs_development.Memo = Memo;
1872
- reactIs_development.Portal = Portal;
1873
- reactIs_development.Profiler = Profiler;
1874
- reactIs_development.StrictMode = StrictMode;
1875
- reactIs_development.Suspense = Suspense;
1876
- reactIs_development.isAsyncMode = isAsyncMode;
1877
- reactIs_development.isConcurrentMode = isConcurrentMode;
1878
- reactIs_development.isContextConsumer = isContextConsumer;
1879
- reactIs_development.isContextProvider = isContextProvider;
1880
- reactIs_development.isElement = isElement;
1881
- reactIs_development.isForwardRef = isForwardRef;
1882
- reactIs_development.isFragment = isFragment;
1883
- reactIs_development.isLazy = isLazy;
1884
- reactIs_development.isMemo = isMemo;
1885
- reactIs_development.isPortal = isPortal;
1886
- reactIs_development.isProfiler = isProfiler;
1887
- reactIs_development.isStrictMode = isStrictMode;
1888
- reactIs_development.isSuspense = isSuspense;
1889
- reactIs_development.isValidElementType = isValidElementType;
1890
- reactIs_development.typeOf = typeOf;
1891
- })();
1892
- }
1893
- return reactIs_development;
1894
- }
1895
-
1896
- var hasRequiredReactIs;
1897
-
1898
- function requireReactIs () {
1899
- if (hasRequiredReactIs) return reactIs.exports;
1900
- hasRequiredReactIs = 1;
1901
- (function (module) {
1902
-
1903
- if (process.env.NODE_ENV === 'production') {
1904
- module.exports = requireReactIs_production_min();
1905
- } else {
1906
- module.exports = requireReactIs_development();
1907
- }
1908
- } (reactIs));
1909
- return reactIs.exports;
1910
- }
1911
-
1912
- /*
1913
- object-assign
1914
- (c) Sindre Sorhus
1915
- @license MIT
1916
- */
1917
-
1918
- var objectAssign;
1919
- var hasRequiredObjectAssign;
1920
-
1921
- function requireObjectAssign () {
1922
- if (hasRequiredObjectAssign) return objectAssign;
1923
- hasRequiredObjectAssign = 1;
1924
- /* eslint-disable no-unused-vars */
1925
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
1926
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1927
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1928
-
1929
- function toObject(val) {
1930
- if (val === null || val === undefined) {
1931
- throw new TypeError('Object.assign cannot be called with null or undefined');
1932
- }
1933
-
1934
- return Object(val);
1935
- }
1936
-
1937
- function shouldUseNative() {
1938
- try {
1939
- if (!Object.assign) {
1940
- return false;
1941
- }
1942
-
1943
- // Detect buggy property enumeration order in older V8 versions.
1944
-
1945
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
1946
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
1947
- test1[5] = 'de';
1948
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
1949
- return false;
1950
- }
1951
-
1952
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1953
- var test2 = {};
1954
- for (var i = 0; i < 10; i++) {
1955
- test2['_' + String.fromCharCode(i)] = i;
1956
- }
1957
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1958
- return test2[n];
1959
- });
1960
- if (order2.join('') !== '0123456789') {
1961
- return false;
1962
- }
1963
-
1964
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1965
- var test3 = {};
1966
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1967
- test3[letter] = letter;
1968
- });
1969
- if (Object.keys(Object.assign({}, test3)).join('') !==
1970
- 'abcdefghijklmnopqrst') {
1971
- return false;
1972
- }
1973
-
1974
- return true;
1975
- } catch (err) {
1976
- // We don't expect any of the above to throw, but better to be safe.
1977
- return false;
1978
- }
1979
- }
1980
-
1981
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
1982
- var from;
1983
- var to = toObject(target);
1984
- var symbols;
1985
-
1986
- for (var s = 1; s < arguments.length; s++) {
1987
- from = Object(arguments[s]);
1988
-
1989
- for (var key in from) {
1990
- if (hasOwnProperty.call(from, key)) {
1991
- to[key] = from[key];
1992
- }
1993
- }
1994
-
1995
- if (getOwnPropertySymbols) {
1996
- symbols = getOwnPropertySymbols(from);
1997
- for (var i = 0; i < symbols.length; i++) {
1998
- if (propIsEnumerable.call(from, symbols[i])) {
1999
- to[symbols[i]] = from[symbols[i]];
2000
- }
2001
- }
2002
- }
2003
- }
2004
-
2005
- return to;
2006
- };
2007
- return objectAssign;
2008
- }
2009
-
2010
- /**
2011
- * Copyright (c) 2013-present, Facebook, Inc.
2012
- *
2013
- * This source code is licensed under the MIT license found in the
2014
- * LICENSE file in the root directory of this source tree.
2015
- */
2016
-
2017
- var ReactPropTypesSecret_1;
2018
- var hasRequiredReactPropTypesSecret;
2019
-
2020
- function requireReactPropTypesSecret () {
2021
- if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
2022
- hasRequiredReactPropTypesSecret = 1;
2023
-
2024
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
2025
-
2026
- ReactPropTypesSecret_1 = ReactPropTypesSecret;
2027
- return ReactPropTypesSecret_1;
2028
- }
2029
-
2030
- var has;
2031
- var hasRequiredHas;
2032
-
2033
- function requireHas () {
2034
- if (hasRequiredHas) return has;
2035
- hasRequiredHas = 1;
2036
- has = Function.call.bind(Object.prototype.hasOwnProperty);
2037
- return has;
2038
- }
2039
-
2040
- /**
2041
- * Copyright (c) 2013-present, Facebook, Inc.
2042
- *
2043
- * This source code is licensed under the MIT license found in the
2044
- * LICENSE file in the root directory of this source tree.
2045
- */
2046
-
2047
- var checkPropTypes_1;
2048
- var hasRequiredCheckPropTypes;
2049
-
2050
- function requireCheckPropTypes () {
2051
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
2052
- hasRequiredCheckPropTypes = 1;
2053
-
2054
- var printWarning = function() {};
2055
-
2056
- if (process.env.NODE_ENV !== 'production') {
2057
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2058
- var loggedTypeFailures = {};
2059
- var has = requireHas();
2060
-
2061
- printWarning = function(text) {
2062
- var message = 'Warning: ' + text;
2063
- if (typeof console !== 'undefined') {
2064
- console.error(message);
2065
- }
2066
- try {
2067
- // --- Welcome to debugging React ---
2068
- // This error was thrown as a convenience so that you can use this stack
2069
- // to find the callsite that caused this warning to fire.
2070
- throw new Error(message);
2071
- } catch (x) { /**/ }
2072
- };
2073
- }
2074
-
2075
- /**
2076
- * Assert that the values match with the type specs.
2077
- * Error messages are memorized and will only be shown once.
2078
- *
2079
- * @param {object} typeSpecs Map of name to a ReactPropType
2080
- * @param {object} values Runtime values that need to be type-checked
2081
- * @param {string} location e.g. "prop", "context", "child context"
2082
- * @param {string} componentName Name of the component for error messages.
2083
- * @param {?Function} getStack Returns the component stack.
2084
- * @private
2085
- */
2086
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
2087
- if (process.env.NODE_ENV !== 'production') {
2088
- for (var typeSpecName in typeSpecs) {
2089
- if (has(typeSpecs, typeSpecName)) {
2090
- var error;
2091
- // Prop type validation may throw. In case they do, we don't want to
2092
- // fail the render phase where it didn't fail before. So we log it.
2093
- // After these have been cleaned up, we'll let them throw.
2094
- try {
2095
- // This is intentionally an invariant that gets caught. It's the same
2096
- // behavior as without this statement except with a better message.
2097
- if (typeof typeSpecs[typeSpecName] !== 'function') {
2098
- var err = Error(
2099
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
2100
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
2101
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
2102
- );
2103
- err.name = 'Invariant Violation';
2104
- throw err;
2105
- }
2106
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
2107
- } catch (ex) {
2108
- error = ex;
2109
- }
2110
- if (error && !(error instanceof Error)) {
2111
- printWarning(
2112
- (componentName || 'React class') + ': type specification of ' +
2113
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
2114
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
2115
- 'You may have forgotten to pass an argument to the type checker ' +
2116
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
2117
- 'shape all require an argument).'
2118
- );
2119
- }
2120
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
2121
- // Only monitor this failure once because there tends to be a lot of the
2122
- // same error.
2123
- loggedTypeFailures[error.message] = true;
2124
-
2125
- var stack = getStack ? getStack() : '';
2126
-
2127
- printWarning(
2128
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
2129
- );
2130
- }
2131
- }
2132
- }
2133
- }
2134
- }
2135
-
2136
- /**
2137
- * Resets warning cache when testing.
2138
- *
2139
- * @private
2140
- */
2141
- checkPropTypes.resetWarningCache = function() {
2142
- if (process.env.NODE_ENV !== 'production') {
2143
- loggedTypeFailures = {};
2144
- }
2145
- };
2146
-
2147
- checkPropTypes_1 = checkPropTypes;
2148
- return checkPropTypes_1;
2149
- }
2150
-
2151
- /**
2152
- * Copyright (c) 2013-present, Facebook, Inc.
2153
- *
2154
- * This source code is licensed under the MIT license found in the
2155
- * LICENSE file in the root directory of this source tree.
2156
- */
2157
-
2158
- var factoryWithTypeCheckers;
2159
- var hasRequiredFactoryWithTypeCheckers;
2160
-
2161
- function requireFactoryWithTypeCheckers () {
2162
- if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
2163
- hasRequiredFactoryWithTypeCheckers = 1;
2164
-
2165
- var ReactIs = requireReactIs();
2166
- var assign = requireObjectAssign();
2167
-
2168
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2169
- var has = requireHas();
2170
- var checkPropTypes = requireCheckPropTypes();
2171
-
2172
- var printWarning = function() {};
2173
-
2174
- if (process.env.NODE_ENV !== 'production') {
2175
- printWarning = function(text) {
2176
- var message = 'Warning: ' + text;
2177
- if (typeof console !== 'undefined') {
2178
- console.error(message);
2179
- }
2180
- try {
2181
- // --- Welcome to debugging React ---
2182
- // This error was thrown as a convenience so that you can use this stack
2183
- // to find the callsite that caused this warning to fire.
2184
- throw new Error(message);
2185
- } catch (x) {}
2186
- };
2187
- }
2188
-
2189
- function emptyFunctionThatReturnsNull() {
2190
- return null;
2191
- }
2192
-
2193
- factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
2194
- /* global Symbol */
2195
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
2196
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
2197
-
2198
- /**
2199
- * Returns the iterator method function contained on the iterable object.
2200
- *
2201
- * Be sure to invoke the function with the iterable as context:
2202
- *
2203
- * var iteratorFn = getIteratorFn(myIterable);
2204
- * if (iteratorFn) {
2205
- * var iterator = iteratorFn.call(myIterable);
2206
- * ...
2207
- * }
2208
- *
2209
- * @param {?object} maybeIterable
2210
- * @return {?function}
2211
- */
2212
- function getIteratorFn(maybeIterable) {
2213
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
2214
- if (typeof iteratorFn === 'function') {
2215
- return iteratorFn;
2216
- }
2217
- }
2218
-
2219
- /**
2220
- * Collection of methods that allow declaration and validation of props that are
2221
- * supplied to React components. Example usage:
2222
- *
2223
- * var Props = require('ReactPropTypes');
2224
- * var MyArticle = React.createClass({
2225
- * propTypes: {
2226
- * // An optional string prop named "description".
2227
- * description: Props.string,
2228
- *
2229
- * // A required enum prop named "category".
2230
- * category: Props.oneOf(['News','Photos']).isRequired,
2231
- *
2232
- * // A prop named "dialog" that requires an instance of Dialog.
2233
- * dialog: Props.instanceOf(Dialog).isRequired
2234
- * },
2235
- * render: function() { ... }
2236
- * });
2237
- *
2238
- * A more formal specification of how these methods are used:
2239
- *
2240
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
2241
- * decl := ReactPropTypes.{type}(.isRequired)?
2242
- *
2243
- * Each and every declaration produces a function with the same signature. This
2244
- * allows the creation of custom validation functions. For example:
2245
- *
2246
- * var MyLink = React.createClass({
2247
- * propTypes: {
2248
- * // An optional string or URI prop named "href".
2249
- * href: function(props, propName, componentName) {
2250
- * var propValue = props[propName];
2251
- * if (propValue != null && typeof propValue !== 'string' &&
2252
- * !(propValue instanceof URI)) {
2253
- * return new Error(
2254
- * 'Expected a string or an URI for ' + propName + ' in ' +
2255
- * componentName
2256
- * );
2257
- * }
2258
- * }
2259
- * },
2260
- * render: function() {...}
2261
- * });
2262
- *
2263
- * @internal
2264
- */
2265
-
2266
- var ANONYMOUS = '<<anonymous>>';
2267
-
2268
- // Important!
2269
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
2270
- var ReactPropTypes = {
2271
- array: createPrimitiveTypeChecker('array'),
2272
- bigint: createPrimitiveTypeChecker('bigint'),
2273
- bool: createPrimitiveTypeChecker('boolean'),
2274
- func: createPrimitiveTypeChecker('function'),
2275
- number: createPrimitiveTypeChecker('number'),
2276
- object: createPrimitiveTypeChecker('object'),
2277
- string: createPrimitiveTypeChecker('string'),
2278
- symbol: createPrimitiveTypeChecker('symbol'),
2279
-
2280
- any: createAnyTypeChecker(),
2281
- arrayOf: createArrayOfTypeChecker,
2282
- element: createElementTypeChecker(),
2283
- elementType: createElementTypeTypeChecker(),
2284
- instanceOf: createInstanceTypeChecker,
2285
- node: createNodeChecker(),
2286
- objectOf: createObjectOfTypeChecker,
2287
- oneOf: createEnumTypeChecker,
2288
- oneOfType: createUnionTypeChecker,
2289
- shape: createShapeTypeChecker,
2290
- exact: createStrictShapeTypeChecker,
2291
- };
2292
-
2293
- /**
2294
- * inlined Object.is polyfill to avoid requiring consumers ship their own
2295
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
2296
- */
2297
- /*eslint-disable no-self-compare*/
2298
- function is(x, y) {
2299
- // SameValue algorithm
2300
- if (x === y) {
2301
- // Steps 1-5, 7-10
2302
- // Steps 6.b-6.e: +0 != -0
2303
- return x !== 0 || 1 / x === 1 / y;
2304
- } else {
2305
- // Step 6.a: NaN == NaN
2306
- return x !== x && y !== y;
2307
- }
2308
- }
2309
- /*eslint-enable no-self-compare*/
2310
-
2311
- /**
2312
- * We use an Error-like object for backward compatibility as people may call
2313
- * PropTypes directly and inspect their output. However, we don't use real
2314
- * Errors anymore. We don't inspect their stack anyway, and creating them
2315
- * is prohibitively expensive if they are created too often, such as what
2316
- * happens in oneOfType() for any type before the one that matched.
2317
- */
2318
- function PropTypeError(message, data) {
2319
- this.message = message;
2320
- this.data = data && typeof data === 'object' ? data: {};
2321
- this.stack = '';
2322
- }
2323
- // Make `instanceof Error` still work for returned errors.
2324
- PropTypeError.prototype = Error.prototype;
2325
-
2326
- function createChainableTypeChecker(validate) {
2327
- if (process.env.NODE_ENV !== 'production') {
2328
- var manualPropTypeCallCache = {};
2329
- var manualPropTypeWarningCount = 0;
2330
- }
2331
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
2332
- componentName = componentName || ANONYMOUS;
2333
- propFullName = propFullName || propName;
2334
-
2335
- if (secret !== ReactPropTypesSecret) {
2336
- if (throwOnDirectAccess) {
2337
- // New behavior only for users of `prop-types` package
2338
- var err = new Error(
2339
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2340
- 'Use `PropTypes.checkPropTypes()` to call them. ' +
2341
- 'Read more at http://fb.me/use-check-prop-types'
2342
- );
2343
- err.name = 'Invariant Violation';
2344
- throw err;
2345
- } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
2346
- // Old behavior for people using React.PropTypes
2347
- var cacheKey = componentName + ':' + propName;
2348
- if (
2349
- !manualPropTypeCallCache[cacheKey] &&
2350
- // Avoid spamming the console because they are often not actionable except for lib authors
2351
- manualPropTypeWarningCount < 3
2352
- ) {
2353
- printWarning(
2354
- 'You are manually calling a React.PropTypes validation ' +
2355
- 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
2356
- 'and will throw in the standalone `prop-types` package. ' +
2357
- 'You may be seeing this warning due to a third-party PropTypes ' +
2358
- 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
2359
- );
2360
- manualPropTypeCallCache[cacheKey] = true;
2361
- manualPropTypeWarningCount++;
2362
- }
2363
- }
2364
- }
2365
- if (props[propName] == null) {
2366
- if (isRequired) {
2367
- if (props[propName] === null) {
2368
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
2369
- }
2370
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
2371
- }
2372
- return null;
2373
- } else {
2374
- return validate(props, propName, componentName, location, propFullName);
2375
- }
2376
- }
2377
-
2378
- var chainedCheckType = checkType.bind(null, false);
2379
- chainedCheckType.isRequired = checkType.bind(null, true);
2380
-
2381
- return chainedCheckType;
2382
- }
2383
-
2384
- function createPrimitiveTypeChecker(expectedType) {
2385
- function validate(props, propName, componentName, location, propFullName, secret) {
2386
- var propValue = props[propName];
2387
- var propType = getPropType(propValue);
2388
- if (propType !== expectedType) {
2389
- // `propValue` being instance of, say, date/regexp, pass the 'object'
2390
- // check, but we can offer a more precise error message here rather than
2391
- // 'of type `object`'.
2392
- var preciseType = getPreciseType(propValue);
2393
-
2394
- return new PropTypeError(
2395
- 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
2396
- {expectedType: expectedType}
2397
- );
2398
- }
2399
- return null;
2400
- }
2401
- return createChainableTypeChecker(validate);
2402
- }
2403
-
2404
- function createAnyTypeChecker() {
2405
- return createChainableTypeChecker(emptyFunctionThatReturnsNull);
2406
- }
2407
-
2408
- function createArrayOfTypeChecker(typeChecker) {
2409
- function validate(props, propName, componentName, location, propFullName) {
2410
- if (typeof typeChecker !== 'function') {
2411
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
2412
- }
2413
- var propValue = props[propName];
2414
- if (!Array.isArray(propValue)) {
2415
- var propType = getPropType(propValue);
2416
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
2417
- }
2418
- for (var i = 0; i < propValue.length; i++) {
2419
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
2420
- if (error instanceof Error) {
2421
- return error;
2422
- }
2423
- }
2424
- return null;
2425
- }
2426
- return createChainableTypeChecker(validate);
2427
- }
2428
-
2429
- function createElementTypeChecker() {
2430
- function validate(props, propName, componentName, location, propFullName) {
2431
- var propValue = props[propName];
2432
- if (!isValidElement(propValue)) {
2433
- var propType = getPropType(propValue);
2434
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
2435
- }
2436
- return null;
2437
- }
2438
- return createChainableTypeChecker(validate);
2439
- }
2440
-
2441
- function createElementTypeTypeChecker() {
2442
- function validate(props, propName, componentName, location, propFullName) {
2443
- var propValue = props[propName];
2444
- if (!ReactIs.isValidElementType(propValue)) {
2445
- var propType = getPropType(propValue);
2446
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
2447
- }
2448
- return null;
2449
- }
2450
- return createChainableTypeChecker(validate);
2451
- }
2452
-
2453
- function createInstanceTypeChecker(expectedClass) {
2454
- function validate(props, propName, componentName, location, propFullName) {
2455
- if (!(props[propName] instanceof expectedClass)) {
2456
- var expectedClassName = expectedClass.name || ANONYMOUS;
2457
- var actualClassName = getClassName(props[propName]);
2458
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
2459
- }
2460
- return null;
2461
- }
2462
- return createChainableTypeChecker(validate);
2463
- }
2464
-
2465
- function createEnumTypeChecker(expectedValues) {
2466
- if (!Array.isArray(expectedValues)) {
2467
- if (process.env.NODE_ENV !== 'production') {
2468
- if (arguments.length > 1) {
2469
- printWarning(
2470
- 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
2471
- 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
2472
- );
2473
- } else {
2474
- printWarning('Invalid argument supplied to oneOf, expected an array.');
2475
- }
2476
- }
2477
- return emptyFunctionThatReturnsNull;
2478
- }
2479
-
2480
- function validate(props, propName, componentName, location, propFullName) {
2481
- var propValue = props[propName];
2482
- for (var i = 0; i < expectedValues.length; i++) {
2483
- if (is(propValue, expectedValues[i])) {
2484
- return null;
2485
- }
2486
- }
2487
-
2488
- var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
2489
- var type = getPreciseType(value);
2490
- if (type === 'symbol') {
2491
- return String(value);
2492
- }
2493
- return value;
2494
- });
2495
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
2496
- }
2497
- return createChainableTypeChecker(validate);
2498
- }
2499
-
2500
- function createObjectOfTypeChecker(typeChecker) {
2501
- function validate(props, propName, componentName, location, propFullName) {
2502
- if (typeof typeChecker !== 'function') {
2503
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
2504
- }
2505
- var propValue = props[propName];
2506
- var propType = getPropType(propValue);
2507
- if (propType !== 'object') {
2508
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
2509
- }
2510
- for (var key in propValue) {
2511
- if (has(propValue, key)) {
2512
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2513
- if (error instanceof Error) {
2514
- return error;
2515
- }
2516
- }
2517
- }
2518
- return null;
2519
- }
2520
- return createChainableTypeChecker(validate);
2521
- }
2522
-
2523
- function createUnionTypeChecker(arrayOfTypeCheckers) {
2524
- if (!Array.isArray(arrayOfTypeCheckers)) {
2525
- process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
2526
- return emptyFunctionThatReturnsNull;
2527
- }
2528
-
2529
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2530
- var checker = arrayOfTypeCheckers[i];
2531
- if (typeof checker !== 'function') {
2532
- printWarning(
2533
- 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
2534
- 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
2535
- );
2536
- return emptyFunctionThatReturnsNull;
2537
- }
2538
- }
2539
-
2540
- function validate(props, propName, componentName, location, propFullName) {
2541
- var expectedTypes = [];
2542
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
2543
- var checker = arrayOfTypeCheckers[i];
2544
- var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
2545
- if (checkerResult == null) {
2546
- return null;
2547
- }
2548
- if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
2549
- expectedTypes.push(checkerResult.data.expectedType);
2550
- }
2551
- }
2552
- var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
2553
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
2554
- }
2555
- return createChainableTypeChecker(validate);
2556
- }
2557
-
2558
- function createNodeChecker() {
2559
- function validate(props, propName, componentName, location, propFullName) {
2560
- if (!isNode(props[propName])) {
2561
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
2562
- }
2563
- return null;
2564
- }
2565
- return createChainableTypeChecker(validate);
2566
- }
2567
-
2568
- function invalidValidatorError(componentName, location, propFullName, key, type) {
2569
- return new PropTypeError(
2570
- (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
2571
- 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
2572
- );
2573
- }
2574
-
2575
- function createShapeTypeChecker(shapeTypes) {
2576
- function validate(props, propName, componentName, location, propFullName) {
2577
- var propValue = props[propName];
2578
- var propType = getPropType(propValue);
2579
- if (propType !== 'object') {
2580
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2581
- }
2582
- for (var key in shapeTypes) {
2583
- var checker = shapeTypes[key];
2584
- if (typeof checker !== 'function') {
2585
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2586
- }
2587
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2588
- if (error) {
2589
- return error;
2590
- }
2591
- }
2592
- return null;
2593
- }
2594
- return createChainableTypeChecker(validate);
2595
- }
2596
-
2597
- function createStrictShapeTypeChecker(shapeTypes) {
2598
- function validate(props, propName, componentName, location, propFullName) {
2599
- var propValue = props[propName];
2600
- var propType = getPropType(propValue);
2601
- if (propType !== 'object') {
2602
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
2603
- }
2604
- // We need to check all keys in case some are required but missing from props.
2605
- var allKeys = assign({}, props[propName], shapeTypes);
2606
- for (var key in allKeys) {
2607
- var checker = shapeTypes[key];
2608
- if (has(shapeTypes, key) && typeof checker !== 'function') {
2609
- return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
2610
- }
2611
- if (!checker) {
2612
- return new PropTypeError(
2613
- 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
2614
- '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
2615
- '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
2616
- );
2617
- }
2618
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
2619
- if (error) {
2620
- return error;
2621
- }
2622
- }
2623
- return null;
2624
- }
2625
-
2626
- return createChainableTypeChecker(validate);
2627
- }
2628
-
2629
- function isNode(propValue) {
2630
- switch (typeof propValue) {
2631
- case 'number':
2632
- case 'string':
2633
- case 'undefined':
2634
- return true;
2635
- case 'boolean':
2636
- return !propValue;
2637
- case 'object':
2638
- if (Array.isArray(propValue)) {
2639
- return propValue.every(isNode);
2640
- }
2641
- if (propValue === null || isValidElement(propValue)) {
2642
- return true;
2643
- }
2644
-
2645
- var iteratorFn = getIteratorFn(propValue);
2646
- if (iteratorFn) {
2647
- var iterator = iteratorFn.call(propValue);
2648
- var step;
2649
- if (iteratorFn !== propValue.entries) {
2650
- while (!(step = iterator.next()).done) {
2651
- if (!isNode(step.value)) {
2652
- return false;
2653
- }
2654
- }
2655
- } else {
2656
- // Iterator will provide entry [k,v] tuples rather than values.
2657
- while (!(step = iterator.next()).done) {
2658
- var entry = step.value;
2659
- if (entry) {
2660
- if (!isNode(entry[1])) {
2661
- return false;
2662
- }
2663
- }
2664
- }
2665
- }
2666
- } else {
2667
- return false;
2668
- }
2669
-
2670
- return true;
2671
- default:
2672
- return false;
2673
- }
2674
- }
2675
-
2676
- function isSymbol(propType, propValue) {
2677
- // Native Symbol.
2678
- if (propType === 'symbol') {
2679
- return true;
2680
- }
2681
-
2682
- // falsy value can't be a Symbol
2683
- if (!propValue) {
2684
- return false;
2685
- }
2686
-
2687
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
2688
- if (propValue['@@toStringTag'] === 'Symbol') {
2689
- return true;
2690
- }
2691
-
2692
- // Fallback for non-spec compliant Symbols which are polyfilled.
2693
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
2694
- return true;
2695
- }
2696
-
2697
- return false;
2698
- }
2699
-
2700
- // Equivalent of `typeof` but with special handling for array and regexp.
2701
- function getPropType(propValue) {
2702
- var propType = typeof propValue;
2703
- if (Array.isArray(propValue)) {
2704
- return 'array';
2705
- }
2706
- if (propValue instanceof RegExp) {
2707
- // Old webkits (at least until Android 4.0) return 'function' rather than
2708
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
2709
- // passes PropTypes.object.
2710
- return 'object';
2711
- }
2712
- if (isSymbol(propType, propValue)) {
2713
- return 'symbol';
2714
- }
2715
- return propType;
2716
- }
2717
-
2718
- // This handles more types than `getPropType`. Only used for error messages.
2719
- // See `createPrimitiveTypeChecker`.
2720
- function getPreciseType(propValue) {
2721
- if (typeof propValue === 'undefined' || propValue === null) {
2722
- return '' + propValue;
2723
- }
2724
- var propType = getPropType(propValue);
2725
- if (propType === 'object') {
2726
- if (propValue instanceof Date) {
2727
- return 'date';
2728
- } else if (propValue instanceof RegExp) {
2729
- return 'regexp';
2730
- }
2731
- }
2732
- return propType;
2733
- }
2734
-
2735
- // Returns a string that is postfixed to a warning about an invalid type.
2736
- // For example, "undefined" or "of type array"
2737
- function getPostfixForTypeWarning(value) {
2738
- var type = getPreciseType(value);
2739
- switch (type) {
2740
- case 'array':
2741
- case 'object':
2742
- return 'an ' + type;
2743
- case 'boolean':
2744
- case 'date':
2745
- case 'regexp':
2746
- return 'a ' + type;
2747
- default:
2748
- return type;
2749
- }
2750
- }
2751
-
2752
- // Returns class name of the object, if any.
2753
- function getClassName(propValue) {
2754
- if (!propValue.constructor || !propValue.constructor.name) {
2755
- return ANONYMOUS;
2756
- }
2757
- return propValue.constructor.name;
2758
- }
2759
-
2760
- ReactPropTypes.checkPropTypes = checkPropTypes;
2761
- ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
2762
- ReactPropTypes.PropTypes = ReactPropTypes;
2763
-
2764
- return ReactPropTypes;
2765
- };
2766
- return factoryWithTypeCheckers;
2767
- }
2768
-
2769
- /**
2770
- * Copyright (c) 2013-present, Facebook, Inc.
2771
- *
2772
- * This source code is licensed under the MIT license found in the
2773
- * LICENSE file in the root directory of this source tree.
2774
- */
2775
-
2776
- var factoryWithThrowingShims;
2777
- var hasRequiredFactoryWithThrowingShims;
2778
-
2779
- function requireFactoryWithThrowingShims () {
2780
- if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
2781
- hasRequiredFactoryWithThrowingShims = 1;
2782
-
2783
- var ReactPropTypesSecret = requireReactPropTypesSecret();
2784
-
2785
- function emptyFunction() {}
2786
- function emptyFunctionWithReset() {}
2787
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
2788
-
2789
- factoryWithThrowingShims = function() {
2790
- function shim(props, propName, componentName, location, propFullName, secret) {
2791
- if (secret === ReactPropTypesSecret) {
2792
- // It is still safe when called from React.
2793
- return;
2794
- }
2795
- var err = new Error(
2796
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
2797
- 'Use PropTypes.checkPropTypes() to call them. ' +
2798
- 'Read more at http://fb.me/use-check-prop-types'
2799
- );
2800
- err.name = 'Invariant Violation';
2801
- throw err;
2802
- } shim.isRequired = shim;
2803
- function getShim() {
2804
- return shim;
2805
- } // Important!
2806
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
2807
- var ReactPropTypes = {
2808
- array: shim,
2809
- bigint: shim,
2810
- bool: shim,
2811
- func: shim,
2812
- number: shim,
2813
- object: shim,
2814
- string: shim,
2815
- symbol: shim,
2816
-
2817
- any: shim,
2818
- arrayOf: getShim,
2819
- element: shim,
2820
- elementType: shim,
2821
- instanceOf: getShim,
2822
- node: shim,
2823
- objectOf: getShim,
2824
- oneOf: getShim,
2825
- oneOfType: getShim,
2826
- shape: getShim,
2827
- exact: getShim,
2828
-
2829
- checkPropTypes: emptyFunctionWithReset,
2830
- resetWarningCache: emptyFunction
2831
- };
2832
-
2833
- ReactPropTypes.PropTypes = ReactPropTypes;
2834
-
2835
- return ReactPropTypes;
2836
- };
2837
- return factoryWithThrowingShims;
2838
- }
2839
-
2840
- /**
2841
- * Copyright (c) 2013-present, Facebook, Inc.
2842
- *
2843
- * This source code is licensed under the MIT license found in the
2844
- * LICENSE file in the root directory of this source tree.
2845
- */
2846
-
2847
- if (process.env.NODE_ENV !== 'production') {
2848
- var ReactIs = requireReactIs();
2849
-
2850
- // By explicitly using `prop-types` you are opting into new development behavior.
2851
- // http://fb.me/prop-types-in-prod
2852
- var throwOnDirectAccess = true;
2853
- propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
2854
- } else {
2855
- // By explicitly using `prop-types` you are opting into new production behavior.
2856
- // http://fb.me/prop-types-in-prod
2857
- propTypes.exports = requireFactoryWithThrowingShims()();
2858
- }
2859
-
2860
1683
  // Define the shape of the linter context object that is passed through the
2861
- const linterContextProps = propTypes.exports.shape({
2862
- contentType: propTypes.exports.string,
2863
- highlightLint: propTypes.exports.bool,
2864
- paths: propTypes.exports.arrayOf(propTypes.exports.string),
2865
- stack: propTypes.exports.arrayOf(propTypes.exports.string)
1684
+ const linterContextProps = PropTypes__default["default"].shape({
1685
+ contentType: PropTypes__default["default"].string,
1686
+ highlightLint: PropTypes__default["default"].bool,
1687
+ paths: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
1688
+ stack: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
2866
1689
  });
2867
1690
  const linterContextDefault = {
2868
1691
  contentType: "",