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.
Files changed (180) hide show
  1. package/README.md +55 -1
  2. package/dist/const.d.ts +133 -0
  3. package/dist/const.d.ts.map +1 -0
  4. package/dist/const.js +36 -0
  5. package/dist/core.d.ts +52 -0
  6. package/dist/core.d.ts.map +1 -0
  7. package/dist/core.js +80 -0
  8. package/dist/devConsole/index.d.ts +169 -0
  9. package/dist/devConsole/index.d.ts.map +1 -0
  10. package/dist/devConsole/index.js +270 -0
  11. package/dist/devEvent/index.d.ts +286 -0
  12. package/dist/devEvent/index.d.ts.map +1 -0
  13. package/dist/devEvent/index.js +435 -0
  14. package/dist/devEventBus/index.d.ts +42 -0
  15. package/dist/devEventBus/index.d.ts.map +1 -0
  16. package/dist/devEventBus/index.js +70 -0
  17. package/dist/devIntercept/index.d.ts +119 -0
  18. package/dist/devIntercept/index.d.ts.map +1 -0
  19. package/dist/devIntercept/index.js +582 -0
  20. package/dist/devRunJS/index.d.ts +67 -0
  21. package/dist/devRunJS/index.d.ts.map +1 -0
  22. package/dist/devStore/index.d.ts +178 -0
  23. package/dist/devStore/index.d.ts.map +1 -0
  24. package/dist/devStore/index.js +395 -0
  25. package/dist/devToolInfo/index.d.ts +17 -0
  26. package/dist/devToolInfo/index.d.ts.map +1 -0
  27. package/dist/devToolInfo/index.js +15 -0
  28. package/{dev → dist}/plugins/uniDevTool/uniDevTool.d.ts +15 -1
  29. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -0
  30. package/dist/plugins/uniDevTool/uniDevTool.js +35 -0
  31. package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.js +7 -7
  32. package/{dev → dist}/plugins/utils/index.d.ts +3 -0
  33. package/{dev → dist}/plugins/utils/index.d.ts.map +1 -1
  34. package/dist/plugins/utils/index.js +1 -0
  35. package/dist/type.d.ts +264 -0
  36. package/dist/type.d.ts.map +1 -0
  37. package/dist/utils/array.d.ts +2 -0
  38. package/dist/utils/array.d.ts.map +1 -0
  39. package/dist/utils/array.js +12 -0
  40. package/dist/utils/date.d.ts +19 -0
  41. package/dist/utils/date.d.ts.map +1 -0
  42. package/dist/utils/date.js +40 -0
  43. package/dist/utils/file.d.ts +11 -0
  44. package/dist/utils/file.d.ts.map +1 -0
  45. package/dist/utils/file.js +87 -0
  46. package/dist/utils/function.d.ts +28 -0
  47. package/dist/utils/function.d.ts.map +1 -0
  48. package/dist/utils/function.js +46 -0
  49. package/dist/utils/index.d.ts +11 -0
  50. package/dist/utils/index.d.ts.map +1 -0
  51. package/dist/utils/index.js +55 -0
  52. package/dist/utils/ip.d.ts +5 -0
  53. package/dist/utils/ip.d.ts.map +1 -0
  54. package/dist/utils/ip.js +21 -0
  55. package/dist/utils/language.d.ts +29 -0
  56. package/dist/utils/language.d.ts.map +1 -0
  57. package/dist/utils/language.js +50 -0
  58. package/dist/utils/object.d.ts +49 -0
  59. package/dist/utils/object.d.ts.map +1 -0
  60. package/dist/utils/object.js +118 -0
  61. package/dist/utils/page.d.ts +7 -0
  62. package/dist/utils/page.d.ts.map +1 -0
  63. package/dist/utils/page.js +7 -0
  64. package/dist/utils/platform.d.ts +4 -0
  65. package/dist/utils/platform.d.ts.map +1 -0
  66. package/dist/utils/platform.js +14 -0
  67. package/dist/utils/string.d.ts +45 -0
  68. package/dist/utils/string.d.ts.map +1 -0
  69. package/dist/utils/string.js +88 -0
  70. package/dist/utils/utils.d.ts +16 -0
  71. package/dist/utils/utils.d.ts.map +1 -0
  72. package/dist/v2/AutoSizer/utils.d.ts +5 -0
  73. package/dist/v2/AutoSizer/utils.d.ts.map +1 -0
  74. package/dist/v2/JsonPretty/hooks/useClipboard.d.ts +4 -0
  75. package/dist/v2/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
  76. package/dist/v2/JsonPretty/hooks/useError.d.ts +8 -0
  77. package/dist/v2/JsonPretty/hooks/useError.d.ts.map +1 -0
  78. package/dist/v2/JsonPretty/type.d.ts +93 -0
  79. package/dist/v2/JsonPretty/type.d.ts.map +1 -0
  80. package/dist/v3/AutoSizer/utils.d.ts +5 -0
  81. package/dist/v3/AutoSizer/utils.d.ts.map +1 -0
  82. package/dist/v3/ConsoleList/staticTips.d.ts +13 -0
  83. package/dist/v3/ConsoleList/staticTips.d.ts.map +1 -0
  84. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts +4 -0
  85. package/dist/v3/JsonPretty/hooks/useClipboard.d.ts.map +1 -0
  86. package/dist/v3/JsonPretty/hooks/useError.d.ts +8 -0
  87. package/dist/v3/JsonPretty/hooks/useError.d.ts.map +1 -0
  88. package/dist/v3/JsonPretty/type.d.ts +93 -0
  89. package/dist/v3/JsonPretty/type.d.ts.map +1 -0
  90. package/dist/v3/JsonPretty/utils/index.d.ts +10 -0
  91. package/dist/v3/JsonPretty/utils/index.d.ts.map +1 -0
  92. package/package.json +5 -5
  93. package/dev/components/AppInfo/index.vue +0 -36
  94. package/dev/components/AutoSizer/index.vue +0 -193
  95. package/dev/components/AutoSizer/index1.vue +0 -186
  96. package/dev/components/AutoSizer/utils.ts +0 -49
  97. package/dev/components/Button/index.vue +0 -34
  98. package/dev/components/CaptureScreen/index.vue +0 -62
  99. package/dev/components/Checkbox/index.vue +0 -40
  100. package/dev/components/CloseButton/index.vue +0 -26
  101. package/dev/components/Code/index.vue +0 -230
  102. package/dev/components/Connection/index.vue +0 -88
  103. package/dev/components/ConsoleList/Code.vue +0 -227
  104. package/dev/components/ConsoleList/ConsoleItem.vue +0 -186
  105. package/dev/components/ConsoleList/RunJSInput.vue +0 -235
  106. package/dev/components/ConsoleList/index.vue +0 -130
  107. package/dev/components/ConsoleList/staticTips.ts +0 -1145
  108. package/dev/components/DevTool/index.vue +0 -182
  109. package/dev/components/DevToolButton/index.vue +0 -213
  110. package/dev/components/DevToolTitle/index.vue +0 -21
  111. package/dev/components/DevToolWindow/index.vue +0 -1037
  112. package/dev/components/DeviceInfo/index.vue +0 -32
  113. package/dev/components/Empty/empty.png +0 -0
  114. package/dev/components/Empty/index.vue +0 -28
  115. package/dev/components/FilterInput/index.vue +0 -86
  116. package/dev/components/JsonPretty/components/Brackets/index.vue +0 -23
  117. package/dev/components/JsonPretty/components/Carets/index.vue +0 -59
  118. package/dev/components/JsonPretty/components/CheckController/index.vue +0 -125
  119. package/dev/components/JsonPretty/components/TreeNode/index.vue +0 -349
  120. package/dev/components/JsonPretty/hooks/useClipboard.ts +0 -21
  121. package/dev/components/JsonPretty/hooks/useError.ts +0 -21
  122. package/dev/components/JsonPretty/index.vue +0 -474
  123. package/dev/components/JsonPretty/type.ts +0 -125
  124. package/dev/components/JsonPretty/utils/index.ts +0 -172
  125. package/dev/components/NetworkList/NetworkDetail.vue +0 -197
  126. package/dev/components/NetworkList/NetworkItem.vue +0 -106
  127. package/dev/components/NetworkList/index.vue +0 -115
  128. package/dev/components/PiniaList/index.vue +0 -64
  129. package/dev/components/RouteList/index.vue +0 -110
  130. package/dev/components/RunJS/index.vue +0 -128
  131. package/dev/components/SettingList/index.vue +0 -225
  132. package/dev/components/StorageList/index.vue +0 -170
  133. package/dev/components/SystemInfo/index.vue +0 -34
  134. package/dev/components/Tabs/index.vue +0 -123
  135. package/dev/components/Tag/index.vue +0 -89
  136. package/dev/components/UniEvent/UniEventItem.vue +0 -124
  137. package/dev/components/UniEvent/index.vue +0 -94
  138. package/dev/components/UploadList/UploadDetail.vue +0 -208
  139. package/dev/components/UploadList/UploadItem.vue +0 -111
  140. package/dev/components/UploadList/index.vue +0 -104
  141. package/dev/components/VirtualList/index.vue +0 -112
  142. package/dev/components/VirtualListPro/AutoSize.vue +0 -43
  143. package/dev/components/VirtualListPro/index.vue +0 -175
  144. package/dev/components/VirtualListPro/readme.md +0 -40
  145. package/dev/components/VuexList/index.vue +0 -54
  146. package/dev/components/WebSocket/WebSocketItem.vue +0 -98
  147. package/dev/components/WebSocket/WebSocketList.vue +0 -176
  148. package/dev/components/WebSocket/index.vue +0 -111
  149. package/dev/components/WindowInfo/index.vue +0 -33
  150. package/dev/const.ts +0 -166
  151. package/dev/core.ts +0 -118
  152. package/dev/devConsole/index.ts +0 -350
  153. package/dev/devEvent/index.ts +0 -806
  154. package/dev/devEventBus/index.ts +0 -94
  155. package/dev/devIntercept/index.ts +0 -745
  156. package/dev/devRunJS/index.ts +0 -170
  157. package/dev/devStore/index.ts +0 -718
  158. package/dev/plugins/uniDevTool/uniDevTool.d.ts.map +0 -1
  159. package/dev/plugins/uniDevTool/uniDevTool.js +0 -36
  160. package/dev/plugins/utils/index.js +0 -1
  161. package/dev/shims-uni.d.ts +0 -43
  162. package/dev/type.ts +0 -264
  163. package/dev/utils/array.ts +0 -15
  164. package/dev/utils/date.ts +0 -75
  165. package/dev/utils/file.ts +0 -121
  166. package/dev/utils/function.ts +0 -192
  167. package/dev/utils/index.d.ts +0 -6
  168. package/dev/utils/index.ts +0 -46
  169. package/dev/utils/ip.ts +0 -79
  170. package/dev/utils/language.ts +0 -72
  171. package/dev/utils/object.ts +0 -298
  172. package/dev/utils/page.ts +0 -13
  173. package/dev/utils/platform.ts +0 -14
  174. package/dev/utils/string.ts +0 -133
  175. package/dev/utils/utils.ts +0 -198
  176. /package/{dev → dist}/index.d.ts +0 -0
  177. /package/{dev → dist}/index.d.ts.map +0 -0
  178. /package/{dev → dist}/index.js +0 -0
  179. /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts +0 -0
  180. /package/{dev → dist}/plugins/uniGlobalComponents/uniGlobalComponents.d.ts.map +0 -0
@@ -1,98 +0,0 @@
1
- <template>
2
- <view class="websocket-item">
3
- <view class="websocket-url-row">
4
- <Tag mode="info" v-if="ws.readyState === 'connection'">con</Tag>
5
- <Tag mode="success" v-if="ws.readyState === 'open'">open</Tag>
6
- <Tag
7
- mode="warn"
8
- v-if="ws.readyState === 'closing' || ws.readyState === 'closed'"
9
- >
10
- close
11
- </Tag>
12
-
13
- <Tag mode="error" v-if="ws.readyState === 'error'">error</Tag>
14
-
15
- <view class="websocket-url" v-html="ws.url" />
16
-
17
- <Tag
18
- mode="main"
19
- class="websocket-detail-icon"
20
- @click="showDetail = !showDetail"
21
- >
22
- 详情
23
- </Tag>
24
- </view>
25
- <view class="websocket-info">
26
- <view class="websocket-info-last">
27
- {{ ws?.message?.[ws.message.length - 1]?.data }}
28
- </view>
29
-
30
- <view>{{
31
- ws?.message?.[ws.message.length - 1].time
32
- ? formatDate(ws?.message?.[ws.message.length - 1].time, 'HH:mm:ss')
33
- : '-'
34
- }}</view>
35
- </view>
36
-
37
- <WebSocketList v-if="showDetail" :ws="ws" @close="onClose" />
38
- </view>
39
- </template>
40
- <script lang="ts" setup>
41
- import { ref } from 'vue';
42
-
43
- import Tag from '../Tag/index.vue';
44
- import WebSocketList from './WebSocketList.vue';
45
- import { formatDate } from '../../utils';
46
- import type { DevTool } from '../../type';
47
-
48
- defineProps<{ ws: DevTool.WS }>();
49
- const showDetail = ref(false);
50
-
51
- function onClose() {
52
- showDetail.value = false;
53
- }
54
- </script>
55
- <style scoped>
56
- .websocket-item {
57
- padding: 16px;
58
-
59
- box-sizing: border-box;
60
- border-bottom: 1px solid var(--dev-tool-border-color);
61
- font-size: var(--dev-tool-base-font-size);
62
- }
63
- .websocket-item .websocket-url-row {
64
- display: flex;
65
- align-items: center;
66
- word-break: break-all;
67
- }
68
-
69
- .websocket-item .websocket-url-row .websocket-url {
70
- margin-left: 4px;
71
- flex: 1;
72
- white-space: nowrap;
73
- overflow: hidden;
74
- text-overflow: ellipsis;
75
- }
76
-
77
- .websocket-item .websocket-url-row .websocket-detail-icon {
78
- flex-shrink: 0;
79
- margin-left: auto;
80
- }
81
- .websocket-item .websocket-url-row .websocket-detail-active {
82
- transform: rotate(135deg);
83
- }
84
- .websocket-item .websocket-info {
85
- display: flex;
86
- align-items: center;
87
- justify-content: space-between;
88
- margin-top: 4px;
89
- color: #616161;
90
- }
91
-
92
- .websocket-item .websocket-info .websocket-info-last {
93
- white-space: nowrap;
94
- flex: 1;
95
- overflow: hidden;
96
- text-overflow: ellipsis;
97
- }
98
- </style>
@@ -1,176 +0,0 @@
1
- <template>
2
- <view class="web-socket-list-container">
3
- <view class="web-socket-top">
4
- 请求url:
5
-
6
- <CloseButton style="margin-left: auto" @click="onClose" />
7
- </view>
8
- <view class="web-socket-url">
9
- {{ ws.url }}
10
- </view>
11
-
12
- <view class="web-socket-data">
13
- <view class="web-socket-title"
14
- >请求方式:<Tag mode="info"> {{ ws.method }} </Tag></view
15
- >
16
- <view class="web-socket-title">请求头:</view>
17
- <view
18
- class="header-detail-item"
19
- v-for="item in ws.headers"
20
- :key="item.key"
21
- >
22
- <view>{{ item.key }}: </view>
23
- {{ item.value }}
24
- </view>
25
-
26
- <view class="web-socket-title">消息列表:</view>
27
- <view class="web-socket-data-list">
28
- <view
29
- v-for="item in ws.message"
30
- :key="item.time"
31
- :class="`web-socket-data-item web-socket-data-item-${item.type}`"
32
- @click="onClick(item)"
33
- >
34
- <view class="web-socket-data-time"
35
- >{{ formatDate(item.time, 'HH:mm:ss') }}
36
- </view>
37
- <view class="web-socket-data-content">
38
- {{ item.data }}
39
- </view>
40
- </view>
41
- </view>
42
- </view>
43
- </view>
44
- </template>
45
- <script setup lang="ts">
46
- import Tag from '../Tag/index.vue';
47
- import CloseButton from '../CloseButton/index.vue';
48
- import { formatDate } from '../../utils/index';
49
- import type { DevTool } from '../../type';
50
-
51
- defineProps<{ ws: DevTool.WS }>();
52
- const emit = defineEmits<{ (e: 'close'): void }>();
53
-
54
- function onClose() {
55
- emit('close');
56
- }
57
-
58
- function onClick(item: {
59
- type: 'success' | 'error';
60
- data: string;
61
- time: number;
62
- }) {
63
- uni.setClipboardData({
64
- data: JSON.stringify(item),
65
- success() {
66
- uni.showToast({
67
- title: '复制成功',
68
- icon: 'none',
69
- });
70
- },
71
- fail() {
72
- uni.showToast({
73
- title: '复制失败',
74
- icon: 'none',
75
- });
76
- },
77
- });
78
- }
79
- </script>
80
- <style>
81
- .web-socket-list-container {
82
- position: fixed;
83
- width: 100vw;
84
- height: 100vh;
85
- z-index: 1000;
86
- top: 0;
87
- left: 0;
88
- padding: 0 16px;
89
- /* #ifdef H5 */
90
- padding: 50px 16px;
91
- /* #endif */
92
-
93
- background-color: rgba(255, 255, 255, 0.95);
94
- box-sizing: border-box;
95
- }
96
- .web-socket-list-title {
97
- min-height: 32px;
98
- display: flex;
99
- align-items: center;
100
- }
101
-
102
- .web-socket-data {
103
- height: calc(100% - 32px);
104
- overflow: auto;
105
- }
106
-
107
- .web-socket-url {
108
- display: flex;
109
- align-items: center;
110
- min-height: 28px;
111
-
112
- white-space: wrap;
113
- word-break: break-all;
114
- }
115
-
116
- .web-socket-close {
117
- flex-shrink: 0;
118
- display: flex;
119
- align-items: center;
120
- justify-content: center;
121
- width: 24px;
122
- height: 24px;
123
- margin-left: auto;
124
- border-radius: 50%;
125
- border: 1px solid #000;
126
- box-sizing: border-box;
127
- }
128
- .web-socket-top {
129
- display: flex;
130
- align-items: center;
131
- height: 32px;
132
-
133
- border-bottom: 1px solid transparent;
134
- box-sizing: border-box;
135
- }
136
- .web-socket-title {
137
- display: flex;
138
- align-items: center;
139
- }
140
- .header-detail-item {
141
- display: flex;
142
- align-items: center;
143
- min-height: 28px;
144
- word-break: break-all;
145
- }
146
- .header-detail-item > view:first-child {
147
- white-space: nowrap;
148
- margin-right: 8px;
149
- color: #616161;
150
- }
151
-
152
- .web-socket-data-item {
153
- display: flex;
154
- align-items: center;
155
- min-height: 28px;
156
- }
157
- .web-socket-data-item-error {
158
- background-color: var(--dev-tool-error-bg-color);
159
- }
160
- .web-socket-data-item-success {
161
- background-color: var(--dev-tool-success-bg-color);
162
- }
163
- .web-socket-data-time {
164
- /* margin-right: 16px; */
165
- padding: 0 6px;
166
- flex-shrink: 0;
167
- color: #616161;
168
- }
169
- .web-socket-data-content {
170
- padding: 6px;
171
- flex: 1;
172
- overflow: hidden;
173
- text-overflow: ellipsis;
174
- word-break: break-all;
175
- }
176
- </style>
@@ -1,111 +0,0 @@
1
- <template>
2
- <view class="websocket-content">
3
- <view class="websocket-control">
4
- <FilterInput
5
- :modelValue="modelValue"
6
- placeholder="查询url"
7
- @search="emit('search', $event)"
8
- @update:modelValue="emit('update:modelValue', $event)"
9
- />
10
- <Tag
11
- v-for="item in webSocketFilter"
12
- :mode="item.mode"
13
- :key="item.value"
14
- :active="item.value === currentWebSocketType"
15
- @click="onChoose(item.value)"
16
- >
17
- {{ item.label }}
18
- </Tag>
19
- </view>
20
-
21
- <VirtualListPro :data="wsList" :pageSize="10" className="websocket-list">
22
- <template v-slot="{ list, start }">
23
- <AutoSize
24
- v-for="(item, index) in list"
25
- :index="start + index"
26
- :key="start + index"
27
- >
28
- <WebSocketItem :ws="item" />
29
- </AutoSize>
30
- <Empty v-if="!wsList || wsList.length === 0" />
31
- </template>
32
- </VirtualListPro>
33
- </view>
34
- </template>
35
- <script lang="ts" setup>
36
- import WebSocketItem from './WebSocketItem.vue';
37
- import Tag from '../Tag/index.vue';
38
- import Empty from '../Empty/index.vue';
39
- import FilterInput from '../FilterInput/index.vue';
40
- import type { DevTool } from '../../type';
41
- import VirtualListPro from '../VirtualListPro/index.vue';
42
- import AutoSize from '../VirtualListPro/AutoSize.vue';
43
-
44
- defineProps<{
45
- wsList: DevTool.WS[];
46
- currentWebSocketType: string;
47
- modelValue: string;
48
- }>();
49
- const emit = defineEmits<{
50
- (e: 'choose', type: string): void;
51
- (e: 'update:modelValue', value: string): void;
52
- (e: 'search', value: string): void;
53
- }>();
54
- const webSocketFilter = [
55
- {
56
- label: '全部',
57
- value: 'all',
58
- mode: 'all',
59
- },
60
- {
61
- label: 'con',
62
- value: 'connection',
63
- mode: 'info',
64
- },
65
- {
66
- label: 'open',
67
- value: 'open',
68
- mode: 'success',
69
- },
70
- {
71
- label: 'close',
72
- value: 'close',
73
- mode: 'warn',
74
- },
75
- {
76
- label: 'error',
77
- value: 'error',
78
- mode: 'error',
79
- },
80
- {
81
- label: '清除',
82
- value: 'clear',
83
- mode: 'clear',
84
- },
85
- ];
86
-
87
- function onChoose(type: string) {
88
- emit('choose', type);
89
- }
90
- </script>
91
- <style scoped>
92
- .websocket-content {
93
- height: 100%;
94
- font-size: var(--dev-tool-base-font-size);
95
- }
96
-
97
- .websocket-control {
98
- display: flex;
99
- align-items: center;
100
- justify-content: space-between;
101
- gap: 8px;
102
- padding: 0 16px;
103
- height: 32px;
104
- border-bottom: 1px solid var(--dev-tool-border-color);
105
- box-sizing: border-box;
106
- }
107
- .websocket-list {
108
- height: calc(100% - 32px);
109
- overflow: auto;
110
- }
111
- </style>
@@ -1,33 +0,0 @@
1
- <template>
2
- <view class="window-info-content">
3
- <JsonPretty v-if="showJson" :data="windowInfo" />
4
- <Empty v-else />
5
- </view>
6
- </template>
7
- <script lang="ts" setup>
8
- import { computed } from 'vue';
9
- import JsonPretty from '../JsonPretty/index.vue';
10
-
11
- import Empty from '../Empty/index.vue';
12
- const props = defineProps<{
13
- windowInfo: Record<string, any>;
14
- }>();
15
-
16
- const showJson = computed(() => {
17
- try {
18
- const str = JSON.stringify(props.windowInfo);
19
- if (typeof props.windowInfo === 'object' && (str === '' || str === '{}')) {
20
- return false;
21
- }
22
- return true;
23
- } catch (error) {
24
- return false;
25
- }
26
- });
27
- </script>
28
- <style scoped>
29
- .window-info-content {
30
- padding: 16px;
31
- font-size: var(--dev-tool-base-font-size);
32
- }
33
- </style>
package/dev/const.ts DELETED
@@ -1,166 +0,0 @@
1
- /**
2
- * 调试按钮事件
3
- * 缓存调试按钮显示隐藏
4
- */
5
- export const EVENT_DEV_BUTTON = 'event-dev-button';
6
-
7
- /**
8
- * 调试弹窗事件
9
- * 缓存调试弹窗显示隐藏
10
- */
11
- export const EVENT_DEV_WINDOW = 'event-dev-window';
12
-
13
- /**
14
- * app 发出的信息
15
- */
16
- export const DEV_APP_MESSAGE = 'dev-app-message';
17
-
18
- /**
19
- * 调试弹窗发出的消息
20
- */
21
- export const DEV_WINDOW_MESSAGE = 'dev-window-message';
22
-
23
- /**
24
- * 缓存调试按钮信息
25
- */
26
- export const DEV_BUTTON_INFO = 'dev-button-info';
27
-
28
- /**
29
- * 缓存调试弹窗信息
30
- */
31
- export const DEV_WINDOW_INFO = ' dev-window-info';
32
-
33
- export const DEV_IS_DESTROY = 'dev-is-destroy';
34
-
35
- /**
36
- * 清空console
37
- */
38
- export const DEV_CONSOLE_CLEAR = 'dev-console-clear';
39
-
40
- /**
41
- * 清空network
42
- */
43
- export const DEV_NETWORK_CLEAR = 'dev-network-clear';
44
-
45
- /**
46
- * 清空websocket
47
- */
48
- export const DEV_WEBSOCKET_CLEAR = 'dev-websocket-clear';
49
-
50
- /**
51
- * 清空upload
52
- */
53
- export const DEV_UPLOAD_CLEAR = 'dev-upload-clear';
54
-
55
- /**
56
- * 清空storage
57
- */
58
- export const DEV_STORAGE_CLEAR = 'dev-storage-clear';
59
-
60
- /**
61
- * 刷新storage
62
- */
63
- export const DEV_STORAGE_REFRESH = 'dev-storage-refresh';
64
-
65
- /**
66
- * 移除storage
67
- */
68
- export const DEV_STORAGE_REMOVE = 'dev-storage-remove';
69
-
70
- /**
71
- * 新增storage
72
- */
73
- export const DEV_STORAGE_ADD = 'dev-storage-add';
74
-
75
- /**
76
- * 更新storage
77
- */
78
- export const DEV_STORAGE_UPDATE = 'dev-storage-update';
79
-
80
- /**
81
- * 页面跳转
82
- */
83
- export const DEV_PAGE_JUMP = 'dev-page-jump';
84
-
85
- /**
86
- * 隐藏调试按钮
87
- */
88
- export const DEV_BUTTON_SHOW_OR_HIDE = 'dev-button-show-or-hide';
89
-
90
- /**
91
- * 重启调试器
92
- */
93
- export const DEV_RESTART_DEBUGGER = 'dev-restart-debugger';
94
-
95
- /**
96
- * 重启app
97
- */
98
- export const DEV_RESTART_APP = 'dev-restart-app';
99
-
100
- /**
101
- * 导出日志
102
- */
103
- export const DEV_EXPORT_LOG = 'dev-export-log';
104
-
105
- /**
106
- * 改变vuex数据
107
- */
108
- export const DEV_VUEX_CHANGE = 'dev-vuex-change';
109
-
110
- /**
111
- * 改变pinia
112
- */
113
- export const DEV_PINIA_CHANGE = 'dev-pinia-change';
114
-
115
- /**
116
- * 清除日志缓存
117
- */
118
- export const DEV_LOG_CACHE_CLEAR = 'dev-log-cache-clear';
119
-
120
- /**
121
- * 销毁调试工具
122
- */
123
- export const DEV_DESTROY = 'dev-destroy';
124
-
125
- /**
126
- * 显示调试弹窗
127
- */
128
- export const DEV_WINDOW_OPEN = 'dev-window-open';
129
-
130
- /**
131
- * 显示调试弹窗
132
- */
133
- export const DEV_WINDOW_CLOSE = 'dev-window-close';
134
-
135
- /**
136
- * 刷新路由列表
137
- */
138
- export const DEV_ROUTE_REFRESH = 'dev-route-refresh';
139
-
140
- /**
141
- * 获取 dev option
142
- */
143
- export const DEV_OPTION = 'dev-option';
144
-
145
- /**
146
- * 获取options
147
- */
148
- export const DEV_OPTION_GET = 'dev-option-get';
149
-
150
- /**
151
- * 发送 options
152
- */
153
- export const DEV_OPTION_SEND = 'dev-option-send';
154
-
155
- /**
156
- * 清空事件
157
- */
158
- export const DEV_UNI_EVENT_CLEAR = 'dev-uni-event-clear';
159
-
160
- /**
161
- * 运行js
162
- */
163
- export const DEV_RUN_JS = 'dev-uni-run-js';
164
-
165
- /** 清空截屏列表 */
166
- export const DEV_CAPTURE_SCREEN_CLEAR = 'dev-capture-screen-clear';
package/dev/core.ts DELETED
@@ -1,118 +0,0 @@
1
- import { DevStore } from './devStore';
2
- import { DevEvent } from './devEvent';
3
- import { DevIntercept } from './devIntercept';
4
- import { DevConsole } from './devConsole';
5
-
6
- import type { DevTool } from './type';
7
-
8
- import { EventBus } from './devEventBus';
9
- /**
10
- * 备份原生方法
11
- *
12
- * @private
13
- * @memberof DevStore
14
- */
15
- const backup = {
16
- // log: console.log,
17
- // info: console.info,
18
- // warn: console.warn,
19
- // error: console.error,
20
- setStorage: uni?.setStorage,
21
- setStorageSync: uni?.setStorageSync,
22
- clearStorage: uni?.clearStorage,
23
- clearStorageSync: uni?.clearStorageSync,
24
- removeStorage: uni?.removeStorage,
25
- removeStorageSync: uni?.removeStorageSync,
26
- reject: Promise.reject,
27
- connectSocket: uni?.connectSocket,
28
- uploadFile: uni?.uploadFile,
29
- $on: uni.$on,
30
- $once: uni.$once,
31
- $emit: uni.$emit,
32
- $off: uni.$off,
33
- __log__: (uni as any).__log__,
34
- };
35
-
36
- const eventBus = new EventBus();
37
-
38
- const store = new DevStore();
39
-
40
- const event = new DevEvent({
41
- store,
42
- eventBus,
43
- });
44
-
45
- const console = new DevConsole(event);
46
-
47
- const intercept = new DevIntercept({
48
- event,
49
- enableInterceptPromiseReject: store?.enableInterceptPromiseReject,
50
- });
51
-
52
- function getDevToolOptions() {
53
- return store.getDevToolOptions();
54
- }
55
-
56
- function initDevTool(options?: DevTool.DevToolOptions) {
57
- if (!options?.mode) {
58
- console.error('[DevTool] 请传入 mode: import.meta.env.MODE');
59
- }
60
-
61
- store.setDevToolOptions(options || { mode: '' });
62
-
63
- intercept.interceptVue3(options?.vue3instance);
64
- }
65
-
66
- function showDevToolButton() {
67
- event.showDevToolButton();
68
- }
69
-
70
- function hideDevToolButton() {
71
- event.hideDevToolButton();
72
- }
73
-
74
- function openDevToolWindow() {
75
- event.openDevToolWindow();
76
- }
77
-
78
- function closeDevToolWindow() {
79
- event.closeDevToolWindow();
80
- }
81
-
82
- function createDevTool() {
83
- event.createDevTool();
84
- intercept.init({
85
- event,
86
- enableInterceptPromiseReject: store?.enableInterceptPromiseReject,
87
- });
88
- }
89
-
90
- function destroyDevTool() {
91
- event.destroyDevTool();
92
- }
93
-
94
- function interceptVuexStorage(store: any) {
95
- return intercept.interceptVuexStorage(store);
96
- }
97
-
98
- function interceptPiniaStore(context: any) {
99
- return intercept.interceptPiniaStore(context);
100
- }
101
-
102
- uni.__dev__console = console;
103
-
104
- export {
105
- backup,
106
- console,
107
- initDevTool,
108
- createDevTool,
109
- destroyDevTool,
110
- showDevToolButton,
111
- hideDevToolButton,
112
- openDevToolWindow,
113
- closeDevToolWindow,
114
- getDevToolOptions,
115
- interceptVuexStorage,
116
- interceptPiniaStore,
117
- eventBus,
118
- };