Updates from 2015-07-27

This commit is contained in:
Alex Kotliarskyi 2015-07-27 10:01:30 -07:00
commit 3bdb3f0f98
4 changed files with 29 additions and 13 deletions

View File

@ -14,9 +14,13 @@ var path = require('path');
// modulePathIgnorePatterns. // modulePathIgnorePatterns.
var sharedBlacklist = [ var sharedBlacklist = [
'website', 'website',
'node_modules/react-tools/src/utils/ImmutableObject.js', 'node_modules/react-tools/src/React.js',
'node_modules/react-tools/src/core/ReactInstanceHandles.js', 'node_modules/react-tools/src/renderers/shared/event/EventPropagators.js',
'node_modules/react-tools/src/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 = { var platformBlacklists = {
@ -24,17 +28,10 @@ var platformBlacklists = {
'.ios.js' '.ios.js'
], ],
ios: [ 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', '.web.js',
'.android.js', '.android.js',
], ],
android: [ 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', '.web.js',
'.ios.js', '.ios.js',
], ],

View File

@ -39,6 +39,7 @@ describe('processRequest', function() {
requestHandler( requestHandler(
{ url: requrl }, { url: requrl },
{ {
setHeader: jest.genMockFunction(),
end: function(res) { end: function(res) {
resolve(res); resolve(res);
} }

View File

@ -358,13 +358,17 @@ Server.prototype.processRequest = function(req, res, next) {
building.then( building.then(
function(p) { function(p) {
if (requestType === 'bundle') { if (requestType === 'bundle') {
res.end(p.getSource({ var bundleSource = p.getSource({
inlineSourceMap: options.inlineSourceMap, inlineSourceMap: options.inlineSourceMap,
minify: options.minify, minify: options.minify,
})); });
res.setHeader('Content-Type', 'application/javascript');
res.end(bundleSource);
Activity.endEvent(startReqEventId); Activity.endEvent(startReqEventId);
} else if (requestType === 'map') { } 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); Activity.endEvent(startReqEventId);
} }
}, },

View File

@ -17,7 +17,19 @@ function attachToServer(server, path) {
}); });
var clients = []; 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) { wss.on('connection', function(ws) {
var id = Math.random().toString(15).slice(10, 20);
sendSpecial({$open: id});
clients.push(ws); clients.push(ws);
var allClientsExcept = function(ws) { var allClientsExcept = function(ws) {
@ -26,10 +38,12 @@ function attachToServer(server, path) {
ws.onerror = function() { ws.onerror = function() {
clients = allClientsExcept(ws); clients = allClientsExcept(ws);
sendSpecial({$error: id});
}; };
ws.onclose = function() { ws.onclose = function() {
clients = allClientsExcept(ws); clients = allClientsExcept(ws);
sendSpecial({$close: id});
}; };
ws.on('message', function(message) { ws.on('message', function(message) {