vite-uni-dev-tool 1.2.3 → 1.2.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/README.md +33 -33
- package/dist/core.js +1 -1
- package/dist/type.d.ts +2 -0
- package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolData.ts +2 -0
- package/dist/v3/DevTool/components/DevToolWindow/hooks/useDevToolHandlers.ts +13 -0
- package/dist/v3/DevTool/components/DevToolWindow/index.vue +15 -3
- package/dist/v3/DevTool/components/NetworkList/NetworkIntercept.vue +1 -1
- package/dist/v3/DevTool/components/SourceCode/Line.vue +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -242,98 +242,98 @@ optimizeDeps: {
|
|
|
242
242
|
|
|
243
243
|
### 预览
|
|
244
244
|
|
|
245
|
-

|
|
246
246
|
|
|
247
247
|
- 调试按钮
|
|
248
248
|
|
|
249
|
-

|
|
250
250
|
|
|
251
251
|
- 支持 console 日志
|
|
252
252
|
|
|
253
|
-

|
|
254
254
|
|
|
255
255
|
- 支持 network 查看
|
|
256
256
|
|
|
257
|
-

|
|
258
|
+

|
|
259
|
+

|
|
260
|
+

|
|
261
|
+

|
|
262
|
+

|
|
263
|
+

|
|
264
264
|
|
|
265
265
|
- 支持 upload 查看
|
|
266
266
|
|
|
267
|
-

|
|
268
|
+

|
|
269
|
+

|
|
270
|
+

|
|
271
271
|
|
|
272
272
|
- 支持 websocket 查看
|
|
273
273
|
|
|
274
|
-

|
|
275
|
+

|
|
276
276
|
|
|
277
277
|
- 支持 connection 网络状态查看
|
|
278
278
|
|
|
279
|
-

|
|
280
280
|
|
|
281
281
|
- 支持 route 查看,跳转
|
|
282
282
|
|
|
283
|
-

|
|
284
284
|
|
|
285
285
|
- 支持 el event 查看
|
|
286
286
|
|
|
287
|
-

|
|
288
288
|
|
|
289
289
|
- 支持 uni event 查看
|
|
290
290
|
|
|
291
|
-

|
|
292
292
|
|
|
293
293
|
- 支持 capture screen 查看
|
|
294
294
|
|
|
295
|
-

|
|
296
296
|
|
|
297
297
|
- 支持 scan code 查看
|
|
298
298
|
|
|
299
|
-

|
|
300
300
|
|
|
301
301
|
- 支持 nfc 查看
|
|
302
302
|
|
|
303
|
-

|
|
304
304
|
|
|
305
305
|
- 支持 storage 查看,编辑
|
|
306
306
|
|
|
307
|
-

|
|
308
308
|
|
|
309
309
|
- 支持 vuex 查看,编辑
|
|
310
310
|
|
|
311
|
-

|
|
312
312
|
|
|
313
313
|
- 支持 pinia 查看,编辑
|
|
314
314
|
|
|
315
|
-

|
|
316
316
|
|
|
317
317
|
- 支持查看 window 信息
|
|
318
318
|
|
|
319
|
-

|
|
320
320
|
|
|
321
321
|
- 支持查看 device 信息
|
|
322
322
|
|
|
323
|
-

|
|
324
324
|
|
|
325
325
|
- 支持查看 system 信息
|
|
326
326
|
|
|
327
|
-

|
|
328
328
|
|
|
329
329
|
- setting 页,支持重启,导出日志(h5,app)
|
|
330
330
|
|
|
331
|
-

|
|
332
|
+

|
|
333
333
|
|
|
334
334
|
- 其他页
|
|
335
|
-

|
|
336
|
+

|
|
337
337
|
|
|
338
338
|
## 更新日志
|
|
339
339
|
|
package/dist/core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{DevStore as f}from"./modules/devStore/index.js";import{DevEvent as v}from"./modules/devEvent/index.js";import{DevIntercept as p}from"./modules/devIntercept/index.js";import{DevConsole as s}from"./modules/devConsole/index.js";import{getPlatform as T}from"./utils/utils.js";import"./utils/index.js";import{consoleProxy as d,setDevConsole as l}from"./core-shared.js";import{backup as H}from"./core-shared.js";import{i18n as D}from"./i18n/instance.js";import{sleep as g}from"./utils/date.js";const i=e=>D.t(e),c="1.2.
|
|
1
|
+
import{DevStore as f}from"./modules/devStore/index.js";import{DevEvent as v}from"./modules/devEvent/index.js";import{DevIntercept as p}from"./modules/devIntercept/index.js";import{DevConsole as s}from"./modules/devConsole/index.js";import{getPlatform as T}from"./utils/utils.js";import"./utils/index.js";import{consoleProxy as d,setDevConsole as l}from"./core-shared.js";import{backup as H}from"./core-shared.js";import{i18n as D}from"./i18n/instance.js";import{sleep as g}from"./utils/date.js";const i=e=>D.t(e),c="1.2.4",u="2026/3/18 15:29:13",m="https://gitee.com/cloud_l/vite-uni-dev-tool",r=new f,t=new v({store:r}),_={getDevToolDestroy:()=>t.getDevToolDestroy(),getDevToolOptions:()=>t.getDevToolOptions(),getRequestIndex:()=>t.getRequestIndex(),setRequestIndex:e=>t.setRequestIndex(e),getTransferIndex:()=>r.getTransferIndex(),setTransferIndex:e=>r.setTransferIndex(e),getScreenIndex:()=>r.getScreenIndex(),setScreenIndex:e=>r.setScreenIndex(e),getInterceptNetworkMap:()=>t.getInterceptNetworkMap(),updateConsole:e=>t.updateConsoleList(e),updateNetwork:(e,o)=>t.updateNetworkList(e,o),updateWs:e=>t.updateWsList(e),addWsTask:(e,o)=>t.addWsTask(e,o),removeWsTask:e=>t.removeWsTask(e),updateStorage:e=>t.updateStorage(e),updateTransfer:(e,o)=>t.updateTransfer(e,o),updateUniEvent:e=>t.updateUniEvent(e),updateScreen:(e,o)=>t.updateScreen(e,o),updateScanCode:e=>t.updateScanCode(e),updateNfc:e=>t.updateNfc(e),updateBluetooth:e=>t.updateBluetooth(e),updateRoute:e=>t.updateRouteList(e),updateUniEventCount:e=>t.updateUniEventCount(e),addTransferTask:(e,o)=>t.addTransferTask(e,o),removeTransferTask:e=>t.removeTransferTask(e),clearStorage:()=>t.clearStorage(!1),removeStorage:e=>t.removeStorage(e,!1),closeWindow:()=>t.closeDevToolWindow(),setVuexList:e=>t.setVuexList(e),setVueStore:e=>t.setVueStore(e),setPiniaList:e=>t.setPiniaList(e),setPiniaStore:e=>t.setPiniaStore(e)},n=new p({hooks:_});let a;t.setIntercept(n);function S(){if(typeof uni>"u")return;const e=T();try{const o=Object.getOwnPropertyDescriptor(uni,"__dev_tool_platform__");if(o&&o.configurable===!1)return;Object.defineProperty(uni,"__dev_tool_platform__",{value:e,configurable:!0})}catch{}}function y(e){if(!(typeof uni>"u"))try{const o=Object.getOwnPropertyDescriptor(uni,"__dev_tool_scan_code_collection__");if(o&&o.configurable===!1)return;Object.defineProperty(uni,"__dev_tool_scan_code_collection__",{value:e.devToolScanCode.bind(e),configurable:!0})}catch{}}function b(e){if(!(typeof uni>"u"))try{const o=Object.getOwnPropertyDescriptor(uni,"__dev_tool_nfc_collection__");if(o&&o.configurable===!1)return;Object.defineProperty(uni,"__dev_tool_nfc_collection__",{value:e.devToolNFC.bind(e),configurable:!0})}catch{}}function L(){return r.getDevToolOptions()}async function R(e){e!=null&&e.mode||d.error(`[DevTool] ${i("common.modeRequired")}`),S(),y(t),b(t),a=new s(t),l(a),r.setDevToolOptions({...e||{mode:""},zIndex:(e==null?void 0:e.zIndex)??998,devToolVersion:c,devToolBuildTime:u,devToolGit:m}),n.interceptVue(e==null?void 0:e.vueInstance),n.init({enableCaptureScreen:e==null?void 0:e.enableCaptureScreen,enableInterceptPromiseReject:e==null?void 0:e.enableInterceptPromiseReject}),r.getDevToolDestroy()||(t.addEventListener(),t.postMessage()),d.log(`[DevTool] ${i("common.initSuccess")}
|
|
2
2
|
${i("setting.devTool.currentVersion")}:${c}
|
|
3
3
|
${i("setting.devTool.buildTime")}:${u}
|
|
4
4
|
${i("common.debugSlogan")}`),t.startAbnormalUpload(),await g(100),t.updateRouteList()}function V(){r.getDevToolDestroy()||t.showDevToolButton()}function j(){r.getDevToolDestroy()||t.hideDevToolButton()}function N(){r.getDevToolDestroy()||t.openDevToolWindow()}function B(){r.getDevToolDestroy()||t.closeDevToolWindow()}function $(){r.getDevToolDestroy()&&(a=new s(t),l(a),t.createDevTool({devToolVersion:c,devToolBuildTime:u}))}function E(){r.getDevToolDestroy()||(t.destroyDevTool(),n.reset(),a=void 0,l(void 0))}function q(){r.getDevToolDestroy()||t.restartDevTool()}function A(){t.restartApp()}function U(e){return n.interceptVuexStorage(e)}function M(e){return n.interceptPiniaStore(e)}function z(e){t.uploadAbnormal(e)}export{H as backup,B as closeDevToolWindow,d as console,$ as createDevTool,E as destroyDevTool,L as getDevToolOptions,j as hideDevToolButton,R as initDevTool,M as interceptPiniaStore,U as interceptVuexStorage,N as openDevToolWindow,A as restartApp,q as restartDevTool,V as showDevToolButton,z as uploadAbnormal};
|
package/dist/type.d.ts
CHANGED
|
@@ -107,6 +107,7 @@ export function useDevToolData(props: DevToolWindowProps) {
|
|
|
107
107
|
const searchStorage = shallowRef('');
|
|
108
108
|
|
|
109
109
|
const activeTab = shallowRef(1);
|
|
110
|
+
const tabScrollLeft = shallowRef(0);
|
|
110
111
|
const theme = shallowRef('light');
|
|
111
112
|
let isActive = false;
|
|
112
113
|
|
|
@@ -397,6 +398,7 @@ export function useDevToolData(props: DevToolWindowProps) {
|
|
|
397
398
|
searchRoute,
|
|
398
399
|
searchStorage,
|
|
399
400
|
activeTab,
|
|
401
|
+
tabScrollLeft,
|
|
400
402
|
theme,
|
|
401
403
|
isFullScreen,
|
|
402
404
|
windowX,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { debounce } from '../../../../../utils/index';
|
|
1
2
|
import { setDevToolInfo } from '../../../../../modules/devToolInfo';
|
|
2
3
|
import type { DevTool } from '../../../../../type';
|
|
3
4
|
import { CMD_TYPE, MSG_TYPE, DEV_CORE_MESSAGE } from '../../../../../const';
|
|
@@ -17,6 +18,7 @@ export function useDevToolHandlers(
|
|
|
17
18
|
currentWebSocketType,
|
|
18
19
|
currentTransferType,
|
|
19
20
|
currentTransferCategory,
|
|
21
|
+
tabScrollLeft,
|
|
20
22
|
cacheInterceptConfig,
|
|
21
23
|
useTransition,
|
|
22
24
|
baseFontSize,
|
|
@@ -62,6 +64,7 @@ export function useDevToolHandlers(
|
|
|
62
64
|
currentNetworkType: currentNetworkType.value,
|
|
63
65
|
currentWebSocketType: currentWebSocketType.value,
|
|
64
66
|
theme: theme.value,
|
|
67
|
+
tabScrollLeft: tabScrollLeft.value,
|
|
65
68
|
cacheInterceptConfig: cacheInterceptConfig.value,
|
|
66
69
|
cacheNetworkLog: cacheNetworkLog.value,
|
|
67
70
|
cacheConsoleLog: cacheConsoleLog.value,
|
|
@@ -79,6 +82,8 @@ export function useDevToolHandlers(
|
|
|
79
82
|
});
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
const debounceSetWindowInfo = debounce(setWindowInfo, 200);
|
|
86
|
+
|
|
82
87
|
function onCloseWindow() {
|
|
83
88
|
emits('close');
|
|
84
89
|
setWindowInfo();
|
|
@@ -89,6 +94,13 @@ export function useDevToolHandlers(
|
|
|
89
94
|
setWindowInfo();
|
|
90
95
|
}
|
|
91
96
|
|
|
97
|
+
function onScrollTabs(e: any) {
|
|
98
|
+
tabScrollLeft.value = e.detail.scrollLeft;
|
|
99
|
+
debounceSetWindowInfo();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const debounceScrollTabs = debounce(onScrollTabs, 200);
|
|
103
|
+
|
|
92
104
|
function onConsoleChoose(type: string) {
|
|
93
105
|
if (type === 'clear') {
|
|
94
106
|
consoleList.value = [];
|
|
@@ -573,6 +585,7 @@ export function useDevToolHandlers(
|
|
|
573
585
|
return {
|
|
574
586
|
onCloseWindow,
|
|
575
587
|
onChangeTabs,
|
|
588
|
+
debounceScrollTabs,
|
|
576
589
|
onConsoleChoose,
|
|
577
590
|
onRunJS,
|
|
578
591
|
onSearchConsole,
|
|
@@ -34,9 +34,12 @@
|
|
|
34
34
|
]">
|
|
35
35
|
<view class="dev-tool-window-bg"></view>
|
|
36
36
|
<Tabs
|
|
37
|
+
data-drag-handle="1"
|
|
37
38
|
:model-value="activeTab"
|
|
38
39
|
:items="tabItems"
|
|
40
|
+
:scroll-left="tabScrollLeft"
|
|
39
41
|
@close="onCloseWindow"
|
|
42
|
+
@scroll="debounceScrollTabs"
|
|
40
43
|
@change="onChangeTabs">
|
|
41
44
|
<template #extra>
|
|
42
45
|
<CircularButton
|
|
@@ -415,6 +418,7 @@ import { onShow, onTabItemTap } from '@dcloudio/uni-app';
|
|
|
415
418
|
import {
|
|
416
419
|
onMounted,
|
|
417
420
|
computed,
|
|
421
|
+
nextTick,
|
|
418
422
|
onBeforeMount,
|
|
419
423
|
onUnmounted,
|
|
420
424
|
ref,
|
|
@@ -500,6 +504,7 @@ const overlay = useDevToolOverlay(props);
|
|
|
500
504
|
// 解构常用状态
|
|
501
505
|
const {
|
|
502
506
|
activeTab,
|
|
507
|
+
tabScrollLeft,
|
|
503
508
|
theme,
|
|
504
509
|
consoleList,
|
|
505
510
|
networkList,
|
|
@@ -608,6 +613,7 @@ const dynamicWindowStyle = computed(() => {
|
|
|
608
613
|
const {
|
|
609
614
|
onCloseWindow,
|
|
610
615
|
onChangeTabs,
|
|
616
|
+
debounceScrollTabs,
|
|
611
617
|
onConsoleChoose,
|
|
612
618
|
onRunJS,
|
|
613
619
|
onSearchConsole,
|
|
@@ -836,9 +842,15 @@ onMounted(() => {
|
|
|
836
842
|
? devToolInfo.barrageShowWhenOpen
|
|
837
843
|
: false;
|
|
838
844
|
|
|
839
|
-
//
|
|
840
|
-
|
|
841
|
-
|
|
845
|
+
// 延迟恢复滚动位置,确保布局已渲染
|
|
846
|
+
setTimeout(() => {
|
|
847
|
+
tabScrollLeft.value = devToolInfo?.tabScrollLeft || 0;
|
|
848
|
+
nextTick(() => {
|
|
849
|
+
// 确保恢复的索引在当前可见 Tab 的范围内
|
|
850
|
+
const savedTab = devToolInfo?.activeTab || 0;
|
|
851
|
+
activeTab.value = savedTab < tabItems.value.length ? savedTab : 0;
|
|
852
|
+
});
|
|
853
|
+
}, 150);
|
|
842
854
|
|
|
843
855
|
if (devToolInfo.windowSettings) {
|
|
844
856
|
isFullScreen.value = devToolInfo.windowSettings.isFullScreen ?? true;
|