52f431b4bb
Summary:
This makes JSTimers actively register a callback for callImmediates.
Besides being generally tricky, circular dependency prevent compiling React Native code with bundlers that rely on concatenating module sources rather that evaluating code at the time of requiring, like Google Closure Compiler.
Sadly, Google Closure Compiler setup that prompted this change is complicated and brittle. And there are no good public tools to find circular dependencies among Haste-style modules (with unqualified require paths).
So some advice on a good test plan would be useful. Does Facebook have any tools to find circular dependencies with Haste-style requires?
FWIW, a check that worked for me was to replace all import paths in React Native from Haste style to normal relative paths (which I needed anyway) and then run [`madge`](https://www.npmjs.com/package/madge) on the code base:
```
$ ~/node_modules/.bin/madge --circular react-native/Libraries
Processed 390 files (7.4s) (81 warnings)
✖ Found 2 circular dependencies!
1) BatchedBridge/NativeModules.js > BatchedBridge/BatchedBridge.js > BatchedBridge/MessageQueue.js > Core/Timers/JSTimers.js
2) StyleSheet/flattenStyle.js > StyleSheet/StyleSheet.js
```
(The second cycle is already eliminated in
|
||
---|---|---|
.. | ||
Devtools | ||
Timers | ||
__mocks__ | ||
__tests__ | ||
ExceptionsManager.js | ||
InitializeCore.js | ||
ReactNativeVersion.js | ||
ReactNativeVersionCheck.js |