react-is
Advanced tools
Comparing version 0.0.0-experimental-357a61324-20220516 to 0.0.0-experimental-36e62c603-20240418
@@ -5,3 +5,3 @@ /** | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -27,5 +27,6 @@ * This source code is licensed under the MIT license found in the | ||
var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); | ||
var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); | ||
var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); // TODO: Delete with enableRenderableContext | ||
var REACT_CONSUMER_TYPE = Symbol.for('react.consumer'); | ||
var REACT_CONTEXT_TYPE = Symbol.for('react.context'); | ||
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); | ||
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); | ||
@@ -37,3 +38,2 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); | ||
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); | ||
var REACT_CACHE_TYPE = Symbol.for('react.cache'); | ||
@@ -46,13 +46,10 @@ // ----------------------------------------------------------------------------- | ||
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber | ||
var enableRenderableContext = true; // Enables the `initialValue` option for `useDeferredValue` | ||
// stuff. Intended to enable React core members to more easily debug scheduling | ||
// issues in DEV builds. | ||
var enableDebugTracing = false; // Track which Fiber(s) schedule render work. | ||
var enableDebugTracing = false; | ||
var REACT_MODULE_REFERENCE; | ||
{ | ||
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); | ||
} | ||
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); | ||
function isValidElementType(type) { | ||
@@ -64,3 +61,3 @@ if (typeof type === 'string' || typeof type === 'function') { | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || type === REACT_CACHE_TYPE || enableTransitionTracing ) { | ||
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableTransitionTracing ) { | ||
return true; | ||
@@ -70,7 +67,7 @@ } | ||
if (typeof type === 'object' && type !== null) { | ||
if (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 || // This needs to include all possible module reference object | ||
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || !enableRenderableContext || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object | ||
// types supported by any Flight configuration anywhere since | ||
// we don't know which Flight build this will end up being used | ||
// with. | ||
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { | ||
type.$$typeof === REACT_CLIENT_REFERENCE || type.getModuleId !== undefined) { | ||
return true; | ||
@@ -103,3 +100,2 @@ } | ||
switch ($$typeofType) { | ||
case REACT_SERVER_CONTEXT_TYPE: | ||
case REACT_CONTEXT_TYPE: | ||
@@ -109,5 +105,15 @@ case REACT_FORWARD_REF_TYPE: | ||
case REACT_MEMO_TYPE: | ||
case REACT_PROVIDER_TYPE: | ||
return $$typeofType; | ||
case REACT_CONSUMER_TYPE: | ||
{ | ||
return $$typeofType; | ||
} | ||
// Fall through | ||
case REACT_PROVIDER_TYPE: | ||
// Fall through | ||
default: | ||
@@ -126,4 +132,4 @@ return $$typeof; | ||
} | ||
var ContextConsumer = REACT_CONTEXT_TYPE; | ||
var ContextProvider = REACT_PROVIDER_TYPE; | ||
var ContextConsumer = REACT_CONSUMER_TYPE ; | ||
var ContextProvider = REACT_CONTEXT_TYPE ; | ||
var Element = REACT_ELEMENT_TYPE; | ||
@@ -139,33 +145,12 @@ var ForwardRef = REACT_FORWARD_REF_TYPE; | ||
var SuspenseList = REACT_SUSPENSE_LIST_TYPE; | ||
var hasWarnedAboutDeprecatedIsAsyncMode = false; | ||
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated | ||
function isAsyncMode(object) { | ||
function isContextConsumer(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsAsyncMode) { | ||
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 18+.'); | ||
} | ||
return typeOf(object) === REACT_CONSUMER_TYPE; | ||
} | ||
return false; | ||
} | ||
function isConcurrentMode(object) { | ||
function isContextProvider(object) { | ||
{ | ||
if (!hasWarnedAboutDeprecatedIsConcurrentMode) { | ||
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint | ||
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); | ||
} | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
return false; | ||
} | ||
function isContextConsumer(object) { | ||
return typeOf(object) === REACT_CONTEXT_TYPE; | ||
} | ||
function isContextProvider(object) { | ||
return typeOf(object) === REACT_PROVIDER_TYPE; | ||
} | ||
function isElement(object) { | ||
@@ -214,4 +199,2 @@ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
exports.SuspenseList = SuspenseList; | ||
exports.isAsyncMode = isAsyncMode; | ||
exports.isConcurrentMode = isConcurrentMode; | ||
exports.isContextConsumer = isContextConsumer; | ||
@@ -218,0 +201,0 @@ exports.isContextProvider = isContextProvider; |
@@ -1,14 +0,15 @@ | ||
/** | ||
* @license React | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u=Symbol.for("react.cache"),v;v=Symbol.for("react.module.reference"); | ||
function w(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m; | ||
exports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return w(a)===h};exports.isContextProvider=function(a){return w(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return w(a)===l};exports.isFragment=function(a){return w(a)===d};exports.isLazy=function(a){return w(a)===q};exports.isMemo=function(a){return w(a)===p}; | ||
exports.isPortal=function(a){return w(a)===c};exports.isProfiler=function(a){return w(a)===f};exports.isStrictMode=function(a){return w(a)===e};exports.isSuspense=function(a){return w(a)===m};exports.isSuspenseList=function(a){return w(a)===n}; | ||
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||a===u||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===v||void 0!==a.getModuleId)?!0:!1};exports.typeOf=w; | ||
/* | ||
React | ||
react-is.production.min.js | ||
Copyright (c) Meta Platforms, Inc. and affiliates. | ||
This source code is licensed under the MIT license found in the | ||
LICENSE file in the root directory of this source tree. | ||
*/ | ||
'use strict';var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler");Symbol.for("react.provider");var g=Symbol.for("react.consumer"),h=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),n=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),t=Symbol.for("react.client.reference"); | ||
function u(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:return a;case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=g;exports.ContextProvider=h;exports.Element=b;exports.ForwardRef=k;exports.Fragment=d;exports.Lazy=p;exports.Memo=n;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=l; | ||
exports.SuspenseList=m;exports.isContextConsumer=function(a){return u(a)===g};exports.isContextProvider=function(a){return u(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return u(a)===k};exports.isFragment=function(a){return u(a)===d};exports.isLazy=function(a){return u(a)===p};exports.isMemo=function(a){return u(a)===n};exports.isPortal=function(a){return u(a)===c};exports.isProfiler=function(a){return u(a)===f}; | ||
exports.isStrictMode=function(a){return u(a)===e};exports.isSuspense=function(a){return u(a)===l};exports.isSuspenseList=function(a){return u(a)===m};exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===l||a===m||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===h||a.$$typeof===g||a.$$typeof===k||a.$$typeof===t||void 0!==a.getModuleId)?!0:!1};exports.typeOf=u; | ||
//# sourceMappingURL=react-is.production.min.js.map |
{ | ||
"name": "react-is", | ||
"version": "0.0.0-experimental-357a61324-20220516", | ||
"version": "0.0.0-experimental-36e62c603-20240418", | ||
"description": "Brand checking of React Elements.", | ||
"main": "index.js", | ||
"sideEffects": false, | ||
"repository": { | ||
@@ -18,3 +19,3 @@ "type": "git", | ||
}, | ||
"homepage": "https://reactjs.org/", | ||
"homepage": "https://react.dev/", | ||
"files": [ | ||
@@ -24,5 +25,4 @@ "LICENSE", | ||
"index.js", | ||
"cjs/", | ||
"umd/" | ||
"cjs/" | ||
] | ||
} |
@@ -43,3 +43,2 @@ # `react-is` | ||
ReactIs.isValidElementType(Context.Consumer); // true | ||
ReactIs.isValidElementType(React.createFactory("div")); // true | ||
``` | ||
@@ -46,0 +45,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24049
372
104
1