|
| 1 | +/** |
| 2 | + * Copyright (c) Facebook, Inc. and its affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * |
| 7 | + * @flow |
| 8 | + */ |
| 9 | + |
| 10 | +import {enableNewReconciler} from 'shared/ReactFeatureFlags'; |
| 11 | + |
| 12 | +// The entry file imports either the old or new version of the reconciler. |
| 13 | +// During build and testing, this indirection is always shimmed with the actual |
| 14 | +// modules, otherwise both reconcilers would be initialized. So this is really |
| 15 | +// only here for Flow purposes. |
| 16 | + |
| 17 | +import { |
| 18 | + createContainer as createContainer_old, |
| 19 | + updateContainer as updateContainer_old, |
| 20 | + batchedEventUpdates as batchedEventUpdates_old, |
| 21 | + batchedUpdates as batchedUpdates_old, |
| 22 | + unbatchedUpdates as unbatchedUpdates_old, |
| 23 | + deferredUpdates as deferredUpdates_old, |
| 24 | + syncUpdates as syncUpdates_old, |
| 25 | + discreteUpdates as discreteUpdates_old, |
| 26 | + flushDiscreteUpdates as flushDiscreteUpdates_old, |
| 27 | + flushControlled as flushControlled_old, |
| 28 | + flushSync as flushSync_old, |
| 29 | + flushPassiveEffects as flushPassiveEffects_old, |
| 30 | + IsThisRendererActing as IsThisRendererActing_old, |
| 31 | + getPublicRootInstance as getPublicRootInstance_old, |
| 32 | + attemptSynchronousHydration as attemptSynchronousHydration_old, |
| 33 | + attemptUserBlockingHydration as attemptUserBlockingHydration_old, |
| 34 | + attemptContinuousHydration as attemptContinuousHydration_old, |
| 35 | + attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_old, |
| 36 | + findHostInstance as findHostInstance_old, |
| 37 | + findHostInstanceWithWarning as findHostInstanceWithWarning_old, |
| 38 | + findHostInstanceWithNoPortals as findHostInstanceWithNoPortals_old, |
| 39 | + shouldSuspend as shouldSuspend_old, |
| 40 | + injectIntoDevTools as injectIntoDevTools_old, |
| 41 | + act as act_old, |
| 42 | +} from './ReactFiberReconciler.old'; |
| 43 | + |
| 44 | +// TODO: Update these to point to the fork. |
| 45 | +import { |
| 46 | + createContainer as createContainer_new, |
| 47 | + updateContainer as updateContainer_new, |
| 48 | + batchedEventUpdates as batchedEventUpdates_new, |
| 49 | + batchedUpdates as batchedUpdates_new, |
| 50 | + unbatchedUpdates as unbatchedUpdates_new, |
| 51 | + deferredUpdates as deferredUpdates_new, |
| 52 | + syncUpdates as syncUpdates_new, |
| 53 | + discreteUpdates as discreteUpdates_new, |
| 54 | + flushDiscreteUpdates as flushDiscreteUpdates_new, |
| 55 | + flushControlled as flushControlled_new, |
| 56 | + flushSync as flushSync_new, |
| 57 | + flushPassiveEffects as flushPassiveEffects_new, |
| 58 | + IsThisRendererActing as IsThisRendererActing_new, |
| 59 | + getPublicRootInstance as getPublicRootInstance_new, |
| 60 | + attemptSynchronousHydration as attemptSynchronousHydration_new, |
| 61 | + attemptUserBlockingHydration as attemptUserBlockingHydration_new, |
| 62 | + attemptContinuousHydration as attemptContinuousHydration_new, |
| 63 | + attemptHydrationAtCurrentPriority as attemptHydrationAtCurrentPriority_new, |
| 64 | + findHostInstance as findHostInstance_new, |
| 65 | + findHostInstanceWithWarning as findHostInstanceWithWarning_new, |
| 66 | + findHostInstanceWithNoPortals as findHostInstanceWithNoPortals_new, |
| 67 | + shouldSuspend as shouldSuspend_new, |
| 68 | + injectIntoDevTools as injectIntoDevTools_new, |
| 69 | + act as act_new, |
| 70 | +} from './ReactFiberReconciler.old'; |
| 71 | + |
| 72 | +export const createContainer = enableNewReconciler |
| 73 | + ? createContainer_new |
| 74 | + : createContainer_old; |
| 75 | +export const updateContainer = enableNewReconciler |
| 76 | + ? updateContainer_new |
| 77 | + : updateContainer_old; |
| 78 | +export const batchedEventUpdates = enableNewReconciler |
| 79 | + ? batchedEventUpdates_new |
| 80 | + : batchedEventUpdates_old; |
| 81 | +export const batchedUpdates = enableNewReconciler |
| 82 | + ? batchedUpdates_new |
| 83 | + : batchedUpdates_old; |
| 84 | +export const unbatchedUpdates = enableNewReconciler |
| 85 | + ? unbatchedUpdates_new |
| 86 | + : unbatchedUpdates_old; |
| 87 | +export const deferredUpdates = enableNewReconciler |
| 88 | + ? deferredUpdates_new |
| 89 | + : deferredUpdates_old; |
| 90 | +export const syncUpdates = enableNewReconciler |
| 91 | + ? syncUpdates_new |
| 92 | + : syncUpdates_old; |
| 93 | +export const discreteUpdates = enableNewReconciler |
| 94 | + ? discreteUpdates_new |
| 95 | + : discreteUpdates_old; |
| 96 | +export const flushDiscreteUpdates = enableNewReconciler |
| 97 | + ? flushDiscreteUpdates_new |
| 98 | + : flushDiscreteUpdates_old; |
| 99 | +export const flushControlled = enableNewReconciler |
| 100 | + ? flushControlled_new |
| 101 | + : flushControlled_old; |
| 102 | +export const flushSync = enableNewReconciler ? flushSync_new : flushSync_old; |
| 103 | +export const flushPassiveEffects = enableNewReconciler |
| 104 | + ? flushPassiveEffects_new |
| 105 | + : flushPassiveEffects_old; |
| 106 | +export const IsThisRendererActing = enableNewReconciler |
| 107 | + ? IsThisRendererActing_new |
| 108 | + : IsThisRendererActing_old; |
| 109 | +export const getPublicRootInstance = enableNewReconciler |
| 110 | + ? getPublicRootInstance_new |
| 111 | + : getPublicRootInstance_old; |
| 112 | +export const attemptSynchronousHydration = enableNewReconciler |
| 113 | + ? attemptSynchronousHydration_new |
| 114 | + : attemptSynchronousHydration_old; |
| 115 | +export const attemptUserBlockingHydration = enableNewReconciler |
| 116 | + ? attemptUserBlockingHydration_new |
| 117 | + : attemptUserBlockingHydration_old; |
| 118 | +export const attemptContinuousHydration = enableNewReconciler |
| 119 | + ? attemptContinuousHydration_new |
| 120 | + : attemptContinuousHydration_old; |
| 121 | +export const attemptHydrationAtCurrentPriority = enableNewReconciler |
| 122 | + ? attemptHydrationAtCurrentPriority_new |
| 123 | + : attemptHydrationAtCurrentPriority_old; |
| 124 | +export const findHostInstance = enableNewReconciler |
| 125 | + ? findHostInstance_new |
| 126 | + : findHostInstance_old; |
| 127 | +export const findHostInstanceWithWarning = enableNewReconciler |
| 128 | + ? findHostInstanceWithWarning_new |
| 129 | + : findHostInstanceWithWarning_old; |
| 130 | +export const findHostInstanceWithNoPortals = enableNewReconciler |
| 131 | + ? findHostInstanceWithNoPortals_new |
| 132 | + : findHostInstanceWithNoPortals_old; |
| 133 | +export const shouldSuspend = enableNewReconciler |
| 134 | + ? shouldSuspend_new |
| 135 | + : shouldSuspend_old; |
| 136 | +export const injectIntoDevTools = enableNewReconciler |
| 137 | + ? injectIntoDevTools_new |
| 138 | + : injectIntoDevTools_old; |
| 139 | +export const act = enableNewReconciler ? act_new : act_old; |
0 commit comments