prop-types
Advanced tools
Comparing version 15.7.2 to 15.8.1
@@ -15,3 +15,3 @@ /** | ||
var loggedTypeFailures = {}; | ||
var has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
var has = require('./lib/has'); | ||
@@ -28,3 +28,3 @@ printWarning = function(text) { | ||
throw new Error(message); | ||
} catch (x) {} | ||
} catch (x) { /**/ } | ||
}; | ||
@@ -58,3 +58,4 @@ } | ||
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' | ||
'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`.' | ||
); | ||
@@ -61,0 +62,0 @@ err.name = 'Invariant Violation'; |
@@ -38,2 +38,3 @@ /** | ||
array: shim, | ||
bigint: shim, | ||
bool: shim, | ||
@@ -40,0 +41,0 @@ func: shim, |
@@ -14,5 +14,5 @@ /** | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
var has = require('./lib/has'); | ||
var checkPropTypes = require('./checkPropTypes'); | ||
var has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
var printWarning = function() {}; | ||
@@ -118,2 +118,3 @@ | ||
array: createPrimitiveTypeChecker('array'), | ||
bigint: createPrimitiveTypeChecker('bigint'), | ||
bool: createPrimitiveTypeChecker('boolean'), | ||
@@ -164,4 +165,5 @@ func: createPrimitiveTypeChecker('function'), | ||
*/ | ||
function PropTypeError(message) { | ||
function PropTypeError(message, data) { | ||
this.message = message; | ||
this.data = data && typeof data === 'object' ? data: {}; | ||
this.stack = ''; | ||
@@ -201,3 +203,3 @@ } | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
@@ -241,3 +243,6 @@ 'You may be seeing this warning due to a third-party PropTypes ' + | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
return new PropTypeError( | ||
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), | ||
{expectedType: expectedType} | ||
); | ||
} | ||
@@ -386,10 +391,15 @@ return null; | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var expectedTypes = []; | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | ||
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); | ||
if (checkerResult == null) { | ||
return null; | ||
} | ||
if (checkerResult.data && has(checkerResult.data, 'expectedType')) { | ||
expectedTypes.push(checkerResult.data.expectedType); | ||
} | ||
} | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); | ||
} | ||
@@ -409,2 +419,9 @@ return createChainableTypeChecker(validate); | ||
function invalidValidatorError(componentName, location, propFullName, key, type) { | ||
return new PropTypeError( | ||
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' | ||
); | ||
} | ||
function createShapeTypeChecker(shapeTypes) { | ||
@@ -419,4 +436,4 @@ function validate(props, propName, componentName, location, propFullName) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
continue; | ||
if (typeof checker !== 'function') { | ||
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); | ||
} | ||
@@ -440,7 +457,9 @@ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
} | ||
// We need to check all keys in case some are required but missing from | ||
// props. | ||
// We need to check all keys in case some are required but missing from props. | ||
var allKeys = assign({}, props[propName], shapeTypes); | ||
for (var key in allKeys) { | ||
var checker = shapeTypes[key]; | ||
if (has(shapeTypes, key) && typeof checker !== 'function') { | ||
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); | ||
} | ||
if (!checker) { | ||
@@ -450,3 +469,3 @@ return new PropTypeError( | ||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') + | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
); | ||
@@ -453,0 +472,0 @@ } |
{ | ||
"name": "prop-types", | ||
"version": "15.7.2", | ||
"version": "15.8.1", | ||
"description": "Runtime type checking for React props and similar objects.", | ||
"sideEffects": false, | ||
"main": "index.js", | ||
@@ -30,3 +31,3 @@ "license": "MIT", | ||
"object-assign": "^4.1.1", | ||
"react-is": "^16.8.1" | ||
"react-is": "^16.13.1" | ||
}, | ||
@@ -41,3 +42,3 @@ "scripts": { | ||
"build": "yarn umd && yarn umd-min", | ||
"prepublish": "yarn build" | ||
"prepublish": "not-in-publish || yarn build" | ||
}, | ||
@@ -47,9 +48,10 @@ "devDependencies": { | ||
"babel-preset-react": "^6.24.1", | ||
"browserify": "^16.2.3", | ||
"bundle-collapser": "^1.2.1", | ||
"eslint": "^5.13.0", | ||
"browserify": "^16.5.0", | ||
"bundle-collapser": "^1.4.0", | ||
"eslint": "^8.6.0", | ||
"in-publish": "^2.0.1", | ||
"jest": "^19.0.2", | ||
"react": "^15.5.1", | ||
"uglifyify": "^3.0.4", | ||
"uglifyjs": "^2.4.10" | ||
"react": "^15.7.0", | ||
"uglifyify": "^5.0.2", | ||
"uglifyjs": "^2.4.11" | ||
}, | ||
@@ -56,0 +58,0 @@ "browserify": { |
@@ -1,2 +0,2 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
/** | ||
@@ -16,3 +16,3 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
var loggedTypeFailures = {}; | ||
var has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
var has = require('./lib/has'); | ||
@@ -29,3 +29,3 @@ printWarning = function(text) { | ||
throw new Error(message); | ||
} catch (x) {} | ||
} catch (x) { /**/ } | ||
}; | ||
@@ -59,3 +59,4 @@ } | ||
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' | ||
'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`.' | ||
); | ||
@@ -108,3 +109,3 @@ err.name = 'Invariant Violation'; | ||
},{"./lib/ReactPropTypesSecret":5}],2:[function(require,module,exports){ | ||
},{"./lib/ReactPropTypesSecret":5,"./lib/has":6}],2:[function(require,module,exports){ | ||
/** | ||
@@ -147,2 +148,3 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
array: shim, | ||
bigint: shim, | ||
bool: shim, | ||
@@ -190,5 +192,5 @@ func: shim, | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
var has = require('./lib/has'); | ||
var checkPropTypes = require('./checkPropTypes'); | ||
var has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
var printWarning = function() {}; | ||
@@ -294,2 +296,3 @@ | ||
array: createPrimitiveTypeChecker('array'), | ||
bigint: createPrimitiveTypeChecker('bigint'), | ||
bool: createPrimitiveTypeChecker('boolean'), | ||
@@ -340,4 +343,5 @@ func: createPrimitiveTypeChecker('function'), | ||
*/ | ||
function PropTypeError(message) { | ||
function PropTypeError(message, data) { | ||
this.message = message; | ||
this.data = data && typeof data === 'object' ? data: {}; | ||
this.stack = ''; | ||
@@ -377,3 +381,3 @@ } | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
@@ -417,3 +421,6 @@ 'You may be seeing this warning due to a third-party PropTypes ' + | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
return new PropTypeError( | ||
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), | ||
{expectedType: expectedType} | ||
); | ||
} | ||
@@ -562,10 +569,15 @@ return null; | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var expectedTypes = []; | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { | ||
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); | ||
if (checkerResult == null) { | ||
return null; | ||
} | ||
if (checkerResult.data.hasOwnProperty('expectedType')) { | ||
expectedTypes.push(checkerResult.data.expectedType); | ||
} | ||
} | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); | ||
} | ||
@@ -585,2 +597,9 @@ return createChainableTypeChecker(validate); | ||
function invalidValidatorError(componentName, location, propFullName, key, type) { | ||
return new PropTypeError( | ||
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' | ||
); | ||
} | ||
function createShapeTypeChecker(shapeTypes) { | ||
@@ -595,4 +614,4 @@ function validate(props, propName, componentName, location, propFullName) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
continue; | ||
if (typeof checker !== 'function') { | ||
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); | ||
} | ||
@@ -616,7 +635,9 @@ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); | ||
} | ||
// We need to check all keys in case some are required but missing from | ||
// props. | ||
// We need to check all keys in case some are required but missing from props. | ||
var allKeys = assign({}, props[propName], shapeTypes); | ||
for (var key in allKeys) { | ||
var checker = shapeTypes[key]; | ||
if (has(shapeTypes, key) && typeof checker !== 'function') { | ||
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); | ||
} | ||
if (!checker) { | ||
@@ -626,3 +647,3 @@ return new PropTypeError( | ||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') + | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
); | ||
@@ -779,3 +800,3 @@ } | ||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"object-assign":6,"react-is":10}],4:[function(require,module,exports){ | ||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"./lib/has":6,"object-assign":7,"react-is":11}],4:[function(require,module,exports){ | ||
/** | ||
@@ -801,3 +822,3 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"react-is":10}],5:[function(require,module,exports){ | ||
},{"./factoryWithThrowingShims":2,"./factoryWithTypeCheckers":3,"react-is":11}],5:[function(require,module,exports){ | ||
/** | ||
@@ -817,2 +838,5 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
},{}],6:[function(require,module,exports){ | ||
module.exports = Function.call.bind(Object.prototype.hasOwnProperty); | ||
},{}],7:[function(require,module,exports){ | ||
/* | ||
@@ -909,3 +933,3 @@ object-assign | ||
},{}],7:[function(require,module,exports){ | ||
},{}],8:[function(require,module,exports){ | ||
// shim for using process in browser | ||
@@ -1096,5 +1120,5 @@ var process = module.exports = {}; | ||
},{}],8:[function(require,module,exports){ | ||
(function (process){ | ||
/** @license React v16.8.1 | ||
},{}],9:[function(require,module,exports){ | ||
(function (process){(function (){ | ||
/** @license React v16.13.1 | ||
* react-is.development.js | ||
@@ -1116,8 +1140,5 @@ * | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol | ||
// nor polyfill, then a plain number is used for performance. | ||
var hasSymbol = typeof Symbol === 'function' && Symbol.for; | ||
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; | ||
@@ -1129,3 +1150,5 @@ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; | ||
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; | ||
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; | ||
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; | ||
@@ -1135,67 +1158,19 @@ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; | ||
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_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; | ||
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; | ||
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; | ||
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; | ||
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); | ||
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 || 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); | ||
} | ||
/** | ||
* Forked from fbjs/warning: | ||
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js | ||
* | ||
* Only change is we use console.warn instead of console.error, | ||
* and do nothing when 'console' is not supported. | ||
* This really simplifies the code. | ||
* --- | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var lowPriorityWarning = function () {}; | ||
{ | ||
var printWarning = function (format) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var argIndex = 0; | ||
var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.warn(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
lowPriorityWarning = function (condition, format) { | ||
if (format === undefined) { | ||
throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
} | ||
if (!condition) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
printWarning.apply(undefined, [format].concat(args)); | ||
} | ||
}; | ||
} | ||
var lowPriorityWarning$1 = lowPriorityWarning; | ||
function typeOf(object) { | ||
if (typeof object === 'object' && object !== null) { | ||
var $$typeof = object.$$typeof; | ||
switch ($$typeof) { | ||
@@ -1213,2 +1188,3 @@ case REACT_ELEMENT_TYPE: | ||
return type; | ||
default: | ||
@@ -1220,10 +1196,13 @@ var $$typeofType = type && type.$$typeof; | ||
case REACT_FORWARD_REF_TYPE: | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
default: | ||
return $$typeof; | ||
} | ||
} | ||
case REACT_LAZY_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PORTAL_TYPE: | ||
@@ -1235,5 +1214,4 @@ return $$typeof; | ||
return undefined; | ||
} | ||
} // AsyncMode is deprecated along with isAsyncMode | ||
// AsyncMode is deprecated along with isAsyncMode | ||
var AsyncMode = REACT_ASYNC_MODE_TYPE; | ||
@@ -1252,13 +1230,13 @@ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; | ||
var Suspense = REACT_SUSPENSE_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; | ||
// AsyncMode should be deprecated | ||
function isAsyncMode(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; | ||
lowPriorityWarning$1(false, '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.'); | ||
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint | ||
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.'); | ||
} | ||
} | ||
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; | ||
@@ -1303,3 +1281,2 @@ } | ||
exports.typeOf = typeOf; | ||
exports.AsyncMode = AsyncMode; | ||
@@ -1318,3 +1295,2 @@ exports.ConcurrentMode = ConcurrentMode; | ||
exports.Suspense = Suspense; | ||
exports.isValidElementType = isValidElementType; | ||
exports.isAsyncMode = isAsyncMode; | ||
@@ -1333,8 +1309,10 @@ exports.isConcurrentMode = isConcurrentMode; | ||
exports.isSuspense = isSuspense; | ||
exports.isValidElementType = isValidElementType; | ||
exports.typeOf = typeOf; | ||
})(); | ||
} | ||
}).call(this,require('_process')) | ||
},{"_process":7}],9:[function(require,module,exports){ | ||
/** @license React v16.8.1 | ||
}).call(this)}).call(this,require('_process')) | ||
},{"_process":8}],10:[function(require,module,exports){ | ||
/** @license React v16.13.1 | ||
* react-is.production.min.js | ||
@@ -1348,11 +1326,11 @@ * | ||
'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}; | ||
'use strict';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.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119; | ||
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}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.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t}; | ||
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===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===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z; | ||
},{}],10:[function(require,module,exports){ | ||
(function (process){ | ||
},{}],11:[function(require,module,exports){ | ||
(function (process){(function (){ | ||
'use strict'; | ||
@@ -1366,4 +1344,4 @@ | ||
}).call(this,require('_process')) | ||
},{"./cjs/react-is.development.js":8,"./cjs/react-is.production.min.js":9,"_process":7}]},{},[4])(4) | ||
}); | ||
}).call(this)}).call(this,require('_process')) | ||
},{"./cjs/react-is.development.js":9,"./cjs/react-is.production.min.js":10,"_process":8}]},{},[4])(4) | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.PropTypes=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";function emptyFunction(){}function emptyFunctionWithReset(){}var ReactPropTypesSecret=require(3);emptyFunctionWithReset.resetWarningCache=emptyFunction,module.exports=function(){function e(e,t,n,r,o,p){if(p!==ReactPropTypesSecret){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return n.PropTypes=n,n}},{3:3}],2:[function(require,module,exports){module.exports=require(1)()},{1:1}],3:[function(require,module,exports){"use strict";module.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[2])(2)}); | ||
!function(f){"object"==typeof exports&&"undefined"!=typeof module?module.exports=f():"function"==typeof define&&define.amd?define([],f):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).PropTypes=f()}(function(){return function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var p="function"==typeof require&&require;if(!f&&p)return p(i,!0);if(u)return u(i,!0);throw(p=new Error("Cannot find module '"+i+"'")).code="MODULE_NOT_FOUND",p}p=n[i]={exports:{}},e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(require,module,exports){"use strict";var ReactPropTypesSecret=require(3);function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction,module.exports=function(){function e(e,t,n,r,o,c){if(c!==ReactPropTypesSecret){c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}var n={array:e.isRequired=e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return n.PropTypes=n}},{3:3}],2:[function(require,module,exports){module.exports=require(1)()},{1:1}],3:[function(require,module,exports){"use strict";module.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},{}]},{},[2])(2)}); |
@@ -1,2 +0,2 @@ | ||
# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=master)](https://travis-ci.org/facebook/prop-types) | ||
# prop-types [![Build Status](https://travis-ci.com/facebook/prop-types.svg?branch=main)](https://travis-ci.org/facebook/prop-types) | ||
@@ -6,3 +6,3 @@ Runtime type checking for React props and similar objects. | ||
You can use prop-types to document the intended types of properties passed to | ||
components. React (and potentially other libraries—see the checkPropTypes() | ||
components. React (and potentially other libraries—see the `checkPropTypes()` | ||
reference below) will check props passed to your components against those | ||
@@ -71,2 +71,3 @@ definitions, and warn in development if they don’t match. | ||
optionalArray: PropTypes.array, | ||
optionalBigInt: PropTypes.bigint, | ||
optionalBool: PropTypes.bool, | ||
@@ -81,2 +82,3 @@ optionalFunc: PropTypes.func, | ||
// (or fragment) containing these types. | ||
// see https://reactjs.org/docs/rendering-elements.html for more info | ||
optionalNode: PropTypes.node, | ||
@@ -87,3 +89,5 @@ | ||
// A React element type (ie. MyComponent). | ||
// A React element type (eg. MyComponent). | ||
// a function, string, or "element-like" object (eg. React.Fragment, Suspense, etc.) | ||
// see https://github.com/facebook/react/blob/HEAD/packages/shared/isValidElementType.js | ||
optionalElementType: PropTypes.elementType, | ||
@@ -263,2 +267,4 @@ | ||
**If you DO want to use validation in production**, you can choose to use the **development version** by importing/requiring `prop-types/prop-types` instead of `prop-types`. | ||
**You might also see this error** if you’re calling a `PropTypes` validator from your own custom `PropTypes` validator. In this case, the fix is to make sure that you are passing *all* of the arguments to the inner function. There is a more in-depth explanation of how to fix it [on this page](https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes). Alternatively, you can temporarily keep using `React.PropTypes` until React 16, as it would still only warn in this case. | ||
@@ -289,3 +295,3 @@ | ||
// Works with standalone PropTypes | ||
PropTypes.checkPropTypes(myPropTypes, props, 'age', 'MyComponent'); | ||
PropTypes.checkPropTypes(myPropTypes, props, 'prop', 'MyComponent'); | ||
// This will warn as follows: | ||
@@ -298,3 +304,3 @@ // Warning: Failed prop type: Invalid prop `age` of type `string` supplied to | ||
`PropTypes.checkPropTypes(...)` only `console.error.log(...)`s a given message once. To reset the cache while testing call `PropTypes.resetWarningCache()` | ||
`PropTypes.checkPropTypes(...)` only `console.error`s a given message once. To reset the error warning cache in tests, call `PropTypes.resetWarningCache()` | ||
@@ -301,0 +307,0 @@ ### License |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1940
303
94537
10
Updatedreact-is@^16.13.1