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.
- package/dist/core.js +1 -1
- package/dist/devIntercept/index.d.ts +3 -3
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +117 -114
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts +32 -0
- package/dist/plugins/uniDevTool/transform/transformApp.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformApp.js +32 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts +26 -0
- package/dist/plugins/uniDevTool/transform/transformMain.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformMain.js +3 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts +41 -0
- package/dist/plugins/uniDevTool/transform/transformVue.d.ts.map +1 -0
- package/dist/plugins/uniDevTool/transform/transformVue.js +9 -0
- package/dist/plugins/uniDevTool/uniDevTool.d.ts +7 -3
- package/dist/plugins/uniDevTool/uniDevTool.d.ts.map +1 -1
- package/dist/plugins/uniDevTool/uniDevTool.js +3 -33
- package/dist/plugins/utils/index.d.ts +32 -0
- package/dist/plugins/utils/index.d.ts.map +1 -1
- package/dist/plugins/utils/index.js +1 -1
- package/dist/type.d.ts +2 -2
- package/dist/type.d.ts.map +1 -1
- package/dist/v2/AppInfo/index.vue +41 -0
- package/dist/v2/AutoSizer/index.vue +189 -0
- package/dist/v2/AutoSizer/index1.vue +193 -0
- package/dist/v2/AutoSizer/utils.ts +49 -0
- package/dist/v2/CaptureScreen/index.vue +78 -0
- package/dist/v2/CloseButton/index.vue +32 -0
- package/dist/v2/Connection/index.vue +94 -0
- package/dist/v2/ConsoleList/ConsoleItem.vue +235 -0
- package/dist/v2/ConsoleList/RunJSInput.vue +243 -0
- package/dist/v2/ConsoleList/index.vue +164 -0
- package/dist/v2/ConsoleList/staticTips.js +1144 -0
- package/dist/v2/DevTool/index.vue +162 -0
- package/dist/v2/DevToolButton/index.vue +228 -0
- package/dist/v2/DevToolTitle/index.vue +28 -0
- package/dist/v2/DevToolWindow/index.vue +1051 -0
- package/dist/v2/DeviceInfo/index.vue +48 -0
- package/dist/v2/Empty/empty.png +0 -0
- package/dist/v2/Empty/index.vue +40 -0
- package/dist/v2/FilterInput/index.vue +100 -0
- package/dist/v2/JsonPretty/components/Brackets/index.vue +30 -0
- package/dist/v2/JsonPretty/components/Carets/index.vue +65 -0
- package/dist/v2/JsonPretty/components/CheckController/index.vue +127 -0
- package/dist/v2/JsonPretty/components/TreeNode/index.vue +417 -0
- package/dist/v2/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v2/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v2/JsonPretty/index.vue +531 -0
- package/dist/v2/JsonPretty/type.ts +125 -0
- package/dist/v2/JsonPretty/utils/index.js +211 -0
- package/dist/v2/NetworkList/NetworkDetail.vue +215 -0
- package/dist/v2/NetworkList/NetworkItem.vue +135 -0
- package/dist/v2/NetworkList/index.vue +148 -0
- package/dist/v2/PiniaList/index.vue +79 -0
- package/dist/v2/RouteList/index.vue +137 -0
- package/dist/v2/RunJS/index.vue +128 -0
- package/dist/v2/SettingList/index.vue +318 -0
- package/dist/v2/SourceCode/index.vue +237 -0
- package/dist/v2/StorageList/index.vue +165 -0
- package/dist/v2/SystemInfo/index.vue +49 -0
- package/dist/v2/Tabs/index.vue +127 -0
- package/dist/v2/Tag/index.vue +91 -0
- package/dist/v2/UniEvent/UniEventItem.vue +157 -0
- package/dist/v2/UniEvent/index.vue +127 -0
- package/dist/v2/UploadList/UploadDetail.vue +204 -0
- package/dist/v2/UploadList/UploadItem.vue +134 -0
- package/dist/v2/UploadList/index.vue +143 -0
- package/dist/v2/VirtualList/index.vue +140 -0
- package/dist/v2/VirtualListPro/AutoSize.vue +50 -0
- package/dist/v2/VirtualListPro/index.vue +255 -0
- package/dist/v2/VirtualListPro/readme.md +40 -0
- package/dist/v2/VuexList/index.vue +80 -0
- package/dist/v2/WebSocket/WebSocketItem.vue +129 -0
- package/dist/v2/WebSocket/WebSocketList.vue +183 -0
- package/dist/v2/WebSocket/index.vue +155 -0
- package/dist/v2/WindowInfo/index.vue +49 -0
- package/dist/v3/AppInfo/index.vue +35 -0
- package/dist/v3/AutoSizer/index.vue +193 -0
- package/dist/v3/AutoSizer/index1.vue +186 -0
- package/dist/v3/AutoSizer/utils.ts +49 -0
- package/dist/v3/CaptureScreen/index.vue +62 -0
- package/dist/v3/CloseButton/index.vue +29 -0
- package/dist/v3/Connection/index.vue +88 -0
- package/dist/v3/ConsoleList/ConsoleItem.vue +208 -0
- package/dist/v3/ConsoleList/RunJSInput.vue +240 -0
- package/dist/v3/ConsoleList/index.vue +139 -0
- package/dist/v3/ConsoleList/staticTips.ts +1145 -0
- package/dist/v3/DevTool/index.vue +217 -0
- package/dist/v3/DevToolButton/index.vue +210 -0
- package/dist/v3/DevToolTitle/index.vue +21 -0
- package/dist/v3/DevToolWindow/index.vue +1116 -0
- package/dist/v3/DeviceInfo/index.vue +32 -0
- package/dist/v3/Empty/empty.png +0 -0
- package/dist/v3/Empty/index.vue +28 -0
- package/dist/v3/FilterInput/index.vue +87 -0
- package/dist/v3/JsonPretty/components/Brackets/index.vue +23 -0
- package/dist/v3/JsonPretty/components/Carets/index.vue +59 -0
- package/dist/v3/JsonPretty/components/CheckController/index.vue +125 -0
- package/dist/v3/JsonPretty/components/TreeNode/index.vue +349 -0
- package/dist/v3/JsonPretty/hooks/useClipboard.ts +21 -0
- package/dist/v3/JsonPretty/hooks/useError.ts +21 -0
- package/dist/v3/JsonPretty/index.vue +476 -0
- package/dist/v3/JsonPretty/type.ts +125 -0
- package/dist/v3/JsonPretty/utils/index.ts +172 -0
- package/dist/v3/NetworkList/NetworkDetail.vue +194 -0
- package/dist/v3/NetworkList/NetworkItem.vue +120 -0
- package/dist/v3/NetworkList/index.vue +128 -0
- package/dist/v3/PiniaList/index.vue +64 -0
- package/dist/v3/RouteList/index.vue +121 -0
- package/dist/v3/RunJS/index.vue +128 -0
- package/dist/v3/SettingList/index.vue +313 -0
- package/dist/v3/SourceCode/index.vue +231 -0
- package/dist/v3/StorageList/index.vue +170 -0
- package/dist/v3/SystemInfo/index.vue +34 -0
- package/dist/v3/Tabs/index.vue +123 -0
- package/dist/v3/Tag/index.vue +89 -0
- package/dist/v3/UniEvent/UniEventItem.vue +126 -0
- package/dist/v3/UniEvent/index.vue +98 -0
- package/dist/v3/UploadList/UploadDetail.vue +192 -0
- package/dist/v3/UploadList/UploadItem.vue +117 -0
- package/dist/v3/UploadList/index.vue +117 -0
- package/dist/v3/VirtualList/index.vue +112 -0
- package/dist/v3/VirtualListPro/AutoSize.vue +43 -0
- package/dist/v3/VirtualListPro/index.vue +238 -0
- package/dist/v3/VirtualListPro/readme.md +40 -0
- package/dist/v3/VuexList/index.vue +54 -0
- package/dist/v3/WebSocket/WebSocketItem.vue +103 -0
- package/dist/v3/WebSocket/WebSocketList.vue +161 -0
- package/dist/v3/WebSocket/index.vue +124 -0
- package/dist/v3/WindowInfo/index.vue +33 -0
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -33,7 +33,7 @@ function T() {
|
|
|
33
33
|
return o.getDevToolOptions();
|
|
34
34
|
}
|
|
35
35
|
function p(e) {
|
|
36
|
-
e != null && e.mode || r.error("[DevTool] 请传入 mode: import.meta.env.MODE"), o.setDevToolOptions(e || { mode: "" }), t.
|
|
36
|
+
e != null && e.mode || r.error("[DevTool] 请传入 mode: import.meta.env.MODE"), o.setDevToolOptions(e || { mode: "" }), t.interceptVue(e == null ? void 0 : e.vueInstance);
|
|
37
37
|
}
|
|
38
38
|
function d() {
|
|
39
39
|
n.showDevToolButton();
|
|
@@ -26,7 +26,7 @@ export declare class DevIntercept {
|
|
|
26
26
|
*
|
|
27
27
|
* @memberof DevIntercept
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
interceptVue(vueInstance: any): void;
|
|
30
30
|
/**
|
|
31
31
|
* app 中捕获全局错误
|
|
32
32
|
*
|
|
@@ -39,7 +39,7 @@ export declare class DevIntercept {
|
|
|
39
39
|
* @param {*} error
|
|
40
40
|
* @memberof DevIntercept
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
interceptErrorVue(error: Error): void;
|
|
43
43
|
preWarn: any;
|
|
44
44
|
/**
|
|
45
45
|
* 拦截 app 警告
|
|
@@ -48,7 +48,7 @@ export declare class DevIntercept {
|
|
|
48
48
|
* @return {*}
|
|
49
49
|
* @memberof DevIntercept
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
interceptWarnVue(warn: string): void;
|
|
52
52
|
/**
|
|
53
53
|
* 拦截 promise reject
|
|
54
54
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devIntercept/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASvC;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAW;IAExB,SAAS,UAAS;IAElB,QAAQ,gBAAa;IACrB,UAAU,gBAAa;IACvB,UAAU,gBAAa;IACvB,SAAS,gBAAa;gBAEV,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAKhD,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAqBzC;;;;OAIG;IACH,mBAAmB;IA8BnB;;;;OAIG;IACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dev/devIntercept/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AASvC;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAW;IAExB,SAAS,UAAS;IAElB,QAAQ,gBAAa;IACrB,UAAU,gBAAa;IACvB,UAAU,gBAAa;IACvB,SAAS,gBAAa;gBAEV,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAKhD,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB;IAqBzC;;;;OAIG;IACH,mBAAmB;IA8BnB;;;;OAIG;IACH,YAAY,CAAC,WAAW,EAAE,GAAG;IA+B7B;;;;OAIG;IACH,iBAAiB;IA0BjB;;;;;OAKG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK;IAuB9B,OAAO,EAAE,GAAG,CAAC;IACb;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAgC7B;;;;OAIG;IACH,sBAAsB;IAStB;;;;OAIG;IACH,kBAAkB;IAelB;;;;OAIG;IACH,mBAAmB;IAcnB;;;;OAIG;IACH,gBAAgB;IA+DhB;;;;OAIG;IACH,eAAe;IAmKf;;;;OAIG;IACH,mBAAmB;IA8BnB;;;;OAIG;IACH,qBAAqB;IAWrB;;;;OAIG;IACH,sBAAsB;IAatB,aAAa;IACb,oBAAoB,CAAC,KAAK,EAAE,GAAG;IAQ/B,cAAc;IACd,mBAAmB,CAAC,OAAO,EAAE,GAAG;IAgBhC;;;;OAIG;IACH,mBAAmB;IAyFnB,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa;IAqBpD,iBAAiB;IAQjB;;;;OAIG;IACH,sBAAsB;CAYvB"}
|
|
@@ -2,10 +2,10 @@ import { backup as m } from "../core.js";
|
|
|
2
2
|
import "../utils/index.js";
|
|
3
3
|
import { transformValueToView as k } from "../utils/language.js";
|
|
4
4
|
import { getCurrentPagePath as g } from "../utils/page.js";
|
|
5
|
-
import { getCurrentDate as
|
|
5
|
+
import { getCurrentDate as S } from "../utils/date.js";
|
|
6
6
|
import { parseValue as L } from "../utils/object.js";
|
|
7
7
|
import { escapeHTML as w } from "../utils/string.js";
|
|
8
|
-
class
|
|
8
|
+
class H {
|
|
9
9
|
constructor(e) {
|
|
10
10
|
this.initPinia = !1, this.cache$on = /* @__PURE__ */ new Map(), this.cache$once = /* @__PURE__ */ new Map(), this.cache$emit = /* @__PURE__ */ new Map(), this.cache$off = /* @__PURE__ */ new Map(), this.event = e.event, this.init(e);
|
|
11
11
|
}
|
|
@@ -21,13 +21,13 @@ class W {
|
|
|
21
21
|
if (!uni.__log__)
|
|
22
22
|
return;
|
|
23
23
|
const e = this;
|
|
24
|
-
uni.__log__ = function(
|
|
25
|
-
const
|
|
26
|
-
m.__log__(
|
|
24
|
+
uni.__log__ = function(r, t, ...i) {
|
|
25
|
+
const a = g();
|
|
26
|
+
m.__log__(r, t, ...i), e.event.updateConsoleList([
|
|
27
27
|
{
|
|
28
|
-
type:
|
|
29
|
-
position:
|
|
30
|
-
time:
|
|
28
|
+
type: r,
|
|
29
|
+
position: a,
|
|
30
|
+
time: S(),
|
|
31
31
|
args: i.map((d) => ({
|
|
32
32
|
type: k(d),
|
|
33
33
|
value: L(d)
|
|
@@ -42,13 +42,16 @@ class W {
|
|
|
42
42
|
*
|
|
43
43
|
* @memberof DevIntercept
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.event.getDevToolDestroy() || this.
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
interceptVue(e) {
|
|
46
|
+
if (!e)
|
|
47
|
+
return;
|
|
48
|
+
const r = (i, a, d) => {
|
|
49
|
+
this.event.getDevToolDestroy() || this.interceptErrorVue(i);
|
|
50
|
+
}, t = (i, a, d) => {
|
|
51
|
+
this.event.getDevToolDestroy() || this.interceptWarnVue(i + `
|
|
52
|
+
` + d);
|
|
53
|
+
};
|
|
54
|
+
e.appContext ? (e.appContext.config.errorHandler = r, e.appContext.config.warnHandler = t) : (e.config.errorHandler = r, e.config.warnHandler = t);
|
|
52
55
|
}
|
|
53
56
|
/**
|
|
54
57
|
* app 中捕获全局错误
|
|
@@ -57,22 +60,22 @@ class W {
|
|
|
57
60
|
*/
|
|
58
61
|
interceptAppError() {
|
|
59
62
|
uni.onError((e) => {
|
|
60
|
-
var i,
|
|
63
|
+
var i, a;
|
|
61
64
|
if (this.event.getDevToolDestroy())
|
|
62
65
|
return;
|
|
63
|
-
const
|
|
64
|
-
`)) == null ? void 0 :
|
|
66
|
+
const r = e.toString(), t = ((a = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
|
|
67
|
+
`)) == null ? void 0 : a[1]) ?? "";
|
|
65
68
|
this.event.updateConsoleList([
|
|
66
69
|
{
|
|
67
70
|
type: "error",
|
|
68
71
|
args: [
|
|
69
72
|
{
|
|
70
73
|
type: "string",
|
|
71
|
-
value:
|
|
74
|
+
value: r
|
|
72
75
|
}
|
|
73
76
|
],
|
|
74
77
|
position: g(),
|
|
75
|
-
time:
|
|
78
|
+
time: S(),
|
|
76
79
|
stack: t
|
|
77
80
|
}
|
|
78
81
|
]);
|
|
@@ -84,10 +87,10 @@ class W {
|
|
|
84
87
|
* @param {*} error
|
|
85
88
|
* @memberof DevIntercept
|
|
86
89
|
*/
|
|
87
|
-
|
|
90
|
+
interceptErrorVue(e) {
|
|
88
91
|
var i;
|
|
89
|
-
const
|
|
90
|
-
`), t =
|
|
92
|
+
const r = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
|
|
93
|
+
`), t = r == null ? void 0 : r[1];
|
|
91
94
|
console.error(e), this.event.updateConsoleList([
|
|
92
95
|
{
|
|
93
96
|
type: "error",
|
|
@@ -98,7 +101,7 @@ class W {
|
|
|
98
101
|
}
|
|
99
102
|
],
|
|
100
103
|
position: g(),
|
|
101
|
-
time:
|
|
104
|
+
time: S(),
|
|
102
105
|
stack: t
|
|
103
106
|
}
|
|
104
107
|
]);
|
|
@@ -110,15 +113,15 @@ class W {
|
|
|
110
113
|
* @return {*}
|
|
111
114
|
* @memberof DevIntercept
|
|
112
115
|
*/
|
|
113
|
-
|
|
116
|
+
interceptWarnVue(e) {
|
|
114
117
|
var d, n, l, h;
|
|
115
118
|
if (this.preWarn === e)
|
|
116
119
|
return;
|
|
117
120
|
this.preWarn = e;
|
|
118
|
-
const
|
|
121
|
+
const r = g(), t = (n = (d = new Error()) == null ? void 0 : d.stack) == null ? void 0 : n.split(`
|
|
119
122
|
`), i = (l = t == null ? void 0 : t.slice(2)) == null ? void 0 : l[0];
|
|
120
123
|
console.warn(e);
|
|
121
|
-
const
|
|
124
|
+
const a = (h = e.split(`
|
|
122
125
|
`)) == null ? void 0 : h.map((v) => w(v)).join(`
|
|
123
126
|
`);
|
|
124
127
|
this.event.updateConsoleList([
|
|
@@ -127,11 +130,11 @@ class W {
|
|
|
127
130
|
args: [
|
|
128
131
|
{
|
|
129
132
|
type: "string",
|
|
130
|
-
value:
|
|
133
|
+
value: a
|
|
131
134
|
}
|
|
132
135
|
],
|
|
133
|
-
position:
|
|
134
|
-
time:
|
|
136
|
+
position: r,
|
|
137
|
+
time: S(),
|
|
135
138
|
stack: i
|
|
136
139
|
}
|
|
137
140
|
]);
|
|
@@ -156,13 +159,13 @@ class W {
|
|
|
156
159
|
interceptSwitchTab() {
|
|
157
160
|
const e = this;
|
|
158
161
|
uni.addInterceptor("switchTab", {
|
|
159
|
-
invoke(
|
|
160
|
-
const t =
|
|
161
|
-
|
|
162
|
+
invoke(r) {
|
|
163
|
+
const t = r.complete;
|
|
164
|
+
r.complete = function(i) {
|
|
162
165
|
var d, n, l;
|
|
163
166
|
t && t(i);
|
|
164
|
-
const
|
|
165
|
-
e.event.updateCurrentPagePath(
|
|
167
|
+
const a = ((l = (n = (d = r.url) == null ? void 0 : d.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : l[0]) || "/";
|
|
168
|
+
e.event.updateCurrentPagePath(a);
|
|
166
169
|
};
|
|
167
170
|
}
|
|
168
171
|
});
|
|
@@ -175,13 +178,13 @@ class W {
|
|
|
175
178
|
interceptNavigateTo() {
|
|
176
179
|
const e = this;
|
|
177
180
|
uni.addInterceptor("navigateTo", {
|
|
178
|
-
invoke(
|
|
179
|
-
const t =
|
|
180
|
-
|
|
181
|
+
invoke(r) {
|
|
182
|
+
const t = r.complete;
|
|
183
|
+
r.complete = function(i) {
|
|
181
184
|
var d, n, l;
|
|
182
185
|
t && t(i);
|
|
183
|
-
const
|
|
184
|
-
e.event.updateCurrentPagePath(
|
|
186
|
+
const a = ((l = (n = (d = r.url) == null ? void 0 : d.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : l[0]) || "/";
|
|
187
|
+
e.event.updateCurrentPagePath(a);
|
|
185
188
|
};
|
|
186
189
|
}
|
|
187
190
|
});
|
|
@@ -194,17 +197,17 @@ class W {
|
|
|
194
197
|
interceptRequest() {
|
|
195
198
|
const e = this;
|
|
196
199
|
uni.addInterceptor("request", {
|
|
197
|
-
invoke(
|
|
198
|
-
var
|
|
199
|
-
const t = e.event.getRequestIndex(), i = e.event.setRequestIndex(t + 1),
|
|
200
|
+
invoke(r) {
|
|
201
|
+
var s;
|
|
202
|
+
const t = e.event.getRequestIndex(), i = e.event.setRequestIndex(t + 1), a = r.url, d = (s = a == null ? void 0 : a.split("?")) == null ? void 0 : s[0], n = d == null ? void 0 : d.lastIndexOf("/"), l = (d == null ? void 0 : d.slice(n + 1)) ?? "", h = {
|
|
200
203
|
index: i,
|
|
201
|
-
url:
|
|
204
|
+
url: r.url,
|
|
202
205
|
name: l,
|
|
203
206
|
startTime: Date.now(),
|
|
204
207
|
endTime: 0,
|
|
205
208
|
time: "-",
|
|
206
209
|
headers: {
|
|
207
|
-
requestHeader: Object.entries(
|
|
210
|
+
requestHeader: Object.entries(r.header ?? {}).map(
|
|
208
211
|
([c, u]) => ({
|
|
209
212
|
key: c,
|
|
210
213
|
value: u
|
|
@@ -212,21 +215,21 @@ class W {
|
|
|
212
215
|
),
|
|
213
216
|
responseHeader: []
|
|
214
217
|
},
|
|
215
|
-
method:
|
|
218
|
+
method: r.method || "GET",
|
|
216
219
|
status: "pending",
|
|
217
|
-
payload:
|
|
220
|
+
payload: r != null && r.data ? JSON.stringify(r.data) : "",
|
|
218
221
|
response: "",
|
|
219
222
|
size: ""
|
|
220
223
|
};
|
|
221
224
|
e.event.updateNetworkList([h]);
|
|
222
|
-
let v =
|
|
223
|
-
|
|
225
|
+
let v = r.complete;
|
|
226
|
+
r.complete = function(c) {
|
|
224
227
|
var p, f;
|
|
225
228
|
v && v(c), h.status = c.statusCode ?? "error", h.endTime = Date.now();
|
|
226
229
|
const u = Date.now() - h.startTime;
|
|
227
230
|
h.time = u < 1e3 ? u + "ms" : u / 1e3 + "s";
|
|
228
|
-
const
|
|
229
|
-
h.size =
|
|
231
|
+
const o = ((p = c == null ? void 0 : c.header) == null ? void 0 : p["Content-Length"]) || ((f = c == null ? void 0 : c.header) == null ? void 0 : f["content-length"]) || 0;
|
|
232
|
+
h.size = o > 1024 ? (o / 1024).toFixed(2) + "k" : o + "b", h.response = c, h.headers.responseHeader = Object.entries(
|
|
230
233
|
c.header ?? {}
|
|
231
234
|
).map(([y, T]) => ({
|
|
232
235
|
key: y,
|
|
@@ -242,13 +245,13 @@ class W {
|
|
|
242
245
|
* @memberof DevIntercept
|
|
243
246
|
*/
|
|
244
247
|
interceptSocket() {
|
|
245
|
-
const e = this,
|
|
246
|
-
const i = t.url,
|
|
247
|
-
([
|
|
248
|
+
const e = this, r = function(t) {
|
|
249
|
+
const i = t.url, a = Object.entries(t.header ?? {}).map(
|
|
250
|
+
([s, c]) => ({ key: s, value: c })
|
|
248
251
|
), d = (t.method ?? "GET").toLowerCase(), n = t.protocols ?? [];
|
|
249
252
|
e.event.updateWsList({
|
|
250
253
|
url: i,
|
|
251
|
-
headers:
|
|
254
|
+
headers: a,
|
|
252
255
|
method: d,
|
|
253
256
|
protocols: n,
|
|
254
257
|
readyState: "connection",
|
|
@@ -256,12 +259,12 @@ class W {
|
|
|
256
259
|
});
|
|
257
260
|
const l = m.connectSocket({
|
|
258
261
|
...t,
|
|
259
|
-
success: (
|
|
262
|
+
success: (s) => {
|
|
260
263
|
var c;
|
|
261
|
-
(c = t.success) == null || c.call(t,
|
|
264
|
+
(c = t.success) == null || c.call(t, s), e.event.updateWsList({
|
|
262
265
|
url: i,
|
|
263
266
|
readyState: "open",
|
|
264
|
-
headers:
|
|
267
|
+
headers: a,
|
|
265
268
|
protocols: n,
|
|
266
269
|
message: [
|
|
267
270
|
{
|
|
@@ -272,12 +275,12 @@ class W {
|
|
|
272
275
|
]
|
|
273
276
|
});
|
|
274
277
|
},
|
|
275
|
-
fail: (
|
|
278
|
+
fail: (s) => {
|
|
276
279
|
var c;
|
|
277
|
-
(c = t.fail) == null || c.call(t,
|
|
280
|
+
(c = t.fail) == null || c.call(t, s), e.event.updateWsList({
|
|
278
281
|
url: i,
|
|
279
282
|
readyState: "error",
|
|
280
|
-
headers:
|
|
283
|
+
headers: a,
|
|
281
284
|
protocols: n,
|
|
282
285
|
message: [
|
|
283
286
|
{
|
|
@@ -288,20 +291,20 @@ class W {
|
|
|
288
291
|
]
|
|
289
292
|
});
|
|
290
293
|
},
|
|
291
|
-
complete: (
|
|
294
|
+
complete: (s) => {
|
|
292
295
|
var c;
|
|
293
|
-
(c = t == null ? void 0 : t.complete) == null || c.call(t,
|
|
296
|
+
(c = t == null ? void 0 : t.complete) == null || c.call(t, s);
|
|
294
297
|
}
|
|
295
298
|
}), h = l.send;
|
|
296
|
-
l.send = (
|
|
299
|
+
l.send = (s) => {
|
|
297
300
|
h.call(l, {
|
|
298
|
-
data:
|
|
301
|
+
data: s.data,
|
|
299
302
|
fail: (c) => {
|
|
300
303
|
var u;
|
|
301
|
-
(u =
|
|
304
|
+
(u = s == null ? void 0 : s.fail) == null || u.call(s, c), e.event.updateWsList({
|
|
302
305
|
url: i,
|
|
303
306
|
readyState: "error",
|
|
304
|
-
headers:
|
|
307
|
+
headers: a,
|
|
305
308
|
protocols: n,
|
|
306
309
|
message: [
|
|
307
310
|
{
|
|
@@ -313,42 +316,42 @@ class W {
|
|
|
313
316
|
});
|
|
314
317
|
},
|
|
315
318
|
success: (c) => {
|
|
316
|
-
var u,
|
|
317
|
-
(u =
|
|
319
|
+
var u, o;
|
|
320
|
+
(u = s == null ? void 0 : s.success) == null || u.call(s, c), e.event.updateWsList({
|
|
318
321
|
readyState: "open",
|
|
319
322
|
url: i,
|
|
320
|
-
headers:
|
|
323
|
+
headers: a,
|
|
321
324
|
protocols: n,
|
|
322
325
|
message: [
|
|
323
326
|
{
|
|
324
327
|
type: "success",
|
|
325
328
|
time: Date.now(),
|
|
326
|
-
data: (
|
|
329
|
+
data: (o = s.data) == null ? void 0 : o.toString()
|
|
327
330
|
}
|
|
328
331
|
]
|
|
329
332
|
});
|
|
330
333
|
},
|
|
331
334
|
complete: (c) => {
|
|
332
335
|
var u;
|
|
333
|
-
(u =
|
|
336
|
+
(u = s == null ? void 0 : s.complete) == null || u.call(s, c);
|
|
334
337
|
}
|
|
335
338
|
});
|
|
336
339
|
};
|
|
337
340
|
const v = l.close;
|
|
338
|
-
return l.close = (
|
|
341
|
+
return l.close = (s) => {
|
|
339
342
|
e.event.updateWsList({
|
|
340
343
|
url: i,
|
|
341
344
|
readyState: "closing",
|
|
342
|
-
headers:
|
|
345
|
+
headers: a,
|
|
343
346
|
protocols: n,
|
|
344
347
|
message: []
|
|
345
348
|
}), v.call(l, {
|
|
346
|
-
...
|
|
349
|
+
...s,
|
|
347
350
|
fail: (c) => {
|
|
348
351
|
var u;
|
|
349
|
-
(u =
|
|
352
|
+
(u = s == null ? void 0 : s.fail) == null || u.call(s, c), e.event.updateWsList({
|
|
350
353
|
url: i,
|
|
351
|
-
headers:
|
|
354
|
+
headers: a,
|
|
352
355
|
readyState: "open",
|
|
353
356
|
protocols: n,
|
|
354
357
|
message: []
|
|
@@ -356,9 +359,9 @@ class W {
|
|
|
356
359
|
},
|
|
357
360
|
success: (c) => {
|
|
358
361
|
var u;
|
|
359
|
-
(u =
|
|
362
|
+
(u = s == null ? void 0 : s.success) == null || u.call(s, c), e.event.updateWsList({
|
|
360
363
|
url: i,
|
|
361
|
-
headers:
|
|
364
|
+
headers: a,
|
|
362
365
|
readyState: "closed",
|
|
363
366
|
protocols: n,
|
|
364
367
|
message: []
|
|
@@ -366,25 +369,25 @@ class W {
|
|
|
366
369
|
},
|
|
367
370
|
complete: (c) => {
|
|
368
371
|
var u;
|
|
369
|
-
(u =
|
|
372
|
+
(u = s == null ? void 0 : s.complete) == null || u.call(s, c);
|
|
370
373
|
}
|
|
371
374
|
});
|
|
372
|
-
}, l.onMessage((
|
|
375
|
+
}, l.onMessage((s) => {
|
|
373
376
|
e.event.updateWsList({
|
|
374
377
|
url: i,
|
|
375
|
-
headers:
|
|
378
|
+
headers: a,
|
|
376
379
|
protocols: n,
|
|
377
380
|
message: [
|
|
378
381
|
{
|
|
379
382
|
type: "success",
|
|
380
383
|
time: Date.now(),
|
|
381
|
-
data: JSON.parse(
|
|
384
|
+
data: JSON.parse(s.data)
|
|
382
385
|
}
|
|
383
386
|
]
|
|
384
387
|
});
|
|
385
388
|
}), l;
|
|
386
389
|
};
|
|
387
|
-
uni.connectSocket =
|
|
390
|
+
uni.connectSocket = r;
|
|
388
391
|
}
|
|
389
392
|
/**
|
|
390
393
|
* 拦截 uni.setStorageSync 和 uni.setStorage
|
|
@@ -392,19 +395,19 @@ class W {
|
|
|
392
395
|
* @memberof DevIntercept
|
|
393
396
|
*/
|
|
394
397
|
interceptSetStorage() {
|
|
395
|
-
uni.setStorageSync = (e,
|
|
396
|
-
m.setStorageSync(e.toString(),
|
|
398
|
+
uni.setStorageSync = (e, r) => {
|
|
399
|
+
m.setStorageSync(e.toString(), r), this.event.updateStoreList([
|
|
397
400
|
{
|
|
398
401
|
key: e.toString(),
|
|
399
402
|
_oldKey: e.toString(),
|
|
400
|
-
value:
|
|
403
|
+
value: r
|
|
401
404
|
}
|
|
402
405
|
]);
|
|
403
406
|
}, uni.setStorage = (e) => {
|
|
404
|
-
var
|
|
407
|
+
var r;
|
|
405
408
|
m.setStorage({
|
|
406
409
|
...e,
|
|
407
|
-
key: (
|
|
410
|
+
key: (r = e.key) == null ? void 0 : r.toString()
|
|
408
411
|
}).then(() => {
|
|
409
412
|
var t, i;
|
|
410
413
|
this.event.updateStoreList([
|
|
@@ -445,15 +448,15 @@ class W {
|
|
|
445
448
|
}
|
|
446
449
|
/** 拦截vuex */
|
|
447
450
|
interceptVuexStorage(e) {
|
|
448
|
-
var
|
|
449
|
-
this.event.setVuexList(e.state), (
|
|
451
|
+
var r;
|
|
452
|
+
this.event.setVuexList(e.state), (r = e == null ? void 0 : e.subscribe) == null || r.call(e, (t, i) => {
|
|
450
453
|
this.event.setVuexList(i);
|
|
451
454
|
});
|
|
452
455
|
}
|
|
453
456
|
/** 拦截pinia */
|
|
454
457
|
interceptPiniaStore(e) {
|
|
455
|
-
var
|
|
456
|
-
return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (
|
|
458
|
+
var r;
|
|
459
|
+
return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (r = e == null ? void 0 : e.store) == null || r.$subscribe(() => {
|
|
457
460
|
this.event.setPiniaList({
|
|
458
461
|
[e.store.$id]: e.store.$state
|
|
459
462
|
});
|
|
@@ -465,12 +468,12 @@ class W {
|
|
|
465
468
|
* @memberof DevIntercept
|
|
466
469
|
*/
|
|
467
470
|
interceptUploadFile() {
|
|
468
|
-
const e = this,
|
|
469
|
-
const i = e.event.getUploadIndex(),
|
|
471
|
+
const e = this, r = (t) => {
|
|
472
|
+
const i = e.event.getUploadIndex(), a = e.event.setUploadIndex(i + 1);
|
|
470
473
|
e.event.updateUploadList(
|
|
471
474
|
[
|
|
472
475
|
{
|
|
473
|
-
index:
|
|
476
|
+
index: a,
|
|
474
477
|
name: t.name,
|
|
475
478
|
url: t.url,
|
|
476
479
|
filePath: t.filePath,
|
|
@@ -489,7 +492,7 @@ class W {
|
|
|
489
492
|
startTime: Date.now()
|
|
490
493
|
}
|
|
491
494
|
],
|
|
492
|
-
|
|
495
|
+
a
|
|
493
496
|
);
|
|
494
497
|
const d = m.uploadFile({
|
|
495
498
|
...t,
|
|
@@ -498,7 +501,7 @@ class W {
|
|
|
498
501
|
(l = t == null ? void 0 : t.success) == null || l.call(t, n), e.event.updateUploadList(
|
|
499
502
|
[
|
|
500
503
|
{
|
|
501
|
-
index:
|
|
504
|
+
index: a,
|
|
502
505
|
status: "success",
|
|
503
506
|
endTime: Date.now(),
|
|
504
507
|
response: {
|
|
@@ -507,51 +510,51 @@ class W {
|
|
|
507
510
|
}
|
|
508
511
|
}
|
|
509
512
|
],
|
|
510
|
-
|
|
511
|
-
), e.event.removeUploadTask(
|
|
513
|
+
a
|
|
514
|
+
), e.event.removeUploadTask(a);
|
|
512
515
|
},
|
|
513
516
|
fail: (n) => {
|
|
514
517
|
var l;
|
|
515
518
|
(l = t == null ? void 0 : t.fail) == null || l.call(t, n), e.event.updateUploadList(
|
|
516
519
|
[
|
|
517
520
|
{
|
|
518
|
-
index:
|
|
521
|
+
index: a,
|
|
519
522
|
status: "error",
|
|
520
523
|
response: n,
|
|
521
524
|
endTime: Date.now()
|
|
522
525
|
}
|
|
523
526
|
],
|
|
524
|
-
|
|
525
|
-
), e.event.removeUploadTask(
|
|
527
|
+
a
|
|
528
|
+
), e.event.removeUploadTask(a);
|
|
526
529
|
}
|
|
527
530
|
});
|
|
528
531
|
return d.onProgressUpdate((n) => {
|
|
529
532
|
e.event.updateUploadList(
|
|
530
533
|
[
|
|
531
534
|
{
|
|
532
|
-
index:
|
|
535
|
+
index: a,
|
|
533
536
|
progress: n.progress,
|
|
534
537
|
totalBytesSent: n.totalBytesSent,
|
|
535
538
|
totalBytesExpectedToSend: n.totalBytesExpectedToSend,
|
|
536
539
|
status: "uploading"
|
|
537
540
|
}
|
|
538
541
|
],
|
|
539
|
-
|
|
542
|
+
a
|
|
540
543
|
);
|
|
541
|
-
}), e.event.addUploadTask(
|
|
544
|
+
}), e.event.addUploadTask(a, d), d;
|
|
542
545
|
};
|
|
543
|
-
uni.uploadFile =
|
|
546
|
+
uni.uploadFile = r.bind(uni);
|
|
544
547
|
}
|
|
545
548
|
interceptUniEventFactory(e) {
|
|
546
|
-
const
|
|
549
|
+
const r = `$${e}`;
|
|
547
550
|
uni[`$${e}`] = (t, i) => {
|
|
548
551
|
var n, l, h, v;
|
|
549
|
-
const
|
|
550
|
-
`), d =
|
|
551
|
-
(v = (h = m) == null ? void 0 : h[
|
|
552
|
+
const a = (l = (n = new Error()) == null ? void 0 : n.stack) == null ? void 0 : l.split(`
|
|
553
|
+
`), d = a == null ? void 0 : a[2];
|
|
554
|
+
(v = (h = m) == null ? void 0 : h[r]) == null || v.call(h, t, i), this.event.updateUniEventList([
|
|
552
555
|
{
|
|
553
556
|
eventName: t,
|
|
554
|
-
timer:
|
|
557
|
+
timer: S(),
|
|
555
558
|
stack: d,
|
|
556
559
|
type: e
|
|
557
560
|
}
|
|
@@ -571,12 +574,12 @@ class W {
|
|
|
571
574
|
this.event.getDevToolDestroy() || this.event.updateCaptureScreenList([
|
|
572
575
|
{
|
|
573
576
|
position: g(),
|
|
574
|
-
timer:
|
|
577
|
+
timer: S()
|
|
575
578
|
}
|
|
576
579
|
]);
|
|
577
580
|
});
|
|
578
581
|
}
|
|
579
582
|
}
|
|
580
583
|
export {
|
|
581
|
-
|
|
584
|
+
H as DevIntercept
|
|
582
585
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
interface TransformAppOptions {
|
|
2
|
+
code: string;
|
|
3
|
+
isSetup: boolean;
|
|
4
|
+
importConsole?: boolean;
|
|
5
|
+
scriptRow: string;
|
|
6
|
+
netWorkInfo: {
|
|
7
|
+
isReady: boolean;
|
|
8
|
+
urls: string[];
|
|
9
|
+
};
|
|
10
|
+
sourceFileServers?: string[];
|
|
11
|
+
reset: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 在App.vue 中注册插件
|
|
15
|
+
*
|
|
16
|
+
* @param {TransformAppOptions} {
|
|
17
|
+
* code,
|
|
18
|
+
* isSetup,
|
|
19
|
+
* importConsole,
|
|
20
|
+
* scriptRow,
|
|
21
|
+
* netWorkInfo,
|
|
22
|
+
* sourceFileServers,
|
|
23
|
+
* reset,
|
|
24
|
+
* }
|
|
25
|
+
* @return {*} {{ code: string; map: any }}
|
|
26
|
+
*/
|
|
27
|
+
export declare const transformApp: ({ code, isSetup, importConsole, scriptRow, netWorkInfo, sourceFileServers, reset, }: TransformAppOptions) => {
|
|
28
|
+
code: string;
|
|
29
|
+
map: any;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=transformApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformApp.d.ts","sourceRoot":"","sources":["../../../../../plugins/src/plugins/uniDevTool/transform/transformApp.ts"],"names":[],"mappings":"AAQA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAClD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,EAAE,GAAG,CAAC;CACZ;AA2ID;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,YAAY,wFAQtB,mBAAmB;UAAW,MAAM;SAAO,GAAG;CA4ChD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/index.js");function d(t){const{lines:n,importConsole:c,netWorkInfo:u,sourceFileServers:p,reset:a}=t,l=n.join(`
|
|
2
|
+
`),i=s.hasImportCurrentInstance(l),r=s.hasImportOnLaunch(l);i||n.unshift("import { getCurrentInstance } from 'vue';"),r||n.unshift("import { onLaunch } from '@dcloudio/uni-app';"),n.unshift(`import { initDevTool${c?", console":""} } from 'vite-uni-dev-tool/dist/core';`,"import pagesJson from './pages.json';");const e=`
|
|
3
|
+
const vueInstance = getCurrentInstance();
|
|
4
|
+
initDevTool({
|
|
5
|
+
pagesJson,
|
|
6
|
+
vueInstance,
|
|
7
|
+
mode: import.meta.env.MODE,
|
|
8
|
+
sourceFileServers: [
|
|
9
|
+
${[...u.urls??[],...p??[]].map(m=>`'${m}'`).join(`,
|
|
10
|
+
`)}
|
|
11
|
+
],
|
|
12
|
+
...${JSON.stringify(a)},
|
|
13
|
+
});`,o=s.findInsertionIndex(n,m=>m.includes("onLaunch("));return o!==-1?n.splice(o+1,0,e):n.push(`
|
|
14
|
+
onLaunch(() => {
|
|
15
|
+
${e}
|
|
16
|
+
});`),n}function h(t){const{lines:n,netWorkInfo:c,sourceFileServers:u,reset:p}=t,a=n.join(`
|
|
17
|
+
`);s.hasImportVue(a)||n.unshift("import Vue from 'vue';");const r=`
|
|
18
|
+
initDevTool({
|
|
19
|
+
pagesJson,
|
|
20
|
+
vueInstance: Vue,
|
|
21
|
+
mode: import.meta.env.MODE,
|
|
22
|
+
sourceFileServers: [
|
|
23
|
+
${[...c.urls??[],...u??[]].map(e=>`'${e}'`).join(`,
|
|
24
|
+
`)}
|
|
25
|
+
],
|
|
26
|
+
...${JSON.stringify(p)},
|
|
27
|
+
});`,f=s.findInsertionIndex(n,e=>e.includes("onLaunch(")||e.includes("onLaunch:"));if(f!==-1)n.splice(f+1,0,r);else{const e=s.findInsertionIndex(n,o=>o.includes("export default"));e!==-1&&n.splice(e+1,0,`
|
|
28
|
+
onLaunch: function() {
|
|
29
|
+
${r}
|
|
30
|
+
},`)}return n}const I=({code:t,isSetup:n,importConsole:c,scriptRow:u,netWorkInfo:p,sourceFileServers:a,reset:l})=>{const i=t.match(s.regScript);if(!i||!i[1])return{code:t,map:null};try{const e={lines:i[1].trim().split(`
|
|
31
|
+
`),isSetup:n,importConsole:c,netWorkInfo:p,sourceFileServers:a,reset:l},o=n?d(e):h(e);o.unshift(u),o.push("<\/script>");const m=o.join(`
|
|
32
|
+
`);return{code:t.replace(s.regScript,m),map:null}}catch(r){return console.error("[DevTool] 转换 App.vue 文件时出错:",r),{code:t,map:null}}};exports.transformApp=I;
|