UNPKG

@callstack/repack-debugger-app

Version:

Browser debugger app for React Native applications as part of @callstack/repack.

373 lines (316 loc) 16.6 kB
/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./src/index.css": /*!***********************!*\ !*** ./src/index.css ***! \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); // extracted by mini-css-extract-plugin /***/ }), /***/ "./src/assets/blue-icon.png": /*!**********************************!*\ !*** ./src/assets/blue-icon.png ***! \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABAJJREFUWMPNV0tIlFEU/nsaPSCrhVFZBBFRFkXvKCpCw6BFtagkWoS1CApp0YMKclHRYxNpj0UUQWUavYmeEi2MsFVS/s7oqOPo6DjqzKjpzOjpnDl35s7MP/8/vyUxFy7c/5x7z/nued5fUcwOgLGKBXIUFYqUaijHqeL0iamGaMSjPbR32IYNMpQaKEbhHlQCpibtpTN09q+HBdJQSCEK7DatWDu7QzJI1pBvrULFPyiOt0iFeWtUw2I8YB825RKEXamFLDM31yifqAIcbwO40QmQ3wIwXtUqmFwDcNQJcKeL96apOiB0LUF+0jH7u26AwUEA3wCERmsAYF+z5B9CUF1B5rmDvPeBx8AdCWOCA05zYEEdCz6JtxqB3xsbACp/M+0WWuR+F6+/9ACsqOczV90AQQSRYdEBQbo0pteJ9p1NrCAsnOYYnNc7IDIuocJRUWdyGpm+qcEgO2JcQTmrEzxkahpZdbH0aABX3LG89Q1M3243CErSGalwBkVmi7gN3SpM2+uQLrgrXLCjSfJ3Cautqk9SrEIVk0qnQfrMtrKwtxiIj70A33vZvwGcA2IGxKxE3j0E9MLHZ6ZZkqQm6Ra1XcOcjofPtwO4AtLULbhuD7DSpwjmspvNTwop8tuQ5wnK/U1+gNMYvFNqdK1QpIjGEsPY7eC0IqFvUPgrHys90MKCz7p43xy0TqaV1xSINPaLmHmNZz73yLTdljgeyhXRySLEXDsr/tYrA29tPQtqxhtZ+zkLnnjlTcns41S+sd3PtCU2Prsaz1b1AfgHOTjjAKiKaKcR4kf0dS0qmRBXyYhGg4rOLCtoBvm7oJXXP/u0VZLc98yrAeDTAHiPAGx+LQCLAJCPJp6ZAMBUVFLg5PWvOADpyHMG2GpxALwaF1C6kb+/ogvm1zJtjXABCSEgo5H20COV3+5kF5D5G4ULVooUpAL2AwH1o8x1Oi7QBOEeB0czpVYpoi71cFwcFEF4RgThDCtnC60vtDMvz8F7X/rYmrQ2DkKdNCQ/X+uQDYgE1fSzMLJQiYeVXsRZ5mUaWSg6bem70GVQD0JpmKQQzauVzYZSsrqPlVExCo+g+K7CJvUIgT0XGTLXaqYQJSnF2aIUZ0eV4jxRim+ihYpETyC3hflb7Uzb3GimFCdpRuHCsiiuGRVHNSPqCdG8ZTYtKP1mlKQdhxvLcpuk0bvgnEsCoDgYGXVmg+iGuXaz7djgQbJQPEhOtPE3AfkkSizldYlIx3KkLbXJjKCgzbSafZAkeZJ96ObAc4tG48XMOOKU/MNOmS3UkEh5mXeoTzKDR+kklbsaPTjp4ZmeoLtRxzvWyn3hVBsXpqE9SlPiWZ4SPyYp8WuWEj+n/+n3/A8emj1HwPlGOgAAAABJRU5ErkJggg=="); /***/ }), /***/ "./src/assets/gray-icon.png": /*!**********************************!*\ !*** ./src/assets/gray-icon.png ***! \**********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /*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FRoeA2HA6zDBiBtUhceBNjzyR0K0O4eWVlRTUgKLq7u2NlGO/s7PCmYGkgZHrZ4n1hYcEVD2QZegJRVVUVK0NJoSSRYBJ8JEkggqthmASiyspKfyDyg+LOzk5WhqcVinE/kD0BYUu3GaVAsV8zksBSW1ubMo/N9STUZQ0NDTajXJuRXzuWjUVvx+D5+XllAPLAqRsC1NJqx14XEpxcv5DAEIAVCHWNmIPOzs6ovr5eVQTyRMK074XE70omywmNCIQSxf1PyicmJlS1oAqw1go6vlcyr0tpUVERdzVcOLExkM26Bkg4PT3NfQHe+vSlNCOu5RnxY5IRv2YZ8XP6U7/n/wFyU6HBPUWxjAAAAABJRU5ErkJggg=="); /***/ }), /***/ "./src/assets/orange-icon.png": /*!************************************!*\ !*** ./src/assets/orange-icon.png ***! \************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAABGZJREFUWMPNV+tvFFUU30/4L/i9K0gQImoiQTQmGtEQQAWCoSGgJiZqojZCYsoHQkNIwAcJppWgHwjqLi1SHrVP2m4tfdAULKUW2NLSx0ILbGsf293ZeR7OOXc72+nM7GwbQjrJze7eufeex+/3O+euz5flAyUrliSL/esTAX9hIugPJYI5YfyMicHfQ/SO1tBa35N68LBnpaC/KB7wT8YDOZDd8E/SHtq7cMMV/mfiwZwCjGo6e8PWwXvxDDpr3lFjSlsXatjmCJ6VdTbkwLJV6HnkSRmflY2IXPL8Su/InYyXrAS54zAoPX9Csi0f4sUr7EbOvAjy1QJQ+87w2vjp5Y5OuGaCcHJLuzZ8GQzDAEOZBnoMaRSSLd+a7+W2fWDIU+Jdcp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5787yHuC/L1H+Z/KV0U1/JF8cdkUfw1WxR/Tp/W3/PHSyH/l51SdaoAAAAASUVORK5CYII="); /***/ }), /***/ "./src/debuggerWorker.js": /*!*******************************!*\ !*** ./src/debuggerWorker.js ***! \*******************************/ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ Worker_fn) /* harmony export */ }); function Worker_fn() { return new Worker(__webpack_require__.p + "static/js/debuggerWorker.16cda763.worker.js"); } /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/publicPath */ /******/ (() => { /******/ __webpack_require__.p = "/debugger-ui/"; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!**********************!*\ !*** ./src/index.js ***! \**********************/ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _index_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.css */ "./src/index.css"); /* harmony import */ var _assets_blue_icon_png__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assets/blue-icon.png */ "./src/assets/blue-icon.png"); /* harmony import */ var _assets_gray_icon_png__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assets/gray-icon.png */ "./src/assets/gray-icon.png"); /* harmony import */ var _assets_orange_icon_png__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./assets/orange-icon.png */ "./src/assets/orange-icon.png"); /* harmony import */ var _debuggerWorker_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./debuggerWorker.js */ "./src/debuggerWorker.js"); /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ /* eslint-env browser */ var isMacLike = /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform); var refreshShortcut = isMacLike ? '⌘R' : 'Ctrl R'; window.onload = function () { if (!isMacLike) { document.getElementById('shortcut').innerHTML = 'Ctrl⇧J'; } Page.render(); }; window.onReloadClicked = function () { var xhr = new XMLHttpRequest(); xhr.open('GET', "".concat(window.location.origin, "/reload"), true); xhr.send(); }; var Page = window.Page = { state: { isDark: localStorage.getItem('darkTheme') === null ? window.matchMedia('(prefers-color-scheme: dark)').matches : localStorage.getItem('darkTheme') === 'on', isPriorityMaintained: localStorage.getItem('maintainPriority') === 'on', status: { type: 'disconnected' }, visibilityState: document.visibilityState }, setState: function setState(partialState) { Page.state = Object.assign({}, Page.state, partialState); Page.render(); }, render: function render() { var _Page$state = Page.state, isDark = _Page$state.isDark, isPriorityMaintained = _Page$state.isPriorityMaintained, status = _Page$state.status, visibilityState = _Page$state.visibilityState; var statusNode = document.getElementById('status'); switch (status.type) { case 'connected': statusNode.innerHTML = 'Debugger session #' + status.id + ' active.'; break; case 'error': statusNode.innerHTML = status.error.reason || 'Disconnected from proxy. Attempting reconnection. Is node server running?'; break; case 'connecting': case 'disconnected': // Fall through. default: statusNode.innerHTML = 'Waiting, press <span class="shortcut">' + refreshShortcut + '</span> in simulator to reload and connect.'; break; } var linkNode = document.querySelector('link[rel=icon]'); if (status.type === 'disconnected' || status.type === 'error') { linkNode.href = _assets_gray_icon_png__WEBPACK_IMPORTED_MODULE_2__["default"]; } else { if (visibilityState === 'visible' || isPriorityMaintained) { linkNode.href = _assets_blue_icon_png__WEBPACK_IMPORTED_MODULE_1__["default"]; } else { linkNode.href = _assets_orange_icon_png__WEBPACK_IMPORTED_MODULE_3__["default"]; } } var darkCheckbox = document.getElementById('dark'); document.body.classList.toggle('dark', isDark); darkCheckbox.checked = isDark; localStorage.setItem('darkTheme', isDark ? 'on' : ''); var maintainPriorityCheckbox = document.getElementById('maintain-priority'); maintainPriorityCheckbox.checked = isPriorityMaintained; localStorage.setItem('maintainPriority', isPriorityMaintained ? 'on' : ''); }, toggleDarkTheme: function toggleDarkTheme() { Page.setState({ isDark: !Page.state.isDark }); }, togglePriorityMaintenance: function togglePriorityMaintenance() { Page.setState({ isPriorityMaintained: !Page.state.isPriorityMaintained }); } }; function connectToDebuggerProxy() { var ws = new WebSocket('ws://' + window.location.host + '/debugger-proxy?role=debugger&name=Chrome'); var worker; function createJSRuntime() { // This worker will run the application JavaScript code, // making sure that it's run in an environment without a global // document, to make it consistent with the JSC executor environment. worker = new _debuggerWorker_js__WEBPACK_IMPORTED_MODULE_4__["default"](); worker.onmessage = function (message) { ws.send(JSON.stringify(message.data)); }; window.onbeforeunload = function () { return 'If you reload this page, it is going to break the debugging session. ' + 'Press ' + refreshShortcut + ' on the device to reload.'; }; updateVisibility(); } function shutdownJSRuntime() { if (worker) { worker.terminate(); worker = null; window.onbeforeunload = null; } } function updateVisibility() { if (worker && !Page.state.isPriorityMaintained) { worker.postMessage({ method: 'setDebuggerVisibility', visibilityState: document.visibilityState }); } Page.setState({ visibilityState: document.visibilityState }); } ws.onopen = function () { Page.setState({ status: { type: 'connecting' } }); }; ws.onmessage = function (message) { if (!message.data) { return; } var object = JSON.parse(message.data); if (object.$event === 'client-disconnected') { shutdownJSRuntime(); Page.setState({ status: { type: 'disconnected' } }); return; } if (!object.method) { return; } // Special message that asks for a new JS runtime if (object.method === 'prepareJSRuntime') { shutdownJSRuntime(); console.clear(); createJSRuntime(); ws.send(JSON.stringify({ replyID: object.id })); Page.setState({ status: { type: 'connected', id: object.id } }); } else if (object.method === '$disconnected') { shutdownJSRuntime(); Page.setState({ status: { type: 'disconnected' } }); } else { worker.postMessage(object); } }; ws.onclose = function (error) { shutdownJSRuntime(); Page.setState({ status: { type: 'error', error: error } }); if (error.reason) { console.warn(error.reason); } setTimeout(connectToDebuggerProxy, 500); }; // Let debuggerWorker.js know when we're not visible so that we can warn about // poor performance when using remote debugging. document.addEventListener('visibilitychange', updateVisibility, false); } connectToDebuggerProxy(); })(); /******/ })() ; //# sourceMappingURL=main.508f7546.js.map