react-native-macos/Libraries
Christoph Nakazawa 81ec2112a1 Use HMRClient to send console logs to Metro
Summary:
This change switches the sending of log messages to Metro from HTTP over to WebSocket. This is what I should have done from the beginning *however* I only spent very little time on this initially, didn't realize that it would be a popular feature *and* we didn't have a persistent WebSocket connection on the client before that was always on. Together with D16442656 we can finally make this happen!

This change:
* Changes the `fetch` call to `HMRClient.log`
* Removes the middleware and integrates logging with `HmrServer` directly in Metro.
* Simplifies the logging logic as WebSockets guarantee messages are processed in order.

This also fixes an issue makovkastar identified when using the `MessageQueue` spy: because we send messages back and forth over the bridge, using `console.log` within `MessageQueue`'s spy method will actually cause an infinite logging loop. This is the proper solution to that problem instead of hacking around it using custom headers.

Note: in a follow-up we will rename these modules to drop the `HMR` prefix. We have not come up with a better name yet and are open to ideas.

Reviewed By: sebmck

Differential Revision: D16458499

fbshipit-source-id: 4c06acece1fef5234015c877354fb730b155168c
2019-07-24 08:11:34 -07:00
..
ART deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
ActionSheetIOS Add NativeModule Spec for ActionSheetManager 2019-07-19 12:12:12 -07:00
Alert Re-land "[RN] TM: attempt to integrate with internal codegen infra"" 2019-06-11 17:11:58 -07:00
Animated Fix typos (#25770) 2019-07-23 03:23:11 -07:00
AppState Feature to listen on window focus events (#25039) 2019-06-05 16:05:34 -07:00
BatchedBridge Fix typos (#25770) 2019-07-23 03:23:11 -07:00
Blob deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
BugReporting add spec for RedBox (#24922) 2019-05-20 18:05:55 -07:00
CameraRoll Remove all calls to bridge.imageLoader [1/N] 2019-07-22 11:13:51 -07:00
Color Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Components Fix typos (#25770) 2019-07-23 03:23:11 -07:00
Core Use HMRClient to send console logs to Metro 2019-07-24 08:11:34 -07:00
DeprecatedPropTypes New Accessibility states API. (#24608) 2019-05-23 05:37:33 -07:00
EventEmitter Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
Experimental Fix typos (#25770) 2019-07-23 03:23:11 -07:00
FBLazyVector TM iOS: Set up CocoaPods specs for the TM specs 2019-07-01 15:20:01 -07:00
FBReactNativeSpec Add NativeModule spec for ShareModule 2019-07-19 12:12:14 -07:00
HeapCapture Replace more Haste imports with path-based imports (#25001) 2019-05-23 00:51:31 -07:00
Image Remove old GIF code (#25636) 2019-07-23 07:10:56 -07:00
Inspector add spec for I18nManager (#24908) 2019-05-31 19:56:37 -07:00
Interaction Fix typos (#25770) 2019-07-23 03:23:11 -07:00
JSInspector Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
LayoutAnimation Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
Linking Replace more Haste imports with path-based imports (#25001) 2019-05-23 00:51:31 -07:00
LinkingIOS deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
Lists Fix typos (#25770) 2019-07-23 03:23:11 -07:00
Modal Fix typos (#25770) 2019-07-23 03:23:11 -07:00
NativeAnimation Fix typos (#25770) 2019-07-23 03:23:11 -07:00
NativeModules/specs Fix types for DialogManagerAndroid 2019-07-17 06:21:50 -07:00
Network Change callback in clearCookies and sendRequest from RCTNetworking to returning void 2019-07-17 06:21:49 -07:00
NewAppScreen Improve the android onboarding messages (#25353) 2019-06-21 21:55:56 -07:00
Performance Remove markerNote from JS bindings 2019-07-18 03:52:44 -07:00
PermissionsAndroid Reland "[RN] TM Spec: relax PermissionsAndroid enforcement" 2019-05-31 10:58:02 -07:00
PushNotificationIOS deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
RCTRequired TM iOS: Set up CocoaPods specs for the TM specs 2019-07-01 15:20:01 -07:00
ReactNative Remove some hacks to UIManager 2019-07-17 12:30:37 -07:00
ReactPrivate Add ReactFiberErrorDialog from React + tests (#25671) 2019-07-16 03:21:07 -07:00
Renderer Fix typos (#25770) 2019-07-23 03:23:11 -07:00
Sample Deploy Flow 0.103 to xplat 2019-07-19 21:43:05 -07:00
Settings deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
Share Add NativeModule spec for ShareModule 2019-07-19 12:12:14 -07:00
Storage Add NativeModule Spec for AsyncStorage 2019-07-19 12:12:12 -07:00
StyleSheet Fix typos (#25770) 2019-07-23 03:23:11 -07:00
SurfaceBackedComponent Fix object initialization 2019-05-10 10:10:27 -07:00
SurfaceHostingComponent Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
Text Fix typos (#25770) 2019-07-23 03:23:11 -07:00
TurboModule Disable legacy native modules in bridgeless mode 2019-06-17 15:13:49 -07:00
TypeSafety iOS: Use RCTTypeSafety header namespace instead of React 2019-07-12 14:30:11 -07:00
Types Change returning value of DirectEventHandler and BubblingEventHandler to void 2019-07-10 05:40:20 -07:00
Utilities Use HMRClient to send console logs to Metro 2019-07-24 08:11:34 -07:00
Vibration Add NativeModule Spec for Vibration 2019-07-19 12:12:14 -07:00
WebSocket deprecate iOS .xcodeproj (#25583) 2019-07-11 12:02:39 -07:00
Wrapper Fix typos (#25770) 2019-07-23 03:23:11 -07:00
YellowBox Fix typos (#25770) 2019-07-23 03:23:11 -07:00
polyfills protect against hanging when logging nasty objects 2019-06-21 07:43:52 -07:00
react-native Silence all Lean Core warnings in Prelude.js 2019-07-01 10:48:47 -07:00
vendor Remove Map/Set from RN Open Source 2019-06-07 06:39:28 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Use standard version of Promise.prototype.finally 2019-03-27 20:48:45 -07:00
UTFSequence.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
promiseRejectionIsError.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00