JM-MiniApp/node_modules/@vue/devtools-api/lib/cjs/index.js
2023-10-08 21:21:21 +08:00

45 lines
1.9 KiB
JavaScript

"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 });
exports.setupDevtoolsPlugin = void 0;
const env_js_1 = require("./env.js");
const const_js_1 = require("./const.js");
const proxy_js_1 = require("./proxy.js");
__exportStar(require("./api/index.js"), exports);
__exportStar(require("./plugin.js"), exports);
__exportStar(require("./time.js"), exports);
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
const descriptor = pluginDescriptor;
const target = (0, env_js_1.getTarget)();
const hook = (0, env_js_1.getDevtoolsGlobalHook)();
const enableProxy = env_js_1.isProxyAvailable && descriptor.enableEarlyProxy;
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
hook.emit(const_js_1.HOOK_SETUP, pluginDescriptor, setupFn);
}
else {
const proxy = enableProxy ? new proxy_js_1.ApiProxy(descriptor, hook) : null;
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
list.push({
pluginDescriptor: descriptor,
setupFn,
proxy,
});
if (proxy)
setupFn(proxy.proxiedTarget);
}
}
exports.setupDevtoolsPlugin = setupDevtoolsPlugin;