vite-uni-dev-tool 0.0.15 → 0.0.17

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 (38) hide show
  1. package/README.md +47 -20
  2. package/dist/devIntercept/index.d.ts.map +1 -1
  3. package/dist/devIntercept/index.js +139 -137
  4. package/dist/devStore/index.js +1 -1
  5. package/dist/type.d.ts +5 -1
  6. package/dist/type.d.ts.map +1 -1
  7. package/dist/v2/{CloseButton → CircularButton}/index.vue +5 -2
  8. package/dist/v2/ConsoleList/ConsoleItem.vue +3 -2
  9. package/dist/v2/NetworkList/NetworkDetail.vue +3 -3
  10. package/dist/v2/NetworkList/NetworkItem.vue +5 -3
  11. package/dist/v2/SettingList/index.vue +1 -1
  12. package/dist/v2/SourceCode/index.vue +3 -3
  13. package/dist/v2/StorageList/index.vue +7 -3
  14. package/dist/v2/Tabs/index.vue +3 -3
  15. package/dist/v2/UploadList/UploadDetail.vue +3 -3
  16. package/dist/v2/WebSocket/WebSocketList.vue +3 -3
  17. package/dist/v3/{CloseButton → CircularButton}/index.vue +4 -2
  18. package/dist/v3/ConsoleList/ConsoleItem.vue +47 -99
  19. package/dist/v3/ConsoleList/index.vue +2 -0
  20. package/dist/v3/DevTool/index.vue +4 -4
  21. package/dist/v3/DevToolWindow/index.vue +162 -14
  22. package/dist/v3/FilterSelect/index.vue +165 -0
  23. package/dist/v3/NetworkList/NetworkDetail.vue +11 -8
  24. package/dist/v3/NetworkList/NetworkItem.vue +56 -26
  25. package/dist/v3/NetworkList/NetworkSend.vue +819 -0
  26. package/dist/v3/NetworkList/const.d.ts +5 -0
  27. package/dist/v3/NetworkList/const.d.ts.map +1 -0
  28. package/dist/v3/NetworkList/const.ts +4 -0
  29. package/dist/v3/NetworkList/index.vue +104 -21
  30. package/dist/v3/SettingList/index.vue +1 -1
  31. package/dist/v3/SourceCode/index.vue +22 -8
  32. package/dist/v3/StorageList/index.vue +7 -6
  33. package/dist/v3/Tabs/index.vue +2 -2
  34. package/dist/v3/UniEvent/UniEventItem.vue +6 -54
  35. package/dist/v3/UniEvent/index.vue +2 -0
  36. package/dist/v3/UploadList/UploadDetail.vue +2 -2
  37. package/dist/v3/WebSocket/WebSocketList.vue +2 -2
  38. package/package.json +1 -1
@@ -176,6 +176,7 @@ export default {
176
176
  margin-top: 4px;
177
177
  /* color: #616161; */
178
178
  text-align: right;
179
+ color: var(--dev-tool-text-color);
179
180
  }
180
181
 
181
182
  .console-tags {
@@ -208,10 +209,10 @@ export default {
208
209
  background-color: var(--dev-tool-success-color);
209
210
  }
210
211
  .console-item-info {
211
- color: var(--dev-tool-log-color);
212
+ color: var(--dev-tool-info-color);
212
213
  }
213
214
  .console-item-log {
214
- color: #f9f9f9;
215
+ color: var(--dev-tool-info-color);
215
216
  }
216
217
 
217
218
  .console-arg-null {
@@ -10,7 +10,7 @@
10
10
  >
11
11
  {{ item.label }}
12
12
  </Tag>
13
- <CloseButton style="margin-left: auto" @click="onClose" />
13
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
14
14
  </view>
15
15
 
16
16
  <view class="network-detail-header" v-if="currentSelect === 'header'">
@@ -79,14 +79,14 @@
79
79
  import JsonPretty from '../JsonPretty/index.vue';
80
80
  import Tag from '../Tag/index.vue';
81
81
  import Empty from '../Empty/index.vue';
82
- import CloseButton from '../CloseButton/index.vue';
82
+ import CircularButton from '../CircularButton/index.vue';
83
83
 
84
84
  export default {
85
85
  components: {
86
86
  JsonPretty,
87
87
  Tag,
88
88
  Empty,
89
- CloseButton,
89
+ CircularButton,
90
90
  },
91
91
  props: {
92
92
  network: {
@@ -32,14 +32,16 @@
32
32
  >开始:
33
33
  {{
34
34
  network.startTime
35
- ? formatDate(network.startTime, 'HH:mm:ss')
36
- : '--:--:--'
35
+ ? formatDate(network.startTime, 'HH:mm:ss:SS')
36
+ : '--:--:--:---'
37
37
  }}</view
38
38
  >
39
39
  <view>
40
40
  结束:
41
41
  {{
42
- network.endTime ? formatDate(network.endTime, 'HH:mm:ss') : '--:--:--'
42
+ network.endTime
43
+ ? formatDate(network.endTime, 'HH:mm:ss:SS')
44
+ : '--:--:--:---'
43
45
  }}
44
46
  </view>
45
47
  </view>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <view class="setting-content">
3
3
  <view class="setting-item">
4
- <DevToolTitle>DevTool(v0.0.12-vue2)</DevToolTitle>
4
+ <DevToolTitle>DevTool(v0.0.16-vue2)</DevToolTitle>
5
5
  <view class="setting-item-content">
6
6
  <view class="setting-row">
7
7
  <view>显示调试按钮:</view>
@@ -6,7 +6,7 @@
6
6
  style="width: 100%"
7
7
  @search="onSearch"
8
8
  />
9
- <CloseButton style="margin-left: auto" @click="onClose" />
9
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
10
10
  </view>
11
11
  <view class="dev-tool-code-title">{{ fileName }}</view>
12
12
  <scroll-view
@@ -36,14 +36,14 @@
36
36
 
37
37
  <script>
38
38
  import FilterInput from '../FilterInput/index.vue';
39
- import CloseButton from '../CloseButton/index.vue';
39
+ import CircularButton from '../CircularButton/index.vue';
40
40
  import Empty from '../Empty/index.vue';
41
41
  import { escapeHTML, hightLight, isAndroid, parseStock } from '../../utils';
42
42
 
43
43
  export default {
44
44
  components: {
45
45
  FilterInput,
46
- CloseButton,
46
+ CircularButton,
47
47
  Empty,
48
48
  },
49
49
  props: {
@@ -24,7 +24,11 @@
24
24
  <view>key: </view>
25
25
  <view v-html="item._oldKey" />
26
26
  </view>
27
- <CloseButton style="margin-left: auto" @click="onRemove(item.key)" />
27
+ <CircularButton
28
+ style="margin-left: auto"
29
+ text="×"
30
+ @click="onRemove(item.key)"
31
+ />
28
32
  </view>
29
33
 
30
34
  <JsonPretty
@@ -46,7 +50,7 @@
46
50
  import Tag from '../Tag/index.vue';
47
51
  import JsonPretty from '../JsonPretty/index.vue';
48
52
  import Empty from '../Empty/index.vue';
49
- import CloseButton from '../CloseButton/index.vue';
53
+ import CircularButton from '../CircularButton/index.vue';
50
54
  import FilterInput from '../FilterInput/index.vue';
51
55
 
52
56
  export default {
@@ -54,7 +58,7 @@ export default {
54
58
  Tag,
55
59
  JsonPretty,
56
60
  Empty,
57
- CloseButton,
61
+ CircularButton,
58
62
  FilterInput,
59
63
  },
60
64
  props: {
@@ -24,17 +24,17 @@
24
24
  </scroll-view>
25
25
  <view class="tabs-extra">
26
26
  <slot name="extra"></slot>
27
- <CloseButton style="margin: 0 16px" @click="onClose" />
27
+ <CircularButton style="margin: 0 16px" text="×" @click="onClose" />
28
28
  </view>
29
29
  </view>
30
30
  </template>
31
31
 
32
32
  <script>
33
- import CloseButton from '../CloseButton/index.vue';
33
+ import CircularButton from '../CircularButton/index.vue';
34
34
 
35
35
  export default {
36
36
  components: {
37
- CloseButton,
37
+ CircularButton,
38
38
  },
39
39
  props: {
40
40
  modelValue: {
@@ -11,7 +11,7 @@
11
11
  {{ item.label }}
12
12
  </Tag>
13
13
 
14
- <CloseButton style="margin-left: auto" @click="onClose" />
14
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
15
15
  </view>
16
16
 
17
17
  <view class="upload-detail-header" v-if="currentSelect === 'header'">
@@ -71,14 +71,14 @@
71
71
  import JsonPretty from '../JsonPretty/index.vue';
72
72
  import Tag from '../Tag/index.vue';
73
73
  import Empty from '../Empty/index.vue';
74
- import CloseButton from '../CloseButton/index.vue';
74
+ import CircularButton from '../CircularButton/index.vue';
75
75
 
76
76
  export default {
77
77
  components: {
78
78
  JsonPretty,
79
79
  Tag,
80
80
  Empty,
81
- CloseButton,
81
+ CircularButton,
82
82
  },
83
83
  props: {
84
84
  upload: {
@@ -3,7 +3,7 @@
3
3
  <view class="web-socket-top">
4
4
  请求url:
5
5
 
6
- <CloseButton style="margin-left: auto" @click="onClose" />
6
+ <CircularButton style="margin-left: auto" text="×" @click="onClose" />
7
7
  </view>
8
8
  <view class="web-socket-url">
9
9
  {{ ws.url }}
@@ -45,13 +45,13 @@
45
45
 
46
46
  <script>
47
47
  import Tag from '../Tag/index.vue';
48
- import CloseButton from '../CloseButton/index.vue';
48
+ import CircularButton from '../CircularButton/index.vue';
49
49
  import { formatDate } from '../../utils/index';
50
50
 
51
51
  export default {
52
52
  components: {
53
53
  Tag,
54
- CloseButton,
54
+ CircularButton,
55
55
  },
56
56
  props: {
57
57
  /** @type {{url:string; method:string; headers: {key:string; value:string}[]; message: { time:string; data:string }[] }} */
@@ -1,7 +1,9 @@
1
1
  <template>
2
- <view class="close-button" @click="onClick"> × </view>
2
+ <view class="circular-button" @click="onClick"> {{ text }} </view>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
+ defineProps<{ text: string }>();
6
+
5
7
  const emit = defineEmits<{ (e: 'click'): void }>();
6
8
 
7
9
  function onClick() {
@@ -10,7 +12,7 @@ function onClick() {
10
12
  </script>
11
13
 
12
14
  <style scoped>
13
- .close-button {
15
+ .circular-button {
14
16
  flex-shrink: 0;
15
17
  display: flex;
16
18
  align-items: center;
@@ -1,68 +1,56 @@
1
1
  <template>
2
2
  <view :id="id" :class="`console-item console-item-${consoleItem.type}`">
3
- <view class="console-info">
4
- <view class="console-args">
5
- <template v-for="(item, index) in consoleItem.args">
6
- <view
7
- v-if="item.type !== 'array' && item.type !== 'object'"
8
- :class="`console-arg console-arg-${item.type}`"
9
- :key="index"
10
- v-html="item.value"
11
- >
12
- </view>
13
- <JsonPretty
14
- v-else
15
- :data="item.value"
16
- collapsed
17
- showLength
18
- :autoVirtualRow="100"
19
- />
20
- </template>
21
- </view>
22
- <view class="console-position">
23
- <view class="console-tags">
24
- <Tag
25
- v-if="consoleItem.mode"
26
- mode="log"
27
- style="margin-right: 6px; justify-content: center"
28
- >
29
- {{ consoleItem.mode }}
30
- </Tag>
31
- <Tag :mode="consoleItem.type">
32
- {{ consoleItem.type }}
33
- </Tag>
3
+ <view class="console-args">
4
+ <template v-for="(item, index) in consoleItem.args">
5
+ <view
6
+ v-if="item.type !== 'array' && item.type !== 'object'"
7
+ :class="`console-arg console-arg-${item.type}`"
8
+ :key="index"
9
+ v-html="item.value"
10
+ >
34
11
  </view>
12
+ <JsonPretty
13
+ v-else
14
+ collapsed
15
+ showLength
16
+ :data="item.value"
17
+ :autoVirtualRow="100"
18
+ />
19
+ </template>
20
+ </view>
21
+ <view class="console-position">
22
+ <view class="console-tags">
23
+ <Tag
24
+ v-if="consoleItem.mode"
25
+ mode="log"
26
+ style="margin-right: 6px; justify-content: center"
27
+ >
28
+ {{ consoleItem.mode }}
29
+ </Tag>
30
+ <Tag :mode="consoleItem.type">
31
+ {{ consoleItem.type }}
32
+ </Tag>
33
+ </view>
35
34
 
36
- <view>
37
- <view class="console-time">{{ consoleItem.time }}</view>
38
- <view class="console-other" v-html="consoleItem.position"></view>
39
- <view
40
- :class="`console-other ${isUseDevSource ? 'console-stack' : ''}`"
41
- v-if="consoleItem.stack"
42
- v-html="consoleItem.stack"
43
- @click="onStackClick"
44
- ></view>
45
- </view>
35
+ <view>
36
+ <view class="console-time">{{ consoleItem.time }}</view>
37
+ <view class="console-other" v-html="consoleItem.position"></view>
38
+ <view
39
+ :class="`console-other ${isUseDevSource ? 'console-stack' : ''}`"
40
+ v-if="consoleItem.stack"
41
+ v-html="consoleItem.stack"
42
+ @click="emit('openCode', consoleItem.stack)"
43
+ ></view>
46
44
  </view>
47
45
  </view>
48
- <!-- <view class="console-copy">C</view> -->
49
- <SourceCode
50
- v-if="openCode && consoleItem.stack"
51
- :url="consoleItem.stack"
52
- :sourceFileServers="sourceFileServers"
53
- :mode="mode"
54
- :zIndex="zIndex"
55
- @close="onCloseCode"
56
- />
57
46
  </view>
58
47
  </template>
59
48
 
60
49
  <script setup lang="ts">
61
- import { ref, computed } from 'vue';
50
+ import { computed } from 'vue';
62
51
  import Tag from '../Tag/index.vue';
63
- import SourceCode from '../SourceCode/index.vue';
64
52
  import type { DevTool } from '../../type';
65
- import { isAndroid, isMockWX } from '../../utils';
53
+ import { isMockWX } from '../../utils';
66
54
  import JsonPretty from '../JsonPretty/index.vue';
67
55
  const props = defineProps<{
68
56
  consoleItem: DevTool.ConsoleItem;
@@ -73,7 +61,9 @@ const props = defineProps<{
73
61
  id: string;
74
62
  }>();
75
63
 
76
- const openCode = ref(false);
64
+ const emit = defineEmits<{
65
+ (e: 'openCode', value: string): void;
66
+ }>();
77
67
 
78
68
  const isUseDevSource = computed(() => {
79
69
  return (
@@ -82,55 +72,13 @@ const isUseDevSource = computed(() => {
82
72
  props.useDevSource
83
73
  );
84
74
  });
85
-
86
- const isWXLink = computed(() => {
87
- return (
88
- isMockWX(props?.consoleItem?.stack ?? '') || props.mode !== 'development'
89
- );
90
- });
91
-
92
- function onStackClick() {
93
- if (isWXLink.value) {
94
- uni.showToast({
95
- icon: 'none',
96
- title: '[DevTool] 请在小程序真机调试模式下查看源码',
97
- });
98
- return;
99
- }
100
-
101
- if (!isUseDevSource.value) {
102
- return;
103
- }
104
-
105
- if (isAndroid()) {
106
- if (props.sourceFileServers && props.sourceFileServers.length > 0) {
107
- openCode.value = true;
108
- } else {
109
- uni.showToast({
110
- icon: 'none',
111
- title: '[DevTool] sourceFileServers 配置异常',
112
- });
113
- uni?.__dev__console?.log('[DevTool] sourceFileServers 配置异常');
114
- }
115
- } else {
116
- openCode.value = true;
117
- }
118
- }
119
-
120
- function onCloseCode() {
121
- openCode.value = false;
122
- }
123
75
  </script>
124
76
  <style scoped>
125
77
  .console-item {
126
- display: flex;
127
78
  padding: 16px;
128
79
  border-bottom: 1px solid var(--dev-tool-border-color);
129
80
  font-size: var(--dev-tool-base-font-size);
130
81
  }
131
- .console-info {
132
- flex: 1;
133
- }
134
82
  .console-args {
135
83
  display: flex;
136
84
  flex-wrap: wrap;
@@ -147,8 +95,8 @@ function onCloseCode() {
147
95
  align-items: flex-start;
148
96
  justify-content: space-between;
149
97
  margin-top: 4px;
150
- /* color: #616161; */
151
98
  text-align: right;
99
+ color: var(--dev-tool-text-color);
152
100
  }
153
101
 
154
102
  .console-tags {
@@ -181,10 +129,10 @@ function onCloseCode() {
181
129
  background-color: var(--dev-tool-success-color);
182
130
  }
183
131
  .console-item-info {
184
- color: var(--dev-tool-log-color);
132
+ color: var(--dev-tool-info-color);
185
133
  }
186
134
  .console-item-log {
187
- color: #f9f9f9;
135
+ color: var(--dev-tool-info-color);
188
136
  }
189
137
 
190
138
  .console-arg-null {
@@ -38,6 +38,7 @@
38
38
  :useDevSource="useDevSource"
39
39
  :id="`dev-console-${index}`"
40
40
  :zIndex="zIndex"
41
+ @openCode="emit('openCode', $event)"
41
42
  />
42
43
  </AutoSize>
43
44
  <Empty v-if="!consoleList || consoleList.length === 0" />
@@ -73,6 +74,7 @@ const emit = defineEmits<{
73
74
  (e: 'search', value: string): void;
74
75
  (e: 'update:modelValue', value: string): void;
75
76
  (e: 'run', value: string): void;
77
+ (e: 'openCode', value: string): void;
76
78
  }>();
77
79
  const consoleFilterItems: {
78
80
  label: string;
@@ -169,10 +169,10 @@ onShow(() => {
169
169
  });
170
170
  }
171
171
  });
172
- onHide(() => {
173
- isActive = false;
174
- devToolWindowVisible.value = false;
175
- });
172
+ // onHide(() => {
173
+ // isActive = false;
174
+ // devToolWindowVisible.value = false;
175
+ // });
176
176
  </script>
177
177
  <style scoped>
178
178
  .dev-tool {