|
4 | 4 | * This source code is licensed under the MIT license found in the |
5 | 5 | * LICENSE file in the root directory of this source tree. |
6 | 6 | * |
7 | | - * @flow |
| 7 | + * @flow strict |
8 | 8 | */ |
9 | 9 |
|
10 | | -import invariant from 'shared/invariant'; |
| 10 | +/* |
| 11 | + SYNC WITH ReactFeatureFlags.js |
| 12 | + except isTestEnvironment = true |
| 13 | +*/ |
11 | 14 |
|
12 | | -import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags'; |
13 | | -import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent'; |
14 | | - |
15 | | -export const debugRenderPhaseSideEffectsForStrictMode = false; |
16 | 15 | export const enableUserTimingAPI = __DEV__; |
| 16 | + |
| 17 | +// Helps identify side effects in render-phase lifecycle hooks and setState |
| 18 | +// reducers by double invoking them in Strict Mode. |
| 19 | +export const debugRenderPhaseSideEffectsForStrictMode = __DEV__; |
| 20 | + |
| 21 | +// To preserve the "Pause on caught exceptions" behavior of the debugger, we |
| 22 | +// replay the begin phase of a failed component inside invokeGuardedCallback. |
| 23 | +export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__; |
| 24 | + |
| 25 | +// Warn about deprecated, async-unsafe lifecycles; relates to RFC #6: |
17 | 26 | export const warnAboutDeprecatedLifecycles = true; |
18 | | -export const replayFailedUnitOfWorkWithInvokeGuardedCallback = false; |
| 27 | + |
| 28 | +// Gather advanced timing metrics for Profiler subtrees. |
19 | 29 | export const enableProfilerTimer = __PROFILE__; |
| 30 | + |
| 31 | +// Trace which interactions trigger each commit. |
20 | 32 | export const enableSchedulerTracing = __PROFILE__; |
21 | | -export const enableSuspenseServerRenderer = false; |
22 | | -export const enableSelectiveHydration = false; |
23 | | -export const enableChunksAPI = false; |
| 33 | + |
| 34 | +// SSR experiments |
| 35 | +export const enableSuspenseServerRenderer = __EXPERIMENTAL__; |
| 36 | +export const enableSelectiveHydration = __EXPERIMENTAL__; |
| 37 | + |
| 38 | +// Flight experiments |
| 39 | +export const enableChunksAPI = __EXPERIMENTAL__; |
| 40 | + |
| 41 | +// Only used in www builds. |
| 42 | +export const enableSchedulerDebugging = false; |
| 43 | + |
| 44 | +// Only used in www builds. |
| 45 | +export function addUserTimingListener() { |
| 46 | + throw new Error('Not implemented.'); |
| 47 | +} |
| 48 | + |
| 49 | +// Disable javascript: URL strings in href for XSS protection. |
24 | 50 | export const disableJavaScriptURLs = false; |
25 | | -export const disableInputAttributeSyncing = false; |
| 51 | + |
| 52 | +// These APIs will no longer be "unstable" in the upcoming 16.7 release, |
| 53 | +// Control this behavior with a flag to support 16.6 minor releases in the meanwhile. |
26 | 54 | export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; |
| 55 | + |
27 | 56 | export const warnAboutShorthandPropertyCollision = false; |
28 | | -export const enableSchedulerDebugging = false; |
| 57 | + |
| 58 | +// Experimental React Flare event system and event components support. |
29 | 59 | export const enableDeprecatedFlareAPI = false; |
| 60 | + |
| 61 | +// Experimental Host Component support. |
30 | 62 | export const enableFundamentalAPI = false; |
| 63 | + |
| 64 | +// Experimental Scope support. |
31 | 65 | export const enableScopeAPI = false; |
| 66 | + |
| 67 | +// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107 |
32 | 68 | export const enableJSXTransformAPI = false; |
| 69 | + |
| 70 | +// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?) |
| 71 | +// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version |
33 | 72 | export const warnAboutUnmockedScheduler = false; |
| 73 | + |
| 74 | +// For tests, we flush suspense fallbacks in an act scope; |
| 75 | +// *except* in some of our own tests, where we test incremental loading states. |
34 | 76 | export const flushSuspenseFallbacksInTests = true; |
| 77 | + |
| 78 | +// Add a callback property to suspense to notify which promises are currently |
| 79 | +// in the update queue. This allows reporting and tracing of what is causing |
| 80 | +// the user to see a loading state. |
| 81 | +// Also allows hydration callbacks to fire when a dehydrated boundary gets |
| 82 | +// hydrated or deleted. |
35 | 83 | export const enableSuspenseCallback = false; |
| 84 | + |
| 85 | +// Part of the simplification of React.createElement so we can eventually move |
| 86 | +// from React.createElement to React.jsx |
| 87 | +// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md |
36 | 88 | export const warnAboutDefaultPropsOnFunctionComponents = false; |
37 | | -export const warnAboutStringRefs = false; |
38 | | -export const disableLegacyContext = false; |
| 89 | + |
39 | 90 | export const disableSchedulerTimeoutBasedOnReactExpirationTime = false; |
| 91 | + |
40 | 92 | export const enableTrainModelFix = true; |
| 93 | + |
41 | 94 | export const enableTrustedTypesIntegration = false; |
| 95 | + |
| 96 | +// Flag to turn event.target and event.currentTarget in ReactNative from a reactTag to a component instance |
42 | 97 | export const enableNativeTargetAsInstance = false; |
| 98 | + |
| 99 | +// Controls behavior of deferred effect destroy functions during unmount. |
| 100 | +// Previously these functions were run during commit (along with layout effects). |
| 101 | +// Ideally we should delay these until after commit for performance reasons. |
| 102 | +// This flag provides a killswitch if that proves to break existing code somehow. |
| 103 | +export const deferPassiveEffectCleanupDuringUnmount = false; |
| 104 | + |
| 105 | +export const isTestEnvironment = true; |
| 106 | + |
| 107 | +// -------------------------- |
| 108 | +// Future APIs to be deprecated |
| 109 | +// -------------------------- |
| 110 | + |
| 111 | +// Prevent the value and checked attributes from syncing |
| 112 | +// with their related DOM properties |
| 113 | +export const disableInputAttributeSyncing = false; |
| 114 | + |
| 115 | +export const warnAboutStringRefs = false; |
| 116 | + |
| 117 | +export const disableLegacyContext = false; |
| 118 | + |
| 119 | +// Disables React.createFactory |
43 | 120 | export const disableCreateFactory = false; |
| 121 | + |
| 122 | +// Disables children for <textarea> elements |
44 | 123 | export const disableTextareaChildren = false; |
| 124 | + |
| 125 | +// Disables Maps as ReactElement children |
45 | 126 | export const disableMapsAsChildren = false; |
| 127 | + |
| 128 | +// Disables ReactDOM.unstable_renderSubtreeIntoContainer |
46 | 129 | export const disableUnstableRenderSubtreeIntoContainer = false; |
| 130 | +// We should remove this flag once the above flag becomes enabled |
47 | 131 | export const warnUnstableRenderSubtreeIntoContainer = false; |
48 | | -export const disableUnstableCreatePortal = false; |
49 | | -export const deferPassiveEffectCleanupDuringUnmount = false; |
50 | | -export const isTestEnvironment = true; |
51 | 132 |
|
52 | | -// Only used in www builds. |
53 | | -export function addUserTimingListener() { |
54 | | - invariant(false, 'Not implemented.'); |
55 | | -} |
56 | | - |
57 | | -// Flow magic to verify the exports of this file match the original version. |
58 | | -// eslint-disable-next-line no-unused-vars |
59 | | -type Check<_X, Y: _X, X: Y = _X> = null; |
60 | | -// eslint-disable-next-line no-unused-expressions |
61 | | -(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>); |
| 133 | +// Disables ReactDOM.unstable_createPortal |
| 134 | +export const disableUnstableCreatePortal = false; |
0 commit comments