@samitouri / QOS-React-2 / commits / f828ca407f

Expose persistent reconciler to custom renderers (#12156)

Dan Abramov committed Feb 5, 2018 at 16:56 UTC f828ca407febc6287011f8ae89aa469c4d522fcc
7 files changed +90
packages/react-reconciler/npm/persistent.js new
+7
@@ -0,0 +1,7 @@
1 +'use strict';
2 +
3 +if (process.env.NODE_ENV === 'production') {
4 + module.exports = require('./cjs/react-reconciler-persistent.production.min.js');
5 +} else {
6 + module.exports = require('./cjs/react-reconciler-persistent.development.js');
7 +}
packages/react-reconciler/package.json
+1
@@ -12,6 +12,7 @@
12 "LICENSE",
13 "README.md",
14 "index.js",
15 + "persistent.js",
16 "reflection.js",
17 "cjs/"
18 ],
packages/react-reconciler/persistent.js new
+20
@@ -0,0 +1,20 @@
1 +/**
2 + * Copyright (c) 2013-present, Facebook, Inc.
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 +'use strict';
11 +
12 +// This is the same export as in index.js,
13 +// with persistent reconciler flags turned on.
14 +const ReactFiberReconciler = require('./src/ReactFiberReconciler');
15 +
16 +// TODO: decide on the top-level export form.
17 +// This is hacky but makes it work with both Rollup and Jest.
18 +module.exports = ReactFiberReconciler.default
19 + ? ReactFiberReconciler.default
20 + : ReactFiberReconciler;
packages/shared/forks/ReactFeatureFlags.persistent.js new
+36
@@ -0,0 +1,36 @@
1 +/**
2 + * Copyright (c) 2013-present, Facebook, Inc.
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 invariant from 'fbjs/lib/invariant';
11 +
12 +import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
13 +import typeof * as PersistentFeatureFlagsType from './ReactFeatureFlags.persistent';
14 +
15 +export const debugRenderPhaseSideEffects = false;
16 +export const debugRenderPhaseSideEffectsForStrictMode = false;
17 +export const enableCreateRoot = false;
18 +export const enableUserTimingAPI = __DEV__;
19 +export const warnAboutDeprecatedLifecycles = false;
20 +
21 +// react-reconciler/persistent entry point
22 +// uses a persistent reconciler.
23 +export const enableMutatingReconciler = false;
24 +export const enableNoopReconciler = false;
25 +export const enablePersistentReconciler = true;
26 +
27 +// Only used in www builds.
28 +export function addUserTimingListener() {
29 + invariant(false, 'Not implemented.');
30 +}
31 +
32 +// Flow magic to verify the exports of this file match the original version.
33 +// eslint-disable-next-line no-unused-vars
34 +type Check<_X, Y: _X, X: Y = _X> = null;
35 +// eslint-disable-next-line no-unused-expressions
36 +(null: Check<PersistentFeatureFlagsType, FeatureFlagsType>);
scripts/rollup/bundles.js
+10
@@ -205,6 +205,16 @@ const bundles = [
205 externals: ['react'],
206 },
207
208 + /******* React Persistent Reconciler *******/
209 + {
210 + label: 'react-reconciler-persistent',
211 + bundleTypes: [NODE_DEV, NODE_PROD],
212 + moduleType: RECONCILER,
213 + entry: 'react-reconciler/persistent',
214 + global: 'ReactPersistentReconciler',
215 + externals: ['react'],
216 + },
217 +
218 /******* Reflection *******/
219 {
220 label: 'reconciler-reflection',
scripts/rollup/forks.js
+2
@@ -36,6 +36,8 @@ const forks = Object.freeze({
36 return 'shared/forks/ReactFeatureFlags.native.js';
37 case 'react-native-renderer/src/ReactFabric':
38 return 'shared/forks/ReactFeatureFlags.native-fabric.js';
39 + case 'react-reconciler/persistent':
40 + return 'shared/forks/ReactFeatureFlags.persistent.js';
41 default:
42 switch (bundleType) {
43 case FB_DEV:
scripts/rollup/results.json
+14
@@ -384,6 +384,20 @@
384 "packageName": "react-native-renderer",
385 "size": 204787,
386 "gzip": 35784
387 + },
388 + {
389 + "filename": "react-reconciler-persistent.development.js",
390 + "bundleType": "NODE_DEV",
391 + "packageName": "react-reconciler",
392 + "size": 288790,
393 + "gzip": 60630
394 + },
395 + {
396 + "filename": "react-reconciler-persistent.production.min.js",
397 + "bundleType": "NODE_PROD",
398 + "packageName": "react-reconciler",
399 + "size": 41151,
400 + "gzip": 13111
401 }
402 ]
403 }
\ No newline at end of file