[ReactNative] Respect --assets-dest in "download from server" mode

This commit is contained in:
Krzysztof Magiera 2015-08-25 07:28:49 -07:00
parent 5f8c0613fe
commit 27a67c2434
1 changed files with 8 additions and 1 deletions

View File

@ -334,6 +334,8 @@ class Server {
requestType = 'bundle'; requestType = 'bundle';
} else if (pathname.match(/\.map$/)) { } else if (pathname.match(/\.map$/)) {
requestType = 'map'; requestType = 'map';
} else if (pathname.match(/\.assets$/)) {
requestType = 'assets';
} else if (pathname.match(/^\/debug/)) { } else if (pathname.match(/^\/debug/)) {
this._processDebugRequest(req.url, res); this._processDebugRequest(req.url, res);
return; return;
@ -372,6 +374,11 @@ class Server {
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');
res.end(sourceMap); res.end(sourceMap);
Activity.endEvent(startReqEventId); Activity.endEvent(startReqEventId);
} else if (requestType === 'assets') {
var assetsList = JSON.stringify(p.getAssets());
res.setHeader('Content-Type', 'application/json');
res.end(assetsList);
Activity.endEvent(startReqEventId);
} }
}, },
this._handleError.bind(this, res, optionsJson) this._handleError.bind(this, res, optionsJson)
@ -416,7 +423,7 @@ class Server {
// entry module name. We can safely remove these options. // entry module name. We can safely remove these options.
const entryFile = pathname.replace(/^\//, '').split('.').filter(part => { const entryFile = pathname.replace(/^\//, '').split('.').filter(part => {
if (part === 'includeRequire' || part === 'runModule' || if (part === 'includeRequire' || part === 'runModule' ||
part === 'bundle' || part === 'map') { part === 'bundle' || part === 'map' || part === 'assets') {
return false; return false;
} }
return true; return true;