UNPKG

electron-devtools-vendor

Version:

<div align="center"> <h2>electron-devtools-vendor</h2> <img alt="MIT" src="https://img.shields.io/github/license/BlackHole1/electron-devtools-vendor?color=9cf&style=flat-square"> <img alt="GitHub repo size" src="https://img.shields.io/github/r

1,881 lines (1,470 loc) 938 kB
/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 25896: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ c: () => (/* binding */ HOOK_SETUP), /* harmony export */ o: () => (/* binding */ HOOK_PLUGIN_SETTINGS_SET) /* harmony export */ }); const HOOK_SETUP = 'devtools-plugin:setup'; const HOOK_PLUGIN_SETTINGS_SET = 'plugin:settings:set'; /***/ }), /***/ 10760: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ GA: () => (/* binding */ getTarget), /* harmony export */ cV: () => (/* binding */ isProxyAvailable), /* harmony export */ gl: () => (/* binding */ getDevtoolsGlobalHook) /* harmony export */ }); function getDevtoolsGlobalHook() { return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__; } function getTarget() { // @ts-expect-error navigator and windows are not available in all environments return typeof navigator !== 'undefined' && typeof window !== 'undefined' ? window : typeof globalThis !== 'undefined' ? globalThis : {}; } const isProxyAvailable = typeof Proxy === 'function'; /***/ }), /***/ 15920: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ isPerformanceSupported: () => (/* reexport safe */ _time_js__WEBPACK_IMPORTED_MODULE_0__.M), /* harmony export */ now: () => (/* reexport safe */ _time_js__WEBPACK_IMPORTED_MODULE_0__.k), /* harmony export */ setupDevtoolsPlugin: () => (/* binding */ setupDevtoolsPlugin) /* harmony export */ }); /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10760); /* harmony import */ var _const_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(25896); /* harmony import */ var _proxy_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(87885); /* harmony import */ var _time_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22264); function setupDevtoolsPlugin(pluginDescriptor, setupFn) { const descriptor = pluginDescriptor; const target = (0,_env_js__WEBPACK_IMPORTED_MODULE_1__/* .getTarget */ .GA)(); const hook = (0,_env_js__WEBPACK_IMPORTED_MODULE_1__/* .getDevtoolsGlobalHook */ .gl)(); const enableProxy = _env_js__WEBPACK_IMPORTED_MODULE_1__/* .isProxyAvailable */ .cV && descriptor.enableEarlyProxy; if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) { hook.emit(_const_js__WEBPACK_IMPORTED_MODULE_2__/* .HOOK_SETUP */ .c, pluginDescriptor, setupFn); } else { const proxy = enableProxy ? new _proxy_js__WEBPACK_IMPORTED_MODULE_3__/* .ApiProxy */ .G(descriptor, hook) : null; const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || []; list.push({ pluginDescriptor: descriptor, setupFn, proxy }); if (proxy) { setupFn(proxy.proxiedTarget); } } } /***/ }), /***/ 87885: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ G: () => (/* binding */ ApiProxy) /* harmony export */ }); /* harmony import */ var _const_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(25896); /* harmony import */ var _time_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22264); class ApiProxy { constructor(plugin, hook) { this.target = null; this.targetQueue = []; this.onQueue = []; this.plugin = plugin; this.hook = hook; const defaultSettings = {}; if (plugin.settings) { for (const id in plugin.settings) { const item = plugin.settings[id]; defaultSettings[id] = item.defaultValue; } } const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`; let currentSettings = Object.assign({}, defaultSettings); try { const raw = localStorage.getItem(localSettingsSaveId); const data = JSON.parse(raw); Object.assign(currentSettings, data); } catch (e) {// noop } this.fallbacks = { getSettings() { return currentSettings; }, setSettings(value) { try { localStorage.setItem(localSettingsSaveId, JSON.stringify(value)); } catch (e) {// noop } currentSettings = value; }, now() { return (0,_time_js__WEBPACK_IMPORTED_MODULE_0__/* .now */ .k)(); } }; if (hook) { hook.on(_const_js__WEBPACK_IMPORTED_MODULE_1__/* .HOOK_PLUGIN_SETTINGS_SET */ .o, (pluginId, value) => { if (pluginId === this.plugin.id) { this.fallbacks.setSettings(value); } }); } this.proxiedOn = new Proxy({}, { get: (_target, prop) => { if (this.target) { return this.target.on[prop]; } else { return (...args) => { this.onQueue.push({ method: prop, args }); }; } } }); this.proxiedTarget = new Proxy({}, { get: (_target, prop) => { if (this.target) { return this.target[prop]; } else if (prop === 'on') { return this.proxiedOn; } else if (Object.keys(this.fallbacks).includes(prop)) { return (...args) => { this.targetQueue.push({ method: prop, args, resolve: () => {} }); return this.fallbacks[prop](...args); }; } else { return (...args) => { return new Promise(resolve => { this.targetQueue.push({ method: prop, args, resolve }); }); }; } } }); } async setRealTarget(target) { this.target = target; for (const item of this.onQueue) { this.target.on[item.method](...item.args); } for (const item of this.targetQueue) { item.resolve(await this.target[item.method](...item.args)); } } } /***/ }), /***/ 22264: /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ M: () => (/* binding */ isPerformanceSupported), /* harmony export */ k: () => (/* binding */ now) /* harmony export */ }); let supported; let perf; function isPerformanceSupported() { var _a; if (supported !== undefined) { return supported; } if (typeof window !== 'undefined' && window.performance) { supported = true; perf = window.performance; } else if (typeof globalThis !== 'undefined' && ((_a = globalThis.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) { supported = true; perf = globalThis.perf_hooks.performance; } else { supported = false; } return supported; } function now() { return isPerformanceSupported() ? perf.now() : Date.now(); } /***/ }), /***/ 68936: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DevtoolsPluginApiInstance = exports.DevtoolsApi = void 0; const shared_utils_1 = __webpack_require__(20212); const devtools_api_1 = __webpack_require__(15920); const hooks_1 = __webpack_require__(39299); const pluginOn = []; class DevtoolsApi { constructor(backend, ctx) { this.stateEditor = new shared_utils_1.StateEditor(); this.backend = backend; this.ctx = ctx; this.bridge = ctx.bridge; this.on = new hooks_1.DevtoolsHookable(ctx); } async callHook(eventType, payload, ctx = this.ctx) { payload = await this.on.callHandlers(eventType, payload, ctx); for (const on of pluginOn) { payload = await on.callHandlers(eventType, payload, ctx); } return payload; } async transformCall(callName, ...args) { const payload = await this.callHook("transformCall" /* Hooks.TRANSFORM_CALL */ , { callName, inArgs: args, outArgs: args.slice() }); return payload.outArgs; } async getAppRecordName(app, defaultName) { const payload = await this.callHook("getAppRecordName" /* Hooks.GET_APP_RECORD_NAME */ , { app, name: null }); if (payload.name) { return payload.name; } else { return `App ${defaultName}`; } } async getAppRootInstance(app) { const payload = await this.callHook("getAppRootInstance" /* Hooks.GET_APP_ROOT_INSTANCE */ , { app, root: null }); return payload.root; } async registerApplication(app) { await this.callHook("registerApplication" /* Hooks.REGISTER_APPLICATION */ , { app }); } async walkComponentTree(instance, maxDepth = -1, filter = null, recursively = false) { const payload = await this.callHook("walkComponentTree" /* Hooks.WALK_COMPONENT_TREE */ , { componentInstance: instance, componentTreeData: null, maxDepth, filter, recursively }); return payload.componentTreeData; } async visitComponentTree(instance, treeNode, filter = null, app) { const payload = await this.callHook("visitComponentTree" /* Hooks.VISIT_COMPONENT_TREE */ , { app, componentInstance: instance, treeNode, filter }); return payload.treeNode; } async walkComponentParents(instance) { const payload = await this.callHook("walkComponentParents" /* Hooks.WALK_COMPONENT_PARENTS */ , { componentInstance: instance, parentInstances: [] }); return payload.parentInstances; } async inspectComponent(instance, app) { const payload = await this.callHook("inspectComponent" /* Hooks.INSPECT_COMPONENT */ , { app, componentInstance: instance, instanceData: null }); return payload.instanceData; } async getComponentBounds(instance) { const payload = await this.callHook("getComponentBounds" /* Hooks.GET_COMPONENT_BOUNDS */ , { componentInstance: instance, bounds: null }); return payload.bounds; } async getComponentName(instance) { const payload = await this.callHook("getComponentName" /* Hooks.GET_COMPONENT_NAME */ , { componentInstance: instance, name: null }); return payload.name; } async getComponentInstances(app) { const payload = await this.callHook("getComponentInstances" /* Hooks.GET_COMPONENT_INSTANCES */ , { app, componentInstances: [] }); return payload.componentInstances; } async getElementComponent(element) { const payload = await this.callHook("getElementComponent" /* Hooks.GET_ELEMENT_COMPONENT */ , { element, componentInstance: null }); return payload.componentInstance; } async getComponentRootElements(instance) { const payload = await this.callHook("getComponentRootElements" /* Hooks.GET_COMPONENT_ROOT_ELEMENTS */ , { componentInstance: instance, rootElements: [] }); return payload.rootElements; } async editComponentState(instance, dotPath, type, state, app) { const arrayPath = dotPath.split('.'); const payload = await this.callHook("editComponentState" /* Hooks.EDIT_COMPONENT_STATE */ , { app, componentInstance: instance, path: arrayPath, type, state, set: (object, path = arrayPath, value = state.value, cb) => this.stateEditor.set(object, path, value, cb || this.stateEditor.createDefaultSetCallback(state)) }); return payload.componentInstance; } async getComponentDevtoolsOptions(instance) { const payload = await this.callHook("getAppDevtoolsOptions" /* Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS */ , { componentInstance: instance, options: null }); return payload.options || {}; } async getComponentRenderCode(instance) { const payload = await this.callHook("getComponentRenderCode" /* Hooks.GET_COMPONENT_RENDER_CODE */ , { componentInstance: instance, code: null }); return { code: payload.code }; } async inspectTimelineEvent(eventData, app) { const payload = await this.callHook("inspectTimelineEvent" /* Hooks.INSPECT_TIMELINE_EVENT */ , { event: eventData.event, layerId: eventData.layerId, app, data: eventData.event.data, all: eventData.all }); return payload.data; } async clearTimeline() { await this.callHook("timelineCleared" /* Hooks.TIMELINE_CLEARED */ , {}); } async getInspectorTree(inspectorId, app, filter) { const payload = await this.callHook("getInspectorTree" /* Hooks.GET_INSPECTOR_TREE */ , { inspectorId, app, filter, rootNodes: [] }); return payload.rootNodes; } async getInspectorState(inspectorId, app, nodeId) { const payload = await this.callHook("getInspectorState" /* Hooks.GET_INSPECTOR_STATE */ , { inspectorId, app, nodeId, state: null }); return payload.state; } async editInspectorState(inspectorId, app, nodeId, dotPath, type, state) { const arrayPath = dotPath.split('.'); await this.callHook("editInspectorState" /* Hooks.EDIT_INSPECTOR_STATE */ , { inspectorId, app, nodeId, path: arrayPath, type, state, set: (object, path = arrayPath, value = state.value, cb) => this.stateEditor.set(object, path, value, cb || this.stateEditor.createDefaultSetCallback(state)) }); } now() { return (0, devtools_api_1.now)(); } } exports.DevtoolsApi = DevtoolsApi; class DevtoolsPluginApiInstance { constructor(plugin, appRecord, ctx) { this.bridge = ctx.bridge; this.ctx = ctx; this.plugin = plugin; this.appRecord = appRecord; this.backendApi = appRecord.backend.api; this.defaultSettings = (0, shared_utils_1.getPluginDefaultSettings)(plugin.descriptor.settings); this.on = new hooks_1.DevtoolsHookable(ctx, plugin); pluginOn.push(this.on); } // Plugin API async notifyComponentUpdate(instance = null) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.COMPONENTS)) { return; } if (instance) { this.ctx.hook.emit(shared_utils_1.HookEvents.COMPONENT_UPDATED, ...(await this.backendApi.transformCall(shared_utils_1.HookEvents.COMPONENT_UPDATED, instance))); } else { this.ctx.hook.emit(shared_utils_1.HookEvents.COMPONENT_UPDATED); } } addTimelineLayer(options) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.TIMELINE)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.TIMELINE_LAYER_ADDED, options, this.plugin); return true; } addTimelineEvent(options) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.TIMELINE)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.TIMELINE_EVENT_ADDED, options, this.plugin); return true; } addInspector(options) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.CUSTOM_INSPECTOR)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.CUSTOM_INSPECTOR_ADD, options, this.plugin); return true; } sendInspectorTree(inspectorId) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.CUSTOM_INSPECTOR)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.CUSTOM_INSPECTOR_SEND_TREE, inspectorId, this.plugin); return true; } sendInspectorState(inspectorId) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.CUSTOM_INSPECTOR)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.CUSTOM_INSPECTOR_SEND_STATE, inspectorId, this.plugin); return true; } selectInspectorNode(inspectorId, nodeId) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.CUSTOM_INSPECTOR)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.CUSTOM_INSPECTOR_SELECT_NODE, inspectorId, nodeId, this.plugin); return true; } getComponentBounds(instance) { return this.backendApi.getComponentBounds(instance); } getComponentName(instance) { return this.backendApi.getComponentName(instance); } getComponentInstances(app) { return this.backendApi.getComponentInstances(app); } highlightElement(instance) { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.COMPONENTS)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.COMPONENT_HIGHLIGHT, instance.__VUE_DEVTOOLS_UID__, this.plugin); return true; } unhighlightElement() { if (!this.enabled || !this.hasPermission(shared_utils_1.PluginPermission.COMPONENTS)) { return false; } this.ctx.hook.emit(shared_utils_1.HookEvents.COMPONENT_UNHIGHLIGHT, this.plugin); return true; } getSettings(pluginId) { return (0, shared_utils_1.getPluginSettings)(pluginId !== null && pluginId !== void 0 ? pluginId : this.plugin.descriptor.id, this.defaultSettings); } setSettings(value, pluginId) { (0, shared_utils_1.setPluginSettings)(pluginId !== null && pluginId !== void 0 ? pluginId : this.plugin.descriptor.id, value); } now() { return (0, devtools_api_1.now)(); } get enabled() { return (0, shared_utils_1.hasPluginPermission)(this.plugin.descriptor.id, shared_utils_1.PluginPermission.ENABLED); } hasPermission(permission) { return (0, shared_utils_1.hasPluginPermission)(this.plugin.descriptor.id, permission); } } exports.DevtoolsPluginApiInstance = DevtoolsPluginApiInstance; /***/ }), /***/ 51024: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), /***/ 5472: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createBackendContext = void 0; function createBackendContext(options) { return { bridge: options.bridge, hook: options.hook, backends: [], appRecords: [], currentTab: null, currentAppRecord: null, currentInspectedComponentId: null, plugins: [], currentPlugin: null, timelineLayers: [], nextTimelineEventId: 0, timelineEventMap: new Map(), perfUniqueGroupId: 0, customInspectors: [], timelineMarkers: [] }; } exports.createBackendContext = createBackendContext; /***/ }), /***/ 48388: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createBackend = exports.defineBackend = exports.BuiltinBackendFeature = void 0; const api_1 = __webpack_require__(68936); var BuiltinBackendFeature; (function (BuiltinBackendFeature) { /** * @deprecated */ BuiltinBackendFeature["FLUSH"] = "flush"; })(BuiltinBackendFeature || (exports.BuiltinBackendFeature = BuiltinBackendFeature = {})); function defineBackend(options) { return options; } exports.defineBackend = defineBackend; function createBackend(options, ctx) { const backend = { options, api: null }; backend.api = new api_1.DevtoolsApi(backend, ctx); options.setup(backend.api); return backend; } exports.createBackend = createBackend; /***/ }), /***/ 8776: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), /***/ 39299: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DevtoolsHookable = void 0; const shared_utils_1 = __webpack_require__(20212); class DevtoolsHookable { constructor(ctx, plugin = null) { this.handlers = {}; this.ctx = ctx; this.plugin = plugin; } hook(eventType, handler, pluginPermision = null) { const handlers = this.handlers[eventType] = this.handlers[eventType] || []; if (this.plugin) { const originalHandler = handler; handler = (...args) => { var _a; // Plugin permission if (!(0, shared_utils_1.hasPluginPermission)(this.plugin.descriptor.id, shared_utils_1.PluginPermission.ENABLED) || pluginPermision && !(0, shared_utils_1.hasPluginPermission)(this.plugin.descriptor.id, pluginPermision)) { return; } // App scope if (!this.plugin.descriptor.disableAppScope && ((_a = this.ctx.currentAppRecord) === null || _a === void 0 ? void 0 : _a.options.app) !== this.plugin.descriptor.app) { return; } // Plugin scope if (!this.plugin.descriptor.disablePluginScope && args[0].pluginId != null && args[0].pluginId !== this.plugin.descriptor.id) { return; } return originalHandler(...args); }; } handlers.push({ handler, plugin: this.ctx.currentPlugin }); } async callHandlers(eventType, payload, ctx) { if (this.handlers[eventType]) { const handlers = this.handlers[eventType]; for (let i = 0; i < handlers.length; i++) { const { handler, plugin } = handlers[i]; try { await handler(payload, ctx); } catch (e) { if (shared_utils_1.SharedData.debugInfo) { console.error(`An error occurred in hook '${eventType}'${plugin ? ` registered by plugin '${plugin.descriptor.id}'` : ''} with payload:`, payload); console.error(e); } } } } return payload; } transformCall(handler) { this.hook("transformCall" /* Hooks.TRANSFORM_CALL */ , handler); } getAppRecordName(handler) { this.hook("getAppRecordName" /* Hooks.GET_APP_RECORD_NAME */ , handler); } getAppRootInstance(handler) { this.hook("getAppRootInstance" /* Hooks.GET_APP_ROOT_INSTANCE */ , handler); } registerApplication(handler) { this.hook("registerApplication" /* Hooks.REGISTER_APPLICATION */ , handler); } walkComponentTree(handler) { this.hook("walkComponentTree" /* Hooks.WALK_COMPONENT_TREE */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } visitComponentTree(handler) { this.hook("visitComponentTree" /* Hooks.VISIT_COMPONENT_TREE */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } walkComponentParents(handler) { this.hook("walkComponentParents" /* Hooks.WALK_COMPONENT_PARENTS */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } inspectComponent(handler) { this.hook("inspectComponent" /* Hooks.INSPECT_COMPONENT */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentBounds(handler) { this.hook("getComponentBounds" /* Hooks.GET_COMPONENT_BOUNDS */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentName(handler) { this.hook("getComponentName" /* Hooks.GET_COMPONENT_NAME */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentInstances(handler) { this.hook("getComponentInstances" /* Hooks.GET_COMPONENT_INSTANCES */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getElementComponent(handler) { this.hook("getElementComponent" /* Hooks.GET_ELEMENT_COMPONENT */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentRootElements(handler) { this.hook("getComponentRootElements" /* Hooks.GET_COMPONENT_ROOT_ELEMENTS */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } editComponentState(handler) { this.hook("editComponentState" /* Hooks.EDIT_COMPONENT_STATE */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentDevtoolsOptions(handler) { this.hook("getAppDevtoolsOptions" /* Hooks.GET_COMPONENT_DEVTOOLS_OPTIONS */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } getComponentRenderCode(handler) { this.hook("getComponentRenderCode" /* Hooks.GET_COMPONENT_RENDER_CODE */ , handler, shared_utils_1.PluginPermission.COMPONENTS); } inspectTimelineEvent(handler) { this.hook("inspectTimelineEvent" /* Hooks.INSPECT_TIMELINE_EVENT */ , handler, shared_utils_1.PluginPermission.TIMELINE); } timelineCleared(handler) { this.hook("timelineCleared" /* Hooks.TIMELINE_CLEARED */ , handler, shared_utils_1.PluginPermission.TIMELINE); } getInspectorTree(handler) { this.hook("getInspectorTree" /* Hooks.GET_INSPECTOR_TREE */ , handler, shared_utils_1.PluginPermission.CUSTOM_INSPECTOR); } getInspectorState(handler) { this.hook("getInspectorState" /* Hooks.GET_INSPECTOR_STATE */ , handler, shared_utils_1.PluginPermission.CUSTOM_INSPECTOR); } editInspectorState(handler) { this.hook("editInspectorState" /* Hooks.EDIT_INSPECTOR_STATE */ , handler, shared_utils_1.PluginPermission.CUSTOM_INSPECTOR); } setPluginSettings(handler) { this.hook("setPluginSettings" /* Hooks.SET_PLUGIN_SETTINGS */ , handler); } } exports.DevtoolsHookable = DevtoolsHookable; /***/ }), /***/ 81016: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function () { return m[k]; } }; } Object.defineProperty(o, k2, desc); } : function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); var __exportStar = this && this.__exportStar || function (m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__webpack_require__(68936), exports); __exportStar(__webpack_require__(51024), exports); __exportStar(__webpack_require__(48388), exports); __exportStar(__webpack_require__(5472), exports); __exportStar(__webpack_require__(8776), exports); __exportStar(__webpack_require__(39299), exports); __exportStar(__webpack_require__(54672), exports); /***/ }), /***/ 54672: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); /***/ }), /***/ 28424: /***/ (function(__unused_webpack_module, exports, __webpack_require__) { "use strict"; var __importDefault = this && this.__importDefault || function (mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports._legacy_getAndRegisterApps = exports.removeApp = exports.sendApps = exports.waitForAppsRegistration = exports.getAppRecord = exports.getAppRecordId = exports.mapAppRecord = exports.selectApp = exports.registerApp = void 0; const shared_utils_1 = __webpack_require__(20212); const speakingurl_1 = __importDefault(__webpack_require__(5624)); const queue_1 = __webpack_require__(96784); const scan_1 = __webpack_require__(38016); const timeline_1 = __webpack_require__(54952); const backend_1 = __webpack_require__(62144); const global_hook_js_1 = __webpack_require__(47480); const component_js_1 = __webpack_require__(61056); const jobs = new queue_1.JobQueue(); let recordId = 0; const appRecordPromises = new Map(); async function registerApp(options, ctx) { return jobs.queue('regiserApp', () => registerAppJob(options, ctx)); } exports.registerApp = registerApp; async function registerAppJob(options, ctx) { // Dedupe if (ctx.appRecords.find(a => a.options.app === options.app)) { return; } if (!options.version) { throw new Error('[Vue Devtools] Vue version not found'); } // Find correct backend const baseFrameworkVersion = Number.parseInt(options.version.substring(0, options.version.indexOf('.'))); for (let i = 0; i < backend_1.availableBackends.length; i++) { const backendOptions = backend_1.availableBackends[i]; if (backendOptions.frameworkVersion === baseFrameworkVersion) { // Enable backend if it's not enabled const backend = (0, backend_1.getBackend)(backendOptions, ctx); await createAppRecord(options, backend, ctx); break; } } } async function createAppRecord(options, backend, ctx) { var _a, _b, _c; const rootInstance = await backend.api.getAppRootInstance(options.app); if (rootInstance) { if ((await backend.api.getComponentDevtoolsOptions(rootInstance)).hide) { options.app._vueDevtools_hidden_ = true; return; } recordId++; const name = await backend.api.getAppRecordName(options.app, recordId.toString()); const id = getAppRecordId(options.app, (0, speakingurl_1.default)(name)); const [el] = await backend.api.getComponentRootElements(rootInstance); const instanceMapRaw = new Map(); const record = { id, name, options, backend, lastInspectedComponentId: null, instanceMap: new Proxy(instanceMapRaw, { get(target, key) { if (key === 'set') { return (instanceId, instance) => { target.set(instanceId, instance); // The component was requested by the frontend before it was registered if (record.missingInstanceQueue.has(instanceId)) { record.missingInstanceQueue.delete(instanceId); if (ctx.currentAppRecord === record) { (0, component_js_1.sendComponentTreeData)(record, instanceId, record.componentFilter, null, false, ctx); if (record.lastInspectedComponentId === instanceId) { (0, component_js_1.sendSelectedComponentData)(record, instanceId, ctx); } } } }; } return target[key].bind(target); } }), rootInstance, perfGroupIds: new Map(), iframe: shared_utils_1.isBrowser && document !== (el === null || el === void 0 ? void 0 : el.ownerDocument) ? (_b = (_a = el === null || el === void 0 ? void 0 : el.ownerDocument) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.pathname : null, meta: (_c = options.meta) !== null && _c !== void 0 ? _c : {}, missingInstanceQueue: new Set() }; options.app.__VUE_DEVTOOLS_APP_RECORD__ = record; const rootId = `${record.id}:root`; record.instanceMap.set(rootId, record.rootInstance); record.rootInstance.__VUE_DEVTOOLS_UID__ = rootId; // Timeline (0, timeline_1.addBuiltinLayers)(record, ctx); ctx.appRecords.push(record); if (backend.options.setupApp) { backend.options.setupApp(backend.api, record); } await backend.api.registerApplication(options.app); ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_APP_ADD, { appRecord: mapAppRecord(record) }); // Auto select first app if (ctx.currentAppRecord == null) { await selectApp(record, ctx); } if (appRecordPromises.has(options.app)) { for (const r of appRecordPromises.get(options.app)) { await r(record); } } } else if (shared_utils_1.SharedData.debugInfo) { console.warn('[Vue devtools] No root instance found for app, it might have been unmounted', options.app); } } async function selectApp(record, ctx) { ctx.currentAppRecord = record; ctx.currentInspectedComponentId = record.lastInspectedComponentId; ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_APP_SELECTED, { id: record.id, lastInspectedComponentId: record.lastInspectedComponentId }); } exports.selectApp = selectApp; function mapAppRecord(record) { return { id: record.id, name: record.name, version: record.options.version, iframe: record.iframe }; } exports.mapAppRecord = mapAppRecord; const appIds = new Set(); function getAppRecordId(app, defaultId) { if (app.__VUE_DEVTOOLS_APP_RECORD_ID__ != null) { return app.__VUE_DEVTOOLS_APP_RECORD_ID__; } let id = defaultId !== null && defaultId !== void 0 ? defaultId : (recordId++).toString(); if (defaultId && appIds.has(id)) { let count = 1; while (appIds.has(`${defaultId}_${count}`)) { count++; } id = `${defaultId}_${count}`; } appIds.add(id); app.__VUE_DEVTOOLS_APP_RECORD_ID__ = id; return id; } exports.getAppRecordId = getAppRecordId; async function getAppRecord(app, ctx) { var _a; const record = (_a = app.__VUE_DEVTOOLS_APP_RECORD__) !== null && _a !== void 0 ? _a : ctx.appRecords.find(ar => ar.options.app === app); if (record) { return record; } if (app._vueDevtools_hidden_) { return null; } return new Promise((resolve, reject) => { let resolvers = appRecordPromises.get(app); let timedOut = false; if (!resolvers) { resolvers = []; appRecordPromises.set(app, resolvers); } let timer; const fn = record => { if (!timedOut) { clearTimeout(timer); resolve(record); } }; resolvers.push(fn); timer = setTimeout(() => { timedOut = true; const index = resolvers.indexOf(fn); if (index !== -1) { resolvers.splice(index, 1); } if (shared_utils_1.SharedData.debugInfo) { // eslint-disable-next-line no-console console.log('Timed out waiting for app record', app); } reject(new Error(`Timed out getting app record for app`)); }, 60000); }); } exports.getAppRecord = getAppRecord; function waitForAppsRegistration() { return jobs.queue('waitForAppsRegistrationNoop', async () => {}); } exports.waitForAppsRegistration = waitForAppsRegistration; async function sendApps(ctx) { const appRecords = []; for (const appRecord of ctx.appRecords) { appRecords.push(appRecord); } ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_APP_LIST, { apps: appRecords.map(mapAppRecord) }); } exports.sendApps = sendApps; function removeAppRecord(appRecord, ctx) { try { appIds.delete(appRecord.id); const index = ctx.appRecords.indexOf(appRecord); if (index !== -1) { ctx.appRecords.splice(index, 1); } (0, timeline_1.removeLayersForApp)(appRecord.options.app, ctx); ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_APP_REMOVE, { id: appRecord.id }); } catch (e) { if (shared_utils_1.SharedData.debugInfo) { console.error(e); } } } async function removeApp(app, ctx) { try { const appRecord = await getAppRecord(app, ctx); if (appRecord) { removeAppRecord(appRecord, ctx); } } catch (e) { if (shared_utils_1.SharedData.debugInfo) { console.error(e); } } } exports.removeApp = removeApp; let scanTimeout; function _legacy_getAndRegisterApps(ctx, clear = false) { setTimeout(() => { try { if (clear) { // Remove apps that are legacy ctx.appRecords.forEach(appRecord => { if (appRecord.meta.Vue) { removeAppRecord(appRecord, ctx); } }); } const apps = (0, scan_1.scan)(); clearTimeout(scanTimeout); if (!apps.length) { scanTimeout = setTimeout(() => _legacy_getAndRegisterApps(ctx), 1000); } apps.forEach(app => { const Vue = global_hook_js_1.hook.Vue; registerApp({ app, types: {}, version: Vue === null || Vue === void 0 ? void 0 : Vue.version, meta: { Vue } }, ctx); }); } catch (e) { if (shared_utils_1.SharedData.debugInfo) { console.error(`Error scanning for legacy apps:`); console.error(e); } } }, 0); } exports._legacy_getAndRegisterApps = _legacy_getAndRegisterApps; /***/ }), /***/ 62144: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getBackend = exports.availableBackends = void 0; const app_backend_api_1 = __webpack_require__(81016); const app_backend_vue1_1 = __webpack_require__(31500); const app_backend_vue2_1 = __webpack_require__(5392); const app_backend_vue3_1 = __webpack_require__(99440); const perf_1 = __webpack_require__(3348); exports.availableBackends = [app_backend_vue1_1.backend, app_backend_vue2_1.backend, app_backend_vue3_1.backend]; const enabledBackends = new Map(); function getBackend(backendOptions, ctx) { let backend; if (!enabledBackends.has(backendOptions)) { // Create backend backend = (0, app_backend_api_1.createBackend)(backendOptions, ctx); (0, perf_1.handleAddPerformanceTag)(backend, ctx); enabledBackends.set(backendOptions, backend); ctx.backends.push(backend); } else { backend = enabledBackends.get(backendOptions); } return backend; } exports.getBackend = getBackend; /***/ }), /***/ 21896: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); const shared_utils_1 = __webpack_require__(20212); const highlighter_1 = __webpack_require__(81892); class ComponentPicker { constructor(ctx) { this.ctx = ctx; this.bindMethods(); } /** * Adds event listeners for mouseover and mouseup */ startSelecting() { if (!shared_utils_1.isBrowser) { return; } window.addEventListener('mouseover', this.elementMouseOver, true); window.addEventListener('click', this.elementClicked, true); window.addEventListener('mouseout', this.cancelEvent, true); window.addEventListener('mouseenter', this.cancelEvent, true); window.addEventListener('mouseleave', this.cancelEvent, true); window.addEventListener('mousedown', this.cancelEvent, true); window.addEventListener('mouseup', this.cancelEvent, true); } /** * Removes event listeners */ stopSelecting() { if (!shared_utils_1.isBrowser) { return; } window.removeEventListener('mouseover', this.elementMouseOver, true); window.removeEventListener('click', this.elementClicked, true); window.removeEventListener('mouseout', this.cancelEvent, true); window.removeEventListener('mouseenter', this.cancelEvent, true); window.removeEventListener('mouseleave', this.cancelEvent, true); window.removeEventListener('mousedown', this.cancelEvent, true); window.removeEventListener('mouseup', this.cancelEvent, true); (0, highlighter_1.unHighlight)(); } /** * Highlights a component on element mouse over */ async elementMouseOver(e) { this.cancelEvent(e); const el = e.target; if (el) { await this.selectElementComponent(el); } (0, highlighter_1.unHighlight)(); if (this.selectedInstance) { (0, highlighter_1.highlight)(this.selectedInstance, this.selectedBackend, this.ctx); } } async selectElementComponent(el) { for (const backend of this.ctx.backends) { const instance = await backend.api.getElementComponent(el); if (instance) { this.selectedInstance = instance; this.selectedBackend = backend; return; } } this.selectedInstance = null; this.selectedBackend = null; } /** * Selects an instance in the component view */ async elementClicked(e) { this.cancelEvent(e); if (this.selectedInstance && this.selectedBackend) { const parentInstances = await this.selectedBackend.api.walkComponentParents(this.selectedInstance); this.ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_PICK, { id: this.selectedInstance.__VUE_DEVTOOLS_UID__, parentIds: parentInstances.map(i => i.__VUE_DEVTOOLS_UID__) }); } else { this.ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_PICK_CANCELED, null); } this.stopSelecting(); } /** * Cancel a mouse event */ cancelEvent(e) { e.stopImmediatePropagation(); e.preventDefault(); } /** * Bind class methods to the class scope to avoid rebind for event listeners */ bindMethods() { this.startSelecting = this.startSelecting.bind(this); this.stopSelecting = this.stopSelecting.bind(this); this.elementMouseOver = this.elementMouseOver.bind(this); this.elementClicked = this.elementClicked.bind(this); } } exports["default"] = ComponentPicker; /***/ }), /***/ 61056: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.sendComponentUpdateTracking = exports.refreshComponentTreeSearch = exports.getComponentInstance = exports.getComponentId = exports.editComponentState = exports.sendEmptyComponentData = exports.markSelectedInstance = exports.sendSelectedComponentData = exports.sendComponentTreeData = void 0; const shared_utils_1 = __webpack_require__(20212); const app_backend_api_1 = __webpack_require__(81016); const app_1 = __webpack_require__(28424); const MAX_$VM = 10; const $vmQueue = []; async function sendComponentTreeData(appRecord, instanceId, filter = '', maxDepth = null, recursively = false, ctx) { if (!instanceId || appRecord !== ctx.currentAppRecord) { return; } // Flush will send all components in the tree // So we skip individiual tree updates if (instanceId !== '_root' && ctx.currentAppRecord.backend.options.features.includes(app_backend_api_1.BuiltinBackendFeature.FLUSH)) { return; } const instance = getComponentInstance(appRecord, instanceId, ctx); if (!instance) { ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_TREE, { instanceId, treeData: null, notFound: true }); } else { if (filter) { filter = filter.toLowerCase(); } if (maxDepth == null) { maxDepth = instance === ctx.currentAppRecord.rootInstance ? 2 : 1; } const data = await appRecord.backend.api.walkComponentTree(instance, maxDepth, filter, recursively); const payload = { instanceId, treeData: (0, shared_utils_1.stringify)(data) }; ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_TREE, payload); } } exports.sendComponentTreeData = sendComponentTreeData; async function sendSelectedComponentData(appRecord, instanceId, ctx) { if (!instanceId || appRecord !== ctx.currentAppRecord) { return; } const instance = getComponentInstance(appRecord, instanceId, ctx); if (!instance) { sendEmptyComponentData(instanceId, ctx); } else { // Expose instance on window if (typeof window !== 'undefined') { const win = window; win.$vm = instance; // $vm0, $vm1, $vm2, ... if ($vmQueue[0] !== instance) { if ($vmQueue.length >= MAX_$VM) { $vmQueue.pop(); } for (let i = $vmQueue.length; i > 0; i--) { win[`$vm${i}`] = $vmQueue[i] = $vmQueue[i - 1]; } win.$vm0 = $vmQueue[0] = instance; } } if (shared_utils_1.SharedData.debugInfo) { // eslint-disable-next-line no-console console.log('[DEBUG] inspect', instance); } const parentInstances = await appRecord.backend.api.walkComponentParents(instance); const payload = { instanceId, data: (0, shared_utils_1.stringify)(await appRecord.backend.api.inspectComponent(instance, ctx.currentAppRecord.options.app)), parentIds: parentInstances.map(i => i.__VUE_DEVTOOLS_UID__) }; ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_SELECTED_DATA, payload); markSelectedInstance(instanceId, ctx); } } exports.sendSelectedComponentData = sendSelectedComponentData; function markSelectedInstance(instanceId, ctx) { ctx.currentInspectedComponentId = instanceId; ctx.currentAppRecord.lastInspectedComponentId = instanceId; } exports.markSelectedInstance = markSelectedInstance; function sendEmptyComponentData(instanceId, ctx) { ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_SELECTED_DATA, { instanceId, data: null }); } exports.sendEmptyComponentData = sendEmptyComponentData; async function editComponentState(instanceId, dotPath, type, state, ctx) { if (!instanceId) { return; } const instance = getComponentInstance(ctx.currentAppRecord, instanceId, ctx); if (instance) { if ('value' in state && state.value != null) { state.value = (0, shared_utils_1.parse)(state.value, true); } await ctx.currentAppRecord.backend.api.editComponentState(instance, dotPath, type, state, ctx.currentAppRecord.options.app); await sendSelectedComponentData(ctx.currentAppRecord, instanceId, ctx); } } exports.editComponentState = editComponentState; async function getComponentId(app, uid, instance, ctx) { try { if (instance.__VUE_DEVTOOLS_UID__) { return instance.__VUE_DEVTOOLS_UID__; } const appRecord = await (0, app_1.getAppRecord)(app, ctx); if (!appRecord) { return null; } const isRoot = appRecord.rootInstance === instance; return `${appRecord.id}:${isRoot ? 'root' : uid}`; } catch (e) { if (shared_utils_1.SharedData.debugInfo) { console.error(e); } return null; } } exports.getComponentId = getComponentId; function getComponentInstance(appRecord, instanceId, _ctx) { if (instanceId === '_root') { instanceId = `${appRecord.id}:root`; } const instance = appRecord.instanceMap.get(instanceId); if (!instance) { appRecord.missingInstanceQueue.add(instanceId); if (shared_utils_1.SharedData.debugInfo) { console.warn(`Instance uid=${instanceId} not found`); } } return instance; } exports.getComponentInstance = getComponentInstance; async function refreshComponentTreeSearch(ctx) { if (!ctx.currentAppRecord.componentFilter) { return; } await sendComponentTreeData(ctx.currentAppRecord, '_root', ctx.currentAppRecord.componentFilter, null, false, ctx); } exports.refreshComponentTreeSearch = refreshComponentTreeSearch; const updateTrackingQueue = (0, shared_utils_1.createThrottleQueue)(500); function sendComponentUpdateTracking(instanceId, time, ctx) { if (!instanceId) { return; } updateTrackingQueue.add(instanceId, () => { const payload = { instanceId, time }; ctx.bridge.send(shared_utils_1.BridgeEvents.TO_FRONT_COMPONENT_UPDATED, payload); }); } exports.sendComponentUpdateTracking = sendComponentUpdateTracking; /***/ }), /***/ 900: /***/ ((__unused_webpack_module, exports) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.flashComponent = void 0; async function flashComponent(instance, backend) { const bounds = await backend.api.getComponentBounds(instance); if (bounds) { let overlay = instance.__VUE_DEVTOOLS_FLASH; if (!overlay) { overlay = document.createElement('div'); instance.__VUE_DEVTOOLS_FLASH = overlay; overlay.style.border = '2px rgba(65, 184, 131, 0.7) solid'; overlay.style.position = 'fixed'; overlay.style.zIndex = '99999999999998'; overlay.style.pointerEvents = 'none'; overlay.style.borderRadius = '3px'; overlay.style.boxSizing = 'border-box'; document.body.appendChild(overlay); } overlay.style.opacity = '1'; overlay.style.transition = null; overlay.style.width = `${Math.round(bounds.width)}px`; overlay.style.height = `${Math.round(bounds.height)}px`; overlay.style.left = `${Math.round(bounds.left)}px`; overlay.style.top = `${Math.round(bounds.top)}px`; requestAnimationFrame(() => { overlay.style.transition = 'opacity 1s'; overlay.style.opacity = '0'; }); clearTimeout(overlay._timer); overlay._timer = setTimeout(() => { document.body.removeChild(overlay); instance.__VUE_DEVTOOLS_FLASH = null; }, 1000); } } exports.flashComponent = flashComponent; /***/ }), /***/ 47480: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.hook = void 0; const shared_utils_1 = __webpack_require__(20212); // hook should have been injected before this executes. exports.hook = shared_utils_1.target.__VUE_DEVTOOLS_GLOBAL_HOOK__; /***/ }), /***/ 81892: /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.unHighlight = exports.highlight = void 0; const shared_utils_1 = __webpack_require__(20212); const queue_1 = __webpack_require__(96784); let overlay; let overlayContent; let currentInstance; function createOverlay() { if (overlay || !shared_utils_1.isBrowser) { return; } overlay = document.createElement('div'); overlay.style.backgroundColor = 'rgba(65, 184, 131, 0.35)'; overlay.style.position = 'fixed'; overlay.style.zIndex = '99999999999998'; overlay.style.pointerEvents = 'none'; overlay.style.borderRadius = '3px'; overlayContent = document.createElement('div'); overlayContent.style.posit