@vue/devtools-kit 8.0.2 → 8.0.4

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
@@ -25,13 +25,9 @@ var __toESM = (mod, isNodeMode, target$21) => (target$21 = mod != null ? __creat
25
25
 
26
26
  //#endregion
27
27
  let __vue_devtools_shared = require("@vue/devtools-shared");
28
- __vue_devtools_shared = __toESM(__vue_devtools_shared);
29
28
  let perfect_debounce = require("perfect-debounce");
30
- perfect_debounce = __toESM(perfect_debounce);
31
29
  let hookable = require("hookable");
32
- hookable = __toESM(hookable);
33
30
  let birpc = require("birpc");
34
- birpc = __toESM(birpc);
35
31
 
36
32
  //#region src/compat/index.ts
37
33
  function onLegacyDevToolsPluginApiAvailable(cb) {
@@ -111,9 +107,7 @@ function getInstanceName(instance) {
111
107
  * @param {Vue} instance
112
108
  */
113
109
  function getUniqueComponentId(instance) {
114
- const appId = instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0;
115
- const instanceId = instance === instance?.root ? "root" : instance.uid;
116
- return `${appId}:${instanceId}`;
110
+ return `${instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0}:${instance === instance?.root ? "root" : instance.uid}`;
117
111
  }
118
112
  function getRenderKey(value) {
119
113
  if (value == null) return "";
@@ -356,10 +350,7 @@ function inspectFn(e) {
356
350
  function selectComponentFn(e, cb) {
357
351
  e.preventDefault();
358
352
  e.stopPropagation();
359
- if (inspectInstance) {
360
- const uniqueComponentId = getUniqueComponentId(inspectInstance);
361
- cb(uniqueComponentId);
362
- }
353
+ if (inspectInstance) cb(getUniqueComponentId(inspectInstance));
363
354
  }
364
355
  let inspectComponentHighLighterSelectFn = null;
365
356
  function cancelInspectComponentHighLighter() {
@@ -632,7 +623,7 @@ function addTimelineLayersStateToStorage(state) {
632
623
  localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state));
633
624
  }
634
625
  function getTimelineLayersStateFromStorage() {
635
- if (!__vue_devtools_shared.isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
626
+ if (typeof window === "undefined" || !__vue_devtools_shared.isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
636
627
  recordingState: false,
637
628
  mouseEventEnabled: false,
638
629
  keyboardEventEnabled: false,
@@ -640,7 +631,7 @@ function getTimelineLayersStateFromStorage() {
640
631
  performanceEventEnabled: false,
641
632
  selected: ""
642
633
  };
643
- const state = localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID);
634
+ const state = typeof localStorage.getItem !== "undefined" ? localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID) : null;
644
635
  return state ? JSON.parse(state) : {
645
636
  recordingState: false,
646
637
  mouseEventEnabled: false,
@@ -1079,10 +1070,7 @@ function getPluginSettings(pluginId, fallbackValue) {
1079
1070
  const localSettings = localStorage.getItem(localKey);
1080
1071
  if (localSettings) return JSON.parse(localSettings);
1081
1072
  }
1082
- if (pluginId) {
1083
- const item = devtoolsPluginBuffer.find((item$1) => item$1[0].id === pluginId)?.[0] ?? null;
1084
- return _getSettings(item?.settings ?? {});
1085
- }
1073
+ if (pluginId) return _getSettings((devtoolsPluginBuffer.find((item) => item[0].id === pluginId)?.[0] ?? null)?.settings ?? {});
1086
1074
  return _getSettings(fallbackValue);
1087
1075
  }
1088
1076
  function initPluginSettings(pluginId, settings) {
@@ -1616,10 +1604,9 @@ function processState(instance) {
1616
1604
  }
1617
1605
  function getStateTypeAndName(info) {
1618
1606
  const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
1619
- const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
1620
1607
  return {
1621
1608
  stateType,
1622
- stateTypeName
1609
+ stateTypeName: stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null
1623
1610
  };
1624
1611
  }
1625
1612
  function processSetupState(instance) {
@@ -1753,15 +1740,11 @@ function processInstanceState(instance) {
1753
1740
  //#region src/core/component/state/index.ts
1754
1741
  function getInstanceState(params) {
1755
1742
  const instance = getComponentInstance(activeAppRecord.value, params.instanceId);
1756
- const id = getUniqueComponentId(instance);
1757
- const name = getInstanceName(instance);
1758
- const file = instance?.type?.__file;
1759
- const state = processInstanceState(instance);
1760
1743
  return {
1761
- id,
1762
- name,
1763
- file,
1764
- state,
1744
+ id: getUniqueComponentId(instance),
1745
+ name: getInstanceName(instance),
1746
+ file: instance?.type?.__file,
1747
+ state: processInstanceState(instance),
1765
1748
  instance
1766
1749
  };
1767
1750
  }
@@ -2008,8 +1991,7 @@ function performanceMarkEnd(api, app, uid, vm, type, time) {
2008
1991
  const groupInfo = appRecord.perfGroupIds.get(groupKey);
2009
1992
  if (groupInfo) {
2010
1993
  const groupId = groupInfo.groupId;
2011
- const startTime = groupInfo.time;
2012
- const duration = time - startTime;
1994
+ const duration = time - groupInfo.time;
2013
1995
  api.addTimelineEvent({
2014
1996
  layerId: PERFORMANCE_EVENT_LAYER_ID,
2015
1997
  event: {
@@ -2196,10 +2178,9 @@ function createComponentsDevToolsPlugin(app) {
2196
2178
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2197
2179
  const result = getInstanceState({ instanceId: payload.nodeId });
2198
2180
  const componentInstance = result.instance;
2199
- const app$1 = result.instance?.appContext.app;
2200
2181
  const _payload = {
2201
2182
  componentInstance,
2202
- app: app$1,
2183
+ app: result.instance?.appContext.app,
2203
2184
  instanceData: result
2204
2185
  };
2205
2186
  devtoolsContext.hooks.callHookWith((callbacks) => {
@@ -4343,8 +4324,7 @@ function updateDevToolsClientDetected(params) {
4343
4324
  ...devtoolsState.devtoolsClientDetected,
4344
4325
  ...params
4345
4326
  };
4346
- const devtoolsClientVisible = Object.values(devtoolsState.devtoolsClientDetected).some(Boolean);
4347
- toggleHighPerfMode(!devtoolsClientVisible);
4327
+ toggleHighPerfMode(!Object.values(devtoolsState.devtoolsClientDetected).some(Boolean));
4348
4328
  }
4349
4329
  __vue_devtools_shared.target.__VUE_DEVTOOLS_UPDATE_CLIENT_DETECTED__ ??= updateDevToolsClientDetected;
4350
4330
 
@@ -4906,8 +4886,7 @@ function copy(target$21, options = {}) {
4906
4886
  return [...props, ...symbols].reduce((carry, key) => {
4907
4887
  if (isArray$1(options.props) && !options.props.includes(key)) return carry;
4908
4888
  const val = target$21[key];
4909
- const newVal = copy(val, options);
4910
- assignProp(carry, key, newVal, target$21, options.nonenumerable);
4889
+ assignProp(carry, key, copy(val, options), target$21, options.nonenumerable);
4911
4890
  return carry;
4912
4891
  }, {});
4913
4892
  }
@@ -5414,10 +5393,9 @@ function getFunctionDetails(func) {
5414
5393
  } catch (e) {}
5415
5394
  const match = matches && matches[0];
5416
5395
  const args = typeof match === "string" ? match : "(?)";
5417
- const name = typeof func.name === "string" ? func.name : "";
5418
5396
  return { _custom: {
5419
5397
  type: "function",
5420
- displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(name)}${args}</span>`,
5398
+ displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(typeof func.name === "string" ? func.name : "")}${args}</span>`,
5421
5399
  tooltipText: string.trim() ? `<pre>${string}</pre>` : null
5422
5400
  } };
5423
5401
  }
package/dist/index.js CHANGED
@@ -107,9 +107,7 @@ function getInstanceName(instance) {
107
107
  * @param {Vue} instance
108
108
  */
109
109
  function getUniqueComponentId(instance) {
110
- const appId = instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0;
111
- const instanceId = instance === instance?.root ? "root" : instance.uid;
112
- return `${appId}:${instanceId}`;
110
+ return `${instance?.appContext?.app?.__VUE_DEVTOOLS_NEXT_APP_RECORD_ID__ ?? 0}:${instance === instance?.root ? "root" : instance.uid}`;
113
111
  }
114
112
  function getRenderKey(value) {
115
113
  if (value == null) return "";
@@ -352,10 +350,7 @@ function inspectFn(e) {
352
350
  function selectComponentFn(e, cb) {
353
351
  e.preventDefault();
354
352
  e.stopPropagation();
355
- if (inspectInstance) {
356
- const uniqueComponentId = getUniqueComponentId(inspectInstance);
357
- cb(uniqueComponentId);
358
- }
353
+ if (inspectInstance) cb(getUniqueComponentId(inspectInstance));
359
354
  }
360
355
  let inspectComponentHighLighterSelectFn = null;
361
356
  function cancelInspectComponentHighLighter() {
@@ -628,7 +623,7 @@ function addTimelineLayersStateToStorage(state) {
628
623
  localStorage.setItem(TIMELINE_LAYERS_STATE_STORAGE_ID, JSON.stringify(state));
629
624
  }
630
625
  function getTimelineLayersStateFromStorage() {
631
- if (!isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
626
+ if (typeof window === "undefined" || !isBrowser || typeof localStorage === "undefined" || localStorage === null) return {
632
627
  recordingState: false,
633
628
  mouseEventEnabled: false,
634
629
  keyboardEventEnabled: false,
@@ -636,7 +631,7 @@ function getTimelineLayersStateFromStorage() {
636
631
  performanceEventEnabled: false,
637
632
  selected: ""
638
633
  };
639
- const state = localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID);
634
+ const state = typeof localStorage.getItem !== "undefined" ? localStorage.getItem(TIMELINE_LAYERS_STATE_STORAGE_ID) : null;
640
635
  return state ? JSON.parse(state) : {
641
636
  recordingState: false,
642
637
  mouseEventEnabled: false,
@@ -1075,10 +1070,7 @@ function getPluginSettings(pluginId, fallbackValue) {
1075
1070
  const localSettings = localStorage.getItem(localKey);
1076
1071
  if (localSettings) return JSON.parse(localSettings);
1077
1072
  }
1078
- if (pluginId) {
1079
- const item = devtoolsPluginBuffer.find((item$1) => item$1[0].id === pluginId)?.[0] ?? null;
1080
- return _getSettings(item?.settings ?? {});
1081
- }
1073
+ if (pluginId) return _getSettings((devtoolsPluginBuffer.find((item) => item[0].id === pluginId)?.[0] ?? null)?.settings ?? {});
1082
1074
  return _getSettings(fallbackValue);
1083
1075
  }
1084
1076
  function initPluginSettings(pluginId, settings) {
@@ -1612,10 +1604,9 @@ function processState(instance) {
1612
1604
  }
1613
1605
  function getStateTypeAndName(info) {
1614
1606
  const stateType = info.computed ? "computed" : info.ref ? "ref" : info.reactive ? "reactive" : null;
1615
- const stateTypeName = stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null;
1616
1607
  return {
1617
1608
  stateType,
1618
- stateTypeName
1609
+ stateTypeName: stateType ? `${stateType.charAt(0).toUpperCase()}${stateType.slice(1)}` : null
1619
1610
  };
1620
1611
  }
1621
1612
  function processSetupState(instance) {
@@ -1749,15 +1740,11 @@ function processInstanceState(instance) {
1749
1740
  //#region src/core/component/state/index.ts
1750
1741
  function getInstanceState(params) {
1751
1742
  const instance = getComponentInstance(activeAppRecord.value, params.instanceId);
1752
- const id = getUniqueComponentId(instance);
1753
- const name = getInstanceName(instance);
1754
- const file = instance?.type?.__file;
1755
- const state = processInstanceState(instance);
1756
1743
  return {
1757
- id,
1758
- name,
1759
- file,
1760
- state,
1744
+ id: getUniqueComponentId(instance),
1745
+ name: getInstanceName(instance),
1746
+ file: instance?.type?.__file,
1747
+ state: processInstanceState(instance),
1761
1748
  instance
1762
1749
  };
1763
1750
  }
@@ -2004,8 +1991,7 @@ function performanceMarkEnd(api, app, uid, vm, type, time) {
2004
1991
  const groupInfo = appRecord.perfGroupIds.get(groupKey);
2005
1992
  if (groupInfo) {
2006
1993
  const groupId = groupInfo.groupId;
2007
- const startTime = groupInfo.time;
2008
- const duration = time - startTime;
1994
+ const duration = time - groupInfo.time;
2009
1995
  api.addTimelineEvent({
2010
1996
  layerId: PERFORMANCE_EVENT_LAYER_ID,
2011
1997
  event: {
@@ -2192,10 +2178,9 @@ function createComponentsDevToolsPlugin(app) {
2192
2178
  if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
2193
2179
  const result = getInstanceState({ instanceId: payload.nodeId });
2194
2180
  const componentInstance = result.instance;
2195
- const app$1 = result.instance?.appContext.app;
2196
2181
  const _payload = {
2197
2182
  componentInstance,
2198
- app: app$1,
2183
+ app: result.instance?.appContext.app,
2199
2184
  instanceData: result
2200
2185
  };
2201
2186
  devtoolsContext.hooks.callHookWith((callbacks) => {
@@ -4339,8 +4324,7 @@ function updateDevToolsClientDetected(params) {
4339
4324
  ...devtoolsState.devtoolsClientDetected,
4340
4325
  ...params
4341
4326
  };
4342
- const devtoolsClientVisible = Object.values(devtoolsState.devtoolsClientDetected).some(Boolean);
4343
- toggleHighPerfMode(!devtoolsClientVisible);
4327
+ toggleHighPerfMode(!Object.values(devtoolsState.devtoolsClientDetected).some(Boolean));
4344
4328
  }
4345
4329
  target.__VUE_DEVTOOLS_UPDATE_CLIENT_DETECTED__ ??= updateDevToolsClientDetected;
4346
4330
 
@@ -4902,8 +4886,7 @@ function copy(target$1, options = {}) {
4902
4886
  return [...props, ...symbols].reduce((carry, key) => {
4903
4887
  if (isArray$1(options.props) && !options.props.includes(key)) return carry;
4904
4888
  const val = target$1[key];
4905
- const newVal = copy(val, options);
4906
- assignProp(carry, key, newVal, target$1, options.nonenumerable);
4889
+ assignProp(carry, key, copy(val, options), target$1, options.nonenumerable);
4907
4890
  return carry;
4908
4891
  }, {});
4909
4892
  }
@@ -5410,10 +5393,9 @@ function getFunctionDetails(func) {
5410
5393
  } catch (e) {}
5411
5394
  const match = matches && matches[0];
5412
5395
  const args = typeof match === "string" ? match : "(?)";
5413
- const name = typeof func.name === "string" ? func.name : "";
5414
5396
  return { _custom: {
5415
5397
  type: "function",
5416
- displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(name)}${args}</span>`,
5398
+ displayText: `<span style="opacity:.8;margin-right:5px;">function</span> <span style="white-space:nowrap;">${escape(typeof func.name === "string" ? func.name : "")}${args}</span>`,
5417
5399
  tooltipText: string.trim() ? `<pre>${string}</pre>` : null
5418
5400
  } };
5419
5401
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue/devtools-kit",
3
3
  "type": "module",
4
- "version": "8.0.2",
4
+ "version": "8.0.4",
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": "^2.5.0",
26
+ "birpc": "^2.6.1",
27
27
  "hookable": "^5.5.3",
28
28
  "mitt": "^3.0.1",
29
29
  "perfect-debounce": "^2.0.0",
30
30
  "speakingurl": "^14.0.1",
31
31
  "superjson": "^2.2.2",
32
- "@vue/devtools-shared": "^8.0.2"
32
+ "@vue/devtools-shared": "^8.0.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/speakingurl": "^13.0.6",
36
- "vue": "^3.5.21",
37
- "vue-router": "^4.5.1"
36
+ "vue": "^3.5.22",
37
+ "vue-router": "^4.6.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsdown --clean",
File without changes
File without changes