@vue/devtools-kit 7.4.5 → 7.5.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.js CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target22) => (target22 = mod != null ? __create(
27
27
  mod
28
28
  ));
29
29
 
30
- // ../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.0_@types+node@20.16.5__@swc+core@1.5.29_jiti@1.21.6__hrrjfaj2jdrhlrlzgjkczhq5ey/node_modules/tsup/assets/esm_shims.js
30
+ // ../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.43.0_@types+node@20.16.11__@swc+core@1.5.29_jiti@2.0.0__khi6fwhekjxtif3xyxfitrs5gq/node_modules/tsup/assets/esm_shims.js
31
31
  var init_esm_shims = __esm({
32
- "../../node_modules/.pnpm/tsup@8.2.4_@microsoft+api-extractor@7.43.0_@types+node@20.16.5__@swc+core@1.5.29_jiti@1.21.6__hrrjfaj2jdrhlrlzgjkczhq5ey/node_modules/tsup/assets/esm_shims.js"() {
32
+ "../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.43.0_@types+node@20.16.11__@swc+core@1.5.29_jiti@2.0.0__khi6fwhekjxtif3xyxfitrs5gq/node_modules/tsup/assets/esm_shims.js"() {
33
33
  "use strict";
34
34
  }
35
35
  });
@@ -1631,7 +1631,12 @@ var Fragment = Symbol.for("v-fgt");
1631
1631
  init_esm_shims();
1632
1632
  import { basename, classify } from "@vue/devtools-shared";
1633
1633
  function getComponentTypeName(options) {
1634
- return options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
1634
+ var _a25;
1635
+ const name = options.name || options._componentTag || options.__VUE_DEVTOOLS_COMPONENT_GUSSED_NAME__ || options.__name;
1636
+ if (name === "index" && ((_a25 = options.__file) == null ? void 0 : _a25.endsWith("index.vue"))) {
1637
+ return "";
1638
+ }
1639
+ return name;
1635
1640
  }
1636
1641
  function getComponentFileName(options) {
1637
1642
  const file = options.__file;
@@ -2237,6 +2242,38 @@ init_esm_shims();
2237
2242
  import { target as global, isUrlString } from "@vue/devtools-shared";
2238
2243
  import { debounce as debounce2 } from "perfect-debounce";
2239
2244
 
2245
+ // src/core/timeline/storage.ts
2246
+ init_esm_shims();
2247
+ import { isBrowser } from "@vue/devtools-shared";
2248
+ var TIMELINE_LAYERS_STATE_STORAGE_ID = "__VUE_DEVTOOLS_KIT_TIMELINE_LAYERS_STATE__";
2249
+ function addTimelineLayersStateToStorage(state) {
2250
+ if (!isBrowser) {
2251
+ return;
2252
+ }
2253
+ localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state));
2254
+ }
2255
+ function getTimelineLayersStateFromStorage() {
2256
+ if (!isBrowser) {
2257
+ return {
2258
+ recordingState: false,
2259
+ mouseEventEnabled: false,
2260
+ keyboardEventEnabled: false,
2261
+ componentEventEnabled: false,
2262
+ performanceEventEnabled: false,
2263
+ selected: ""
2264
+ };
2265
+ }
2266
+ const state = localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID);
2267
+ return state ? JSON.parse(state) : {
2268
+ recordingState: false,
2269
+ mouseEventEnabled: false,
2270
+ keyboardEventEnabled: false,
2271
+ componentEventEnabled: false,
2272
+ performanceEventEnabled: false,
2273
+ selected: ""
2274
+ };
2275
+ }
2276
+
2240
2277
  // src/ctx/hook.ts
2241
2278
  init_esm_shims();
2242
2279
  import { createHooks } from "hookable";
@@ -2263,6 +2300,16 @@ function addTimelineLayer(options, descriptor) {
2263
2300
  appRecord: getAppRecord(descriptor.app)
2264
2301
  });
2265
2302
  }
2303
+ function updateTimelineLayersState(state) {
2304
+ const updatedState = {
2305
+ ...devtoolsState.timelineLayersState,
2306
+ ...state
2307
+ };
2308
+ addTimelineLayersStateToStorage(updatedState);
2309
+ updateDevToolsState({
2310
+ timelineLayersState: updatedState
2311
+ });
2312
+ }
2266
2313
 
2267
2314
  // src/ctx/inspector.ts
2268
2315
  var _a3, _b3;
@@ -2296,7 +2343,8 @@ function getActiveInspectors() {
2296
2343
  logo: descriptor.logo,
2297
2344
  icon: `custom-ic-baseline-${(_a25 = options == null ? void 0 : options.icon) == null ? void 0 : _a25.replace(/_/g, "-")}`,
2298
2345
  packageName: descriptor.packageName,
2299
- homepage: descriptor.homepage
2346
+ homepage: descriptor.homepage,
2347
+ pluginId: descriptor.id
2300
2348
  };
2301
2349
  });
2302
2350
  }
@@ -2493,7 +2541,9 @@ function initStateFactory() {
2493
2541
  tabs: [],
2494
2542
  commands: [],
2495
2543
  highPerfModeEnabled: true,
2496
- devtoolsClientDetected: {}
2544
+ devtoolsClientDetected: {},
2545
+ perfUniqueGroupId: 0,
2546
+ timelineLayersState: getTimelineLayersStateFromStorage()
2497
2547
  };
2498
2548
  }
2499
2549
  var _a9, _b9;
@@ -2708,10 +2758,12 @@ function getPluginLocalKey(pluginId) {
2708
2758
  return `__VUE_DEVTOOLS_NEXT_PLUGIN_SETTINGS__${pluginId}__`;
2709
2759
  }
2710
2760
  function getPluginSettingsOptions(pluginId) {
2711
- var _a25, _b25, _c, _d;
2712
- const descriptor = (_a25 = getInspector(pluginId)) == null ? void 0 : _a25.descriptor;
2713
- const item = (_c = (_b25 = devtoolsPluginBuffer.find((item2) => item2[0].id === (descriptor == null ? void 0 : descriptor.id))) == null ? void 0 : _b25[0]) != null ? _c : null;
2714
- return (_d = item == null ? void 0 : item.settings) != null ? _d : null;
2761
+ var _a25, _b25, _c;
2762
+ const item = (_b25 = (_a25 = devtoolsPluginBuffer.find((item2) => {
2763
+ var _a26;
2764
+ return item2[0].id === pluginId && !!((_a26 = item2[0]) == null ? void 0 : _a26.settings);
2765
+ })) == null ? void 0 : _a25[0]) != null ? _b25 : null;
2766
+ return (_c = item == null ? void 0 : item.settings) != null ? _c : null;
2715
2767
  }
2716
2768
  function getPluginSettings(pluginId, fallbackValue) {
2717
2769
  var _a25, _b25, _c;
@@ -2806,6 +2858,9 @@ var on = {
2806
2858
  componentAdded(fn) {
2807
2859
  return devtoolsHooks.hook("component:added" /* COMPONENT_ADDED */, fn);
2808
2860
  },
2861
+ componentEmit(fn) {
2862
+ return devtoolsHooks.hook("component:emit" /* COMPONENT_EMIT */, fn);
2863
+ },
2809
2864
  componentUpdated(fn) {
2810
2865
  return devtoolsHooks.hook("component:updated" /* COMPONENT_UPDATED */, fn);
2811
2866
  },
@@ -2814,6 +2869,12 @@ var on = {
2814
2869
  },
2815
2870
  setupDevtoolsPlugin(fn) {
2816
2871
  devtoolsHooks.hook("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, fn);
2872
+ },
2873
+ perfStart(fn) {
2874
+ return devtoolsHooks.hook("perf:start" /* PERFORMANCE_START */, fn);
2875
+ },
2876
+ perfEnd(fn) {
2877
+ return devtoolsHooks.hook("perf:end" /* PERFORMANCE_END */, fn);
2817
2878
  }
2818
2879
  };
2819
2880
  function createDevToolsHook() {
@@ -2882,6 +2943,21 @@ function subscribeDevToolsHook() {
2882
2943
  return;
2883
2944
  devtoolsHooks.callHook("component:removed" /* COMPONENT_REMOVED */, app, uid, parentUid, component);
2884
2945
  });
2946
+ hook2.on("component:emit" /* COMPONENT_EMIT */, async (app, instance, event, params) => {
2947
+ if (!app || !instance || devtoolsState.highPerfModeEnabled)
2948
+ return;
2949
+ devtoolsHooks.callHook("component:emit" /* COMPONENT_EMIT */, app, instance, event, params);
2950
+ });
2951
+ hook2.on("perf:start" /* PERFORMANCE_START */, (app, uid, vm, type, time) => {
2952
+ if (!app || devtoolsState.highPerfModeEnabled)
2953
+ return;
2954
+ devtoolsHooks.callHook("perf:start" /* PERFORMANCE_START */, app, uid, vm, type, time);
2955
+ });
2956
+ hook2.on("perf:end" /* PERFORMANCE_END */, (app, uid, vm, type, time) => {
2957
+ if (!app || devtoolsState.highPerfModeEnabled)
2958
+ return;
2959
+ devtoolsHooks.callHook("perf:end" /* PERFORMANCE_END */, app, uid, vm, type, time);
2960
+ });
2885
2961
  hook2.on("devtools-plugin:setup" /* SETUP_DEVTOOLS_PLUGIN */, (pluginDescriptor, setupFn, options) => {
2886
2962
  if ((options == null ? void 0 : options.target) === "legacy")
2887
2963
  return;
@@ -2983,8 +3059,7 @@ var DevToolsV6PluginAPI = class {
2983
3059
  }
2984
3060
  // settings
2985
3061
  getSettings(pluginId) {
2986
- const inspector = getActiveInspectors().find((i) => i.packageName === this.plugin.descriptor.packageName);
2987
- return getPluginSettings(pluginId != null ? pluginId : inspector == null ? void 0 : inspector.id, this.plugin.descriptor.settings);
3062
+ return getPluginSettings(pluginId != null ? pluginId : this.plugin.descriptor.id, this.plugin.descriptor.settings);
2988
3063
  }
2989
3064
  // utilities
2990
3065
  getComponentInstances(app) {
@@ -3646,6 +3721,205 @@ var ComponentWalker = class {
3646
3721
  }
3647
3722
  };
3648
3723
 
3724
+ // src/core/timeline/index.ts
3725
+ init_esm_shims();
3726
+ import { isBrowser as isBrowser2 } from "@vue/devtools-shared";
3727
+
3728
+ // src/core/timeline/perf.ts
3729
+ init_esm_shims();
3730
+ var markEndQueue = /* @__PURE__ */ new Map();
3731
+ var PERFORMANCE_EVENT_LAYER_ID = "performance";
3732
+ async function performanceMarkStart(api, app, uid, vm, type, time) {
3733
+ const appRecord = await getAppRecord(app);
3734
+ if (!appRecord) {
3735
+ return;
3736
+ }
3737
+ const componentName = getInstanceName(vm) || "Unknown Component";
3738
+ const groupId = devtoolsState.perfUniqueGroupId++;
3739
+ const groupKey = `${uid}-${type}`;
3740
+ appRecord.perfGroupIds.set(groupKey, { groupId, time });
3741
+ await api.addTimelineEvent({
3742
+ layerId: PERFORMANCE_EVENT_LAYER_ID,
3743
+ event: {
3744
+ time: Date.now(),
3745
+ data: {
3746
+ component: componentName,
3747
+ type,
3748
+ measure: "start"
3749
+ },
3750
+ title: componentName,
3751
+ subtitle: type,
3752
+ groupId
3753
+ }
3754
+ });
3755
+ if (markEndQueue.has(groupKey)) {
3756
+ const {
3757
+ app: app2,
3758
+ uid: uid2,
3759
+ instance,
3760
+ type: type2,
3761
+ time: time2
3762
+ } = markEndQueue.get(groupKey);
3763
+ markEndQueue.delete(groupKey);
3764
+ await performanceMarkEnd(
3765
+ api,
3766
+ app2,
3767
+ uid2,
3768
+ instance,
3769
+ type2,
3770
+ time2
3771
+ );
3772
+ }
3773
+ }
3774
+ function performanceMarkEnd(api, app, uid, vm, type, time) {
3775
+ const appRecord = getAppRecord(app);
3776
+ if (!appRecord)
3777
+ return;
3778
+ const componentName = getInstanceName(vm) || "Unknown Component";
3779
+ const groupKey = `${uid}-${type}`;
3780
+ const groupInfo = appRecord.perfGroupIds.get(groupKey);
3781
+ if (groupInfo) {
3782
+ const groupId = groupInfo.groupId;
3783
+ const startTime = groupInfo.time;
3784
+ const duration = time - startTime;
3785
+ api.addTimelineEvent({
3786
+ layerId: PERFORMANCE_EVENT_LAYER_ID,
3787
+ event: {
3788
+ time: Date.now(),
3789
+ data: {
3790
+ component: componentName,
3791
+ type,
3792
+ measure: "end",
3793
+ duration: {
3794
+ _custom: {
3795
+ type: "Duration",
3796
+ value: duration,
3797
+ display: `${duration} ms`
3798
+ }
3799
+ }
3800
+ },
3801
+ title: componentName,
3802
+ subtitle: type,
3803
+ groupId
3804
+ }
3805
+ });
3806
+ } else {
3807
+ markEndQueue.set(groupKey, { app, uid, instance: vm, type, time });
3808
+ }
3809
+ }
3810
+
3811
+ // src/core/timeline/index.ts
3812
+ var COMPONENT_EVENT_LAYER_ID = "component-event";
3813
+ function setupBuiltinTimelineLayers(api) {
3814
+ if (!isBrowser2)
3815
+ return;
3816
+ api.addTimelineLayer({
3817
+ id: "mouse",
3818
+ label: "Mouse",
3819
+ color: 10768815
3820
+ });
3821
+ ["mousedown", "mouseup", "click", "dblclick"].forEach((eventType) => {
3822
+ if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.mouseEventEnabled)
3823
+ return;
3824
+ window.addEventListener(eventType, async (event) => {
3825
+ await api.addTimelineEvent({
3826
+ layerId: "mouse",
3827
+ event: {
3828
+ time: Date.now(),
3829
+ data: {
3830
+ type: eventType,
3831
+ x: event.clientX,
3832
+ y: event.clientY
3833
+ },
3834
+ title: eventType
3835
+ }
3836
+ });
3837
+ }, {
3838
+ capture: true,
3839
+ passive: true
3840
+ });
3841
+ });
3842
+ api.addTimelineLayer({
3843
+ id: "keyboard",
3844
+ label: "Keyboard",
3845
+ color: 8475055
3846
+ });
3847
+ ["keyup", "keydown", "keypress"].forEach((eventType) => {
3848
+ window.addEventListener(eventType, async (event) => {
3849
+ if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.keyboardEventEnabled)
3850
+ return;
3851
+ await api.addTimelineEvent({
3852
+ layerId: "keyboard",
3853
+ event: {
3854
+ time: Date.now(),
3855
+ data: {
3856
+ type: eventType,
3857
+ key: event.key,
3858
+ ctrlKey: event.ctrlKey,
3859
+ shiftKey: event.shiftKey,
3860
+ altKey: event.altKey,
3861
+ metaKey: event.metaKey
3862
+ },
3863
+ title: event.key
3864
+ }
3865
+ });
3866
+ }, {
3867
+ capture: true,
3868
+ passive: true
3869
+ });
3870
+ });
3871
+ api.addTimelineLayer({
3872
+ id: COMPONENT_EVENT_LAYER_ID,
3873
+ label: "Component events",
3874
+ color: 5226637
3875
+ });
3876
+ hook.on.componentEmit(async (app, instance, event, params) => {
3877
+ if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.componentEventEnabled)
3878
+ return;
3879
+ const appRecord = await getAppRecord(app);
3880
+ if (!appRecord)
3881
+ return;
3882
+ const componentId = `${appRecord.id}:${instance.uid}`;
3883
+ const componentName = getInstanceName(instance) || "Unknown Component";
3884
+ api.addTimelineEvent({
3885
+ layerId: COMPONENT_EVENT_LAYER_ID,
3886
+ event: {
3887
+ time: Date.now(),
3888
+ data: {
3889
+ component: {
3890
+ _custom: {
3891
+ type: "component-definition",
3892
+ display: componentName
3893
+ }
3894
+ },
3895
+ event,
3896
+ params
3897
+ },
3898
+ title: event,
3899
+ subtitle: `by ${componentName}`,
3900
+ meta: {
3901
+ componentId
3902
+ }
3903
+ }
3904
+ });
3905
+ });
3906
+ api.addTimelineLayer({
3907
+ id: "performance",
3908
+ label: PERFORMANCE_EVENT_LAYER_ID,
3909
+ color: 4307050
3910
+ });
3911
+ hook.on.perfStart((app, uid, vm, type, time) => {
3912
+ if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled)
3913
+ return;
3914
+ performanceMarkStart(api, app, uid, vm, type, time);
3915
+ });
3916
+ hook.on.perfEnd((app, uid, vm, type, time) => {
3917
+ if (!devtoolsState.timelineLayersState.recordingState || !devtoolsState.timelineLayersState.performanceEventEnabled)
3918
+ return;
3919
+ performanceMarkEnd(api, app, uid, vm, type, time);
3920
+ });
3921
+ }
3922
+
3649
3923
  // src/core/vm/index.ts
3650
3924
  init_esm_shims();
3651
3925
  var MAX_$VM = 10;
@@ -3682,6 +3956,7 @@ function createComponentsDevToolsPlugin(app) {
3682
3956
  label: "Components",
3683
3957
  treeFilterPlaceholder: "Search components"
3684
3958
  });
3959
+ setupBuiltinTimelineLayers(api);
3685
3960
  api.on.getInspectorTree(async (payload) => {
3686
3961
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
3687
3962
  const instance = getComponentInstance(activeAppRecord.value, payload.instanceId);
@@ -3831,13 +4106,6 @@ function callDevToolsPluginSetupFn(plugin, app) {
3831
4106
  });
3832
4107
  }
3833
4108
  setupFn(api);
3834
- if (pluginDescriptor.settings) {
3835
- const inspector = devtoolsInspector.find((inspector2) => inspector2.descriptor.id === pluginDescriptor.id);
3836
- if (inspector) {
3837
- inspector.descriptor.settings = pluginDescriptor.settings;
3838
- initPluginSettings(inspector.options.id, pluginDescriptor.settings);
3839
- }
3840
- }
3841
4109
  }
3842
4110
  function removeRegisteredPluginApp(app) {
3843
4111
  target8.__VUE_DEVTOOLS_KIT__REGISTERED_PLUGIN_APPS__.delete(app);
@@ -4139,6 +4407,7 @@ function createAppRecord(app) {
4139
4407
  id,
4140
4408
  name,
4141
4409
  instanceMap: /* @__PURE__ */ new Map(),
4410
+ perfGroupIds: /* @__PURE__ */ new Map(),
4142
4411
  rootInstance
4143
4412
  };
4144
4413
  app.__VUE_DEVTOOLS_NEXT_APP_RECORD__ = record;
@@ -4179,6 +4448,9 @@ function initDevTools() {
4179
4448
  var _a26;
4180
4449
  addDevToolsPluginToBuffer(pluginDescriptor, setupFn);
4181
4450
  const { app } = (_a26 = activeAppRecord) != null ? _a26 : {};
4451
+ if (pluginDescriptor.settings) {
4452
+ initPluginSettings(pluginDescriptor.id, pluginDescriptor.settings);
4453
+ }
4182
4454
  if (!app)
4183
4455
  return;
4184
4456
  callDevToolsPluginSetupFn([pluginDescriptor, setupFn], app);
@@ -5499,7 +5771,7 @@ init_esm_shims();
5499
5771
 
5500
5772
  // src/messaging/presets/iframe/client.ts
5501
5773
  init_esm_shims();
5502
- import { isBrowser } from "@vue/devtools-shared";
5774
+ import { isBrowser as isBrowser3 } from "@vue/devtools-shared";
5503
5775
 
5504
5776
  // src/messaging/presets/iframe/context.ts
5505
5777
  init_esm_shims();
@@ -5515,7 +5787,7 @@ function setIframeServerContext(context) {
5515
5787
 
5516
5788
  // src/messaging/presets/iframe/client.ts
5517
5789
  function createIframeClientChannel() {
5518
- if (!isBrowser) {
5790
+ if (!isBrowser3) {
5519
5791
  return {
5520
5792
  post: (data) => {
5521
5793
  },
@@ -5542,9 +5814,9 @@ function createIframeClientChannel() {
5542
5814
 
5543
5815
  // src/messaging/presets/iframe/server.ts
5544
5816
  init_esm_shims();
5545
- import { isBrowser as isBrowser2 } from "@vue/devtools-shared";
5817
+ import { isBrowser as isBrowser4 } from "@vue/devtools-shared";
5546
5818
  function createIframeServerChannel() {
5547
- if (!isBrowser2) {
5819
+ if (!isBrowser4) {
5548
5820
  return {
5549
5821
  post: (data) => {
5550
5822
  },
@@ -6296,5 +6568,6 @@ export {
6296
6568
  toggleComponentInspectorEnabled,
6297
6569
  toggleHighPerfMode,
6298
6570
  updateDevToolsClientDetected,
6299
- updateDevToolsState
6571
+ updateDevToolsState,
6572
+ updateTimelineLayersState
6300
6573
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "7.4.5",
4
+ "version": "7.5.0",
5
5
  "author": "webfansplz",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,18 +23,18 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "birpc": "^0.2.17",
26
+ "birpc": "^0.2.19",
27
27
  "hookable": "^5.5.3",
28
28
  "mitt": "^3.0.1",
29
29
  "perfect-debounce": "^1.0.0",
30
30
  "speakingurl": "^14.0.1",
31
31
  "superjson": "^2.2.1",
32
- "@vue/devtools-shared": "^7.4.5"
32
+ "@vue/devtools-shared": "^7.5.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/speakingurl": "^13.0.6",
36
- "vue": "^3.5.3",
37
- "vue-router": "^4.4.3"
36
+ "vue": "^3.5.12",
37
+ "vue-router": "^4.4.5"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup --clean",