vite-uni-dev-tool 0.0.11 → 0.0.13
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 +55 -1
- package/dist/const.d.ts +133 -0
- package/dist/const.d.ts.map +1 -0
- package/dist/const.js +36 -0
- package/dist/core.d.ts +52 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +80 -0
- package/dist/devConsole/index.d.ts +169 -0
- package/dist/devConsole/index.d.ts.map +1 -0
- package/dist/devConsole/index.js +270 -0
- package/dist/devEvent/index.d.ts +286 -0
- package/dist/devEvent/index.d.ts.map +1 -0
- package/dist/devEvent/index.js +435 -0
- package/dist/devEventBus/index.d.ts +42 -0
- package/dist/devEventBus/index.d.ts.map +1 -0
- package/dist/devEventBus/index.js +70 -0
- package/dist/devIntercept/index.d.ts +119 -0
- package/dist/devIntercept/index.d.ts.map +1 -0
- package/dist/devIntercept/index.js +582 -0
- package/dist/devRunJS/index.d.ts +67 -0
- package/dist/devRunJS/index.d.ts.map +1 -0
- package/dist/devStore/index.d.ts +178 -0
- package/dist/devStore/index.d.ts.map +1 -0
- package/dist/devStore/index.js +395 -0
- package/dist/devToolInfo/index.d.ts +17 -0
- package/dist/devToolInfo/index.d.ts.map +1 -0
- package/dist/devToolInfo/index.js +15 -0
- package/{dev → dist}/plugins/uniDevTool/uniDevTool.d.ts +15 -1
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/uniDevTool.js +35 -0
- package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.js +7 -7
- package/{dev → dist}/plugins/utils/index.d.ts +3 -0
- package/{dev → dist}/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +1 -0
- package/dist/type.d.ts +264 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/utils/array.d.ts +2 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/array.js +12 -0
- package/dist/utils/date.d.ts +19 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/date.js +40 -0
- package/dist/utils/file.d.ts +11 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +87 -0
- package/dist/utils/function.d.ts +28 -0
- package/dist/utils/function.d.ts.map +1 -0
- package/dist/utils/function.js +46 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +55 -0
- package/dist/utils/ip.d.ts +5 -0
- package/dist/utils/ip.d.ts.map +1 -0
- package/dist/utils/ip.js +21 -0
- package/dist/utils/language.d.ts +29 -0
- package/dist/utils/language.d.ts.map +1 -0
- package/dist/utils/language.js +50 -0
- package/dist/utils/object.d.ts +49 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +118 -0
- package/dist/utils/page.d.ts +7 -0
- package/dist/utils/page.d.ts.map +1 -0
- package/dist/utils/page.js +7 -0
- package/dist/utils/platform.d.ts +4 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +14 -0
- package/dist/utils/string.d.ts +45 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +88 -0
- package/dist/utils/utils.d.ts +16 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/v2/AutoSizer/utils.d.ts +5 -0
- package/dist/v2/AutoSizer/utils.d.ts.map +1 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.d.ts +4 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
- package/dist/v2/JsonPretty/hooks/useError.d.ts +8 -0
- package/dist/v2/JsonPretty/hooks/useError.d.ts.map +1 -0
- package/dist/v2/JsonPretty/type.d.ts +93 -0
- package/dist/v2/JsonPretty/type.d.ts.map +1 -0
- package/dist/v3/AutoSizer/utils.d.ts +5 -0
- package/dist/v3/AutoSizer/utils.d.ts.map +1 -0
- package/dist/v3/ConsoleList/staticTips.d.ts +13 -0
- package/dist/v3/ConsoleList/staticTips.d.ts.map +1 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +4 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
- package/dist/v3/JsonPretty/hooks/useError.d.ts +8 -0
- package/dist/v3/JsonPretty/hooks/useError.d.ts.map +1 -0
- package/dist/v3/JsonPretty/type.d.ts +93 -0
- package/dist/v3/JsonPretty/type.d.ts.map +1 -0
- package/dist/v3/JsonPretty/utils/index.d.ts +10 -0
- package/dist/v3/JsonPretty/utils/index.d.ts.map +1 -0
- package/package.json +5 -5
- package/dev/components/AppInfo/index.vue +0 -36
- package/dev/components/AutoSizer/index.vue +0 -193
- package/dev/components/AutoSizer/index1.vue +0 -186
- package/dev/components/AutoSizer/utils.ts +0 -49
- package/dev/components/Button/index.vue +0 -34
- package/dev/components/CaptureScreen/index.vue +0 -62
- package/dev/components/Checkbox/index.vue +0 -40
- package/dev/components/CloseButton/index.vue +0 -26
- package/dev/components/Code/index.vue +0 -230
- package/dev/components/Connection/index.vue +0 -88
- package/dev/components/ConsoleList/Code.vue +0 -227
- package/dev/components/ConsoleList/ConsoleItem.vue +0 -186
- package/dev/components/ConsoleList/RunJSInput.vue +0 -235
- package/dev/components/ConsoleList/index.vue +0 -130
- package/dev/components/ConsoleList/staticTips.ts +0 -1145
- package/dev/components/DevTool/index.vue +0 -182
- package/dev/components/DevToolButton/index.vue +0 -213
- package/dev/components/DevToolTitle/index.vue +0 -21
- package/dev/components/DevToolWindow/index.vue +0 -1037
- package/dev/components/DeviceInfo/index.vue +0 -32
- package/dev/components/Empty/empty.png +0 -0
- package/dev/components/Empty/index.vue +0 -28
- package/dev/components/FilterInput/index.vue +0 -86
- package/dev/components/JsonPretty/components/Brackets/index.vue +0 -23
- package/dev/components/JsonPretty/components/Carets/index.vue +0 -59
- package/dev/components/JsonPretty/components/CheckController/index.vue +0 -125
- package/dev/components/JsonPretty/components/TreeNode/index.vue +0 -349
- package/dev/components/JsonPretty/hooks/useClipboard.ts +0 -21
- package/dev/components/JsonPretty/hooks/useError.ts +0 -21
- package/dev/components/JsonPretty/index.vue +0 -474
- package/dev/components/JsonPretty/type.ts +0 -125
- package/dev/components/JsonPretty/utils/index.ts +0 -172
- package/dev/components/NetworkList/NetworkDetail.vue +0 -197
- package/dev/components/NetworkList/NetworkItem.vue +0 -106
- package/dev/components/NetworkList/index.vue +0 -115
- package/dev/components/PiniaList/index.vue +0 -64
- package/dev/components/RouteList/index.vue +0 -110
- package/dev/components/RunJS/index.vue +0 -128
- package/dev/components/SettingList/index.vue +0 -225
- package/dev/components/StorageList/index.vue +0 -170
- package/dev/components/SystemInfo/index.vue +0 -34
- package/dev/components/Tabs/index.vue +0 -123
- package/dev/components/Tag/index.vue +0 -89
- package/dev/components/UniEvent/UniEventItem.vue +0 -124
- package/dev/components/UniEvent/index.vue +0 -94
- package/dev/components/UploadList/UploadDetail.vue +0 -208
- package/dev/components/UploadList/UploadItem.vue +0 -111
- package/dev/components/UploadList/index.vue +0 -104
- package/dev/components/VirtualList/index.vue +0 -112
- package/dev/components/VirtualListPro/AutoSize.vue +0 -43
- package/dev/components/VirtualListPro/index.vue +0 -175
- package/dev/components/VirtualListPro/readme.md +0 -40
- package/dev/components/VuexList/index.vue +0 -54
- package/dev/components/WebSocket/WebSocketItem.vue +0 -98
- package/dev/components/WebSocket/WebSocketList.vue +0 -176
- package/dev/components/WebSocket/index.vue +0 -111
- package/dev/components/WindowInfo/index.vue +0 -33
- package/dev/const.ts +0 -166
- package/dev/core.ts +0 -118
- package/dev/devConsole/index.ts +0 -350
- package/dev/devEvent/index.ts +0 -806
- package/dev/devEventBus/index.ts +0 -94
- package/dev/devIntercept/index.ts +0 -745
- package/dev/devRunJS/index.ts +0 -170
- package/dev/devStore/index.ts +0 -718
- package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +0 -1
- package/dev/plugins/uniDevTool/uniDevTool.js +0 -36
- package/dev/plugins/utils/index.js +0 -1
- package/dev/shims-uni.d.ts +0 -43
- package/dev/type.ts +0 -264
- package/dev/utils/array.ts +0 -15
- package/dev/utils/date.ts +0 -75
- package/dev/utils/file.ts +0 -121
- package/dev/utils/function.ts +0 -192
- package/dev/utils/index.d.ts +0 -6
- package/dev/utils/index.ts +0 -46
- package/dev/utils/ip.ts +0 -79
- package/dev/utils/language.ts +0 -72
- package/dev/utils/object.ts +0 -298
- package/dev/utils/page.ts +0 -13
- package/dev/utils/platform.ts +0 -14
- package/dev/utils/string.ts +0 -133
- package/dev/utils/utils.ts +0 -198
- /package/{dev → dist}/index.d.ts +0 -0
- /package/{dev → dist}/index.d.ts.map +0 -0
- /package/{dev → dist}/index.js +0 -0
- /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts +0 -0
- /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { DevTool } from '../type';
|
|
2
|
+
|
|
3
|
+
/** 数据存储中心 */
|
|
4
|
+
export declare class DevStore {
|
|
5
|
+
/** 状态数据 */
|
|
6
|
+
private state;
|
|
7
|
+
/** 调试配置 */
|
|
8
|
+
private devToolOptions;
|
|
9
|
+
/** 日志最大值 */
|
|
10
|
+
private uploadMaxSize;
|
|
11
|
+
/** 日志最大值 */
|
|
12
|
+
private consoleMaxSize;
|
|
13
|
+
/** 网络最大值 */
|
|
14
|
+
private networkMaxSize;
|
|
15
|
+
/** ws数据最大值 */
|
|
16
|
+
private wsDataMaxSize;
|
|
17
|
+
/** 事件列表最大值 */
|
|
18
|
+
private eventListMaxSize;
|
|
19
|
+
/** 截屏最大值 */
|
|
20
|
+
private captureScreenMaxSize;
|
|
21
|
+
/** 缓存最大值 */
|
|
22
|
+
cacheMaxSize: number;
|
|
23
|
+
private vuexStore;
|
|
24
|
+
private piniaStore;
|
|
25
|
+
private uploadTaskMap;
|
|
26
|
+
private requestIndex;
|
|
27
|
+
private uploadIndex;
|
|
28
|
+
/** 是否显示按钮 */
|
|
29
|
+
private devToolVisible;
|
|
30
|
+
/** 是否销毁 */
|
|
31
|
+
private devToolDestroy;
|
|
32
|
+
/** 是否开启拦截Promise reject错误 */
|
|
33
|
+
enableInterceptPromiseReject: boolean;
|
|
34
|
+
private zIndex;
|
|
35
|
+
constructor();
|
|
36
|
+
setDevToolVisible(visible: boolean): void;
|
|
37
|
+
getDevToolVisible(): boolean;
|
|
38
|
+
setWindowInfo(windowInfo: Record<string, any>): void;
|
|
39
|
+
setDeviceInfo(deviceInfo: Record<string, any>): void;
|
|
40
|
+
setSystemInfo(systemInfo: Record<string, any>): void;
|
|
41
|
+
setNetWorkStatus(netWorkStatus: Record<string, any>): void;
|
|
42
|
+
setVuexList(vuexList: Record<string, any>): void;
|
|
43
|
+
setPiniaList(piniaList: Record<string, any>): void;
|
|
44
|
+
setRequestIndex(index: number): number;
|
|
45
|
+
getDevToolOptions(): DevTool.DevToolOptions | undefined;
|
|
46
|
+
getRequestIndex(): number;
|
|
47
|
+
setUploadIndex(index: number): number;
|
|
48
|
+
getUploadIndex(): number;
|
|
49
|
+
setDevToolOptions(options: DevTool.DevToolOptions): void;
|
|
50
|
+
getDevData(): Promise<{
|
|
51
|
+
systemInfo: UniApp.GetSystemInfoResult;
|
|
52
|
+
deviceInfo: UniApp.GetDeviceInfoResult;
|
|
53
|
+
windowInfo: UniApp.GetWindowInfoResult;
|
|
54
|
+
devToolVisible: boolean;
|
|
55
|
+
appInfo: {
|
|
56
|
+
albumAuthorized?: "authorized" | "denied" | "not determined" | undefined;
|
|
57
|
+
bluetoothAuthorized?: "authorized" | "denied" | "not determined" | "config error" | undefined;
|
|
58
|
+
cameraAuthorized: "authorized" | "denied" | "not determined" | "config error";
|
|
59
|
+
locationAuthorized: "authorized" | "denied" | "not determined" | "config error";
|
|
60
|
+
locationAccuracy?: "reduced" | "full" | "unsupported" | undefined;
|
|
61
|
+
locationReducedAccuracy?: boolean | undefined;
|
|
62
|
+
microphoneAuthorized: "authorized" | "denied" | "not determined" | "config error";
|
|
63
|
+
notificationAuthorized: "authorized" | "denied" | "not determined" | "config error";
|
|
64
|
+
notificationAlertAuthorized?: "authorized" | "denied" | "not determined" | "config error" | undefined;
|
|
65
|
+
notificationBadgeAuthorized?: "authorized" | "denied" | "not determined" | "config error" | undefined;
|
|
66
|
+
notificationSoundAuthorized?: "authorized" | "denied" | "not determined" | "config error" | undefined;
|
|
67
|
+
phoneCalendarAuthorized?: "authorized" | "denied" | "not determined" | undefined;
|
|
68
|
+
appId: string;
|
|
69
|
+
appName: string;
|
|
70
|
+
appVersion: string;
|
|
71
|
+
appVersionCode: string;
|
|
72
|
+
appWgtVersion?: string | undefined;
|
|
73
|
+
language: string;
|
|
74
|
+
version: string;
|
|
75
|
+
hostName?: string | undefined;
|
|
76
|
+
hostVersion?: string | undefined;
|
|
77
|
+
hostLanguage?: string | undefined;
|
|
78
|
+
hostTheme?: string | undefined;
|
|
79
|
+
hostPackageName?: string | undefined;
|
|
80
|
+
theme?: string | undefined;
|
|
81
|
+
SDKVersion: string;
|
|
82
|
+
enableDebug: boolean;
|
|
83
|
+
host?: string | undefined;
|
|
84
|
+
appLanguage?: string | undefined;
|
|
85
|
+
hostFontSizeSetting?: number | undefined;
|
|
86
|
+
hostSDKVersion?: string | undefined;
|
|
87
|
+
};
|
|
88
|
+
netWorkStatus: {
|
|
89
|
+
isConnected: boolean;
|
|
90
|
+
networkType: string;
|
|
91
|
+
hasSystemProxy?: boolean | undefined;
|
|
92
|
+
signalStrength?: number | undefined;
|
|
93
|
+
errMsg?: string | undefined;
|
|
94
|
+
ip: any;
|
|
95
|
+
};
|
|
96
|
+
consoleList?: DevTool.ConsoleItem[] | undefined;
|
|
97
|
+
networkList?: DevTool.NetworkItem[] | undefined;
|
|
98
|
+
storageList?: DevTool.StorageItem[] | undefined;
|
|
99
|
+
routeList?: DevTool.Page[] | undefined;
|
|
100
|
+
vuexList?: Record<string, any> | undefined;
|
|
101
|
+
piniaList?: Record<string, any> | undefined;
|
|
102
|
+
wsList?: DevTool.WS[] | undefined;
|
|
103
|
+
size?: number | undefined;
|
|
104
|
+
sizeFormat?: string | undefined;
|
|
105
|
+
uploadList?: DevTool.UploadItem[] | undefined;
|
|
106
|
+
eventCount?: DevTool.EventCount | undefined;
|
|
107
|
+
eventList?: DevTool.EventItem[] | undefined;
|
|
108
|
+
captureScreenList?: DevTool.CaptureScreenItem[] | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
updateStore(data: {
|
|
111
|
+
key: string;
|
|
112
|
+
_oldKey: string;
|
|
113
|
+
value: any;
|
|
114
|
+
}): DevTool.StorageItem[] | undefined;
|
|
115
|
+
updateVuexStore(data: Record<string, any>): Record<string, any> | undefined;
|
|
116
|
+
setPiniaStore(piniaStore: any): void;
|
|
117
|
+
updatePiniaStore(data: Record<string, any>): Record<string, any>;
|
|
118
|
+
getExportData(exports: {
|
|
119
|
+
exportLog: boolean;
|
|
120
|
+
exportNetwork: boolean;
|
|
121
|
+
exportStorage: boolean;
|
|
122
|
+
exportWebSocket: boolean;
|
|
123
|
+
exportUpload: boolean;
|
|
124
|
+
exportWindow: boolean;
|
|
125
|
+
exportDevice: boolean;
|
|
126
|
+
exportSystem: boolean;
|
|
127
|
+
}): DevTool.WindowData;
|
|
128
|
+
clearConsoleList(): void;
|
|
129
|
+
clearDevCache(): void;
|
|
130
|
+
clearAll(): void;
|
|
131
|
+
addUploadTask(index: number | string, task: UniApp.UploadTask): void;
|
|
132
|
+
removeUploadTask(index: number | string): void;
|
|
133
|
+
clearUploadTask(): void;
|
|
134
|
+
clearWsList(): void;
|
|
135
|
+
updateWsList(item: DevTool.WS): DevTool.WS[] | undefined;
|
|
136
|
+
clearWsMessage(url: string): void;
|
|
137
|
+
clearStorageList(): DevTool.StorageItem[];
|
|
138
|
+
setStorageList(items: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
|
|
139
|
+
removeStorage(key: string): DevTool.StorageItem[];
|
|
140
|
+
addStorage(data: {
|
|
141
|
+
key: string;
|
|
142
|
+
value: any;
|
|
143
|
+
}): DevTool.StorageItem[] | undefined;
|
|
144
|
+
refreshStore(): DevTool.StorageItem[];
|
|
145
|
+
updateStoreList(addItems: DevTool.StorageItem[]): DevTool.StorageItem[] | undefined;
|
|
146
|
+
setRouteList(pages: DevTool.Page[], currentPath?: string): DevTool.Page[] | undefined;
|
|
147
|
+
getRouteList(): DevTool.Page[] | undefined;
|
|
148
|
+
updateCurrentPagePath(path: string): DevTool.Page[] | undefined;
|
|
149
|
+
setConsoleList(items: DevTool.ConsoleItem[]): void;
|
|
150
|
+
updateConsoleList(addItems: DevTool.ConsoleItem[], index?: number): DevTool.ConsoleItem[] | undefined;
|
|
151
|
+
clearNetworkList(): void;
|
|
152
|
+
setNetworkList(items: DevTool.NetworkItem[]): void;
|
|
153
|
+
updateNetworkList(addItems: DevTool.NetworkItem[], index?: number): DevTool.NetworkItem[] | undefined;
|
|
154
|
+
updateUploadList(addItems: DevTool.UploadItem[], index?: number): DevTool.UploadItem[] | undefined;
|
|
155
|
+
clearUploadList(): void;
|
|
156
|
+
setDevToolDestroy(destroy: boolean): void;
|
|
157
|
+
getDevToolDestroy(): boolean;
|
|
158
|
+
getCurrentPagePath(): string;
|
|
159
|
+
/**
|
|
160
|
+
* 新增事件
|
|
161
|
+
*
|
|
162
|
+
* @param {DevTool.EventItem} event
|
|
163
|
+
* @memberof DevStore
|
|
164
|
+
*/
|
|
165
|
+
addEventItem(event: DevTool.EventItem): void;
|
|
166
|
+
/**
|
|
167
|
+
* 增加注册事件的数量
|
|
168
|
+
*
|
|
169
|
+
* @param {DevTool.EventCountKey} type
|
|
170
|
+
* @memberof DevStore
|
|
171
|
+
*/
|
|
172
|
+
updateUniEventCount(type: DevTool.EventCountKey): void;
|
|
173
|
+
updateUniEventList(evenList: DevTool.EventItem[]): DevTool.EventItem[] | undefined;
|
|
174
|
+
uniEventClear(): void;
|
|
175
|
+
updateCaptureScreenList(captureScreenList: DevTool.CaptureScreenItem[]): DevTool.CaptureScreenItem[] | undefined;
|
|
176
|
+
clearCaptureScreenList(): void;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devStore/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAgBvC,cAAc;AACd,qBAAa,QAAQ;IACnB,WAAW;IACX,OAAO,CAAC,KAAK,CAsBX;IAEF,WAAW;IACX,OAAO,CAAC,cAAc,CAAqC;IAC3D,YAAY;IACZ,OAAO,CAAC,aAAa,CAAQ;IAC7B,YAAY;IACZ,OAAO,CAAC,cAAc,CAAQ;IAC9B,YAAY;IACZ,OAAO,CAAC,cAAc,CAAQ;IAC9B,cAAc;IACd,OAAO,CAAC,aAAa,CAAQ;IAC7B,cAAc;IACd,OAAO,CAAC,gBAAgB,CAAQ;IAChC,YAAY;IACZ,OAAO,CAAC,oBAAoB,CAAQ;IAEpC,YAAY;IACZ,YAAY,SAAwB;IAEpC,OAAO,CAAC,SAAS,CAAM;IAEvB,OAAO,CAAC,UAAU,CAAM;IAExB,OAAO,CAAC,aAAa,CAAiD;IAEtE,OAAO,CAAC,YAAY,CAAM;IAE1B,OAAO,CAAC,WAAW,CAAM;IAEzB,aAAa;IACb,OAAO,CAAC,cAAc,CAAS;IAE/B,WAAW;IACX,OAAO,CAAC,cAAc,CAAS;IAE/B,6BAA6B;IAC7B,4BAA4B,UAAS;IAErC,OAAO,CAAC,MAAM,CAAQ;;IAUtB,iBAAiB,CAAC,OAAO,EAAE,OAAO;IAQlC,iBAAiB;IAIjB,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI7C,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI7C,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC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AE,OAAO,CAAC,iBAAiB,EAAE;IActE,sBAAsB;CAGvB"}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { DEV_TOOL_INFO as L } from "../const.js";
|
|
2
|
+
import "../utils/index.js";
|
|
3
|
+
import { setDevToolInfo as p, getDevToolInfo as f } from "../devToolInfo/index.js";
|
|
4
|
+
import { isBoolean as v, isNil as S, isNumber as c } from "../utils/language.js";
|
|
5
|
+
import { getWifiIp as d, getLanIp as x, getMicroAppIp as w } from "../utils/ip.js";
|
|
6
|
+
import { setValueByPath as y } from "../utils/object.js";
|
|
7
|
+
class V {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.state = {
|
|
10
|
+
consoleList: [],
|
|
11
|
+
networkList: [],
|
|
12
|
+
storageList: [],
|
|
13
|
+
routeList: [],
|
|
14
|
+
vuexList: {},
|
|
15
|
+
piniaList: {},
|
|
16
|
+
deviceInfo: {},
|
|
17
|
+
windowInfo: {},
|
|
18
|
+
systemInfo: {},
|
|
19
|
+
appInfo: {},
|
|
20
|
+
wsList: [],
|
|
21
|
+
netWorkStatus: {},
|
|
22
|
+
uploadList: [],
|
|
23
|
+
eventList: [],
|
|
24
|
+
eventCount: {
|
|
25
|
+
on: 0,
|
|
26
|
+
once: 0,
|
|
27
|
+
emit: 0,
|
|
28
|
+
off: 0
|
|
29
|
+
},
|
|
30
|
+
captureScreenList: []
|
|
31
|
+
}, this.uploadMaxSize = 1e3, this.consoleMaxSize = 1e3, this.networkMaxSize = 1e3, this.wsDataMaxSize = 1e3, this.eventListMaxSize = 1e3, this.captureScreenMaxSize = 1e3, this.cacheMaxSize = 8 * 1024 * 1024 * 10, this.uploadTaskMap = /* @__PURE__ */ new Map(), this.requestIndex = -1, this.uploadIndex = -1, this.devToolVisible = !1, this.devToolDestroy = !1, this.enableInterceptPromiseReject = !1, this.zIndex = 1e3;
|
|
32
|
+
const { devToolDestroy: t = !1, devToolButtonVisible: e = !1 } = uni.getStorageSync(L);
|
|
33
|
+
this.devToolDestroy = t, this.devToolVisible = e;
|
|
34
|
+
}
|
|
35
|
+
setDevToolVisible(t) {
|
|
36
|
+
this.devToolVisible = t, p({
|
|
37
|
+
devToolButtonVisible: t
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getDevToolVisible() {
|
|
41
|
+
return this.devToolVisible;
|
|
42
|
+
}
|
|
43
|
+
setWindowInfo(t) {
|
|
44
|
+
this.state.windowInfo = t;
|
|
45
|
+
}
|
|
46
|
+
setDeviceInfo(t) {
|
|
47
|
+
this.state.deviceInfo = t;
|
|
48
|
+
}
|
|
49
|
+
setSystemInfo(t) {
|
|
50
|
+
this.state.systemInfo = t;
|
|
51
|
+
}
|
|
52
|
+
setNetWorkStatus(t) {
|
|
53
|
+
this.state.netWorkStatus = t;
|
|
54
|
+
}
|
|
55
|
+
setVuexList(t) {
|
|
56
|
+
this.state.vuexList = t;
|
|
57
|
+
}
|
|
58
|
+
setPiniaList(t) {
|
|
59
|
+
this.state.piniaList = {
|
|
60
|
+
...this.state.piniaList || {},
|
|
61
|
+
...t
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
setRequestIndex(t) {
|
|
65
|
+
return this.requestIndex = t, this.requestIndex;
|
|
66
|
+
}
|
|
67
|
+
getDevToolOptions() {
|
|
68
|
+
return this.devToolOptions;
|
|
69
|
+
}
|
|
70
|
+
getRequestIndex() {
|
|
71
|
+
return this.requestIndex;
|
|
72
|
+
}
|
|
73
|
+
setUploadIndex(t) {
|
|
74
|
+
return this.uploadIndex = t, this.uploadIndex;
|
|
75
|
+
}
|
|
76
|
+
getUploadIndex() {
|
|
77
|
+
return this.uploadIndex;
|
|
78
|
+
}
|
|
79
|
+
setDevToolOptions(t) {
|
|
80
|
+
var o, i, a;
|
|
81
|
+
this.devToolOptions = t, this.uploadMaxSize = t.uploadMaxSize || 1e3, this.consoleMaxSize = t.consoleMaxSize || 1e3, this.networkMaxSize = t.networkMaxSize || 1e3, this.wsDataMaxSize = t.wsDataMaxSize || 1e3, this.cacheMaxSize = t.cacheMaxSize || 8 * 1024 * 1024 * 10, this.eventListMaxSize = t.eventListMaxSize || 1e3, this.captureScreenMaxSize = t.captureScreenMaxSize || 1e3, this.zIndex = t.zIndex || 1e3;
|
|
82
|
+
const { devToolButtonVisible: e } = f();
|
|
83
|
+
this.devToolVisible = v(e) ? e : t.initShowDevTool ?? !0, this.setDevToolVisible(this.devToolVisible);
|
|
84
|
+
const s = ((o = t.pagesJson) == null ? void 0 : o.pages.map((r) => {
|
|
85
|
+
var n, l, u;
|
|
86
|
+
const h = (u = (l = (n = t.pagesJson) == null ? void 0 : n.tabBar) == null ? void 0 : l.list) == null ? void 0 : u.some(
|
|
87
|
+
(g) => g.pagePath === r.path
|
|
88
|
+
);
|
|
89
|
+
return {
|
|
90
|
+
...r,
|
|
91
|
+
type: h ? "nav" : "main"
|
|
92
|
+
};
|
|
93
|
+
})) ?? [];
|
|
94
|
+
(a = (i = t.pagesJson) == null ? void 0 : i.subPackages) == null || a.forEach((r) => {
|
|
95
|
+
r.pages.forEach((h) => {
|
|
96
|
+
const n = {
|
|
97
|
+
...h,
|
|
98
|
+
path: `${r.root}/${h.path}`,
|
|
99
|
+
type: "sub"
|
|
100
|
+
};
|
|
101
|
+
s.push(n);
|
|
102
|
+
});
|
|
103
|
+
}), this.setRouteList(s);
|
|
104
|
+
}
|
|
105
|
+
async getDevData() {
|
|
106
|
+
const t = await uni.getNetworkType(), e = uni.getSystemInfoSync(), s = uni.getDeviceInfo(), o = uni.getWindowInfo(), i = {
|
|
107
|
+
...await uni.getAppBaseInfo()
|
|
108
|
+
}, a = d() || x() || await w();
|
|
109
|
+
return {
|
|
110
|
+
...this.state,
|
|
111
|
+
systemInfo: e,
|
|
112
|
+
deviceInfo: s,
|
|
113
|
+
windowInfo: o,
|
|
114
|
+
devToolVisible: this.getDevToolVisible(),
|
|
115
|
+
appInfo: i,
|
|
116
|
+
netWorkStatus: {
|
|
117
|
+
ip: a,
|
|
118
|
+
...t,
|
|
119
|
+
isConnected: t.networkType !== "none"
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
updateStore(t) {
|
|
124
|
+
var i, a;
|
|
125
|
+
const { key: e, _oldKey: s, value: o } = t;
|
|
126
|
+
return s !== e && (uni.removeStorageSync(s), this.state.storageList = (i = this.state.storageList) == null ? void 0 : i.filter(
|
|
127
|
+
(r) => r.key === s
|
|
128
|
+
)), uni.setStorageSync(e, o), (a = this.state.storageList) == null || a.push({
|
|
129
|
+
key: e,
|
|
130
|
+
_oldKey: s,
|
|
131
|
+
value: o
|
|
132
|
+
}), this.state.storageList;
|
|
133
|
+
}
|
|
134
|
+
updateVuexStore(t) {
|
|
135
|
+
var e, s;
|
|
136
|
+
try {
|
|
137
|
+
Object.assign(((e = this.vuexStore) == null ? void 0 : e.state) ?? {}, t);
|
|
138
|
+
} catch (o) {
|
|
139
|
+
console.error("[DevTool] updateVuexStore error", o);
|
|
140
|
+
}
|
|
141
|
+
return this.setVuexList({
|
|
142
|
+
...((s = this.vuexStore) == null ? void 0 : s.state) ?? {}
|
|
143
|
+
}), this.state.vuexList;
|
|
144
|
+
}
|
|
145
|
+
setPiniaStore(t) {
|
|
146
|
+
this.piniaStore = t;
|
|
147
|
+
}
|
|
148
|
+
updatePiniaStore(t) {
|
|
149
|
+
try {
|
|
150
|
+
if (!this.piniaStore)
|
|
151
|
+
return console.error("[DevTool] updatePiniaStore piniaStore is undefined"), {};
|
|
152
|
+
const [e, s] = Object.entries(t)[0];
|
|
153
|
+
if (S(e))
|
|
154
|
+
return console.error("[DevTool] updatePiniaStore key is undefined or null"), {};
|
|
155
|
+
y(this.piniaStore.state.value, e, s), this.setPiniaList({
|
|
156
|
+
...this.piniaStore.state.value ?? {}
|
|
157
|
+
});
|
|
158
|
+
} catch (e) {
|
|
159
|
+
console.error("[DevTool] updatePiniaStore error", e);
|
|
160
|
+
}
|
|
161
|
+
return this.state.piniaList ?? {};
|
|
162
|
+
}
|
|
163
|
+
getExportData(t) {
|
|
164
|
+
const e = {};
|
|
165
|
+
return t.exportLog && (e.consoleList = this.state.consoleList), t.exportNetwork && (e.networkList = this.state.networkList), t.exportStorage && (e.storageList = this.state.storageList, e.vuexList = this.state.vuexList, e.piniaList = this.state.piniaList), t.exportUpload && (e.uploadList = this.state.uploadList), t.exportWebSocket && (e.wsList = this.state.wsList), t.exportWindow && (e.windowInfo = this.state.windowInfo), t.exportDevice && (e.deviceInfo = this.state.deviceInfo), t.exportSystem && (e.systemInfo = this.state.systemInfo), e;
|
|
166
|
+
}
|
|
167
|
+
clearConsoleList() {
|
|
168
|
+
this.state.consoleList = [];
|
|
169
|
+
}
|
|
170
|
+
clearDevCache() {
|
|
171
|
+
this.state.consoleList = [], this.state.networkList = [], this.state.wsList = [], this.state.uploadList = [], this.state.eventList = [], this.state.eventCount = {
|
|
172
|
+
on: 0,
|
|
173
|
+
once: 0,
|
|
174
|
+
emit: 0,
|
|
175
|
+
off: 0
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
clearAll() {
|
|
179
|
+
this.state.consoleList = [], this.state.networkList = [], this.state.storageList = [], this.state.routeList = [], this.state.wsList = [], this.state.uploadList = [], this.state.vuexList = {}, this.state.piniaList = {}, this.state.deviceInfo = {}, this.state.windowInfo = {}, this.state.systemInfo = {}, this.state.netWorkStatus = {}, this.state.appInfo = {}, this.state.eventList = [], this.state.eventCount = {
|
|
180
|
+
on: 0,
|
|
181
|
+
once: 0,
|
|
182
|
+
emit: 0,
|
|
183
|
+
off: 0
|
|
184
|
+
}, this.state.captureScreenList = [];
|
|
185
|
+
}
|
|
186
|
+
addUploadTask(t, e) {
|
|
187
|
+
this.uploadTaskMap.set(t, e);
|
|
188
|
+
}
|
|
189
|
+
removeUploadTask(t) {
|
|
190
|
+
this.uploadTaskMap.delete(t);
|
|
191
|
+
}
|
|
192
|
+
clearUploadTask() {
|
|
193
|
+
this.uploadTaskMap.clear();
|
|
194
|
+
}
|
|
195
|
+
clearWsList() {
|
|
196
|
+
this.state.wsList = [];
|
|
197
|
+
}
|
|
198
|
+
updateWsList(t) {
|
|
199
|
+
var s, o, i, a, r, h;
|
|
200
|
+
if (!this.getDevToolVisible())
|
|
201
|
+
return [];
|
|
202
|
+
const e = ((o = (s = this.state) == null ? void 0 : s.wsList) == null ? void 0 : o.findIndex((n) => n.url === t.url)) ?? -1;
|
|
203
|
+
if (e > -1) {
|
|
204
|
+
if ((i = this.state.wsList) != null && i[e]) {
|
|
205
|
+
const n = this.state.wsList[e];
|
|
206
|
+
n.headers = t.headers ?? n.headers, n.readyState = t.readyState ?? n.readyState, n.method = t.method ?? n.method, n.protocols = t.protocols ?? n.protocols, n.message = [
|
|
207
|
+
...this.state.wsList[e].message ?? [],
|
|
208
|
+
...t.message ?? []
|
|
209
|
+
];
|
|
210
|
+
const l = this.wsDataMaxSize, u = ((a = n == null ? void 0 : n.message) == null ? void 0 : a.length) ?? 0;
|
|
211
|
+
Array.isArray(n == null ? void 0 : n.message) && u > l && ((r = n == null ? void 0 : n.message) == null || r.splice(0, u - l));
|
|
212
|
+
}
|
|
213
|
+
} else
|
|
214
|
+
(h = this.state.wsList) == null || h.push(t);
|
|
215
|
+
return this.state.wsList;
|
|
216
|
+
}
|
|
217
|
+
clearWsMessage(t) {
|
|
218
|
+
var s, o, i;
|
|
219
|
+
const e = ((o = (s = this.state) == null ? void 0 : s.wsList) == null ? void 0 : o.findIndex((a) => a.url === t)) ?? -1;
|
|
220
|
+
e !== -1 && (i = this.state.wsList) != null && i[e] && (this.state.wsList[e].message = []);
|
|
221
|
+
}
|
|
222
|
+
clearStorageList() {
|
|
223
|
+
return this.state.storageList = [], uni.clearStorage(), this.state.storageList;
|
|
224
|
+
}
|
|
225
|
+
setStorageList(t) {
|
|
226
|
+
if (this.getDevToolVisible())
|
|
227
|
+
return this.state.storageList = t, this.state.storageList;
|
|
228
|
+
}
|
|
229
|
+
removeStorage(t) {
|
|
230
|
+
var e;
|
|
231
|
+
return this.state.storageList = ((e = this.state.storageList) == null ? void 0 : e.filter((s) => s.key !== t)) ?? [], uni.removeStorageSync(t), this.state.storageList;
|
|
232
|
+
}
|
|
233
|
+
addStorage(t) {
|
|
234
|
+
var o;
|
|
235
|
+
const { key: e, value: s } = t;
|
|
236
|
+
return (o = this.state.storageList) == null || o.unshift({
|
|
237
|
+
key: e,
|
|
238
|
+
_oldKey: e,
|
|
239
|
+
value: s
|
|
240
|
+
}), uni.setStorageSync(e, s), this.state.storageList;
|
|
241
|
+
}
|
|
242
|
+
refreshStore() {
|
|
243
|
+
const { keys: t } = uni.getStorageInfoSync();
|
|
244
|
+
return this.state.storageList = t.map((e) => {
|
|
245
|
+
const s = uni.getStorageSync(e);
|
|
246
|
+
return {
|
|
247
|
+
key: e,
|
|
248
|
+
_oldKey: e,
|
|
249
|
+
value: s
|
|
250
|
+
};
|
|
251
|
+
}), this.state.storageList;
|
|
252
|
+
}
|
|
253
|
+
updateStoreList(t) {
|
|
254
|
+
var o, i, a;
|
|
255
|
+
const e = t[0], s = ((o = this.state.storageList) == null ? void 0 : o.findIndex((r) => r.key === e._oldKey)) ?? -1;
|
|
256
|
+
return s > -1 && t.length === 1 ? (i = this.state.storageList) != null && i[s] && (this.state.storageList[s] = t[0]) : (a = this.state.storageList) == null || a.push(...t), this.state.storageList;
|
|
257
|
+
}
|
|
258
|
+
setRouteList(t, e) {
|
|
259
|
+
var o;
|
|
260
|
+
if (!this.getDevToolVisible())
|
|
261
|
+
return;
|
|
262
|
+
const s = e || ((o = t == null ? void 0 : t[0]) == null ? void 0 : o.path) || "";
|
|
263
|
+
return this.state.routeList = t.map((i, a) => ({
|
|
264
|
+
type: i.type,
|
|
265
|
+
path: i.path,
|
|
266
|
+
style: i.style,
|
|
267
|
+
index: i.path === s && a === 0 ? 4 : i.path === s ? 3 : a === 0 ? 2 : 1,
|
|
268
|
+
name: i.style.navigationBarTitleText || "无名"
|
|
269
|
+
})), this.state.routeList;
|
|
270
|
+
}
|
|
271
|
+
getRouteList() {
|
|
272
|
+
return this.state.routeList;
|
|
273
|
+
}
|
|
274
|
+
updateCurrentPagePath(t) {
|
|
275
|
+
var e, s, o;
|
|
276
|
+
if (this.getDevToolVisible())
|
|
277
|
+
return t = t === "/" ? ((s = (e = this.state.routeList) == null ? void 0 : e[0]) == null ? void 0 : s.path) ?? t : t, this.state.routeList = ((o = this.state.routeList) == null ? void 0 : o.map((i, a) => ({
|
|
278
|
+
type: i.type,
|
|
279
|
+
path: i.path,
|
|
280
|
+
style: i.style,
|
|
281
|
+
index: i.path === t && a === 0 ? 4 : i.path === t ? 3 : a === 0 ? 2 : 1,
|
|
282
|
+
name: i.style.navigationBarTitleText || "无名"
|
|
283
|
+
}))) ?? [], this.state.routeList;
|
|
284
|
+
}
|
|
285
|
+
setConsoleList(t) {
|
|
286
|
+
var e, s;
|
|
287
|
+
this.getDevToolVisible() && ((((s = (e = this.state) == null ? void 0 : e.consoleList) == null ? void 0 : s.length) ?? 0) + t.length > this.consoleMaxSize && (this.state.consoleList = []), this.state.consoleList = t);
|
|
288
|
+
}
|
|
289
|
+
updateConsoleList(t, e) {
|
|
290
|
+
var s, o, i, a, r, h;
|
|
291
|
+
if (this.getDevToolVisible())
|
|
292
|
+
return c(e) && e > -1 && t.length === 1 ? (s = this.state.consoleList) != null && s[e] && (this.state.consoleList[e] = t[0]) : ((((i = (o = this.state) == null ? void 0 : o.consoleList) == null ? void 0 : i.length) ?? 0) + t.length > this.cacheMaxSize && ((a = this.state.consoleList) == null || a.splice(
|
|
293
|
+
0,
|
|
294
|
+
this.state.consoleList.length - this.cacheMaxSize - t.length
|
|
295
|
+
)), (h = (r = this.state) == null ? void 0 : r.consoleList) == null || h.push(...t)), this.state.consoleList;
|
|
296
|
+
}
|
|
297
|
+
clearNetworkList() {
|
|
298
|
+
this.state.networkList = [];
|
|
299
|
+
}
|
|
300
|
+
setNetworkList(t) {
|
|
301
|
+
var e, s;
|
|
302
|
+
this.getDevToolVisible() && ((((s = (e = this.state) == null ? void 0 : e.networkList) == null ? void 0 : s.length) ?? 0) + t.length > this.networkMaxSize && (this.state.networkList = []), this.state.networkList = t);
|
|
303
|
+
}
|
|
304
|
+
updateNetworkList(t, e) {
|
|
305
|
+
var s, o, i, a, r, h, n;
|
|
306
|
+
if (c(e) && e > -1)
|
|
307
|
+
(o = (s = this.state) == null ? void 0 : s.networkList) != null && o[e] && (this.state.networkList[e] = t[0]);
|
|
308
|
+
else {
|
|
309
|
+
const l = this.networkMaxSize, u = ((a = (i = this.state) == null ? void 0 : i.networkList) == null ? void 0 : a.length) ?? 0;
|
|
310
|
+
u + t.length > l && ((r = this.state.networkList) == null || r.splice(0, u - l - t.length)), (n = (h = this.state) == null ? void 0 : h.networkList) == null || n.push(...t);
|
|
311
|
+
}
|
|
312
|
+
return this.state.networkList;
|
|
313
|
+
}
|
|
314
|
+
updateUploadList(t, e) {
|
|
315
|
+
var s, o, i, a, r;
|
|
316
|
+
if (c(e) && e > -1 && t.length === 1)
|
|
317
|
+
if ((s = this.state.uploadList) != null && s[e])
|
|
318
|
+
this.state.uploadList[e] = {
|
|
319
|
+
...this.state.uploadList[e],
|
|
320
|
+
...t[0]
|
|
321
|
+
};
|
|
322
|
+
else {
|
|
323
|
+
const h = this.uploadMaxSize, n = ((i = (o = this.state) == null ? void 0 : o.uploadList) == null ? void 0 : i.length) ?? 0;
|
|
324
|
+
n + t.length > h && ((a = this.state.uploadList) == null || a.splice(0, n - h - t.length)), (r = this.state.uploadList) == null || r.push(t[0]);
|
|
325
|
+
}
|
|
326
|
+
return this.state.uploadList;
|
|
327
|
+
}
|
|
328
|
+
clearUploadList() {
|
|
329
|
+
this.state.uploadList = [];
|
|
330
|
+
}
|
|
331
|
+
setDevToolDestroy(t) {
|
|
332
|
+
this.devToolDestroy = t, p({
|
|
333
|
+
devToolDestroy: t
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
getDevToolDestroy() {
|
|
337
|
+
const { devToolDestroy: t = !1 } = uni.getStorageSync(L);
|
|
338
|
+
return this.devToolDestroy ?? t;
|
|
339
|
+
}
|
|
340
|
+
getCurrentPagePath() {
|
|
341
|
+
let t = getCurrentPages(), e = t[t.length - 1];
|
|
342
|
+
return e && e.route ? e.route : "";
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 新增事件
|
|
346
|
+
*
|
|
347
|
+
* @param {DevTool.EventItem} event
|
|
348
|
+
* @memberof DevStore
|
|
349
|
+
*/
|
|
350
|
+
addEventItem(t) {
|
|
351
|
+
var e;
|
|
352
|
+
this.state.eventList || (this.state.eventList = []), (e = this.state.eventList) == null || e.push(t);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* 增加注册事件的数量
|
|
356
|
+
*
|
|
357
|
+
* @param {DevTool.EventCountKey} type
|
|
358
|
+
* @memberof DevStore
|
|
359
|
+
*/
|
|
360
|
+
updateUniEventCount(t) {
|
|
361
|
+
this.state.eventCount || (this.state.eventCount = {
|
|
362
|
+
on: 0,
|
|
363
|
+
once: 0,
|
|
364
|
+
emit: 0,
|
|
365
|
+
off: 0
|
|
366
|
+
}), this.state.eventCount[t] = this.state.eventCount[t] + 1;
|
|
367
|
+
}
|
|
368
|
+
updateUniEventList(t) {
|
|
369
|
+
var o, i, a;
|
|
370
|
+
const e = ((o = this.state.eventList) == null ? void 0 : o.length) ?? 0, s = this.eventListMaxSize;
|
|
371
|
+
return e + t.length > s && ((i = this.state.eventList) == null || i.splice(0, e - s - t.length)), (a = this.state.eventList) == null || a.push(...t), this.state.eventList;
|
|
372
|
+
}
|
|
373
|
+
uniEventClear() {
|
|
374
|
+
this.state.eventCount = {
|
|
375
|
+
on: 0,
|
|
376
|
+
once: 0,
|
|
377
|
+
emit: 0,
|
|
378
|
+
off: 0
|
|
379
|
+
}, this.state.eventList = [];
|
|
380
|
+
}
|
|
381
|
+
updateCaptureScreenList(t) {
|
|
382
|
+
var o, i, a;
|
|
383
|
+
const e = ((o = this.state.captureScreenList) == null ? void 0 : o.length) ?? 0, s = this.captureScreenMaxSize;
|
|
384
|
+
return e + t.length > s && ((i = this.state.captureScreenList) == null || i.splice(
|
|
385
|
+
0,
|
|
386
|
+
e - s - t.length
|
|
387
|
+
)), (a = this.state.captureScreenList) == null || a.push(...t), this.state.captureScreenList;
|
|
388
|
+
}
|
|
389
|
+
clearCaptureScreenList() {
|
|
390
|
+
this.state.captureScreenList = [];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
export {
|
|
394
|
+
V as DevStore
|
|
395
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DevTool } from '../type';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 缓存调试工具信息到本地
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @param {DevTool.DevToolInfo} info
|
|
8
|
+
*/
|
|
9
|
+
export declare function setDevToolInfo(info: DevTool.DevToolInfo): void;
|
|
10
|
+
/**
|
|
11
|
+
* 获取本地缓存信息
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @return {*}
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDevToolInfo(): DevTool.DevToolInfo;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devToolInfo/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,QAMvD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,wBAE7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DEV_TOOL_INFO as o } from "../const.js";
|
|
2
|
+
function r(n) {
|
|
3
|
+
const t = uni.getStorageSync(o);
|
|
4
|
+
uni.setStorageSync(o, {
|
|
5
|
+
...t,
|
|
6
|
+
...n
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function c() {
|
|
10
|
+
return uni.getStorageSync(o);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
c as getDevToolInfo,
|
|
14
|
+
r as setDevToolInfo
|
|
15
|
+
};
|
|
@@ -20,7 +20,7 @@ import { Plugin } from 'vite';
|
|
|
20
20
|
* }
|
|
21
21
|
* @return {*} {Plugin}
|
|
22
22
|
*/
|
|
23
|
-
export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
|
|
23
|
+
export default function uniDevTool({ pages, sourceFileServers, importConsole, vueVersion, ...reset }: {
|
|
24
24
|
/** 是否拦截Promise.reject 最好不要拦截 默认禁用 */
|
|
25
25
|
enableInterceptPromiseReject?: boolean;
|
|
26
26
|
/** 打开窗口时隐藏按钮 */
|
|
@@ -35,6 +35,10 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
|
|
|
35
35
|
wsDataMaxSize?: number;
|
|
36
36
|
/** 最大占用缓存空间 bytes */
|
|
37
37
|
cacheMaxSize?: number;
|
|
38
|
+
/** 最大时间列表条数 */
|
|
39
|
+
eventListMaxSize?: number;
|
|
40
|
+
/** 最大截屏记录条数 */
|
|
41
|
+
captureScreenMaxSize?: number;
|
|
38
42
|
/** 按钮大小 */
|
|
39
43
|
buttonSize?: number;
|
|
40
44
|
/** 按钮文本 */
|
|
@@ -47,6 +51,8 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
|
|
|
47
51
|
buttonBackgroundColor?: string;
|
|
48
52
|
/** 初始化时是否显示调试按钮,默认显示 */
|
|
49
53
|
initShowDevTool?: boolean;
|
|
54
|
+
/** 调试弹窗层级默认 1000 */
|
|
55
|
+
zIndex?: number;
|
|
50
56
|
/**
|
|
51
57
|
* 该属性处于实验当中,谨慎使用
|
|
52
58
|
* 读取开发环境 source file,source map,默认 禁用
|
|
@@ -57,6 +63,14 @@ export default function uniDevTool({ pages, sourceFileServers, ...reset }: {
|
|
|
57
63
|
* 开发环境 source file 服务器地址,默认 [] ,配合 useDevSource 使用
|
|
58
64
|
*/
|
|
59
65
|
sourceFileServers?: string[];
|
|
66
|
+
/** 是否导入 console 默认不导入, 只会捕获error 和 warn , */
|
|
67
|
+
importConsole?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* 该属性处于实验当中,目前只支持 vue3
|
|
70
|
+
* vue版本 默认 3 , 配置为 3 ,将使用 ts + setup + hooks 语法
|
|
71
|
+
*
|
|
72
|
+
*/
|
|
73
|
+
vueVersion?: number;
|
|
60
74
|
/** 页面配置 用于读取路由 */
|
|
61
75
|
pages: {
|
|
62
76
|
pages: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAwBnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,iBAAiB,EACjB,aAAa,EACb,UAAc,EACd,GAAG,KAAK,EACT,EAAE;IACD,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,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