mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fork React Native renderer into FB and OSS bundles (#12625)
* Added new "native-fb" and "native-fabric-fb" bundles. * Split RN_DEV and RN_PROD bundle types into RN_OSS_DEV, RN_OSS_PROD, RN_FB_DEV, and RN_FB_PROD. (This is a bit redundant but it seemed the least intrusive way of supporting a forked feature flags file for these bundles.) * Renamed FB_DEV and FB_PROD bundle types to be more explicitly for www (FB_WWW_DEV and FB_WWW_PROD) * Removed Haste @providesModule headers from the RB-specific RN renderer bundles to avoid a duplicate name conflicts. * Remove dynamic values from OSS RN feature flags. (Leave them in FB RN feature flags.) * Updated the sync script(s) to account for new renderer type. * Move ReactFeatureFlags.js shim to FB bundle only (since OSS bundle no longer needs dynamic values).
This commit is contained in:
1 parent
039695cc01
commit
0887c7d56c
14 files changed
+349
-99
No files matched your search
@@ -17,7 +17,7 @@ let UIManager;
|
||||
let FabricUIManager;
|
||||
|
||||
jest.mock('shared/ReactFeatureFlags', () =>
|
||||
require('shared/forks/ReactFeatureFlags.native-fabric'),
|
||||
require('shared/forks/ReactFeatureFlags.native-fabric-oss'),
|
||||
);
|
||||
|
||||
describe('ReactFabric', () => {
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('ReactFabric', () => {
|
||||
ReactNative = require('react-native-renderer');
|
||||
jest.resetModules();
|
||||
jest.mock('shared/ReactFeatureFlags', () =>
|
||||
require('shared/forks/ReactFeatureFlags.native-fabric'),
|
||||
require('shared/forks/ReactFeatureFlags.native-fabric-oss'),
|
||||
);
|
||||
|
||||
React = require('react');
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
import invariant from 'fbjs/lib/invariant';
|
||||
|
||||
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
||||
import typeof * as FabricFeatureFlagsType from './ReactFeatureFlags.native-fabric';
|
||||
import typeof * as FabricFeatureFlagsType from './ReactFeatureFlags.native-fabric-fb';
|
||||
|
||||
export const debugRenderPhaseSideEffects = false;
|
||||
export const debugRenderPhaseSideEffectsForStrictMode = false;
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* 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 'fbjs/lib/invariant';
|
||||
|
||||
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
||||
import typeof * as FabricFeatureFlagsType from './ReactFeatureFlags.native-fabric-oss';
|
||||
|
||||
export const debugRenderPhaseSideEffects = false;
|
||||
export const debugRenderPhaseSideEffectsForStrictMode = false;
|
||||
export const enableUserTimingAPI = __DEV__;
|
||||
export const enableGetDerivedStateFromCatch = false;
|
||||
export const warnAboutDeprecatedLifecycles = false;
|
||||
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
|
||||
|
||||
// React Fabric uses persistent reconciler.
|
||||
export const enableMutatingReconciler = false;
|
||||
export const enableNoopReconciler = false;
|
||||
export const enablePersistentReconciler = true;
|
||||
export const alwaysUseRequestIdleCallbackPolyfill = 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<FabricFeatureFlagsType, FeatureFlagsType>);
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
import invariant from 'fbjs/lib/invariant';
|
||||
|
||||
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
||||
import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native';
|
||||
import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native-fb';
|
||||
|
||||
// Re-export dynamic flags from the fbsource version.
|
||||
export const {
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* 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 'fbjs/lib/invariant';
|
||||
|
||||
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
|
||||
import typeof * as FeatureFlagsShimType from './ReactFeatureFlags.native-oss';
|
||||
|
||||
export const alwaysUseRequestIdleCallbackPolyfill = false;
|
||||
export const debugRenderPhaseSideEffects = false;
|
||||
export const debugRenderPhaseSideEffectsForStrictMode = false;
|
||||
export const enableGetDerivedStateFromCatch = false;
|
||||
export const enableMutatingReconciler = true;
|
||||
export const enableNoopReconciler = false;
|
||||
export const enablePersistentReconciler = false;
|
||||
export const enableUserTimingAPI = __DEV__;
|
||||
export const replayFailedUnitOfWorkWithInvokeGuardedCallback = __DEV__;
|
||||
export const warnAboutDeprecatedLifecycles = 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>);
|
||||
+45
-31
@@ -39,10 +39,12 @@ const {
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_DEV,
|
||||
FB_PROD,
|
||||
RN_DEV,
|
||||
RN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
RN_OSS_DEV,
|
||||
RN_OSS_PROD,
|
||||
RN_FB_DEV,
|
||||
RN_FB_PROD,
|
||||
} = Bundles.bundleTypes;
|
||||
|
||||
const requestedBundleTypes = (argv.type || '')
|
||||
@@ -81,8 +83,8 @@ function getBabelConfig(updateBabelOptions, bundleType, filename) {
|
||||
options = updateBabelOptions(options);
|
||||
}
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return Object.assign({}, options, {
|
||||
plugins: options.plugins.concat([
|
||||
// Minify invariant messages
|
||||
@@ -91,8 +93,10 @@ function getBabelConfig(updateBabelOptions, bundleType, filename) {
|
||||
require('../babel/wrap-warning-with-env-check'),
|
||||
]),
|
||||
});
|
||||
case RN_DEV:
|
||||
case RN_PROD:
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
return Object.assign({}, options, {
|
||||
plugins: options.plugins.concat([
|
||||
// Wrap warning() calls in a __DEV__ check so they are stripped from production.
|
||||
@@ -139,10 +143,12 @@ function getFormat(bundleType) {
|
||||
return `umd`;
|
||||
case NODE_DEV:
|
||||
case NODE_PROD:
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case RN_DEV:
|
||||
case RN_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
return `cjs`;
|
||||
}
|
||||
}
|
||||
@@ -159,11 +165,13 @@ function getFilename(name, globalName, bundleType) {
|
||||
return `${name}.development.js`;
|
||||
case NODE_PROD:
|
||||
return `${name}.production.min.js`;
|
||||
case FB_DEV:
|
||||
case RN_DEV:
|
||||
case FB_WWW_DEV:
|
||||
case RN_OSS_DEV:
|
||||
case RN_FB_DEV:
|
||||
return `${globalName}-dev.js`;
|
||||
case FB_PROD:
|
||||
case RN_PROD:
|
||||
case FB_WWW_PROD:
|
||||
case RN_OSS_PROD:
|
||||
case RN_FB_PROD:
|
||||
return `${globalName}-prod.js`;
|
||||
}
|
||||
}
|
||||
@@ -172,13 +180,15 @@ function isProductionBundleType(bundleType) {
|
||||
switch (bundleType) {
|
||||
case UMD_DEV:
|
||||
case NODE_DEV:
|
||||
case FB_DEV:
|
||||
case RN_DEV:
|
||||
case FB_WWW_DEV:
|
||||
case RN_OSS_DEV:
|
||||
case RN_FB_DEV:
|
||||
return false;
|
||||
case UMD_PROD:
|
||||
case NODE_PROD:
|
||||
case FB_PROD:
|
||||
case RN_PROD:
|
||||
case FB_WWW_PROD:
|
||||
case RN_OSS_PROD:
|
||||
case RN_FB_PROD:
|
||||
return true;
|
||||
default:
|
||||
throw new Error(`Unknown type: ${bundleType}`);
|
||||
@@ -200,8 +210,12 @@ function getPlugins(
|
||||
const forks = Modules.getForks(bundleType, entry);
|
||||
const isProduction = isProductionBundleType(bundleType);
|
||||
const isInGlobalScope = bundleType === UMD_DEV || bundleType === UMD_PROD;
|
||||
const isFBBundle = bundleType === FB_DEV || bundleType === FB_PROD;
|
||||
const isRNBundle = bundleType === RN_DEV || bundleType === RN_PROD;
|
||||
const isFBBundle = bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD;
|
||||
const isRNBundle =
|
||||
bundleType === RN_OSS_DEV ||
|
||||
bundleType === RN_OSS_PROD ||
|
||||
bundleType === RN_FB_DEV ||
|
||||
bundleType === RN_FB_PROD;
|
||||
const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput;
|
||||
return [
|
||||
// Extract error codes from invariant() messages into a file.
|
||||
@@ -329,7 +343,7 @@ async function createBundle(bundle, bundleType) {
|
||||
const packageName = Packaging.getPackageName(bundle.entry);
|
||||
|
||||
let resolvedEntry = require.resolve(bundle.entry);
|
||||
if (bundleType === FB_DEV || bundleType === FB_PROD) {
|
||||
if (bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD) {
|
||||
const resolvedFBEntry = resolvedEntry.replace('.js', '.fb.js');
|
||||
if (fs.existsSync(resolvedFBEntry)) {
|
||||
resolvedEntry = resolvedFBEntry;
|
||||
@@ -379,7 +393,7 @@ async function createBundle(bundle, bundleType) {
|
||||
bundle.modulesToStub
|
||||
),
|
||||
// We can't use getters in www.
|
||||
legacy: bundleType === FB_DEV || bundleType === FB_PROD,
|
||||
legacy: bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD,
|
||||
};
|
||||
const [mainOutputPath, ...otherOutputPaths] = Packaging.getBundleOutputPaths(
|
||||
bundleType,
|
||||
@@ -478,19 +492,19 @@ async function buildEverything() {
|
||||
await createBundle(bundle, UMD_PROD);
|
||||
await createBundle(bundle, NODE_DEV);
|
||||
await createBundle(bundle, NODE_PROD);
|
||||
await createBundle(bundle, FB_DEV);
|
||||
await createBundle(bundle, FB_PROD);
|
||||
await createBundle(bundle, RN_DEV);
|
||||
await createBundle(bundle, RN_PROD);
|
||||
await createBundle(bundle, FB_WWW_DEV);
|
||||
await createBundle(bundle, FB_WWW_PROD);
|
||||
await createBundle(bundle, RN_OSS_DEV);
|
||||
await createBundle(bundle, RN_OSS_PROD);
|
||||
await createBundle(bundle, RN_FB_DEV);
|
||||
await createBundle(bundle, RN_FB_PROD);
|
||||
}
|
||||
|
||||
await Packaging.copyAllShims();
|
||||
await Packaging.prepareNpmPackages();
|
||||
|
||||
if (syncFBSourcePath) {
|
||||
await Sync.syncReactNative('build/react-native', syncFBSourcePath);
|
||||
await Sync.syncReactNativeRT('build/react-rt', syncFBSourcePath);
|
||||
await Sync.syncReactNativeCS('build/react-cs', syncFBSourcePath);
|
||||
await Sync.syncReactNative(syncFBSourcePath);
|
||||
} else if (syncWWWPath) {
|
||||
await Sync.syncReactDom('build/facebook-www', syncWWWPath);
|
||||
}
|
||||
|
||||
+106
-19
@@ -5,20 +5,24 @@ const bundleTypes = {
|
||||
UMD_PROD: 'UMD_PROD',
|
||||
NODE_DEV: 'NODE_DEV',
|
||||
NODE_PROD: 'NODE_PROD',
|
||||
FB_DEV: 'FB_DEV',
|
||||
FB_PROD: 'FB_PROD',
|
||||
RN_DEV: 'RN_DEV',
|
||||
RN_PROD: 'RN_PROD',
|
||||
FB_WWW_DEV: 'FB_WWW_DEV',
|
||||
FB_WWW_PROD: 'FB_WWW_PROD',
|
||||
RN_OSS_DEV: 'RN_OSS_DEV',
|
||||
RN_OSS_PROD: 'RN_OSS_PROD',
|
||||
RN_FB_DEV: 'RN_FB_DEV',
|
||||
RN_FB_PROD: 'RN_FB_PROD',
|
||||
};
|
||||
|
||||
const UMD_DEV = bundleTypes.UMD_DEV;
|
||||
const UMD_PROD = bundleTypes.UMD_PROD;
|
||||
const NODE_DEV = bundleTypes.NODE_DEV;
|
||||
const NODE_PROD = bundleTypes.NODE_PROD;
|
||||
const FB_DEV = bundleTypes.FB_DEV;
|
||||
const FB_PROD = bundleTypes.FB_PROD;
|
||||
const RN_DEV = bundleTypes.RN_DEV;
|
||||
const RN_PROD = bundleTypes.RN_PROD;
|
||||
const FB_WWW_DEV = bundleTypes.FB_WWW_DEV;
|
||||
const FB_WWW_PROD = bundleTypes.FB_WWW_PROD;
|
||||
const RN_OSS_DEV = bundleTypes.RN_OSS_DEV;
|
||||
const RN_OSS_PROD = bundleTypes.RN_OSS_PROD;
|
||||
const RN_FB_DEV = bundleTypes.RN_FB_DEV;
|
||||
const RN_FB_PROD = bundleTypes.RN_FB_PROD;
|
||||
|
||||
const moduleTypes = {
|
||||
ISOMORPHIC: 'ISOMORPHIC',
|
||||
@@ -40,7 +44,14 @@ const bundles = [
|
||||
/******* Isomorphic *******/
|
||||
{
|
||||
label: 'core',
|
||||
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
|
||||
bundleTypes: [
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'react',
|
||||
global: 'React',
|
||||
@@ -50,7 +61,14 @@ const bundles = [
|
||||
/******* React DOM *******/
|
||||
{
|
||||
label: 'dom-client',
|
||||
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
|
||||
bundleTypes: [
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-dom',
|
||||
global: 'ReactDOM',
|
||||
@@ -61,7 +79,7 @@ const bundles = [
|
||||
{
|
||||
label: 'dom-test-utils',
|
||||
moduleType: RENDERER_UTILS,
|
||||
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
entry: 'react-dom/test-utils',
|
||||
global: 'ReactTestUtils',
|
||||
externals: ['react', 'react-dom'],
|
||||
@@ -70,7 +88,14 @@ const bundles = [
|
||||
/* React DOM internals required for react-native-web (e.g., to shim native events from react-dom) */
|
||||
{
|
||||
label: 'dom-unstable-native-dependencies',
|
||||
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
|
||||
bundleTypes: [
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
],
|
||||
moduleType: RENDERER_UTILS,
|
||||
entry: 'react-dom/unstable-native-dependencies',
|
||||
global: 'ReactDOMUnstableNativeDependencies',
|
||||
@@ -80,7 +105,14 @@ const bundles = [
|
||||
/******* React DOM Server *******/
|
||||
{
|
||||
label: 'dom-server-browser',
|
||||
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
|
||||
bundleTypes: [
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-dom/server.browser',
|
||||
global: 'ReactDOMServer',
|
||||
@@ -98,7 +130,14 @@ const bundles = [
|
||||
/******* React ART *******/
|
||||
{
|
||||
label: 'art',
|
||||
bundleTypes: [UMD_DEV, UMD_PROD, NODE_DEV, NODE_PROD, FB_DEV, FB_PROD],
|
||||
bundleTypes: [
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-art',
|
||||
global: 'ReactART',
|
||||
@@ -111,9 +150,29 @@ const bundles = [
|
||||
},
|
||||
|
||||
/******* React Native *******/
|
||||
{
|
||||
label: 'native-fb',
|
||||
bundleTypes: [RN_FB_DEV, RN_FB_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-native-renderer',
|
||||
global: 'ReactNativeRenderer',
|
||||
externals: [
|
||||
'ExceptionsManager',
|
||||
'InitializeCore',
|
||||
'Platform',
|
||||
'RCTEventEmitter',
|
||||
'TextInputState',
|
||||
'UIManager',
|
||||
'deepDiffer',
|
||||
'deepFreezeAndThrowOnMutationInDev',
|
||||
'flattenStyle',
|
||||
'ReactNativeViewConfigRegistry',
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
label: 'native',
|
||||
bundleTypes: [RN_DEV, RN_PROD],
|
||||
bundleTypes: [RN_OSS_DEV, RN_OSS_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-native-renderer',
|
||||
global: 'ReactNativeRenderer',
|
||||
@@ -132,9 +191,30 @@ const bundles = [
|
||||
},
|
||||
|
||||
/******* React Native Fabric *******/
|
||||
{
|
||||
label: 'native-fabric-fb',
|
||||
bundleTypes: [RN_FB_DEV, RN_FB_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-native-renderer/fabric',
|
||||
global: 'ReactFabric',
|
||||
externals: [
|
||||
'ExceptionsManager',
|
||||
'InitializeCore',
|
||||
'Platform',
|
||||
'RCTEventEmitter',
|
||||
'TextInputState',
|
||||
'UIManager',
|
||||
'FabricUIManager',
|
||||
'deepDiffer',
|
||||
'deepFreezeAndThrowOnMutationInDev',
|
||||
'flattenStyle',
|
||||
'ReactNativeViewConfigRegistry',
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
label: 'native-fabric',
|
||||
bundleTypes: [RN_DEV, RN_PROD],
|
||||
bundleTypes: [RN_OSS_DEV, RN_OSS_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-native-renderer/fabric',
|
||||
global: 'ReactFabric',
|
||||
@@ -156,7 +236,7 @@ const bundles = [
|
||||
/******* React Test Renderer *******/
|
||||
{
|
||||
label: 'test',
|
||||
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-test-renderer',
|
||||
global: 'ReactTestRenderer',
|
||||
@@ -165,7 +245,7 @@ const bundles = [
|
||||
|
||||
{
|
||||
label: 'test-shallow',
|
||||
bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
bundleTypes: [FB_WWW_DEV, NODE_DEV, NODE_PROD, UMD_DEV, UMD_PROD],
|
||||
moduleType: RENDERER,
|
||||
entry: 'react-test-renderer/shallow',
|
||||
global: 'ReactShallowRenderer',
|
||||
@@ -238,7 +318,14 @@ const bundles = [
|
||||
/******* React Is *******/
|
||||
{
|
||||
label: 'react-is',
|
||||
bundleTypes: [NODE_DEV, NODE_PROD, FB_DEV, FB_PROD, UMD_DEV, UMD_PROD],
|
||||
bundleTypes: [
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
UMD_DEV,
|
||||
UMD_PROD,
|
||||
],
|
||||
moduleType: ISOMORPHIC,
|
||||
entry: 'react-is',
|
||||
global: 'ReactIs',
|
||||
|
||||
+46
-20
@@ -4,10 +4,12 @@ const bundleTypes = require('./bundles').bundleTypes;
|
||||
|
||||
const UMD_DEV = bundleTypes.UMD_DEV;
|
||||
const UMD_PROD = bundleTypes.UMD_PROD;
|
||||
const FB_DEV = bundleTypes.FB_DEV;
|
||||
const FB_PROD = bundleTypes.FB_PROD;
|
||||
const RN_DEV = bundleTypes.RN_DEV;
|
||||
const RN_PROD = bundleTypes.RN_PROD;
|
||||
const FB_WWW_DEV = bundleTypes.FB_WWW_DEV;
|
||||
const FB_WWW_PROD = bundleTypes.FB_WWW_PROD;
|
||||
const RN_OSS_DEV = bundleTypes.RN_OSS_DEV;
|
||||
const RN_OSS_PROD = bundleTypes.RN_OSS_PROD;
|
||||
const RN_FB_DEV = bundleTypes.RN_FB_DEV;
|
||||
const RN_FB_PROD = bundleTypes.RN_FB_PROD;
|
||||
|
||||
// If you need to replace a file with another file for a specific environment,
|
||||
// add it to this list with the logic for choosing the right replacement.
|
||||
@@ -33,17 +35,39 @@ const forks = Object.freeze({
|
||||
'shared/ReactFeatureFlags': (bundleType, entry) => {
|
||||
switch (entry) {
|
||||
case 'react-native-renderer':
|
||||
return 'shared/forks/ReactFeatureFlags.native.js';
|
||||
switch (bundleType) {
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
return 'shared/forks/ReactFeatureFlags.native-fb.js';
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
return 'shared/forks/ReactFeatureFlags.native-oss.js';
|
||||
default:
|
||||
throw Error(
|
||||
`Unexpected entry (${entry}) and bundleType (${bundleType})`
|
||||
);
|
||||
}
|
||||
case 'react-native-renderer/fabric':
|
||||
return 'shared/forks/ReactFeatureFlags.native-fabric.js';
|
||||
switch (bundleType) {
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
return 'shared/forks/ReactFeatureFlags.native-fabric-fb.js';
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
return 'shared/forks/ReactFeatureFlags.native-fabric-oss.js';
|
||||
default:
|
||||
throw Error(
|
||||
`Unexpected entry (${entry}) and bundleType (${bundleType})`
|
||||
);
|
||||
}
|
||||
case 'react-reconciler/persistent':
|
||||
return 'shared/forks/ReactFeatureFlags.persistent.js';
|
||||
case 'react-test-renderer':
|
||||
return 'shared/forks/ReactFeatureFlags.test-renderer.js';
|
||||
default:
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return 'shared/forks/ReactFeatureFlags.www.js';
|
||||
}
|
||||
}
|
||||
@@ -53,8 +77,8 @@ const forks = Object.freeze({
|
||||
// This logic is forked on www to blacklist warnings.
|
||||
'shared/lowPriorityWarning': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return 'shared/forks/lowPriorityWarning.www.js';
|
||||
default:
|
||||
return null;
|
||||
@@ -65,8 +89,8 @@ const forks = Object.freeze({
|
||||
// See the explanation in FB version of ReactCurrentOwner in www:
|
||||
'react/src/ReactCurrentOwner': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return 'react/src/forks/ReactCurrentOwner.www.js';
|
||||
default:
|
||||
return null;
|
||||
@@ -76,8 +100,8 @@ const forks = Object.freeze({
|
||||
// Different wrapping/reporting for caught errors.
|
||||
'shared/invokeGuardedCallback': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return 'shared/forks/invokeGuardedCallback.www.js';
|
||||
default:
|
||||
return null;
|
||||
@@ -87,12 +111,14 @@ const forks = Object.freeze({
|
||||
// Different dialogs for caught errors.
|
||||
'react-reconciler/src/ReactFiberErrorDialog': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
// Use the www fork which shows an error dialog.
|
||||
return 'react-reconciler/src/forks/ReactFiberErrorDialog.www.js';
|
||||
case RN_DEV:
|
||||
case RN_PROD:
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
switch (entry) {
|
||||
case 'react-native-renderer':
|
||||
// Use the RN fork which plays well with redbox.
|
||||
@@ -108,8 +134,8 @@ const forks = Object.freeze({
|
||||
// We wrap top-level listeners into guards on www.
|
||||
'react-dom/src/events/EventListener': (bundleType, entry) => {
|
||||
switch (bundleType) {
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
// Use the www fork which is integrated with TimeSlice profiling.
|
||||
return 'react-dom/src/events/forks/EventListener-www.js';
|
||||
default:
|
||||
|
||||
@@ -14,10 +14,12 @@ const {
|
||||
UMD_PROD,
|
||||
NODE_DEV,
|
||||
NODE_PROD,
|
||||
FB_DEV,
|
||||
FB_PROD,
|
||||
RN_DEV,
|
||||
RN_PROD,
|
||||
FB_WWW_DEV,
|
||||
FB_WWW_PROD,
|
||||
RN_OSS_DEV,
|
||||
RN_OSS_PROD,
|
||||
RN_FB_DEV,
|
||||
RN_FB_PROD,
|
||||
} = Bundles.bundleTypes;
|
||||
|
||||
function getPackageName(name) {
|
||||
@@ -38,14 +40,22 @@ function getBundleOutputPaths(bundleType, filename, packageName) {
|
||||
`build/node_modules/${packageName}/umd/${filename}`,
|
||||
`build/dist/${filename}`,
|
||||
];
|
||||
case FB_DEV:
|
||||
case FB_PROD:
|
||||
case FB_WWW_DEV:
|
||||
case FB_WWW_PROD:
|
||||
return [`build/facebook-www/${filename}`];
|
||||
case RN_DEV:
|
||||
case RN_PROD:
|
||||
case RN_OSS_DEV:
|
||||
case RN_OSS_PROD:
|
||||
switch (packageName) {
|
||||
case 'react-native-renderer':
|
||||
return [`build/react-native/${filename}`];
|
||||
return [`build/react-native/oss/${filename}`];
|
||||
default:
|
||||
throw new Error('Unknown RN package.');
|
||||
}
|
||||
case RN_FB_DEV:
|
||||
case RN_FB_PROD:
|
||||
switch (packageName) {
|
||||
case 'react-native-renderer':
|
||||
return [`build/react-native/fb/${filename}`];
|
||||
default:
|
||||
throw new Error('Unknown RN package.');
|
||||
}
|
||||
@@ -73,6 +83,7 @@ async function copyRNShims() {
|
||||
require.resolve('react-native-renderer/src/ReactNativeTypes.js'),
|
||||
'build/react-native/shims/ReactNativeTypes.js'
|
||||
),
|
||||
asyncCopyTo(`${__dirname}/shims/react-native-fb`, 'build/react-native/fb'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
File renamed without changes.
@@ -6,7 +6,7 @@ const resolvePath = require('./utils').resolvePath;
|
||||
|
||||
const DEFAULT_FB_SOURCE_PATH = '~/fbsource/';
|
||||
const DEFAULT_WWW_PATH = '~/www/';
|
||||
const RELATIVE_RN_PATH = 'xplat/js/react-native-github/Libraries/Renderer/';
|
||||
const RELATIVE_RN_OSS_PATH = 'xplat/js/react-native-github/Libraries/Renderer/';
|
||||
const RELATIVE_WWW_PATH = 'html/shared/react/';
|
||||
|
||||
async function doSync(buildPath, destPath) {
|
||||
@@ -43,8 +43,12 @@ async function syncReactNativeHelper(
|
||||
await doSync(buildPath, destPath);
|
||||
}
|
||||
|
||||
async function syncReactNative(buildPath, fbSourcePath) {
|
||||
await syncReactNativeHelper(buildPath, fbSourcePath, RELATIVE_RN_PATH);
|
||||
async function syncReactNative(fbSourcePath) {
|
||||
await syncReactNativeHelper(
|
||||
'build/react-native',
|
||||
fbSourcePath,
|
||||
RELATIVE_RN_OSS_PATH
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -60,7 +60,11 @@ const bundles = [
|
||||
},
|
||||
{
|
||||
format: 'rn',
|
||||
filePatterns: [`./build/{react-cs,react-native,react-rt}/*.js`],
|
||||
filePatterns: [
|
||||
`./build/react-native/oss/*.js`,
|
||||
`./build/react-native/fb/ReactFabric-*.js`,
|
||||
`./build/react-native/fb/ReactNativeRenderer-*.js`,
|
||||
],
|
||||
},
|
||||
{
|
||||
format: 'umd',
|
||||
|
||||
+44
-12
@@ -7,10 +7,12 @@ const UMD_DEV = Bundles.bundleTypes.UMD_DEV;
|
||||
const UMD_PROD = Bundles.bundleTypes.UMD_PROD;
|
||||
const NODE_DEV = Bundles.bundleTypes.NODE_DEV;
|
||||
const NODE_PROD = Bundles.bundleTypes.NODE_PROD;
|
||||
const FB_DEV = Bundles.bundleTypes.FB_DEV;
|
||||
const FB_PROD = Bundles.bundleTypes.FB_PROD;
|
||||
const RN_DEV = Bundles.bundleTypes.RN_DEV;
|
||||
const RN_PROD = Bundles.bundleTypes.RN_PROD;
|
||||
const FB_WWW_DEV = Bundles.bundleTypes.FB_WWW_DEV;
|
||||
const FB_WWW_PROD = Bundles.bundleTypes.FB_WWW_PROD;
|
||||
const RN_OSS_DEV = Bundles.bundleTypes.RN_OSS_DEV;
|
||||
const RN_OSS_PROD = Bundles.bundleTypes.RN_OSS_PROD;
|
||||
const RN_FB_DEV = Bundles.bundleTypes.RN_FB_DEV;
|
||||
const RN_FB_PROD = Bundles.bundleTypes.RN_FB_PROD;
|
||||
|
||||
const RECONCILER = Bundles.moduleTypes.RECONCILER;
|
||||
|
||||
@@ -87,8 +89,8 @@ ${
|
||||
${source}`;
|
||||
},
|
||||
|
||||
/****************** FB_DEV ******************/
|
||||
[FB_DEV](source, globalName, filename, moduleType) {
|
||||
/****************** FB_WWW_DEV ******************/
|
||||
[FB_WWW_DEV](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
@@ -106,8 +108,8 @@ ${source}
|
||||
}`;
|
||||
},
|
||||
|
||||
/****************** FB_PROD ******************/
|
||||
[FB_PROD](source, globalName, filename, moduleType) {
|
||||
/****************** FB_WWW_PROD ******************/
|
||||
[FB_WWW_PROD](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
@@ -119,8 +121,8 @@ ${license}
|
||||
${source}`;
|
||||
},
|
||||
|
||||
/****************** RN_DEV ******************/
|
||||
[RN_DEV](source, globalName, filename, moduleType) {
|
||||
/****************** RN_OSS_DEV ******************/
|
||||
[RN_OSS_DEV](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
@@ -138,8 +140,8 @@ ${source}
|
||||
}`;
|
||||
},
|
||||
|
||||
/****************** RN_DEV ******************/
|
||||
[RN_PROD](source, globalName, filename, moduleType) {
|
||||
/****************** RN_OSS_PROD ******************/
|
||||
[RN_OSS_PROD](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
@@ -148,6 +150,36 @@ ${license}
|
||||
* @preventMunge
|
||||
*/
|
||||
|
||||
${source}`;
|
||||
},
|
||||
|
||||
/****************** RN_FB_DEV ******************/
|
||||
[RN_FB_DEV](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
* @noflow
|
||||
* @preventMunge
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (__DEV__) {
|
||||
(function() {
|
||||
${source}
|
||||
})();
|
||||
}`;
|
||||
},
|
||||
|
||||
/****************** RN_FB_PROD ******************/
|
||||
[RN_FB_PROD](source, globalName, filename, moduleType) {
|
||||
return `/**
|
||||
${license}
|
||||
*
|
||||
* @noflow
|
||||
* @preventMunge
|
||||
*/
|
||||
|
||||
${source}`;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user