UNPKG

@lynker-desktop/devtron

Version:

Electron DevTools Extension to track IPC events

132 lines (124 loc) 5.07 kB
/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ /* 0 */, /* 1 */ /***/ ((module) => { module.exports = require("electron"); /***/ }), /* 2 */ /***/ ((module) => { module.exports = require("node:path"); /***/ }) /******/ ]); /************************************************************************/ /******/ // 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/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? /******/ () => (module['default']) : /******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ })(); /******/ /******/ /* 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 }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. (() => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ devtron: () => (/* binding */ devtron) /* harmony export */ }); /* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); /* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); /* harmony import */ var node_path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(node_path__WEBPACK_IMPORTED_MODULE_1__); async function install() { const extensionName = 'Lynker'; const extensionsFun = electron__WEBPACK_IMPORTED_MODULE_0__.session.defaultSession.extensions || electron__WEBPACK_IMPORTED_MODULE_0__.session.defaultSession; const extensions = extensionsFun.getAllExtensions(); const isInstalled = extensions.some((ext) => ext.name === extensionName); if (isInstalled) { return; } try { const devtronPath = node_path__WEBPACK_IMPORTED_MODULE_1___default().resolve('node_modules', '@lynker-desktop', 'devtron'); const distPath = node_path__WEBPACK_IMPORTED_MODULE_1___default().join(devtronPath, 'dist', 'extension'); const ext = await extensionsFun.loadExtension(distPath, { allowFileAccess: true, }); console.log(`Successfully Installed extension: ${ext.name}`); } catch (e) { console.error('Failed to load devtron: ', e); if (e instanceof Error) { throw new Error(`Failed to load devtron extension: ${e.message}`); } else { throw new Error('Failed to load devtron extension: Unknown error'); } } } const devtron = { install, }; })(); module.exports = __webpack_exports__; /******/ })() ;