react-is
Advanced tools
Comparing version 0.0.0-experimental-819687279-20221208 to 0.0.0-experimental-81c5ff2e04-20240521
@@ -17,7 +17,16 @@ /** | ||
// ATTENTION | ||
// When adding new symbols to this file, | ||
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' | ||
// The Symbol used to tag the ReactElement-like types. | ||
var REACT_ELEMENT_TYPE = Symbol.for('react.element'); | ||
// ----------------------------------------------------------------------------- | ||
var enableScopeAPI = false; // Experimental Create Event Handle API. | ||
var enableTransitionTracing = false; // No known bugs, but needs performance testing | ||
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; | ||
var REACT_ELEMENT_TYPE = Symbol.for('react.transitional.element') ; | ||
var REACT_PORTAL_TYPE = Symbol.for('react.portal'); | ||
@@ -27,5 +36,6 @@ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); | ||
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,16 +47,4 @@ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); | ||
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); | ||
var REACT_CACHE_TYPE = Symbol.for('react.cache'); | ||
// ----------------------------------------------------------------------------- | ||
var enableScopeAPI = false; // Experimental Create Event Handle API. | ||
var enableTransitionTracing = false; // No known bugs, but needs performance testing | ||
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber | ||
// 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 REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); | ||
var REACT_CLIENT_REFERENCE = Symbol.for('react.client.reference'); | ||
function isValidElementType(type) { | ||
@@ -58,3 +56,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; | ||
@@ -64,7 +62,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; | ||
@@ -97,3 +95,2 @@ } | ||
switch ($$typeofType) { | ||
case REACT_SERVER_CONTEXT_TYPE: | ||
case REACT_CONTEXT_TYPE: | ||
@@ -103,5 +100,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: | ||
@@ -120,4 +127,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; | ||
@@ -133,33 +140,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) { | ||
@@ -208,4 +194,2 @@ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; | ||
exports.SuspenseList = SuspenseList; | ||
exports.isAsyncMode = isAsyncMode; | ||
exports.isConcurrentMode = isConcurrentMode; | ||
exports.isContextConsumer = isContextConsumer; | ||
@@ -212,0 +196,0 @@ exports.isContextProvider = isContextProvider; |
'use strict'; | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/react-is.production.min.js'); | ||
module.exports = require('./cjs/react-is.production.js'); | ||
} else { | ||
module.exports = require('./cjs/react-is.development.js'); | ||
} |
{ | ||
"name": "react-is", | ||
"version": "0.0.0-experimental-819687279-20221208", | ||
"version": "0.0.0-experimental-81c5ff2e04-20240521", | ||
"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 @@ |
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
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
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
15060
6
309
104
1