Skip to content

Commit

Permalink
Add gating to the JS delta client on the remote debugger
Browse files Browse the repository at this point in the history
Reviewed By: jeanlauliac

Differential Revision: D5940923

fbshipit-source-id: 1ef4cd52ef3567f2e726217636253802a2e6bb40
  • Loading branch information
rafeca authored and facebook-github-bot committed Sep 29, 2017
1 parent b3fc642 commit a0e88c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 7 additions & 4 deletions local-cli/server/middleware/getDevToolsMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const launchChrome = require('../util/launchChrome');

const {exec} = require('child_process');

function launchChromeDevTools(port) {
var debuggerURL = 'http://localhost:' + port + '/debugger-ui';
function launchChromeDevTools(port, args = '') {
var debuggerURL = 'http://localhost:' + port + '/debugger-ui' + args;
console.log('Launching Dev Tools...');
launchChrome(debuggerURL);
}
Expand All @@ -25,7 +25,10 @@ function escapePath(pathname) {
return '"' + pathname + '"';
}

function launchDevTools({port, projectRoots}, isChromeConnected) {
function launchDevTools(
{port, projectRoots, useDeltaBundler},
isChromeConnected,
) {
// Explicit config always wins
var customDebugger = process.env.REACT_DEBUGGER;
if (customDebugger) {
Expand All @@ -39,7 +42,7 @@ function launchDevTools({port, projectRoots}, isChromeConnected) {
});
} else if (!isChromeConnected()) {
// Dev tools are not yet open; we need to open a session
launchChromeDevTools(port);
launchChromeDevTools(port, useDeltaBundler ? '#useDeltaBundler' : '');
}
}

Expand Down
4 changes: 4 additions & 0 deletions local-cli/server/util/debugger-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@
connectToDebuggerProxy();

async function getBlobUrl(url) {
if (window.location.hash.indexOf('useDeltaBundler') === -1) {
return url;
}

return await window.deltaUrlToBlobUrl(url.replace('.bundle', '.delta'));
}
})();
Expand Down

0 comments on commit a0e88c2

Please sign in to comment.