vite-uni-dev-tool 0.0.13 → 0.0.15

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 (130) hide show
  1. package/dist/core.js +1 -1
  2. package/dist/devIntercept/index.d.ts +3 -3
  3. package/dist/devIntercept/index.d.ts.map +1 -1
  4. package/dist/devIntercept/index.js +117 -114
  5. package/dist/plugins/uniDevTool/transform/transformApp.d.ts +32 -0
  6. package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -0
  7. package/dist/plugins/uniDevTool/transform/transformApp.js +32 -0
  8. package/dist/plugins/uniDevTool/transform/transformMain.d.ts +26 -0
  9. package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -0
  10. package/dist/plugins/uniDevTool/transform/transformMain.js +3 -0
  11. package/dist/plugins/uniDevTool/transform/transformVue.d.ts +41 -0
  12. package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -0
  13. package/dist/plugins/uniDevTool/transform/transformVue.js +9 -0
  14. package/dist/plugins/uniDevTool/uniDevTool.d.ts +7 -3
  15. package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
  16. package/dist/plugins/uniDevTool/uniDevTool.js +3 -33
  17. package/dist/plugins/utils/index.d.ts +32 -0
  18. package/dist/plugins/utils/index.d.ts.map +1 -1
  19. package/dist/plugins/utils/index.js +1 -1
  20. package/dist/type.d.ts +2 -2
  21. package/dist/type.d.ts.map +1 -1
  22. package/dist/v2/AppInfo/index.vue +41 -0
  23. package/dist/v2/AutoSizer/index.vue +189 -0
  24. package/dist/v2/AutoSizer/index1.vue +193 -0
  25. package/dist/v2/AutoSizer/utils.ts +49 -0
  26. package/dist/v2/CaptureScreen/index.vue +78 -0
  27. package/dist/v2/CloseButton/index.vue +32 -0
  28. package/dist/v2/Connection/index.vue +94 -0
  29. package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
  30. package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
  31. package/dist/v2/ConsoleList/index.vue +164 -0
  32. package/dist/v2/ConsoleList/staticTips.js +1144 -0
  33. package/dist/v2/DevTool/index.vue +162 -0
  34. package/dist/v2/DevToolButton/index.vue +228 -0
  35. package/dist/v2/DevToolTitle/index.vue +28 -0
  36. package/dist/v2/DevToolWindow/index.vue +1051 -0
  37. package/dist/v2/DeviceInfo/index.vue +48 -0
  38. package/dist/v2/Empty/empty.png +0 -0
  39. package/dist/v2/Empty/index.vue +40 -0
  40. package/dist/v2/FilterInput/index.vue +100 -0
  41. package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
  42. package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
  43. package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
  44. package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
  45. package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
  46. package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
  47. package/dist/v2/JsonPretty/index.vue +531 -0
  48. package/dist/v2/JsonPretty/type.ts +125 -0
  49. package/dist/v2/JsonPretty/utils/index.js +211 -0
  50. package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
  51. package/dist/v2/NetworkList/NetworkItem.vue +135 -0
  52. package/dist/v2/NetworkList/index.vue +148 -0
  53. package/dist/v2/PiniaList/index.vue +79 -0
  54. package/dist/v2/RouteList/index.vue +137 -0
  55. package/dist/v2/RunJS/index.vue +128 -0
  56. package/dist/v2/SettingList/index.vue +318 -0
  57. package/dist/v2/SourceCode/index.vue +237 -0
  58. package/dist/v2/StorageList/index.vue +165 -0
  59. package/dist/v2/SystemInfo/index.vue +49 -0
  60. package/dist/v2/Tabs/index.vue +127 -0
  61. package/dist/v2/Tag/index.vue +91 -0
  62. package/dist/v2/UniEvent/UniEventItem.vue +157 -0
  63. package/dist/v2/UniEvent/index.vue +127 -0
  64. package/dist/v2/UploadList/UploadDetail.vue +204 -0
  65. package/dist/v2/UploadList/UploadItem.vue +134 -0
  66. package/dist/v2/UploadList/index.vue +143 -0
  67. package/dist/v2/VirtualList/index.vue +140 -0
  68. package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
  69. package/dist/v2/VirtualListPro/index.vue +255 -0
  70. package/dist/v2/VirtualListPro/readme.md +40 -0
  71. package/dist/v2/VuexList/index.vue +80 -0
  72. package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
  73. package/dist/v2/WebSocket/WebSocketList.vue +183 -0
  74. package/dist/v2/WebSocket/index.vue +155 -0
  75. package/dist/v2/WindowInfo/index.vue +49 -0
  76. package/dist/v3/AppInfo/index.vue +35 -0
  77. package/dist/v3/AutoSizer/index.vue +193 -0
  78. package/dist/v3/AutoSizer/index1.vue +186 -0
  79. package/dist/v3/AutoSizer/utils.ts +49 -0
  80. package/dist/v3/CaptureScreen/index.vue +62 -0
  81. package/dist/v3/CloseButton/index.vue +29 -0
  82. package/dist/v3/Connection/index.vue +88 -0
  83. package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
  84. package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
  85. package/dist/v3/ConsoleList/index.vue +139 -0
  86. package/dist/v3/ConsoleList/staticTips.ts +1145 -0
  87. package/dist/v3/DevTool/index.vue +217 -0
  88. package/dist/v3/DevToolButton/index.vue +210 -0
  89. package/dist/v3/DevToolTitle/index.vue +21 -0
  90. package/dist/v3/DevToolWindow/index.vue +1116 -0
  91. package/dist/v3/DeviceInfo/index.vue +32 -0
  92. package/dist/v3/Empty/empty.png +0 -0
  93. package/dist/v3/Empty/index.vue +28 -0
  94. package/dist/v3/FilterInput/index.vue +87 -0
  95. package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
  96. package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
  97. package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
  98. package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
  99. package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
  100. package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
  101. package/dist/v3/JsonPretty/index.vue +476 -0
  102. package/dist/v3/JsonPretty/type.ts +125 -0
  103. package/dist/v3/JsonPretty/utils/index.ts +172 -0
  104. package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
  105. package/dist/v3/NetworkList/NetworkItem.vue +120 -0
  106. package/dist/v3/NetworkList/index.vue +128 -0
  107. package/dist/v3/PiniaList/index.vue +64 -0
  108. package/dist/v3/RouteList/index.vue +121 -0
  109. package/dist/v3/RunJS/index.vue +128 -0
  110. package/dist/v3/SettingList/index.vue +313 -0
  111. package/dist/v3/SourceCode/index.vue +231 -0
  112. package/dist/v3/StorageList/index.vue +170 -0
  113. package/dist/v3/SystemInfo/index.vue +34 -0
  114. package/dist/v3/Tabs/index.vue +123 -0
  115. package/dist/v3/Tag/index.vue +89 -0
  116. package/dist/v3/UniEvent/UniEventItem.vue +126 -0
  117. package/dist/v3/UniEvent/index.vue +98 -0
  118. package/dist/v3/UploadList/UploadDetail.vue +192 -0
  119. package/dist/v3/UploadList/UploadItem.vue +117 -0
  120. package/dist/v3/UploadList/index.vue +117 -0
  121. package/dist/v3/VirtualList/index.vue +112 -0
  122. package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
  123. package/dist/v3/VirtualListPro/index.vue +238 -0
  124. package/dist/v3/VirtualListPro/readme.md +40 -0
  125. package/dist/v3/VuexList/index.vue +54 -0
  126. package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
  127. package/dist/v3/WebSocket/WebSocketList.vue +161 -0
  128. package/dist/v3/WebSocket/index.vue +124 -0
  129. package/dist/v3/WindowInfo/index.vue +33 -0
  130. package/package.json +1 -1
@@ -0,0 +1,161 @@
1
+ <template>
2
+ <view class="web-socket-list-container" :style="{ zIndex: zIndex }">
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; zIndex?: number }>();
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: 1001;
86
+ top: 0;
87
+ left: 0;
88
+ padding: 0 16px;
89
+
90
+ background-color: var(--dev-tool-bg2-color);
91
+ box-sizing: border-box;
92
+ }
93
+ .web-socket-list-title {
94
+ min-height: 32px;
95
+ display: flex;
96
+ align-items: center;
97
+ }
98
+
99
+ .web-socket-data {
100
+ height: calc(100% - 32px);
101
+ overflow: auto;
102
+ }
103
+
104
+ .web-socket-url {
105
+ display: flex;
106
+ align-items: center;
107
+ min-height: 28px;
108
+
109
+ white-space: wrap;
110
+ word-break: break-all;
111
+ }
112
+
113
+ .web-socket-top {
114
+ display: flex;
115
+ align-items: center;
116
+ height: 32px;
117
+
118
+ border-bottom: 1px solid transparent;
119
+ box-sizing: border-box;
120
+ }
121
+ .web-socket-title {
122
+ display: flex;
123
+ align-items: center;
124
+ }
125
+ .header-detail-item {
126
+ display: flex;
127
+ align-items: center;
128
+ min-height: 28px;
129
+ word-break: break-all;
130
+ }
131
+ .header-detail-item > view:first-child {
132
+ white-space: nowrap;
133
+ margin-right: 8px;
134
+ color: var(--dev-tool-info-color);
135
+ }
136
+
137
+ .web-socket-data-item {
138
+ display: flex;
139
+ align-items: center;
140
+ min-height: 28px;
141
+ }
142
+ .web-socket-data-item-error {
143
+ background-color: var(--dev-tool-error-bg-color);
144
+ }
145
+ .web-socket-data-item-success {
146
+ background-color: var(--dev-tool-success-bg-color);
147
+ }
148
+ .web-socket-data-time {
149
+ /* margin-right: 16px; */
150
+ padding: 0 6px;
151
+ flex-shrink: 0;
152
+ color: var(--dev-tool-info-color);
153
+ }
154
+ .web-socket-data-content {
155
+ padding: 6px;
156
+ flex: 1;
157
+ overflow: hidden;
158
+ text-overflow: ellipsis;
159
+ word-break: break-all;
160
+ }
161
+ </style>
@@ -0,0 +1,124 @@
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
22
+ :data="wsList"
23
+ :pageSize="10"
24
+ :height="height"
25
+ className="websocket-list"
26
+ >
27
+ <template v-slot="{ list, start }">
28
+ <AutoSize
29
+ v-for="(item, index) in list"
30
+ :index="start + index"
31
+ :key="start + index"
32
+ >
33
+ <WebSocketItem :ws="item" :zIndex="zIndex" />
34
+ </AutoSize>
35
+ <Empty v-if="!wsList || wsList.length === 0" />
36
+ </template>
37
+ </VirtualListPro>
38
+ </view>
39
+ </template>
40
+ <script lang="ts" setup>
41
+ import WebSocketItem from './WebSocketItem.vue';
42
+ import Tag from '../Tag/index.vue';
43
+ import Empty from '../Empty/index.vue';
44
+ import FilterInput from '../FilterInput/index.vue';
45
+ import type { DevTool } from '../../type';
46
+ import VirtualListPro from '../VirtualListPro/index.vue';
47
+ import AutoSize from '../VirtualListPro/AutoSize.vue';
48
+ import { onMounted, ref } from 'vue';
49
+
50
+ defineProps<{
51
+ wsList: DevTool.WS[];
52
+ currentWebSocketType: string;
53
+ modelValue: string;
54
+ zIndex?: number;
55
+ }>();
56
+ const emit = defineEmits<{
57
+ (e: 'choose', type: string): void;
58
+ (e: 'update:modelValue', value: string): void;
59
+ (e: 'search', value: string): void;
60
+ }>();
61
+ const webSocketFilter = [
62
+ {
63
+ label: '全部',
64
+ value: 'all',
65
+ mode: 'all',
66
+ },
67
+ {
68
+ label: 'con',
69
+ value: 'connection',
70
+ mode: 'info',
71
+ },
72
+ {
73
+ label: 'open',
74
+ value: 'open',
75
+ mode: 'success',
76
+ },
77
+ {
78
+ label: 'close',
79
+ value: 'close',
80
+ mode: 'warn',
81
+ },
82
+ {
83
+ label: 'error',
84
+ value: 'error',
85
+ mode: 'error',
86
+ },
87
+ {
88
+ label: '清除',
89
+ value: 'clear',
90
+ mode: 'clear',
91
+ },
92
+ ];
93
+
94
+ function onChoose(type: string) {
95
+ emit('choose', type);
96
+ }
97
+
98
+ const height = ref(0);
99
+ onMounted(() => {
100
+ const { windowHeight } = uni.getWindowInfo();
101
+ height.value = windowHeight - 32 - 32;
102
+ });
103
+ </script>
104
+ <style scoped>
105
+ .websocket-content {
106
+ height: 100%;
107
+ font-size: var(--dev-tool-base-font-size);
108
+ }
109
+
110
+ .websocket-control {
111
+ display: flex;
112
+ align-items: center;
113
+ justify-content: space-between;
114
+ gap: 8px;
115
+ padding: 0 16px;
116
+ height: 32px;
117
+ border-bottom: 1px solid var(--dev-tool-border-color);
118
+ box-sizing: border-box;
119
+ }
120
+ .websocket-list {
121
+ height: calc(100% - 32px);
122
+ overflow: auto;
123
+ }
124
+ </style>
@@ -0,0 +1,33 @@
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-uni-dev-tool",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "vite-uni-dev-tool, debug, uni-app, 一处编写,到处调试",
5
5
  "keywords": [
6
6
  "vite",