@vue/devtools-kit 7.0.27 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -33,9 +33,9 @@ var __toESM = (mod, isNodeMode, target10) => (target10 = mod != null ? __create(
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.4/node_modules/tsup/assets/cjs_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js
37
37
  var init_cjs_shims = __esm({
38
- "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.4/node_modules/tsup/assets/cjs_shims.js"() {
38
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/cjs_shims.js"() {
39
39
  "use strict";
40
40
  }
41
41
  });
@@ -1581,6 +1581,9 @@ var require_speakingurl2 = __commonJS({
1581
1581
  // src/index.ts
1582
1582
  var src_exports = {};
1583
1583
  __export(src_exports, {
1584
+ INFINITY: () => INFINITY,
1585
+ NAN: () => NAN,
1586
+ NEGATIVE_INFINITY: () => NEGATIVE_INFINITY,
1584
1587
  UNDEFINED: () => UNDEFINED,
1585
1588
  addCustomCommand: () => addCustomCommand,
1586
1589
  addCustomTab: () => addCustomTab,
@@ -1588,11 +1591,13 @@ __export(src_exports, {
1588
1591
  formatInspectorStateValue: () => formatInspectorStateValue,
1589
1592
  getInspectorStateValueType: () => getInspectorStateValueType,
1590
1593
  getRaw: () => getRaw,
1594
+ isPlainObject: () => isPlainObject,
1591
1595
  onDevToolsClientConnected: () => onDevToolsClientConnected,
1592
1596
  onDevToolsConnected: () => onDevToolsConnected,
1593
1597
  parse: () => parse,
1594
1598
  removeCustomCommand: () => removeCustomCommand,
1595
1599
  setDevToolsEnv: () => setDevToolsEnv,
1600
+ setOpenInEditorBaseUrl: () => setOpenInEditorBaseUrl,
1596
1601
  setupDevToolsPlugin: () => setupDevToolsPlugin,
1597
1602
  stringify: () => stringify,
1598
1603
  toEdit: () => toEdit,
@@ -1640,6 +1645,9 @@ var on = {
1640
1645
  vueAppInit(fn) {
1641
1646
  devtoolsHooks.hook("app:init" /* APP_INIT */, fn);
1642
1647
  },
1648
+ vueAppUnmount(fn) {
1649
+ devtoolsHooks.hook("app:unmount" /* APP_UNMOUNT */, fn);
1650
+ },
1643
1651
  vueAppConnected(fn) {
1644
1652
  devtoolsHooks.hook("app:connected" /* APP_CONNECTED */, fn);
1645
1653
  },
@@ -1701,6 +1709,9 @@ function subscribeDevToolsHook() {
1701
1709
  return;
1702
1710
  devtoolsHooks.callHook("app:init" /* APP_INIT */, app, version);
1703
1711
  });
1712
+ hook2.on("app:unmount" /* APP_UNMOUNT */, (app) => {
1713
+ devtoolsHooks.callHook("app:unmount" /* APP_UNMOUNT */, app);
1714
+ });
1704
1715
  hook2.on("component:added" /* COMPONENT_ADDED */, async (app, uid, parentUid, component) => {
1705
1716
  var _a10, _b10, _c;
1706
1717
  if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
@@ -1783,6 +1794,11 @@ var import_devtools_shared2 = require("@vue/devtools-shared");
1783
1794
  var import_hookable2 = require("hookable");
1784
1795
  var _a2, _b2;
1785
1796
  var apiHooks = (_b2 = (_a2 = import_devtools_shared2.target).__VUE_DEVTOOLS_API_HOOK) != null ? _b2 : _a2.__VUE_DEVTOOLS_API_HOOK = (0, import_hookable2.createHooks)();
1797
+ var instanceHooks = [];
1798
+ var registerInstanceHook = (...args) => {
1799
+ const unregister = apiHooks.hook(...args);
1800
+ instanceHooks.push(unregister);
1801
+ };
1786
1802
 
1787
1803
  // src/core/router/index.ts
1788
1804
  function getRoutes(router) {
@@ -1817,7 +1833,7 @@ function filterCurrentRoute(route) {
1817
1833
  }
1818
1834
  return route;
1819
1835
  }
1820
- function normalizeRouterInfo(appRecord) {
1836
+ function normalizeRouterInfo(appRecord, state) {
1821
1837
  function init() {
1822
1838
  var _a10;
1823
1839
  const router = (_a10 = appRecord.app) == null ? void 0 : _a10.config.globalProperties.$router;
@@ -1835,6 +1851,9 @@ function normalizeRouterInfo(appRecord) {
1835
1851
  }
1836
1852
  init();
1837
1853
  hook.on.componentUpdated((0, import_perfect_debounce.debounce)(() => {
1854
+ var _a10;
1855
+ if (((_a10 = state.activeAppRecord) == null ? void 0 : _a10.app) !== appRecord.app)
1856
+ return;
1838
1857
  init();
1839
1858
  apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, import_devtools_shared3.target[ROUTER_INFO_KEY]);
1840
1859
  }, 200));
@@ -1965,7 +1984,7 @@ function getInstanceName(instance) {
1965
1984
  function getUniqueComponentId(instance) {
1966
1985
  var _a10, _b10, _c;
1967
1986
  const appId = (_c = (_b10 = (_a10 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a10.app) == null ? void 0 : _b10.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__) != null ? _c : 0;
1968
- const instanceId = instance === instance.root ? "root" : instance.uid;
1987
+ const instanceId = instance === (instance == null ? void 0 : instance.root) ? "root" : instance.uid;
1969
1988
  return `${appId}:${instanceId}`;
1970
1989
  }
1971
1990
  function getRenderKey(value) {
@@ -2714,7 +2733,7 @@ function processSetupState(instance) {
2714
2733
  const value = returnError(() => toRaw2(instance.setupState[key]));
2715
2734
  const rawData = raw[key];
2716
2735
  let result;
2717
- let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2736
+ let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
2718
2737
  if (rawData) {
2719
2738
  const info = getSetupStateType(rawData);
2720
2739
  const { stateType, stateTypeName } = getStateTypeAndName(info);
@@ -3256,6 +3275,12 @@ function selectComponentFn(e, cb) {
3256
3275
  });
3257
3276
  }
3258
3277
  }
3278
+ var inspectComponentHighLighterSelectFn = null;
3279
+ function cancelInspectComponentHighLighter() {
3280
+ window.removeEventListener("mouseover", inspectFn);
3281
+ window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
3282
+ inspectComponentHighLighterSelectFn = null;
3283
+ }
3259
3284
  function inspectComponentHighLighter() {
3260
3285
  window.addEventListener("mouseover", inspectFn);
3261
3286
  return new Promise((resolve) => {
@@ -3264,6 +3289,7 @@ function inspectComponentHighLighter() {
3264
3289
  e.stopPropagation();
3265
3290
  selectComponentFn(e, (id) => {
3266
3291
  window.removeEventListener("click", onSelect, true);
3292
+ inspectComponentHighLighterSelectFn = null;
3267
3293
  window.removeEventListener("mouseover", inspectFn);
3268
3294
  const el = getContainerElement();
3269
3295
  if (el)
@@ -3271,6 +3297,7 @@ function inspectComponentHighLighter() {
3271
3297
  resolve(JSON.stringify({ id }));
3272
3298
  });
3273
3299
  }
3300
+ inspectComponentHighLighterSelectFn = onSelect;
3274
3301
  window.addEventListener("click", onSelect, true);
3275
3302
  });
3276
3303
  }
@@ -3338,7 +3365,7 @@ function getFunctionDetails(func) {
3338
3365
  return {
3339
3366
  _custom: {
3340
3367
  type: "function",
3341
- displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
3368
+ displayText: `<span style="opacity:.5;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(name)}${args}</span>`,
3342
3369
  tooltipText: string.trim() ? `<pre>${string}</pre>` : null
3343
3370
  }
3344
3371
  };
@@ -3956,11 +3983,16 @@ function getComponentInspector() {
3956
3983
  // src/core/open-in-editor/index.ts
3957
3984
  init_cjs_shims();
3958
3985
  var import_devtools_shared9 = require("@vue/devtools-shared");
3986
+ function setOpenInEditorBaseUrl(url) {
3987
+ import_devtools_shared9.target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ = url;
3988
+ }
3959
3989
  function openInEditor(options = {}) {
3990
+ var _a10;
3960
3991
  const { file, baseUrl = window.location.origin, line = 0, column = 0 } = options;
3961
3992
  if (file) {
3962
3993
  if (devtoolsState.vitePluginDetected) {
3963
- import_devtools_shared9.target.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3994
+ const _baseUrl = (_a10 = import_devtools_shared9.target.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__) != null ? _a10 : baseUrl;
3995
+ import_devtools_shared9.target.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
3964
3996
  } else {
3965
3997
  }
3966
3998
  }
@@ -3971,50 +4003,50 @@ init_cjs_shims();
3971
4003
  var on2 = {
3972
4004
  // #region compatible with old devtools
3973
4005
  addTimelineEvent(fn) {
3974
- apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
4006
+ registerInstanceHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3975
4007
  },
3976
4008
  inspectComponent(fn) {
3977
- apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
4009
+ registerInstanceHook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3978
4010
  },
3979
4011
  visitComponentTree(fn) {
3980
- apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
4012
+ registerInstanceHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3981
4013
  },
3982
4014
  getInspectorTree(fn) {
3983
- apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
4015
+ registerInstanceHook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3984
4016
  },
3985
4017
  getInspectorState(fn) {
3986
- apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
4018
+ registerInstanceHook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3987
4019
  },
3988
4020
  sendInspectorTree(fn) {
3989
- apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
4021
+ registerInstanceHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3990
4022
  },
3991
4023
  sendInspectorState(fn) {
3992
- apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
4024
+ registerInstanceHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3993
4025
  },
3994
4026
  editInspectorState(fn) {
3995
- apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
4027
+ registerInstanceHook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3996
4028
  },
3997
4029
  editComponentState() {
3998
4030
  },
3999
4031
  componentUpdated(fn) {
4000
- apiHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
4032
+ registerInstanceHook("component:updated" /* COMPONENT_UPDATED */, fn);
4001
4033
  },
4002
4034
  // #endregion compatible with old devtools
4003
4035
  // router
4004
4036
  routerInfoUpdated(fn) {
4005
- apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
4037
+ registerInstanceHook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
4006
4038
  },
4007
4039
  // component highlighter
4008
4040
  getComponentBoundingRect(fn) {
4009
- apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
4041
+ registerInstanceHook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
4010
4042
  },
4011
4043
  // custom tabs
4012
4044
  customTabsUpdated(fn) {
4013
- apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
4045
+ registerInstanceHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
4014
4046
  },
4015
4047
  // custom commands
4016
4048
  customCommandsUpdated(fn) {
4017
- apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
4049
+ registerInstanceHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
4018
4050
  },
4019
4051
  devtoolsStateUpdated(fn) {
4020
4052
  apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
@@ -4024,7 +4056,7 @@ var on2 = {
4024
4056
  // src/api/off.ts
4025
4057
  init_cjs_shims();
4026
4058
  function remove() {
4027
- apiHooks.removeAllHooks();
4059
+ instanceHooks.forEach((unregister) => unregister());
4028
4060
  }
4029
4061
 
4030
4062
  // src/api/api.ts
@@ -4158,9 +4190,17 @@ var DevToolsPluginApi = class {
4158
4190
  inspectComponentInspector() {
4159
4191
  return inspectComponentHighLighter();
4160
4192
  }
4193
+ cancelInspectComponentInspector() {
4194
+ return cancelInspectComponentHighLighter();
4195
+ }
4161
4196
  scrollToComponent(...params) {
4162
4197
  return scrollToComponent(...params);
4163
4198
  }
4199
+ getComponentRenderCode(id) {
4200
+ const instance = getComponentInstance(devtoolsContext.appRecord, id);
4201
+ if (instance)
4202
+ return !((instance == null ? void 0 : instance.type) instanceof Function) ? instance.render.toString() : instance.type.toString();
4203
+ }
4164
4204
  getComponentBoundingRect(...params) {
4165
4205
  var _a10;
4166
4206
  const { inspectorId, instanceId = "" } = params[0];
@@ -4343,7 +4383,7 @@ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4343
4383
  devtoolsContext.appRecord = _value;
4344
4384
  devtoolsContext.api = _value.api;
4345
4385
  devtoolsContext.inspector = (_a10 = _value.inspector) != null ? _a10 : [];
4346
- normalizeRouterInfo(value);
4386
+ normalizeRouterInfo(value, devtoolsState);
4347
4387
  devtoolsContext.routerInfo = devtoolsRouterInfo;
4348
4388
  } else if (property === "activeId") {
4349
4389
  devtoolsState.activeAppRecordId = value;
@@ -4439,6 +4479,12 @@ function initDevTools() {
4439
4479
  devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
4440
4480
  }
4441
4481
  });
4482
+ hook.on.vueAppUnmount(async (app) => {
4483
+ const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
4484
+ devtoolsAppRecords.value = activeRecords;
4485
+ if (devtoolsAppRecords.active.app === app)
4486
+ await setActiveAppRecord(activeRecords[0]);
4487
+ });
4442
4488
  subscribeDevToolsHook();
4443
4489
  }
4444
4490
  function onDevToolsConnected(fn) {
@@ -4490,6 +4536,9 @@ var devtools = {
4490
4536
  };
4491
4537
  // Annotate the CommonJS export names for ESM import in node:
4492
4538
  0 && (module.exports = {
4539
+ INFINITY,
4540
+ NAN,
4541
+ NEGATIVE_INFINITY,
4493
4542
  UNDEFINED,
4494
4543
  addCustomCommand,
4495
4544
  addCustomTab,
@@ -4497,11 +4546,13 @@ var devtools = {
4497
4546
  formatInspectorStateValue,
4498
4547
  getInspectorStateValueType,
4499
4548
  getRaw,
4549
+ isPlainObject,
4500
4550
  onDevToolsClientConnected,
4501
4551
  onDevToolsConnected,
4502
4552
  parse,
4503
4553
  removeCustomCommand,
4504
4554
  setDevToolsEnv,
4555
+ setOpenInEditorBaseUrl,
4505
4556
  setupDevToolsPlugin,
4506
4557
  stringify,
4507
4558
  toEdit,
package/dist/index.d.cts CHANGED
@@ -178,6 +178,7 @@ declare enum DevToolsHooks {
178
178
  interface DevToolsEvent$1 {
179
179
  [DevToolsHooks.APP_INIT]: (app: VueAppInstance['appContext']['app'], version: string) => void;
180
180
  [DevToolsHooks.APP_CONNECTED]: () => void;
181
+ [DevToolsHooks.APP_UNMOUNT]: (app: VueAppInstance['appContext']['app']) => void;
181
182
  [DevToolsHooks.COMPONENT_ADDED]: (app: HookAppInstance, uid: number, parentUid: number, component: VueAppInstance) => void;
182
183
  [DevToolsHooks.COMPONENT_UPDATED]: DevToolsEvent$1['component:added'];
183
184
  [DevToolsHooks.COMPONENT_REMOVED]: DevToolsEvent$1['component:added'];
@@ -203,6 +204,7 @@ interface DevToolsHook {
203
204
  interface VueHooks {
204
205
  on: {
205
206
  vueAppInit: (fn: DevToolsEvent$1[DevToolsHooks.APP_INIT]) => void;
207
+ vueAppUnmount: (fn: DevToolsEvent$1[DevToolsHooks.APP_UNMOUNT]) => void;
206
208
  vueAppConnected: (fn: DevToolsEvent$1[DevToolsHooks.APP_CONNECTED]) => void;
207
209
  componentAdded: (fn: DevToolsEvent$1[DevToolsHooks.COMPONENT_ADDED]) => () => void;
208
210
  componentUpdated: (fn: DevToolsEvent$1[DevToolsHooks.COMPONENT_UPDATED]) => () => void;
@@ -456,6 +458,7 @@ interface OpenInEditorOptions {
456
458
  line?: number;
457
459
  column?: number;
458
460
  }
461
+ declare function setOpenInEditorBaseUrl(url: string): void;
459
462
  declare function openInEditor(options?: OpenInEditorOptions): void;
460
463
 
461
464
  interface ComponentHighLighterOptions {
@@ -471,6 +474,7 @@ interface ScrollToComponentOptions {
471
474
  declare function toggleComponentHighLighter(options: ComponentHighLighterOptions): void;
472
475
  declare function highlight(instance: VueAppInstance): void;
473
476
  declare function unhighlight(): void;
477
+ declare function cancelInspectComponentHighLighter(): void;
474
478
  declare function inspectComponentHighLighter(): Promise<string>;
475
479
  declare function scrollToComponent(options: ScrollToComponentOptions): void;
476
480
 
@@ -483,6 +487,7 @@ declare enum DevToolsEvents {
483
487
  TOGGLE_COMPONENT_HIGHLIGHTER = "component-highlighter:toggle",
484
488
  GET_COMPONENT_BOUNDING_RECT = "component-bounding-rect:get",
485
489
  SCROLL_TO_COMPONENT = "scroll-to-component",
490
+ GET_COMPONENT_RENDER_CODE = "component-render-code:get",
486
491
  GET_INSPECTOR_TREE = "inspector-tree:get",
487
492
  SEND_INSPECTOR_TREE = "inspector-tree:send",
488
493
  GET_INSPECTOR_STATE = "inspector-state:get",
@@ -498,6 +503,7 @@ interface DevToolsEvent {
498
503
  [DevToolsEvents.ROUTER_INFO_UPDATED]: (routerInfo: RouterInfo) => void;
499
504
  [DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER]: (payload: ComponentHighLighterOptions) => void;
500
505
  [DevToolsEvents.SCROLL_TO_COMPONENT]: (payload: ScrollToComponentOptions) => void;
506
+ [DevToolsEvents.GET_COMPONENT_RENDER_CODE]: (id: string) => void;
501
507
  [DevToolsEvents.GET_COMPONENT_BOUNDING_RECT]: (payload: ComponentBoundingRectApiPayload) => void;
502
508
  [DevToolsEvents.DEVTOOLS_STATE_UPDATED]: (state: DevToolsState, oldState: DevToolsState) => void;
503
509
  [DevToolsEvents.DEVTOOLS_CONNECTED_UPDATED]: (state: DevToolsState, oldState: DevToolsState) => void;
@@ -574,7 +580,9 @@ declare class DevToolsPluginApi {
574
580
  };
575
581
  toggleComponentInspector(...params: DevToolsEventParams<DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER>): void;
576
582
  inspectComponentInspector(): Promise<string>;
583
+ cancelInspectComponentInspector(): void;
577
584
  scrollToComponent(...params: DevToolsEventParams<DevToolsEvents.SCROLL_TO_COMPONENT>): void;
585
+ getComponentRenderCode(id: string): any;
578
586
  getComponentBoundingRect(...params: DevToolsEventParams<DevToolsEvents.GET_COMPONENT_BOUNDING_RECT>): string;
579
587
  toggleApp(id: string): Promise<void>;
580
588
  addCustomTab(tab: CustomTab): void;
@@ -614,6 +622,11 @@ declare function stringify<T extends object = Record<string, unknown>>(data: T):
614
622
  declare function parse(data: string, revive?: boolean): any;
615
623
 
616
624
  declare const UNDEFINED = "__vue_devtool_undefined__";
625
+ declare const INFINITY = "__vue_devtool_infinity__";
626
+ declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
627
+ declare const NAN = "__vue_devtool_nan__";
628
+
629
+ declare function isPlainObject(obj: unknown): boolean;
617
630
 
618
631
  interface DevToolsType {
619
632
  state: typeof devtoolsState;
@@ -631,4 +644,4 @@ declare const devtools: {
631
644
  readonly api: DevToolsPluginApi;
632
645
  };
633
646
 
634
- export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
647
+ export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
package/dist/index.d.ts CHANGED
@@ -178,6 +178,7 @@ declare enum DevToolsHooks {
178
178
  interface DevToolsEvent$1 {
179
179
  [DevToolsHooks.APP_INIT]: (app: VueAppInstance['appContext']['app'], version: string) => void;
180
180
  [DevToolsHooks.APP_CONNECTED]: () => void;
181
+ [DevToolsHooks.APP_UNMOUNT]: (app: VueAppInstance['appContext']['app']) => void;
181
182
  [DevToolsHooks.COMPONENT_ADDED]: (app: HookAppInstance, uid: number, parentUid: number, component: VueAppInstance) => void;
182
183
  [DevToolsHooks.COMPONENT_UPDATED]: DevToolsEvent$1['component:added'];
183
184
  [DevToolsHooks.COMPONENT_REMOVED]: DevToolsEvent$1['component:added'];
@@ -203,6 +204,7 @@ interface DevToolsHook {
203
204
  interface VueHooks {
204
205
  on: {
205
206
  vueAppInit: (fn: DevToolsEvent$1[DevToolsHooks.APP_INIT]) => void;
207
+ vueAppUnmount: (fn: DevToolsEvent$1[DevToolsHooks.APP_UNMOUNT]) => void;
206
208
  vueAppConnected: (fn: DevToolsEvent$1[DevToolsHooks.APP_CONNECTED]) => void;
207
209
  componentAdded: (fn: DevToolsEvent$1[DevToolsHooks.COMPONENT_ADDED]) => () => void;
208
210
  componentUpdated: (fn: DevToolsEvent$1[DevToolsHooks.COMPONENT_UPDATED]) => () => void;
@@ -456,6 +458,7 @@ interface OpenInEditorOptions {
456
458
  line?: number;
457
459
  column?: number;
458
460
  }
461
+ declare function setOpenInEditorBaseUrl(url: string): void;
459
462
  declare function openInEditor(options?: OpenInEditorOptions): void;
460
463
 
461
464
  interface ComponentHighLighterOptions {
@@ -471,6 +474,7 @@ interface ScrollToComponentOptions {
471
474
  declare function toggleComponentHighLighter(options: ComponentHighLighterOptions): void;
472
475
  declare function highlight(instance: VueAppInstance): void;
473
476
  declare function unhighlight(): void;
477
+ declare function cancelInspectComponentHighLighter(): void;
474
478
  declare function inspectComponentHighLighter(): Promise<string>;
475
479
  declare function scrollToComponent(options: ScrollToComponentOptions): void;
476
480
 
@@ -483,6 +487,7 @@ declare enum DevToolsEvents {
483
487
  TOGGLE_COMPONENT_HIGHLIGHTER = "component-highlighter:toggle",
484
488
  GET_COMPONENT_BOUNDING_RECT = "component-bounding-rect:get",
485
489
  SCROLL_TO_COMPONENT = "scroll-to-component",
490
+ GET_COMPONENT_RENDER_CODE = "component-render-code:get",
486
491
  GET_INSPECTOR_TREE = "inspector-tree:get",
487
492
  SEND_INSPECTOR_TREE = "inspector-tree:send",
488
493
  GET_INSPECTOR_STATE = "inspector-state:get",
@@ -498,6 +503,7 @@ interface DevToolsEvent {
498
503
  [DevToolsEvents.ROUTER_INFO_UPDATED]: (routerInfo: RouterInfo) => void;
499
504
  [DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER]: (payload: ComponentHighLighterOptions) => void;
500
505
  [DevToolsEvents.SCROLL_TO_COMPONENT]: (payload: ScrollToComponentOptions) => void;
506
+ [DevToolsEvents.GET_COMPONENT_RENDER_CODE]: (id: string) => void;
501
507
  [DevToolsEvents.GET_COMPONENT_BOUNDING_RECT]: (payload: ComponentBoundingRectApiPayload) => void;
502
508
  [DevToolsEvents.DEVTOOLS_STATE_UPDATED]: (state: DevToolsState, oldState: DevToolsState) => void;
503
509
  [DevToolsEvents.DEVTOOLS_CONNECTED_UPDATED]: (state: DevToolsState, oldState: DevToolsState) => void;
@@ -574,7 +580,9 @@ declare class DevToolsPluginApi {
574
580
  };
575
581
  toggleComponentInspector(...params: DevToolsEventParams<DevToolsEvents.TOGGLE_COMPONENT_HIGHLIGHTER>): void;
576
582
  inspectComponentInspector(): Promise<string>;
583
+ cancelInspectComponentInspector(): void;
577
584
  scrollToComponent(...params: DevToolsEventParams<DevToolsEvents.SCROLL_TO_COMPONENT>): void;
585
+ getComponentRenderCode(id: string): any;
578
586
  getComponentBoundingRect(...params: DevToolsEventParams<DevToolsEvents.GET_COMPONENT_BOUNDING_RECT>): string;
579
587
  toggleApp(id: string): Promise<void>;
580
588
  addCustomTab(tab: CustomTab): void;
@@ -614,6 +622,11 @@ declare function stringify<T extends object = Record<string, unknown>>(data: T):
614
622
  declare function parse(data: string, revive?: boolean): any;
615
623
 
616
624
  declare const UNDEFINED = "__vue_devtool_undefined__";
625
+ declare const INFINITY = "__vue_devtool_infinity__";
626
+ declare const NEGATIVE_INFINITY = "__vue_devtool_negative_infinity__";
627
+ declare const NAN = "__vue_devtool_nan__";
628
+
629
+ declare function isPlainObject(obj: unknown): boolean;
617
630
 
618
631
  interface DevToolsType {
619
632
  state: typeof devtoolsState;
@@ -631,4 +644,4 @@ declare const devtools: {
631
644
  readonly api: DevToolsPluginApi;
632
645
  };
633
646
 
634
- export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
647
+ export { type AddInspectorApiPayload, type AppRecord, type ComponentBoundingRect, type ComponentBoundingRectApiPayload, type ComponentHighLighterOptions, type ComponentInspector, type ComponentTreeNode, type CustomCommand, type CustomCommandAction, type CustomTab, type DevToolsContext, type DevToolsEnv, type DevToolsEvent$1 as DevToolsEvent, type DevToolsHook, DevToolsHooks, type DevToolsState, type DevToolsType, INFINITY, type Inspector, type InspectorApiPayload, type InspectorCustomState, type InspectorNodeTag, type InspectorState, type InspectorStateApiPayload, type InspectorStateEditorPayload, type InspectorTreeApiPayload, NAN, NEGATIVE_INFINITY, type OpenInEditorOptions, type PluginApi, type PluginDescriptor, type PluginSettingsItem, type PluginSetupFunction, type PropPath, type RouterInfo, type ScrollToComponentOptions, type TimelineEvent, type TimelineLayerItem, UNDEFINED, type VueAppInstance, type VueHooks, addCustomCommand, addCustomTab, addInspector, addTimelineLayer, cancelInspectComponentHighLighter, type customTypeEnums, devtools, formatInspectorStateValue, getComponentInspector, getInspector, getInspectorStateValueType, getRaw, getTimelineLayer, highlight, inspectComponentHighLighter, isPlainObject, onDevToolsClientConnected, onDevToolsConnected, openInEditor, parse, removeCustomCommand, scrollToComponent, setDevToolsEnv, setOpenInEditorBaseUrl, setupDevToolsPlugin, stringify, toEdit, toSubmit, toggleComponentHighLighter, toggleComponentInspectorEnabled, toggleHighPerfMode, unhighlight, updateInspector };
package/dist/index.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target10) => (target10 = mod != null ? __create(
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.4/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.4/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.0.2_postcss@8.4.38_typescript@5.4.5/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1612,6 +1612,9 @@ var on = {
1612
1612
  vueAppInit(fn) {
1613
1613
  devtoolsHooks.hook("app:init" /* APP_INIT */, fn);
1614
1614
  },
1615
+ vueAppUnmount(fn) {
1616
+ devtoolsHooks.hook("app:unmount" /* APP_UNMOUNT */, fn);
1617
+ },
1615
1618
  vueAppConnected(fn) {
1616
1619
  devtoolsHooks.hook("app:connected" /* APP_CONNECTED */, fn);
1617
1620
  },
@@ -1673,6 +1676,9 @@ function subscribeDevToolsHook() {
1673
1676
  return;
1674
1677
  devtoolsHooks.callHook("app:init" /* APP_INIT */, app, version);
1675
1678
  });
1679
+ hook2.on("app:unmount" /* APP_UNMOUNT */, (app) => {
1680
+ devtoolsHooks.callHook("app:unmount" /* APP_UNMOUNT */, app);
1681
+ });
1676
1682
  hook2.on("component:added" /* COMPONENT_ADDED */, async (app, uid, parentUid, component) => {
1677
1683
  var _a10, _b10, _c;
1678
1684
  if ((_c = (_b10 = (_a10 = app == null ? void 0 : app._instance) == null ? void 0 : _a10.type) == null ? void 0 : _b10.devtools) == null ? void 0 : _c.hide)
@@ -1755,6 +1761,11 @@ import { target as target2 } from "@vue/devtools-shared";
1755
1761
  import { createHooks as createHooks2 } from "hookable";
1756
1762
  var _a2, _b2;
1757
1763
  var apiHooks = (_b2 = (_a2 = target2).__VUE_DEVTOOLS_API_HOOK) != null ? _b2 : _a2.__VUE_DEVTOOLS_API_HOOK = createHooks2();
1764
+ var instanceHooks = [];
1765
+ var registerInstanceHook = (...args) => {
1766
+ const unregister = apiHooks.hook(...args);
1767
+ instanceHooks.push(unregister);
1768
+ };
1758
1769
 
1759
1770
  // src/core/router/index.ts
1760
1771
  function getRoutes(router) {
@@ -1789,7 +1800,7 @@ function filterCurrentRoute(route) {
1789
1800
  }
1790
1801
  return route;
1791
1802
  }
1792
- function normalizeRouterInfo(appRecord) {
1803
+ function normalizeRouterInfo(appRecord, state) {
1793
1804
  function init() {
1794
1805
  var _a10;
1795
1806
  const router = (_a10 = appRecord.app) == null ? void 0 : _a10.config.globalProperties.$router;
@@ -1807,6 +1818,9 @@ function normalizeRouterInfo(appRecord) {
1807
1818
  }
1808
1819
  init();
1809
1820
  hook.on.componentUpdated(debounce(() => {
1821
+ var _a10;
1822
+ if (((_a10 = state.activeAppRecord) == null ? void 0 : _a10.app) !== appRecord.app)
1823
+ return;
1810
1824
  init();
1811
1825
  apiHooks.callHook("router-info:updated" /* ROUTER_INFO_UPDATED */, global[ROUTER_INFO_KEY]);
1812
1826
  }, 200));
@@ -1937,7 +1951,7 @@ function getInstanceName(instance) {
1937
1951
  function getUniqueComponentId(instance) {
1938
1952
  var _a10, _b10, _c;
1939
1953
  const appId = (_c = (_b10 = (_a10 = instance == null ? void 0 : instance.appContext) == null ? void 0 : _a10.app) == null ? void 0 : _b10.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__) != null ? _c : 0;
1940
- const instanceId = instance === instance.root ? "root" : instance.uid;
1954
+ const instanceId = instance === (instance == null ? void 0 : instance.root) ? "root" : instance.uid;
1941
1955
  return `${appId}:${instanceId}`;
1942
1956
  }
1943
1957
  function getRenderKey(value) {
@@ -2686,7 +2700,7 @@ function processSetupState(instance) {
2686
2700
  const value = returnError(() => toRaw2(instance.setupState[key]));
2687
2701
  const rawData = raw[key];
2688
2702
  let result;
2689
- let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function";
2703
+ let isOtherType = typeof value === "function" || typeof (value == null ? void 0 : value.render) === "function" || typeof (value == null ? void 0 : value.__asyncLoader) === "function" || typeof value === "object" && value && ("setup" in value || "props" in value) || /^v[A-Z]/.test(key);
2690
2704
  if (rawData) {
2691
2705
  const info = getSetupStateType(rawData);
2692
2706
  const { stateType, stateTypeName } = getStateTypeAndName(info);
@@ -3228,6 +3242,12 @@ function selectComponentFn(e, cb) {
3228
3242
  });
3229
3243
  }
3230
3244
  }
3245
+ var inspectComponentHighLighterSelectFn = null;
3246
+ function cancelInspectComponentHighLighter() {
3247
+ window.removeEventListener("mouseover", inspectFn);
3248
+ window.removeEventListener("click", inspectComponentHighLighterSelectFn, true);
3249
+ inspectComponentHighLighterSelectFn = null;
3250
+ }
3231
3251
  function inspectComponentHighLighter() {
3232
3252
  window.addEventListener("mouseover", inspectFn);
3233
3253
  return new Promise((resolve) => {
@@ -3236,6 +3256,7 @@ function inspectComponentHighLighter() {
3236
3256
  e.stopPropagation();
3237
3257
  selectComponentFn(e, (id) => {
3238
3258
  window.removeEventListener("click", onSelect, true);
3259
+ inspectComponentHighLighterSelectFn = null;
3239
3260
  window.removeEventListener("mouseover", inspectFn);
3240
3261
  const el = getContainerElement();
3241
3262
  if (el)
@@ -3243,6 +3264,7 @@ function inspectComponentHighLighter() {
3243
3264
  resolve(JSON.stringify({ id }));
3244
3265
  });
3245
3266
  }
3267
+ inspectComponentHighLighterSelectFn = onSelect;
3246
3268
  window.addEventListener("click", onSelect, true);
3247
3269
  });
3248
3270
  }
@@ -3310,7 +3332,7 @@ function getFunctionDetails(func) {
3310
3332
  return {
3311
3333
  _custom: {
3312
3334
  type: "function",
3313
- displayText: `<span style="opacity:.5;">function</span> ${escape(name)}${args}`,
3335
+ displayText: `<span style="opacity:.5;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(name)}${args}</span>`,
3314
3336
  tooltipText: string.trim() ? `<pre>${string}</pre>` : null
3315
3337
  }
3316
3338
  };
@@ -3928,11 +3950,16 @@ function getComponentInspector() {
3928
3950
  // src/core/open-in-editor/index.ts
3929
3951
  init_esm_shims();
3930
3952
  import { target as target5 } from "@vue/devtools-shared";
3953
+ function setOpenInEditorBaseUrl(url) {
3954
+ target5.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__ = url;
3955
+ }
3931
3956
  function openInEditor(options = {}) {
3957
+ var _a10;
3932
3958
  const { file, baseUrl = window.location.origin, line = 0, column = 0 } = options;
3933
3959
  if (file) {
3934
3960
  if (devtoolsState.vitePluginDetected) {
3935
- target5.__VUE_INSPECTOR__.openInEditor(baseUrl, file, line, column);
3961
+ const _baseUrl = (_a10 = target5.__VUE_DEVTOOLS_OPEN_IN_EDITOR_BASE_URL__) != null ? _a10 : baseUrl;
3962
+ target5.__VUE_INSPECTOR__.openInEditor(_baseUrl, file, line, column);
3936
3963
  } else {
3937
3964
  }
3938
3965
  }
@@ -3943,50 +3970,50 @@ init_esm_shims();
3943
3970
  var on2 = {
3944
3971
  // #region compatible with old devtools
3945
3972
  addTimelineEvent(fn) {
3946
- apiHooks.hook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3973
+ registerInstanceHook("timeline:add-event" /* ADD_TIMELINE_EVENT */, fn);
3947
3974
  },
3948
3975
  inspectComponent(fn) {
3949
- apiHooks.hook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3976
+ registerInstanceHook("component-state:inspect" /* COMPONENT_STATE_INSPECT */, fn);
3950
3977
  },
3951
3978
  visitComponentTree(fn) {
3952
- apiHooks.hook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3979
+ registerInstanceHook("component-tree:visit" /* VISIT_COMPONENT_TREE */, fn);
3953
3980
  },
3954
3981
  getInspectorTree(fn) {
3955
- apiHooks.hook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3982
+ registerInstanceHook("inspector-tree:get" /* GET_INSPECTOR_TREE */, fn);
3956
3983
  },
3957
3984
  getInspectorState(fn) {
3958
- apiHooks.hook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3985
+ registerInstanceHook("inspector-state:get" /* GET_INSPECTOR_STATE */, fn);
3959
3986
  },
3960
3987
  sendInspectorTree(fn) {
3961
- apiHooks.hook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3988
+ registerInstanceHook("inspector-tree:send" /* SEND_INSPECTOR_TREE */, fn);
3962
3989
  },
3963
3990
  sendInspectorState(fn) {
3964
- apiHooks.hook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3991
+ registerInstanceHook("inspector-state:send" /* SEND_INSPECTOR_STATE */, fn);
3965
3992
  },
3966
3993
  editInspectorState(fn) {
3967
- apiHooks.hook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3994
+ registerInstanceHook("inspector-state:edit" /* EDIT_INSPECTOR_STATE */, fn);
3968
3995
  },
3969
3996
  editComponentState() {
3970
3997
  },
3971
3998
  componentUpdated(fn) {
3972
- apiHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
3999
+ registerInstanceHook("component:updated" /* COMPONENT_UPDATED */, fn);
3973
4000
  },
3974
4001
  // #endregion compatible with old devtools
3975
4002
  // router
3976
4003
  routerInfoUpdated(fn) {
3977
- apiHooks.hook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
4004
+ registerInstanceHook("router-info:updated" /* ROUTER_INFO_UPDATED */, fn);
3978
4005
  },
3979
4006
  // component highlighter
3980
4007
  getComponentBoundingRect(fn) {
3981
- apiHooks.hook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
4008
+ registerInstanceHook("component-bounding-rect:get" /* GET_COMPONENT_BOUNDING_RECT */, fn);
3982
4009
  },
3983
4010
  // custom tabs
3984
4011
  customTabsUpdated(fn) {
3985
- apiHooks.hook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
4012
+ registerInstanceHook("custom-tabs:updated" /* CUSTOM_TABS_UPDATED */, fn);
3986
4013
  },
3987
4014
  // custom commands
3988
4015
  customCommandsUpdated(fn) {
3989
- apiHooks.hook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
4016
+ registerInstanceHook("custom-commands:updated" /* CUSTOM_COMMANDS_UPDATED */, fn);
3990
4017
  },
3991
4018
  devtoolsStateUpdated(fn) {
3992
4019
  apiHooks.hook("devtools:state-updated" /* DEVTOOLS_STATE_UPDATED */, fn);
@@ -3996,7 +4023,7 @@ var on2 = {
3996
4023
  // src/api/off.ts
3997
4024
  init_esm_shims();
3998
4025
  function remove() {
3999
- apiHooks.removeAllHooks();
4026
+ instanceHooks.forEach((unregister) => unregister());
4000
4027
  }
4001
4028
 
4002
4029
  // src/api/api.ts
@@ -4130,9 +4157,17 @@ var DevToolsPluginApi = class {
4130
4157
  inspectComponentInspector() {
4131
4158
  return inspectComponentHighLighter();
4132
4159
  }
4160
+ cancelInspectComponentInspector() {
4161
+ return cancelInspectComponentHighLighter();
4162
+ }
4133
4163
  scrollToComponent(...params) {
4134
4164
  return scrollToComponent(...params);
4135
4165
  }
4166
+ getComponentRenderCode(id) {
4167
+ const instance = getComponentInstance(devtoolsContext.appRecord, id);
4168
+ if (instance)
4169
+ return !((instance == null ? void 0 : instance.type) instanceof Function) ? instance.render.toString() : instance.type.toString();
4170
+ }
4136
4171
  getComponentBoundingRect(...params) {
4137
4172
  var _a10;
4138
4173
  const { inspectorId, instanceId = "" } = params[0];
@@ -4315,7 +4350,7 @@ var devtoolsAppRecords = new Proxy(devtoolsState.appRecords, {
4315
4350
  devtoolsContext.appRecord = _value;
4316
4351
  devtoolsContext.api = _value.api;
4317
4352
  devtoolsContext.inspector = (_a10 = _value.inspector) != null ? _a10 : [];
4318
- normalizeRouterInfo(value);
4353
+ normalizeRouterInfo(value, devtoolsState);
4319
4354
  devtoolsContext.routerInfo = devtoolsRouterInfo;
4320
4355
  } else if (property === "activeId") {
4321
4356
  devtoolsState.activeAppRecordId = value;
@@ -4411,6 +4446,12 @@ function initDevTools() {
4411
4446
  devtoolsHooks.callHook("app:connected" /* APP_CONNECTED */);
4412
4447
  }
4413
4448
  });
4449
+ hook.on.vueAppUnmount(async (app) => {
4450
+ const activeRecords = devtoolsAppRecords.value.filter((appRecord) => appRecord.app !== app);
4451
+ devtoolsAppRecords.value = activeRecords;
4452
+ if (devtoolsAppRecords.active.app === app)
4453
+ await setActiveAppRecord(activeRecords[0]);
4454
+ });
4414
4455
  subscribeDevToolsHook();
4415
4456
  }
4416
4457
  function onDevToolsConnected(fn) {
@@ -4461,6 +4502,9 @@ var devtools = {
4461
4502
  }
4462
4503
  };
4463
4504
  export {
4505
+ INFINITY,
4506
+ NAN,
4507
+ NEGATIVE_INFINITY,
4464
4508
  UNDEFINED,
4465
4509
  addCustomCommand,
4466
4510
  addCustomTab,
@@ -4468,11 +4512,13 @@ export {
4468
4512
  formatInspectorStateValue,
4469
4513
  getInspectorStateValueType,
4470
4514
  getRaw,
4515
+ isPlainObject,
4471
4516
  onDevToolsClientConnected,
4472
4517
  onDevToolsConnected,
4473
4518
  parse,
4474
4519
  removeCustomCommand,
4475
4520
  setDevToolsEnv,
4521
+ setOpenInEditorBaseUrl,
4476
4522
  setupDevToolsPlugin,
4477
4523
  stringify,
4478
4524
  toEdit,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.0.27",
4
+ "version": "7.1.0",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -25,12 +25,12 @@
25
25
  "mitt": "^3.0.1",
26
26
  "perfect-debounce": "^1.0.0",
27
27
  "speakingurl": "^14.0.1",
28
- "@vue/devtools-shared": "^7.0.27"
28
+ "@vue/devtools-shared": "^7.1.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/speakingurl": "^13.0.6",
32
- "vue": "^3.4.21",
33
- "vue-router": "^4.3.0"
32
+ "vue": "^3.4.23",
33
+ "vue-router": "^4.3.2"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup --clean",