react-native-macos/Libraries/Utilities
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
..
__mocks__ Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
__tests__ Fix typos (#25770) 2019-07-23 03:23:11 -07:00
differ Fix flow and formatting 2019-05-20 02:52:37 -07:00
BackHandler.android.js Add spec for NativeDeviceEventManager (#24914) 2019-05-20 18:05:54 -07:00
BackHandler.ios.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
DeviceInfo.js Add spec for DeviceInfo module 2019-05-29 16:37:15 -07:00
Dimensions.js Add spec for DeviceInfo module 2019-05-29 16:37:15 -07:00
GlobalPerformanceLogger.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
HMRClient.js Use HMRClient to send console logs to Metro 2019-07-24 08:11:34 -07:00
HMRClientProdShim.js Use HMRClient to send console logs to Metro 2019-07-24 08:11:34 -07:00
JSDevSupportModule.js add spec for JSDevSupport (#24905) 2019-05-22 03:27:54 -07:00
LoadingView.android.js Add a loading bar when loading split bundles 2019-07-18 03:06:49 -07:00
LoadingView.ios.js Add a loading bar when loading split bundles 2019-07-18 03:06:49 -07:00
LoadingView.js Add a loading bar when loading split bundles 2019-07-18 03:06:49 -07:00
MatrixMath.js Use `invariant` instead of `fbjs/lib/invariant` 2018-12-03 00:07:02 -08:00
NativeDevLoadingView.js Replace more Haste imports with path-based imports (#25001) 2019-05-23 00:51:31 -07:00
NativeDeviceInfo.js Add a lint rule to disallow Haste imports (#25058) 2019-05-30 07:45:16 -07:00
NativeJSDevSupport.js Replace more Haste imports with path-based imports (#25001) 2019-05-23 00:51:31 -07:00
NativePlatformConstantsAndroid.js add spec for PlatformConstants (#24928) 2019-05-30 14:29:42 -07:00
NativePlatformConstantsIOS.js add spec for PlatformConstants (#24928) 2019-05-30 14:29:42 -07:00
PerformanceLoggerContext.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
PixelRatio.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
Platform.android.js Cache Platform constants in JS 2019-06-18 23:10:50 -07:00
Platform.ios.js Cache Platform constants in JS 2019-06-18 23:10:50 -07:00
PolyfillFunctions.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
RCTLog.js Use `invariant` instead of `fbjs/lib/invariant` 2018-12-03 00:07:02 -08:00
ReactNativeTestTools.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
SceneTracker.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
binaryToBase64.js Deploy 0.94 to xplat 2019-03-06 14:57:30 -08:00
buildStyleInterpolator.js Remove var in Libraries/Utilities/buildStyleInterpolator.js (#22112) 2018-11-04 11:03:09 -08:00
clamp.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
codegenNativeCommands.js Update View Config generator to create command methods 2019-06-24 18:54:41 -07:00
codegenNativeComponent.js Add paperComponentName and paperComponentNameDeprecated 2019-06-19 09:56:04 -07:00
createPerformanceLogger.js Fix typos (#25770) 2019-07-23 03:23:11 -07:00
deepFreezeAndThrowOnMutationInDev.js Remove var in Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js (#22126) 2018-11-05 16:15:54 -08:00
defineLazyObjectProperty.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
deprecatedPropType.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
dismissKeyboard.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
groupByEveryN.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
infoLog.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
logError.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
mapWithSeparator.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
mergeIntoFast.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
registerGeneratedViewConfig.js Add paperComponentName and paperComponentNameDeprecated 2019-06-19 09:56:04 -07:00
setAndForwardRef.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00
stringifySafe.js add support for stringifying error object messages to stringifySafe (#25723) 2019-07-23 02:46:19 -07:00
truncate.js Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
verifyComponentAttributeEquivalence.js Retry add JS view config for View 2019-07-22 09:30:31 -07:00
warnOnce.js Introduce generic `warnOnce` function for warning messages (#22109) 2019-02-05 02:24:59 -08:00