mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
This commit is a follow-up to https://github.com/facebook/react/pull/15604, which explains more of the rationale behind moving React Native to path-based imports and the work needed in the React repository. In that linked PR, the generated renderers were updated but not the shims; this commit updates the shims. The problem is that FB needs a different copy of the built renderers than the OSS versions so we need a way for FB code to import different modules than in OSS. This was previously done with Haste, but with the removal of Haste from RN, we need another mechanism. Talking with cpojer, we are using a `.fb.js` extension that Metro can be configured to prioritize over `.js`. This commit generates FB's renderers with the `.fb.js` extension and OSS renderers with just `.js`. This way, FB can internally configure Metro to use the `.fb.js` implementations and OSS will use the `.js` ones, letting us swap out which implementation gets bundled. Test Plan: Generated the renderers and shims with `yarn build` and then verified that the generated shims don't contain any Haste-style imports. Copied the renderers and shims into RN manually and launched the RNTester app to verify it loads end-to-end. Added `.fb.js` to the extensions in `metro.config.js` and verified that the FB-specific bundles loaded.
50 lines
1.8 KiB
JavaScript
50 lines
1.8 KiB
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import invariant from 'shared/invariant';
|
|
|
|
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
|
import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native-fb';
|
|
|
|
// Re-export dynamic flags from the fbsource version.
|
|
export const {
|
|
debugRenderPhaseSideEffects,
|
|
} = require('../shims/ReactFeatureFlags');
|
|
|
|
// The rest of the flags are static for better dead code elimination.
|
|
export const enableUserTimingAPI = __DEV__;
|
|
export const enableProfilerTimer = __PROFILE__;
|
|
export const enableSchedulerTracing = __PROFILE__;
|
|
export const enableSuspenseServerRenderer = false;
|
|
export const enableStableConcurrentModeAPIs = false;
|
|
export const warnAboutShorthandPropertyCollision = false;
|
|
export const enableSchedulerDebugging = false;
|
|
export const debugRenderPhaseSideEffectsForStrictMode = true;
|
|
export const disableJavaScriptURLs = false;
|
|
export const disableYielding = false;
|
|
export const disableInputAttributeSyncing = false;
|
|
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
|
|
export const warnAboutDeprecatedLifecycles = true;
|
|
export const warnAboutDeprecatedSetNativeProps = true;
|
|
export const enableEventAPI = false;
|
|
export const enableJSXTransformAPI = false;
|
|
export const warnAboutMissingMockScheduler = true;
|
|
export const revertPassiveEffectsChange = false;
|
|
|
|
// Only used in www builds.
|
|
export function addUserTimingListener() {
|
|
invariant(false, 'Not implemented.');
|
|
}
|
|
|
|
// Flow magic to verify the exports of this file match the original version.
|
|
// eslint-disable-next-line no-unused-vars
|
|
type Check<_X, Y: _X, X: Y = _X> = null;
|
|
// eslint-disable-next-line no-unused-expressions
|
|
(null: Check<FeatureFlagsShimType, FeatureFlagsType>);
|