dillon1000/react

Commit

ReactNative flat renderer bundles (#9626)

* Split ReactNativeFiber into separate ReactNativeFiberRenderer module
Hopefully this is sufficient to work around Rollup circular dependency problems. (To be seen in subsequent commits...)

* Split findNodeHandle into findNodeHandleFiber + findNodeHandleStack
This allowed me to remove the ReactNative -> findNodeHandle injections, which should in turn allow me to require a fully-functional findNodeHandle without going through ReactNative. This will hopefully allow ReactNativeBaseomponent to avoid a circular dependency.

* Un-forked findNodeHandle in favor of just inlining the findNode function impl

* takeSnapshot no longer requires/depends-on ReactNative for findNodeHandle
Instead it uses the new, renderer-specific wrappers (eg findNodeHandleFiberWrapper and findNodeHandleStackWrapper) to ensure the returned value is numeric (or null). This avoids a circular dependency that would trip up Rollup.

* NativeMethodsMixin requires findNodeHandler wrapper(s) directly rather than ReactNative
This works around a potential circular dependency that would break the Rollup build

* Add RN_* build targets to hash-finle-name check

* Strip @providesModule annotations from headers for RN_* builds

* Added process.env.REACT_NATIVE_USE_FIBER to ReactNativeFeatureFlags
This is kind of a hacky solution, but it is temporary. It works around the fact that ReactNativeFeatureFlag values need to be set at build time in order to avoid a mismatch between runtime flag values. DOM avoids the need to do this by using injection but Native is not able to use this same approach due to circular dependency issues.

* Moved a couple of SECRET exports to dev-only. Removed SyntheticEvent and PooledClass from SECRET exports. Converted Rollup helper function to use named params.

* Split NativeMethodsMixins interface and object-type

* Add @noflow header to flat-bundle template to avoid triggering Flow problems
When Flow tries to infer such a large file, it consumes massive amounts of CPU/RAM and can often lead to programs crashing. It is better for such large files to use .flow.js types instead.

* NativeMethodsMixin and ReactNativeFiberHostComponent now share the same Flow type

* Collocated (externally exposed) ReactTypes and ReactNativeTypes into single files to be synced to fbsource. ReactNativeFiber and ReactNativeStack use ReactNativeType Flow type

* Build script syncs RN types and PooledClass automatically

* Added optional sync-RN step to Rollup build script

* Added results.json for new RN bundles
Browse files
Changed paths33 files
First-parent comparison
M scripts/rollup/build.js ModifiedM scripts/rollup/bundles.js ModifiedM scripts/rollup/header.js ModifiedM scripts/rollup/packaging.js ModifiedM scripts/rollup/results.json ModifiedM scripts/rollup/shims/react-native/NativeMethodsMixin.js ModifiedR scripts/rollup/shims/react-native/PooledClass.js →scripts/rollup/shims/react-native/ReactGlobalSharedState.js RenamedA scripts/rollup/shims/react-native/ReactNative.js AddedA scripts/rollup/shims/react-native/ReactNativeFeatureFlags.js AddedD scripts/rollup/shims/react-native/findNodeHandle.js DeletedR scripts/rollup/shims/react-native/ReactErrorUtils.js →scripts/rollup/shims/react-native/takeSnapshot.js RenamedA scripts/rollup/sync.js AddedA scripts/rollup/utils.js AddedM src/renderers/native/NativeMethodsMixin.js ModifiedM src/renderers/native/NativeMethodsMixinUtils.js ModifiedM src/renderers/native/ReactNativeFeatureFlags.js ModifiedM src/renderers/native/ReactNativeFiber.js ModifiedM src/renderers/native/ReactNativeFiberHostComponent.js ModifiedA src/renderers/native/ReactNativeFiberRenderer.js AddedM src/renderers/native/ReactNativeStack.js ModifiedM src/renderers/native/ReactNativeStackInjection.js ModifiedA src/renderers/native/ReactNativeTypes.js AddedM src/renderers/native/findNodeHandle.js ModifiedA src/renderers/native/findNumericNodeHandleFiber.js AddedA src/renderers/native/findNumericNodeHandleStack.js AddedM src/renderers/native/takeSnapshot.js ModifiedM src/renderers/shared/fiber/ReactChildFiber.js ModifiedM src/renderers/shared/fiber/ReactFiber.js ModifiedM src/renderers/shared/fiber/ReactFiberBeginWork.js ModifiedM src/renderers/shared/fiber/ReactFiberCompleteWork.js ModifiedM src/renderers/shared/fiber/isomorphic/ReactCoroutine.js ModifiedM src/renderers/shared/fiber/isomorphic/ReactPortal.js ModifiedM src/renderers/shared/fiber/isomorphic/ReactTypes.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…