From c90d79fe01d7a4f1ebf0ae3e8645045bedb19d82 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Thu, 23 Jul 2015 16:56:23 -0700 Subject: [PATCH 1/3] [react-native] enable react devtools from JavascriptCore --- webSocketProxy.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webSocketProxy.js b/webSocketProxy.js index f8636213..22151c4e 100644 --- a/webSocketProxy.js +++ b/webSocketProxy.js @@ -17,7 +17,19 @@ function attachToServer(server, path) { }); var clients = []; + function sendSpecial(message) { + clients.forEach(function (cn) { + try { + cn.send(JSON.stringify(message)); + } catch(e) { + console.warn('WARN: ' + e.message); + } + }); + } + wss.on('connection', function(ws) { + var id = Math.random().toString(15).slice(10, 20); + sendSpecial({$open: id}); clients.push(ws); var allClientsExcept = function(ws) { @@ -26,10 +38,12 @@ function attachToServer(server, path) { ws.onerror = function() { clients = allClientsExcept(ws); + sendSpecial({$error: id}); }; ws.onclose = function() { clients = allClientsExcept(ws); + sendSpecial({$close: id}); }; ws.on('message', function(message) { From 4b7f9c60c4163d89195b288849f135bdccf200d1 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Thu, 23 Jul 2015 17:50:16 -0700 Subject: [PATCH 2/3] [ReactNative] Update core RN modules to work with React 0.14-beta1 --- blacklist.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/blacklist.js b/blacklist.js index 237691a8..a1b9c946 100644 --- a/blacklist.js +++ b/blacklist.js @@ -14,9 +14,13 @@ var path = require('path'); // modulePathIgnorePatterns. var sharedBlacklist = [ 'website', - 'node_modules/react-tools/src/utils/ImmutableObject.js', - 'node_modules/react-tools/src/core/ReactInstanceHandles.js', - 'node_modules/react-tools/src/event/EventPropagators.js' + 'node_modules/react-tools/src/React.js', + 'node_modules/react-tools/src/renderers/shared/event/EventPropagators.js', + 'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderEventPlugin.js', + 'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderSyntheticEvent.js', + 'node_modules/react-tools/src/renderers/shared/event/eventPlugins/ResponderTouchHistoryStore.js', + 'node_modules/react-tools/src/renderers/shared/reconciler/ReactInstanceHandles.js', + 'node_modules/react-tools/src/shared/vendor/core/ExecutionEnvironment.js', ]; var platformBlacklists = { @@ -24,17 +28,10 @@ var platformBlacklists = { '.ios.js' ], ios: [ - 'node_modules/react-tools/src/browser/ui/React.js', - 'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js', - 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js', '.web.js', '.android.js', ], android: [ - 'node_modules/react-tools/src/browser/ui/React.js', - 'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js', - 'node_modules/react-tools/src/browser/ReactTextComponent.js', - 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js', '.web.js', '.ios.js', ], From 03b4050c6e4b6c3775c4c9fd209895a93fab8c61 Mon Sep 17 00:00:00 2001 From: James Ide Date: Fri, 24 Jul 2015 18:31:41 -0700 Subject: [PATCH 3/3] [Packager] Include Content-Type headers with bundle and source maps Summary: The packager did not send back the Content-Type headers. Adding these. Closes https://github.com/facebook/react-native/pull/2029 Github Author: James Ide --- react-packager/src/Server/__tests__/Server-test.js | 1 + react-packager/src/Server/index.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/react-packager/src/Server/__tests__/Server-test.js b/react-packager/src/Server/__tests__/Server-test.js index 32c9060a..7d399cb2 100644 --- a/react-packager/src/Server/__tests__/Server-test.js +++ b/react-packager/src/Server/__tests__/Server-test.js @@ -39,6 +39,7 @@ describe('processRequest', function() { requestHandler( { url: requrl }, { + setHeader: jest.genMockFunction(), end: function(res) { resolve(res); } diff --git a/react-packager/src/Server/index.js b/react-packager/src/Server/index.js index 1d2140ef..a4ee53ef 100644 --- a/react-packager/src/Server/index.js +++ b/react-packager/src/Server/index.js @@ -358,13 +358,17 @@ Server.prototype.processRequest = function(req, res, next) { building.then( function(p) { if (requestType === 'bundle') { - res.end(p.getSource({ + var bundleSource = p.getSource({ inlineSourceMap: options.inlineSourceMap, minify: options.minify, - })); + }); + res.setHeader('Content-Type', 'application/javascript'); + res.end(bundleSource); Activity.endEvent(startReqEventId); } else if (requestType === 'map') { - res.end(JSON.stringify(p.getSourceMap())); + var sourceMap = JSON.stringify(p.getSourceMap()); + res.setHeader('Content-Type', 'application/json'); + res.end(sourceMap); Activity.endEvent(startReqEventId); } },