react-native/local-cli/server/util
Christoph Pojer 6554ad5983 Kill fastfs
Summary:
This kills fastfs in favor of Jest's hasteFS. It gets rid of a ton of code, including the mocking code in ResolutionRequest which we don't need any more. Next step after this is to rewrite HasteMap, ModuleCache, Module/Package. We are getting closer to a nicer and faster world! :)

Here is what I did:
* Use Jest's HasteFS instead of fastfs. A fresh instance is received every time something changes on the FS.
* HasteFS is not shared with everything any more. Only one reference is kept in DependencyGraph and there are a few smaller functions that are passed around (getClosestPackage and dirExists). Note: `dirExists` now does fs access instead of an offline check. This sucks but stat calls aren't slow and aren't going to be a bottleneck in ResolutionRequest, I promise! When it is time to tackle a ResolutionRequest rewrite with jest-resolve, this will go away. "It gets worse before it gets better" :) The ModuleGraph equivalent does *not* do fs access and retains the previous way of doing things because we shouldn't do online fs access there.
* Add flow annotations to ResolutionRequest. This required a few tiny hacks for now because of ModuleGraph's duck typing. I'll get rid of this soon.
* Updated ModuleGraph to work with the new code, also created a mock HasteFS instance there.
* I fixed a few tiny mock issues for `fs` to make the tests work; I had to add one tiny little internal update to `dgraph._hasteFS._files` because the file watching in the tests isn't real. It is instrumented through some function calls, therefore the hasteFS instance doesn't get automatically updated. One way to solve this is to add `JestHasteMap.emit('change', …)` for testing but I didn't want to cut a Jest release just for that. #movefast

(Note: I will likely land this in 1.5 weeks from now after my vacation and I have yet to fully test all the product flows. Please give me feedback so I can make sure this is solid!)

Reviewed By: davidaurelio

Differential Revision: D4204082

fbshipit-source-id: d6dc9fcb77ac224df4554a59f0fce241c01b0512
2016-11-30 04:28:32 -08:00
..
attachHMRServer.js Kill fastfs 2016-11-30 04:28:32 -08:00
copyToClipBoard.js Add Copy and Dismiss Button in RN Android Red Box 2016-06-30 08:13:22 -07:00
debugger.html RN: Show Warning for Background Remote Debuggers 2016-10-31 11:29:57 -07:00
debuggerWorker.js RN: Show Warning for Background Remote Debuggers 2016-10-31 11:29:57 -07:00
inspectorProxy.js Support loading source maps 2016-11-15 08:59:02 -08:00
launchChrome.js Allow launching inspector from dev menu 2016-11-15 08:59:02 -08:00
launchEditor.js Allow arguments in the editor env var 2016-11-04 12:59:17 -07:00
messageSocket.js Use messageSocket to broadcast reload command on global shortcut 2016-06-20 10:58:32 -07:00
webSocketProxy.js Improve Chrome debugger 2016-02-05 15:17:33 -08:00