Skip to content

Commit 02633fe

Browse files
cpojerfacebook-github-bot
authored andcommitted
Remove old JSC workarounds in HMRClient
Reviewed By: fkgozali Differential Revision: D19297717 fbshipit-source-id: e85abe1c0d1b96cf21ae3a223ee65d92e6f88824
1 parent 11ea095 commit 02633fe

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

Libraries/Utilities/HMRClient.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
'use strict';
1212

1313
const DevSettings = require('./DevSettings');
14-
const Platform = require('./Platform');
1514
const invariant = require('invariant');
16-
1715
const MetroHMRClient = require('metro/src/lib/bundle-modules/HMRClient');
16+
const Platform = require('./Platform');
17+
const prettyFormat = require('pretty-format');
1818

1919
import NativeRedBox from '../NativeModules/specs/NativeRedBox';
2020
import * as LogBoxData from '../LogBox/Data/LogBoxData';
@@ -114,36 +114,23 @@ const HMRClient: HMRClientNativeInterface = {
114114
return;
115115
}
116116
try {
117-
let message;
118-
if (global.Symbol) {
119-
message = JSON.stringify({
117+
hmrClient.send(
118+
JSON.stringify({
120119
type: 'log',
121120
level,
122121
data: data.map(item =>
123122
typeof item === 'string'
124123
? item
125-
: require('pretty-format')(item, {
124+
: prettyFormat(item, {
126125
escapeString: true,
127126
highlight: true,
128127
maxDepth: 3,
129128
min: true,
130-
plugins: [require('pretty-format').plugins.ReactElement],
129+
plugins: [prettyFormat.plugins.ReactElement],
131130
}),
132131
),
133-
});
134-
} else {
135-
try {
136-
message = JSON.stringify({type: 'log', level, data});
137-
} catch (error) {
138-
message = JSON.stringify({
139-
type: 'log',
140-
level,
141-
data: [error.message],
142-
});
143-
}
144-
}
145-
146-
hmrClient.send(message);
132+
}),
133+
);
147134
} catch (error) {
148135
// If sending logs causes any failures we want to silently ignore them
149136
// to ensure we do not cause infinite-logging loops.

0 commit comments

Comments
 (0)