You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.9 KiB

2 weeks ago
  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. var desc = Object.getOwnPropertyDescriptor(m, k);
  5. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  6. desc = { enumerable: true, get: function() { return m[k]; } };
  7. }
  8. Object.defineProperty(o, k2, desc);
  9. }) : (function(o, m, k, k2) {
  10. if (k2 === undefined) k2 = k;
  11. o[k2] = m[k];
  12. }));
  13. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  14. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  15. };
  16. Object.defineProperty(exports, "__esModule", { value: true });
  17. exports.setupDevtoolsPlugin = void 0;
  18. const env_js_1 = require("./env.js");
  19. const const_js_1 = require("./const.js");
  20. const proxy_js_1 = require("./proxy.js");
  21. __exportStar(require("./api/index.js"), exports);
  22. __exportStar(require("./plugin.js"), exports);
  23. __exportStar(require("./time.js"), exports);
  24. function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
  25. const descriptor = pluginDescriptor;
  26. const target = (0, env_js_1.getTarget)();
  27. const hook = (0, env_js_1.getDevtoolsGlobalHook)();
  28. const enableProxy = env_js_1.isProxyAvailable && descriptor.enableEarlyProxy;
  29. if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
  30. hook.emit(const_js_1.HOOK_SETUP, pluginDescriptor, setupFn);
  31. }
  32. else {
  33. const proxy = enableProxy ? new proxy_js_1.ApiProxy(descriptor, hook) : null;
  34. const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
  35. list.push({
  36. pluginDescriptor: descriptor,
  37. setupFn,
  38. proxy,
  39. });
  40. if (proxy) {
  41. setupFn(proxy.proxiedTarget);
  42. }
  43. }
  44. }
  45. exports.setupDevtoolsPlugin = setupDevtoolsPlugin;