mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
3dab9a0d01
Summary: Right now, running the codegen parser on regular JavaScript files causes it to throw an error: https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/packages/react-native-codegen/src/parsers/flow/index.js?commit=1e93f27aac8890f1731650fdcc38b702ae8874e2&lines=59-63%2C106-107 This makes the parser less usable, because you can't simply loop over a list of JavaScript files, and run codegen on them. You need to do some filtering beforehand, or surround each invocation of the parser with a try/catch. Our codegen schema supports the idea of an empty schema: ``` { modules: {} } ``` To improve the parser's ergonomics, this diff migrates the codegen parser over to returning the empty schema when it cannot detect a Component or NativeModule spec inside a JavaScript file. Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D26034052 fbshipit-source-id: c2f15aba9c0e052012396eaed2034537f5918e33