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,14 +0,0 @@
1
- export function isH5(): boolean {
2
- return process.env.UNI_PLATFORM === 'h5';
3
- }
4
-
5
- export function isWX() {
6
- return process.env.UNI_PLATFORM === 'mp-weixin';
7
- }
8
-
9
- export function isAndroid() {
10
- return (
11
- process.env.UNI_PLATFORM === 'app' ||
12
- process.env.UNI_PLATFORM === 'app-plus'
13
- );
14
- }
@@ -1,133 +0,0 @@
1
- /**
2
- * 将匹配到的字符串高亮显示
3
- *
4
- * @export
5
- * @param {string} [str='']
6
- * @param {string} [search='']
7
- * @return {*}
8
- */
9
- export function hightLight(str: string = '', search: string = '') {
10
- if (!str) return '';
11
- if (!search) return str;
12
-
13
- // 转义特殊字符,确保正则表达式安全
14
- const escapedSearch = search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
15
- const regex = new RegExp(escapedSearch, 'g');
16
-
17
- const html = str.replace(
18
- regex,
19
- `<span style="color:#fff; background-color: var(--dev-tool-main-color);">${search}</span>`,
20
- );
21
-
22
- return html;
23
- }
24
-
25
- export function escapeHTML(unsafe: string) {
26
- if (!unsafe) return '';
27
-
28
- const escapeMap: Record<string, string> = {
29
- '&': '&amp;',
30
- '"': '&quot;',
31
- "'": '&#39;',
32
- '>': '&gt;',
33
- '<': '&lt;',
34
- '=': '&#61;',
35
- '+': '&#43;',
36
- '-': '&#45;',
37
- '(': '&#40;',
38
- ')': '&#41;',
39
- '[': '&#91;',
40
- ']': '&#93;',
41
- '{': '&#123;',
42
- '}': '&#125;',
43
- '.': '&#46;',
44
- '?': '&#63;',
45
- '/': '&#47;',
46
- ':': '&#58;',
47
- };
48
-
49
- return unsafe.replace(
50
- /[&"'><=+\-().?\/:[\]{}]/g,
51
- (char) => escapeMap[char] || char,
52
- );
53
- }
54
-
55
- const urlPattern = /https?:\/\/[^\s/$.?#](?:(?!\s|\)).)*/g;
56
- /**
57
- * 在字符串中获取url
58
- *
59
- * @export
60
- * @param {string} text
61
- * @return {*}
62
- */
63
- export function extractUrl(text: string) {
64
- const match = text.match(urlPattern);
65
- return match ? match[0] : '';
66
- }
67
-
68
- const rowAndColPattern = /:(\d+)(?::(\d+))?\)?$/;
69
- /**
70
- * 获取url 中末尾的行号和列号
71
- *
72
- * @export
73
- * @param {string} url
74
- * @return {*}
75
- */
76
- export function extractRowAndCol(url: string) {
77
- const match = url.match(rowAndColPattern);
78
- if (match) {
79
- const lineNumber = match[1];
80
- const columnNumber = match[2];
81
- return {
82
- row: parseInt(lineNumber) - 1,
83
- col: parseInt(columnNumber) - 1,
84
- };
85
- }
86
-
87
- return {
88
- row: -1,
89
- col: -1,
90
- };
91
- }
92
-
93
- // at pages/index/index.js:46
94
- // at pages/index/index.js:46:10
95
- // at handleClick (http://localhost:8080/pages/main.js:123:4)
96
- // at http://example.com/app.bundle.js:5:2
97
- // at init (lib/utils.js:10)
98
- const stockReg =
99
- /at\s+(?:([^(]+)\s+\()?((?:[^:\/\s]+(?:\/[^:\/\s]+)*\.[^:\/\s]+)|(?:[^:]+:\/\/[^:\/\s]+(?::\d+)?(?:\/[^:\s]*)*)):(\d+)(?::(\d+))?(?:\s*\)?)?$/;
100
-
101
- /**
102
- * 解析栈信息
103
- *
104
- * @export
105
- * @param {string} stack
106
- * @return {*}
107
- */
108
- export function parseStock(stack: string) {
109
- const match = stack.match(stockReg);
110
- return {
111
- info: match?.[1] ?? '',
112
- path: match?.[2] ?? '',
113
- row: match?.[3] ? parseInt(match?.[3]) - 1 : -1,
114
- col: match?.[4] ? parseInt(match?.[4]) - 1 : -1,
115
- };
116
- }
117
-
118
- const mockWXReg = /https?:\/\/usr/;
119
- export function isMockWX(stack: string) {
120
- return mockWXReg.test(stack);
121
- }
122
-
123
- export function uniqueId(
124
- pre: string = '',
125
- length = 16,
126
- chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
127
- ): string {
128
- let result = '';
129
- for (let i = 0; i < length; i++) {
130
- result += chars.charAt(Math.floor(Math.random() * chars.length));
131
- }
132
- return pre + result;
133
- }
@@ -1,198 +0,0 @@
1
- /**
2
- * 获取当前页面地址
3
- *
4
- * @return {*}
5
- */
6
- export function getCurrentPagePath() {
7
- let pages = getCurrentPages();
8
- let item = pages[pages.length - 1];
9
- if (item && item.route) {
10
- return item.route;
11
- }
12
- return '';
13
- }
14
-
15
- /** 截图 */
16
- export function screenshot() {
17
- if (!plus) return;
18
- if (!plus.nativeObj) return;
19
- if (!plus.nativeObj.Bitmap) return;
20
-
21
- let pages = getCurrentPages();
22
- let page = pages[pages.length - 1];
23
-
24
- let ws = page.$getAppWebview?.();
25
- let bitmap = new plus.nativeObj.Bitmap('drawScreen');
26
-
27
- // 将webview内容绘制到Bitmap对象中
28
- ws?.draw(
29
- bitmap,
30
- () => {
31
- // 保存图片到本地
32
- bitmap.save(
33
- `pictures/${Date.now()}.jpg`,
34
- {
35
- overwrite: true,
36
- },
37
- (res) => {
38
- console.log('res.target' + res.target); // 图片地址
39
- uni.showToast({
40
- title: '截图成功:' + res.target,
41
- icon: 'none',
42
- duration: 60 * 1000,
43
- });
44
- bitmap.clear(); // 清除Bitmap对象
45
- },
46
- (error) => {
47
- console.log('[DevTool] 截图失败:' + JSON.stringify(error)); // 保存失败信息
48
- uni.showToast({
49
- title: '[DevTool] 截图失败:' + JSON.stringify(error),
50
- icon: 'none',
51
- duration: 60 * 1000,
52
- });
53
- bitmap.clear(); // 清除Bitmap对象
54
- },
55
- );
56
- // bitmap.clear(); // 清除Bitmap对象
57
- },
58
- (error) => {
59
- console.log('[DevTool] 绘制失败:' + JSON.stringify(error)); // 绘制失败
60
- uni.showToast({
61
- title: '绘制失败:' + JSON.stringify(error),
62
- icon: 'none',
63
- duration: 60 * 1000,
64
- });
65
- },
66
- {
67
- check: true, // 设置为检测白屏
68
- },
69
- );
70
- }
71
-
72
- // 截屏函数
73
- export function captureScreen(option: { success?: () => void }) {
74
- const ctx = uni.createCanvasContext('fullscreenCanvas');
75
- const { windowWidth, windowHeight } = uni.getSystemInfoSync();
76
- // 绘制需要截屏的内容(示例:绘制一个矩形)
77
- ctx.setFillStyle('#ffffff');
78
- ctx.fillRect(0, 0, windowWidth, windowHeight); // 画布尺寸
79
- ctx.setFillStyle('#000000');
80
- ctx.setFontSize(20);
81
- ctx.fillText('这是截屏内容', 100, 100);
82
-
83
- ctx.draw(false, () => {
84
- // 生成图片
85
- uni.canvasToTempFilePath({
86
- canvasId: 'fullscreenCanvas',
87
- width: windowWidth,
88
- height: windowHeight,
89
- destWidth: windowWidth * 2, // 提高清晰度
90
- destHeight: windowHeight * 2,
91
- fileType: 'png',
92
- success: (res) => {
93
- console.log('res: ', res);
94
- console.log('全屏截屏成功:', res.tempFilePath);
95
- },
96
- fail: (err) => {
97
- console.error('全屏截屏失败:', err);
98
- },
99
- });
100
- });
101
- }
102
-
103
- type Primitive = string | number | boolean | null | undefined | symbol | bigint;
104
-
105
- function isPrimitive(value: unknown): value is Primitive {
106
- return (
107
- value === null || (typeof value !== 'object' && typeof value !== 'function')
108
- );
109
- }
110
-
111
- export interface DeepEqualOptions {
112
- maxDepth?: number;
113
- }
114
-
115
- export function deepEqual(
116
- a: unknown,
117
- b: unknown,
118
- options: DeepEqualOptions = { maxDepth: 10 },
119
- ): boolean {
120
- const { maxDepth = 10 } = options;
121
- const seen = new WeakMap<object, number>();
122
- let nextStamp = 1;
123
- return deepEqualInternal(a, b, seen, () => nextStamp++, 1, maxDepth);
124
- }
125
-
126
- function deepEqualInternal(
127
- a: unknown,
128
- b: unknown,
129
- seen: WeakMap<object, number>,
130
- getNextStamp: () => number,
131
- currentDepth: number,
132
- maxDepth: number,
133
- ): boolean {
134
- // 超过最大深度
135
- if (currentDepth > maxDepth) return false;
136
-
137
- // 处理原始值
138
- if (isPrimitive(a) || isPrimitive(b)) {
139
- // 特殊处理 NaN(两个 NaN 被视为相等)
140
- if (typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b))
141
- return true;
142
- return a === b;
143
- }
144
-
145
- // 处理对象和数组
146
- if (a instanceof Date && b instanceof Date)
147
- return a.getTime() === b.getTime();
148
- if (a instanceof RegExp && b instanceof RegExp)
149
- return a.toString() === b.toString();
150
-
151
- // 确保都是对象
152
- if (
153
- typeof a !== 'object' ||
154
- typeof b !== 'object' ||
155
- a === null ||
156
- b === null
157
- )
158
- return false;
159
-
160
- // 检查循环引用
161
- const aStamp = seen.get(a as object);
162
- const bStamp = seen.get(b as object);
163
-
164
- if (aStamp !== undefined || bStamp !== undefined) {
165
- return aStamp === bStamp;
166
- }
167
-
168
- // 标记已访问对象
169
- const stamp = getNextStamp();
170
- seen.set(a as object, stamp);
171
- seen.set(b as object, stamp);
172
-
173
- // 获取所有属性(包括不可枚举属性,但排除 Symbol 类型)
174
- const aKeys = Object.getOwnPropertyNames(a);
175
- const bKeys = Object.getOwnPropertyNames(b);
176
-
177
- // 检查属性数量是否相同
178
- if (aKeys.length !== bKeys.length) return false;
179
-
180
- // 检查属性值是否相同
181
- for (const key of aKeys) {
182
- if (!bKeys.includes(key)) return false;
183
- // @ts-ignore 允许索引访问
184
- if (
185
- !deepEqualInternal(
186
- (a as any)?.[key],
187
- (b as any)?.[key],
188
- seen,
189
- getNextStamp,
190
- currentDepth + 1,
191
- maxDepth,
192
- )
193
- )
194
- return false;
195
- }
196
-
197
- return true;
198
- }
File without changes
File without changes
File without changes