Update WordPress to 5.2
This commit is contained in:
parent
489b5a5914
commit
e00f87f2f5
599 changed files with 119573 additions and 55990 deletions
358
wp-includes/js/dist/vendor/react.js
vendored
358
wp-includes/js/dist/vendor/react.js
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/** @license React v16.6.1
|
||||
/** @license React v16.8.4
|
||||
* react.development.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
// TODO: this is special because it gets imported during build.
|
||||
|
||||
var ReactVersion = '16.6.3';
|
||||
var ReactVersion = '16.8.4';
|
||||
|
||||
// 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.
|
||||
|
|
@ -51,43 +51,6 @@ function getIteratorFn(maybeIterable) {
|
|||
return null;
|
||||
}
|
||||
|
||||
var enableHooks = false;
|
||||
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
||||
|
||||
|
||||
// In some cases, StrictMode should also double-render lifecycles.
|
||||
// This can be confusing for tests though,
|
||||
// And it can be bad for performance in production.
|
||||
// This feature flag can be used to control the behavior:
|
||||
|
||||
|
||||
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
||||
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
||||
|
||||
|
||||
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
||||
|
||||
|
||||
// Gather advanced timing metrics for Profiler subtrees.
|
||||
|
||||
|
||||
// Trace which interactions trigger each commit.
|
||||
var enableSchedulerTracing = true;
|
||||
|
||||
// Only used in www builds.
|
||||
|
||||
|
||||
// Only used in www builds.
|
||||
|
||||
|
||||
// React Fire: prevent the value and checked attributes from syncing
|
||||
// with their related DOM properties
|
||||
|
||||
|
||||
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
||||
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
||||
var enableStableConcurrentModeAPIs = false;
|
||||
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
|
|
@ -534,6 +497,8 @@ function createRef() {
|
|||
return refObject;
|
||||
}
|
||||
|
||||
var enableSchedulerDebugging = false;
|
||||
|
||||
/* eslint-disable no-var */
|
||||
|
||||
// TODO: Use symbols?
|
||||
|
|
@ -561,6 +526,9 @@ var IDLE_PRIORITY = maxSigned31BitInt;
|
|||
var firstCallbackNode = null;
|
||||
|
||||
var currentDidTimeout = false;
|
||||
// Pausing the scheduler is useful for debugging.
|
||||
var isSchedulerPaused = false;
|
||||
|
||||
var currentPriorityLevel = NormalPriority;
|
||||
var currentEventStartTime = -1;
|
||||
var currentExpirationTime = -1;
|
||||
|
|
@ -695,13 +663,20 @@ function flushImmediateWork() {
|
|||
}
|
||||
|
||||
function flushWork(didTimeout) {
|
||||
// Exit right away if we're currently paused
|
||||
|
||||
if (enableSchedulerDebugging && isSchedulerPaused) {
|
||||
return;
|
||||
}
|
||||
|
||||
isExecutingCallback = true;
|
||||
var previousDidTimeout = currentDidTimeout;
|
||||
currentDidTimeout = didTimeout;
|
||||
try {
|
||||
if (didTimeout) {
|
||||
// Flush all the expired callbacks without yielding.
|
||||
while (firstCallbackNode !== null) {
|
||||
while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
|
||||
// TODO Wrap in feature flag
|
||||
// Read the current time. Flush all the callbacks that expire at or
|
||||
// earlier than that time. Then read the current time again and repeat.
|
||||
// This optimizes for as few performance.now calls as possible.
|
||||
|
|
@ -709,7 +684,7 @@ function flushWork(didTimeout) {
|
|||
if (firstCallbackNode.expirationTime <= currentTime) {
|
||||
do {
|
||||
flushFirstCallback();
|
||||
} while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
|
||||
} while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
|
@ -718,6 +693,9 @@ function flushWork(didTimeout) {
|
|||
// Keep flushing callbacks until we run out of time in the frame.
|
||||
if (firstCallbackNode !== null) {
|
||||
do {
|
||||
if (enableSchedulerDebugging && isSchedulerPaused) {
|
||||
break;
|
||||
}
|
||||
flushFirstCallback();
|
||||
} while (firstCallbackNode !== null && !shouldYieldToHost());
|
||||
}
|
||||
|
|
@ -764,6 +742,37 @@ function unstable_runWithPriority(priorityLevel, eventHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
function unstable_next(eventHandler) {
|
||||
var priorityLevel = void 0;
|
||||
switch (currentPriorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
var previousEventStartTime = currentEventStartTime;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
currentEventStartTime = getCurrentTime();
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
currentEventStartTime = previousEventStartTime;
|
||||
|
||||
// Before exiting, flush all the immediate work that was scheduled.
|
||||
flushImmediateWork();
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel;
|
||||
return function () {
|
||||
|
|
@ -856,6 +865,21 @@ function unstable_scheduleCallback(callback, deprecated_options) {
|
|||
return newNode;
|
||||
}
|
||||
|
||||
function unstable_pauseExecution() {
|
||||
isSchedulerPaused = true;
|
||||
}
|
||||
|
||||
function unstable_continueExecution() {
|
||||
isSchedulerPaused = false;
|
||||
if (firstCallbackNode !== null) {
|
||||
ensureHostCallbackIsScheduled();
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return firstCallbackNode;
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(callbackNode) {
|
||||
var next = callbackNode.next;
|
||||
if (next === null) {
|
||||
|
|
@ -951,41 +975,45 @@ var requestHostCallback;
|
|||
var cancelHostCallback;
|
||||
var shouldYieldToHost;
|
||||
|
||||
if (typeof window !== 'undefined' && window._schedMock) {
|
||||
var globalValue = null;
|
||||
if (typeof window !== 'undefined') {
|
||||
globalValue = window;
|
||||
} else if (typeof global !== 'undefined') {
|
||||
globalValue = global;
|
||||
}
|
||||
|
||||
if (globalValue && globalValue._schedMock) {
|
||||
// Dynamic injection, only for testing purposes.
|
||||
var impl = window._schedMock;
|
||||
requestHostCallback = impl[0];
|
||||
cancelHostCallback = impl[1];
|
||||
shouldYieldToHost = impl[2];
|
||||
var globalImpl = globalValue._schedMock;
|
||||
requestHostCallback = globalImpl[0];
|
||||
cancelHostCallback = globalImpl[1];
|
||||
shouldYieldToHost = globalImpl[2];
|
||||
getCurrentTime = globalImpl[3];
|
||||
} else if (
|
||||
// If Scheduler runs in a non-DOM environment, it falls back to a naive
|
||||
// implementation using setTimeout.
|
||||
typeof window === 'undefined' ||
|
||||
// "addEventListener" might not be available on the window object
|
||||
// if this is a mocked "window" object. So we need to validate that too.
|
||||
typeof window.addEventListener !== 'function') {
|
||||
// Check if MessageChannel is supported, too.
|
||||
typeof MessageChannel !== 'function') {
|
||||
// If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
|
||||
// fallback to a naive implementation.
|
||||
var _callback = null;
|
||||
var _currentTime = -1;
|
||||
var _flushCallback = function (didTimeout, ms) {
|
||||
var _flushCallback = function (didTimeout) {
|
||||
if (_callback !== null) {
|
||||
var cb = _callback;
|
||||
_callback = null;
|
||||
try {
|
||||
_currentTime = ms;
|
||||
cb(didTimeout);
|
||||
_callback(didTimeout);
|
||||
} finally {
|
||||
_currentTime = -1;
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
requestHostCallback = function (cb, ms) {
|
||||
if (_currentTime !== -1) {
|
||||
if (_callback !== null) {
|
||||
// Protect against re-entrancy.
|
||||
setTimeout(requestHostCallback, 0, cb, ms);
|
||||
setTimeout(requestHostCallback, 0, cb);
|
||||
} else {
|
||||
_callback = cb;
|
||||
setTimeout(_flushCallback, ms, true, ms);
|
||||
setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
|
||||
setTimeout(_flushCallback, 0, false);
|
||||
}
|
||||
};
|
||||
cancelHostCallback = function () {
|
||||
|
|
@ -994,9 +1022,6 @@ typeof window.addEventListener !== 'function') {
|
|||
shouldYieldToHost = function () {
|
||||
return false;
|
||||
};
|
||||
getCurrentTime = function () {
|
||||
return _currentTime === -1 ? 0 : _currentTime;
|
||||
};
|
||||
} else {
|
||||
if (typeof console !== 'undefined') {
|
||||
// TODO: Remove fb.me link
|
||||
|
|
@ -1028,12 +1053,9 @@ typeof window.addEventListener !== 'function') {
|
|||
};
|
||||
|
||||
// We use the postMessage trick to defer idle work until after the repaint.
|
||||
var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
|
||||
var idleTick = function (event) {
|
||||
if (event.source !== window || event.data !== messageKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var channel = new MessageChannel();
|
||||
var port = channel.port2;
|
||||
channel.port1.onmessage = function (event) {
|
||||
isMessageEventScheduled = false;
|
||||
|
||||
var prevScheduledCallback = scheduledHostCallback;
|
||||
|
|
@ -1074,9 +1096,6 @@ typeof window.addEventListener !== 'function') {
|
|||
}
|
||||
}
|
||||
};
|
||||
// Assumes that we have addEventListener in this environment. Might need
|
||||
// something better for old IE.
|
||||
window.addEventListener('message', idleTick, false);
|
||||
|
||||
var animationTick = function (rafTime) {
|
||||
if (scheduledHostCallback !== null) {
|
||||
|
|
@ -1116,7 +1135,7 @@ typeof window.addEventListener !== 'function') {
|
|||
frameDeadline = rafTime + activeFrameTime;
|
||||
if (!isMessageEventScheduled) {
|
||||
isMessageEventScheduled = true;
|
||||
window.postMessage(messageKey, '*');
|
||||
port.postMessage(undefined);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1125,7 +1144,7 @@ typeof window.addEventListener !== 'function') {
|
|||
timeoutTime = absoluteTimeout;
|
||||
if (isFlushingHostCallback || absoluteTimeout < 0) {
|
||||
// Don't wait for the next frame. Continue working ASAP, in a new event.
|
||||
window.postMessage(messageKey, '*');
|
||||
port.postMessage(undefined);
|
||||
} else if (!isAnimationFrameScheduled) {
|
||||
// If rAF didn't already schedule one, we need to schedule a frame.
|
||||
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
||||
|
|
@ -1143,6 +1162,45 @@ typeof window.addEventListener !== 'function') {
|
|||
};
|
||||
}
|
||||
|
||||
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
||||
|
||||
|
||||
// In some cases, StrictMode should also double-render lifecycles.
|
||||
// This can be confusing for tests though,
|
||||
// And it can be bad for performance in production.
|
||||
// This feature flag can be used to control the behavior:
|
||||
|
||||
|
||||
// To preserve the "Pause on caught exceptions" behavior of the debugger, we
|
||||
// replay the begin phase of a failed component inside invokeGuardedCallback.
|
||||
|
||||
|
||||
// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
|
||||
|
||||
|
||||
// Gather advanced timing metrics for Profiler subtrees.
|
||||
|
||||
|
||||
// Trace which interactions trigger each commit.
|
||||
var enableSchedulerTracing = true;
|
||||
|
||||
// Only used in www builds.
|
||||
// TODO: true? Here it might just be false.
|
||||
|
||||
// Only used in www builds.
|
||||
|
||||
|
||||
// Only used in www builds.
|
||||
|
||||
|
||||
// React Fire: prevent the value and checked attributes from syncing
|
||||
// with their related DOM properties
|
||||
|
||||
|
||||
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
||||
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
||||
var enableStableConcurrentModeAPIs = false;
|
||||
|
||||
var DEFAULT_THREAD_ID = 0;
|
||||
|
||||
// Counters used to generate unique IDs.
|
||||
|
|
@ -1500,6 +1558,17 @@ function onWorkCanceled(interactions, threadID) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Keeps track of the current dispatcher.
|
||||
*/
|
||||
var ReactCurrentDispatcher = {
|
||||
/**
|
||||
* @internal
|
||||
* @type {ReactComponent}
|
||||
*/
|
||||
current: null
|
||||
};
|
||||
|
||||
/**
|
||||
* Keeps track of the current owner.
|
||||
*
|
||||
|
|
@ -1511,8 +1580,7 @@ var ReactCurrentOwner = {
|
|||
* @internal
|
||||
* @type {ReactComponent}
|
||||
*/
|
||||
current: null,
|
||||
currentDispatcher: null
|
||||
current: null
|
||||
};
|
||||
|
||||
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
||||
|
|
@ -1643,6 +1711,7 @@ function setCurrentlyValidatingElement(element) {
|
|||
}
|
||||
|
||||
var ReactSharedInternals = {
|
||||
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
||||
ReactCurrentOwner: ReactCurrentOwner,
|
||||
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
||||
assign: objectAssign
|
||||
|
|
@ -1661,8 +1730,17 @@ var ReactSharedInternals = {
|
|||
unstable_now: getCurrentTime,
|
||||
unstable_scheduleCallback: unstable_scheduleCallback,
|
||||
unstable_runWithPriority: unstable_runWithPriority,
|
||||
unstable_next: unstable_next,
|
||||
unstable_wrapCallback: unstable_wrapCallback,
|
||||
unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
|
||||
unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
||||
unstable_pauseExecution: unstable_pauseExecution,
|
||||
unstable_continueExecution: unstable_continueExecution,
|
||||
unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel,
|
||||
unstable_IdlePriority: IdlePriority,
|
||||
unstable_ImmediatePriority: ImmediatePriority,
|
||||
unstable_LowPriority: LowPriority,
|
||||
unstable_NormalPriority: NormalPriority,
|
||||
unstable_UserBlockingPriority: UserBlockingPriority
|
||||
},
|
||||
SchedulerTracing: {
|
||||
__interactionsRef: interactionsRef,
|
||||
|
|
@ -2452,13 +2530,51 @@ function createContext(defaultValue, calculateChangedBits) {
|
|||
}
|
||||
|
||||
function lazy(ctor) {
|
||||
return {
|
||||
var lazyType = {
|
||||
$$typeof: REACT_LAZY_TYPE,
|
||||
_ctor: ctor,
|
||||
// React uses these fields to store the result.
|
||||
_status: -1,
|
||||
_result: null
|
||||
};
|
||||
|
||||
{
|
||||
// In production, this would just set it on the object.
|
||||
var defaultProps = void 0;
|
||||
var propTypes = void 0;
|
||||
Object.defineProperties(lazyType, {
|
||||
defaultProps: {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return defaultProps;
|
||||
},
|
||||
set: function (newDefaultProps) {
|
||||
warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
||||
defaultProps = newDefaultProps;
|
||||
// Match production behavior more closely:
|
||||
Object.defineProperty(lazyType, 'defaultProps', {
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
},
|
||||
propTypes: {
|
||||
configurable: true,
|
||||
get: function () {
|
||||
return propTypes;
|
||||
},
|
||||
set: function (newPropTypes) {
|
||||
warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
||||
propTypes = newPropTypes;
|
||||
// Match production behavior more closely:
|
||||
Object.defineProperty(lazyType, 'propTypes', {
|
||||
enumerable: true
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return lazyType;
|
||||
}
|
||||
|
||||
function forwardRef(render) {
|
||||
|
|
@ -2504,14 +2620,16 @@ function memo(type, compare) {
|
|||
}
|
||||
|
||||
function resolveDispatcher() {
|
||||
var dispatcher = ReactCurrentOwner.currentDispatcher;
|
||||
!(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
|
||||
var dispatcher = ReactCurrentDispatcher.current;
|
||||
!(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
|
||||
return dispatcher;
|
||||
}
|
||||
|
||||
function useContext(Context, observedBits) {
|
||||
function useContext(Context, unstable_observedBits) {
|
||||
var dispatcher = resolveDispatcher();
|
||||
{
|
||||
!(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
|
||||
|
||||
// TODO: add a more generic warning for invalid values.
|
||||
if (Context._context !== undefined) {
|
||||
var realContext = Context._context;
|
||||
|
|
@ -2524,7 +2642,7 @@ function useContext(Context, observedBits) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return dispatcher.useContext(Context, observedBits);
|
||||
return dispatcher.useContext(Context, unstable_observedBits);
|
||||
}
|
||||
|
||||
function useState(initialState) {
|
||||
|
|
@ -2532,9 +2650,9 @@ function useState(initialState) {
|
|||
return dispatcher.useState(initialState);
|
||||
}
|
||||
|
||||
function useReducer(reducer, initialState, initialAction) {
|
||||
function useReducer(reducer, initialArg, init) {
|
||||
var dispatcher = resolveDispatcher();
|
||||
return dispatcher.useReducer(reducer, initialState, initialAction);
|
||||
return dispatcher.useReducer(reducer, initialArg, init);
|
||||
}
|
||||
|
||||
function useRef(initialValue) {
|
||||
|
|
@ -2547,11 +2665,6 @@ function useEffect(create, inputs) {
|
|||
return dispatcher.useEffect(create, inputs);
|
||||
}
|
||||
|
||||
function useMutationEffect(create, inputs) {
|
||||
var dispatcher = resolveDispatcher();
|
||||
return dispatcher.useMutationEffect(create, inputs);
|
||||
}
|
||||
|
||||
function useLayoutEffect(create, inputs) {
|
||||
var dispatcher = resolveDispatcher();
|
||||
return dispatcher.useLayoutEffect(create, inputs);
|
||||
|
|
@ -2567,9 +2680,16 @@ function useMemo(create, inputs) {
|
|||
return dispatcher.useMemo(create, inputs);
|
||||
}
|
||||
|
||||
function useImperativeMethods(ref, create, inputs) {
|
||||
function useImperativeHandle(ref, create, inputs) {
|
||||
var dispatcher = resolveDispatcher();
|
||||
return dispatcher.useImperativeMethods(ref, create, inputs);
|
||||
return dispatcher.useImperativeHandle(ref, create, inputs);
|
||||
}
|
||||
|
||||
function useDebugValue(value, formatterFn) {
|
||||
{
|
||||
var dispatcher = resolveDispatcher();
|
||||
return dispatcher.useDebugValue(value, formatterFn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -2763,7 +2883,7 @@ function validateExplicitKey(element, parentType) {
|
|||
|
||||
setCurrentlyValidatingElement(element);
|
||||
{
|
||||
warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
||||
warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
||||
}
|
||||
setCurrentlyValidatingElement(null);
|
||||
}
|
||||
|
|
@ -2819,16 +2939,17 @@ function validateChildKeys(node, parentType) {
|
|||
*/
|
||||
function validatePropTypes(element) {
|
||||
var type = element.type;
|
||||
var name = void 0,
|
||||
propTypes = void 0;
|
||||
if (type === null || type === undefined || typeof type === 'string') {
|
||||
return;
|
||||
}
|
||||
var name = getComponentName(type);
|
||||
var propTypes = void 0;
|
||||
if (typeof type === 'function') {
|
||||
// Class or function component
|
||||
name = type.displayName || type.name;
|
||||
propTypes = type.propTypes;
|
||||
} else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
|
||||
// ForwardRef
|
||||
var functionName = type.render.displayName || type.render.name || '';
|
||||
name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
|
||||
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
||||
// Note: Memo only checks outer props here.
|
||||
// Inner props are checked in the reconciler.
|
||||
type.$$typeof === REACT_MEMO_TYPE)) {
|
||||
propTypes = type.propTypes;
|
||||
} else {
|
||||
return;
|
||||
|
|
@ -2977,6 +3098,17 @@ var React = {
|
|||
lazy: lazy,
|
||||
memo: memo,
|
||||
|
||||
useCallback: useCallback,
|
||||
useContext: useContext,
|
||||
useEffect: useEffect,
|
||||
useImperativeHandle: useImperativeHandle,
|
||||
useDebugValue: useDebugValue,
|
||||
useLayoutEffect: useLayoutEffect,
|
||||
useMemo: useMemo,
|
||||
useReducer: useReducer,
|
||||
useRef: useRef,
|
||||
useState: useState,
|
||||
|
||||
Fragment: REACT_FRAGMENT_TYPE,
|
||||
StrictMode: REACT_STRICT_MODE_TYPE,
|
||||
Suspense: REACT_SUSPENSE_TYPE,
|
||||
|
|
@ -2988,28 +3120,22 @@ var React = {
|
|||
|
||||
version: ReactVersion,
|
||||
|
||||
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
||||
unstable_Profiler: REACT_PROFILER_TYPE,
|
||||
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
||||
};
|
||||
|
||||
// Note: some APIs are added with feature flags.
|
||||
// Make sure that stable builds for open source
|
||||
// don't modify the React object to avoid deopts.
|
||||
// Also let's not expose their names in stable builds.
|
||||
|
||||
if (enableStableConcurrentModeAPIs) {
|
||||
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
||||
React.Profiler = REACT_PROFILER_TYPE;
|
||||
} else {
|
||||
React.unstable_ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
||||
React.unstable_Profiler = REACT_PROFILER_TYPE;
|
||||
}
|
||||
|
||||
if (enableHooks) {
|
||||
React.useCallback = useCallback;
|
||||
React.useContext = useContext;
|
||||
React.useEffect = useEffect;
|
||||
React.useImperativeMethods = useImperativeMethods;
|
||||
React.useLayoutEffect = useLayoutEffect;
|
||||
React.useMemo = useMemo;
|
||||
React.useMutationEffect = useMutationEffect;
|
||||
React.useReducer = useReducer;
|
||||
React.useRef = useRef;
|
||||
React.useState = useState;
|
||||
React.unstable_ConcurrentMode = undefined;
|
||||
React.unstable_Profiler = undefined;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue