vite-uni-dev-tool 0.0.19 → 0.0.21
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/README.md +10 -0
- package/dist/devEvent/index.d.ts +2 -2
- package/dist/devEvent/index.d.ts.map +1 -1
- package/dist/devEvent/index.js +5 -5
- package/dist/devIntercept/index.d.ts.map +1 -1
- package/dist/devIntercept/index.js +224 -211
- package/dist/devStore/index.d.ts +3 -3
- package/dist/devStore/index.d.ts.map +1 -1
- package/dist/devStore/index.js +13 -13
- package/dist/v2/VirtualListPro/index.vue +8 -4
- package/dist/v3/DevToolWindow/index.vue +20 -0
- package/dist/v3/NetworkList/NetworkDetail.vue +63 -19
- package/dist/v3/SettingList/index.vue +1 -1
- package/dist/v3/SourceCode/Line.vue +101 -0
- package/dist/v3/SourceCode/index.vue +97 -91
- package/dist/v3/SourceCode/parseCode.d.ts +27 -0
- package/dist/v3/SourceCode/parseCode.d.ts.map +1 -0
- package/dist/v3/SourceCode/parseCode.ts +643 -0
- package/dist/v3/VirtualListPro/index.vue +48 -6
- package/package.json +1 -1
|
@@ -2,10 +2,10 @@ import { backup as v } from "../core.js";
|
|
|
2
2
|
import "../utils/index.js";
|
|
3
3
|
import { transformValueToView as E } from "../utils/language.js";
|
|
4
4
|
import { getCurrentPagePath as f } from "../utils/page.js";
|
|
5
|
-
import { getCurrentDate as
|
|
5
|
+
import { getCurrentDate as p } from "../utils/date.js";
|
|
6
6
|
import { parseValue as C } from "../utils/object.js";
|
|
7
|
-
import { escapeHTML as
|
|
8
|
-
class
|
|
7
|
+
import { escapeHTML as P } from "../utils/string.js";
|
|
8
|
+
class I {
|
|
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,16 +21,16 @@ class V {
|
|
|
21
21
|
if (!uni.__log__)
|
|
22
22
|
return;
|
|
23
23
|
const e = this;
|
|
24
|
-
uni.__log__ = function(
|
|
25
|
-
const
|
|
26
|
-
v.__log__(
|
|
24
|
+
uni.__log__ = function(r, t, ...n) {
|
|
25
|
+
const s = f();
|
|
26
|
+
v.__log__(r, t, ...n), e.event.updateConsoleList([
|
|
27
27
|
{
|
|
28
|
-
type:
|
|
29
|
-
position:
|
|
30
|
-
time:
|
|
31
|
-
args:
|
|
32
|
-
type: E(
|
|
33
|
-
value: C(
|
|
28
|
+
type: r,
|
|
29
|
+
position: s,
|
|
30
|
+
time: p(),
|
|
31
|
+
args: n.map((c) => ({
|
|
32
|
+
type: E(c),
|
|
33
|
+
value: C(c)
|
|
34
34
|
})),
|
|
35
35
|
stack: t
|
|
36
36
|
}
|
|
@@ -45,13 +45,13 @@ class V {
|
|
|
45
45
|
interceptVue(e) {
|
|
46
46
|
if (!e)
|
|
47
47
|
return;
|
|
48
|
-
const
|
|
49
|
-
this.event.getDevToolDestroy() || this.interceptErrorVue(
|
|
50
|
-
}, t = (
|
|
51
|
-
this.event.getDevToolDestroy() || this.interceptWarnVue(
|
|
52
|
-
` +
|
|
48
|
+
const r = (n, s, c) => {
|
|
49
|
+
this.event.getDevToolDestroy() || this.interceptErrorVue(n);
|
|
50
|
+
}, t = (n, s, c) => {
|
|
51
|
+
this.event.getDevToolDestroy() || this.interceptWarnVue(n + `
|
|
52
|
+
` + c);
|
|
53
53
|
};
|
|
54
|
-
e.appContext ? (e.appContext.config.errorHandler =
|
|
54
|
+
e.appContext ? (e.appContext.config.errorHandler = r, e.appContext.config.warnHandler = t) : (e.config.errorHandler = r, e.config.warnHandler = t);
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* app 中捕获全局错误
|
|
@@ -60,22 +60,22 @@ class V {
|
|
|
60
60
|
*/
|
|
61
61
|
interceptAppError() {
|
|
62
62
|
uni.onError((e) => {
|
|
63
|
-
var
|
|
63
|
+
var n, s;
|
|
64
64
|
if (this.event.getDevToolDestroy())
|
|
65
65
|
return;
|
|
66
|
-
const
|
|
67
|
-
`)) == null ? void 0 :
|
|
66
|
+
const r = e.toString(), t = ((s = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
|
|
67
|
+
`)) == null ? void 0 : s[1]) ?? "";
|
|
68
68
|
this.event.updateConsoleList([
|
|
69
69
|
{
|
|
70
70
|
type: "error",
|
|
71
71
|
args: [
|
|
72
72
|
{
|
|
73
73
|
type: "string",
|
|
74
|
-
value:
|
|
74
|
+
value: r
|
|
75
75
|
}
|
|
76
76
|
],
|
|
77
77
|
position: f(),
|
|
78
|
-
time:
|
|
78
|
+
time: p(),
|
|
79
79
|
stack: t
|
|
80
80
|
}
|
|
81
81
|
]);
|
|
@@ -88,9 +88,9 @@ class V {
|
|
|
88
88
|
* @memberof DevIntercept
|
|
89
89
|
*/
|
|
90
90
|
interceptErrorVue(e) {
|
|
91
|
-
var
|
|
92
|
-
const
|
|
93
|
-
`), t =
|
|
91
|
+
var n;
|
|
92
|
+
const r = (n = e == null ? void 0 : e.stack) == null ? void 0 : n.split(`
|
|
93
|
+
`), t = r == null ? void 0 : r[1];
|
|
94
94
|
console.error(e), this.event.updateConsoleList([
|
|
95
95
|
{
|
|
96
96
|
type: "error",
|
|
@@ -101,7 +101,7 @@ class V {
|
|
|
101
101
|
}
|
|
102
102
|
],
|
|
103
103
|
position: f(),
|
|
104
|
-
time:
|
|
104
|
+
time: p(),
|
|
105
105
|
stack: t
|
|
106
106
|
}
|
|
107
107
|
]);
|
|
@@ -114,15 +114,15 @@ class V {
|
|
|
114
114
|
* @memberof DevIntercept
|
|
115
115
|
*/
|
|
116
116
|
interceptWarnVue(e) {
|
|
117
|
-
var
|
|
117
|
+
var c, i, l, o;
|
|
118
118
|
if (this.preWarn === e)
|
|
119
119
|
return;
|
|
120
120
|
this.preWarn = e;
|
|
121
|
-
const
|
|
122
|
-
`),
|
|
121
|
+
const r = f(), t = (i = (c = new Error()) == null ? void 0 : c.stack) == null ? void 0 : i.split(`
|
|
122
|
+
`), n = (l = t == null ? void 0 : t.slice(2)) == null ? void 0 : l[0];
|
|
123
123
|
console.warn(e);
|
|
124
|
-
const
|
|
125
|
-
`)) == null ? void 0 :
|
|
124
|
+
const s = (o = e.split(`
|
|
125
|
+
`)) == null ? void 0 : o.map((m) => P(m)).join(`
|
|
126
126
|
`);
|
|
127
127
|
this.event.updateConsoleList([
|
|
128
128
|
{
|
|
@@ -130,12 +130,12 @@ class V {
|
|
|
130
130
|
args: [
|
|
131
131
|
{
|
|
132
132
|
type: "string",
|
|
133
|
-
value:
|
|
133
|
+
value: s
|
|
134
134
|
}
|
|
135
135
|
],
|
|
136
|
-
position:
|
|
137
|
-
time:
|
|
138
|
-
stack:
|
|
136
|
+
position: r,
|
|
137
|
+
time: p(),
|
|
138
|
+
stack: n
|
|
139
139
|
}
|
|
140
140
|
]);
|
|
141
141
|
}
|
|
@@ -159,13 +159,13 @@ class V {
|
|
|
159
159
|
interceptSwitchTab() {
|
|
160
160
|
const e = this;
|
|
161
161
|
uni.addInterceptor("switchTab", {
|
|
162
|
-
invoke(
|
|
163
|
-
const t =
|
|
164
|
-
|
|
165
|
-
var
|
|
166
|
-
t && t(
|
|
167
|
-
const
|
|
168
|
-
e.event.updateCurrentPagePath(
|
|
162
|
+
invoke(r) {
|
|
163
|
+
const t = r.complete;
|
|
164
|
+
r.complete = function(n) {
|
|
165
|
+
var c, i, l;
|
|
166
|
+
t && t(n);
|
|
167
|
+
const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
|
|
168
|
+
e.event.updateCurrentPagePath(s);
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
171
|
});
|
|
@@ -178,13 +178,13 @@ class V {
|
|
|
178
178
|
interceptNavigateTo() {
|
|
179
179
|
const e = this;
|
|
180
180
|
uni.addInterceptor("navigateTo", {
|
|
181
|
-
invoke(
|
|
182
|
-
const t =
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
t && t(
|
|
186
|
-
const
|
|
187
|
-
e.event.updateCurrentPagePath(
|
|
181
|
+
invoke(r) {
|
|
182
|
+
const t = r.complete;
|
|
183
|
+
r.complete = function(n) {
|
|
184
|
+
var c, i, l;
|
|
185
|
+
t && t(n);
|
|
186
|
+
const s = ((l = (i = (c = r.url) == null ? void 0 : c.slice(1)) == null ? void 0 : i.split("?")) == null ? void 0 : l[0]) || "/";
|
|
187
|
+
e.event.updateCurrentPagePath(s);
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
});
|
|
@@ -197,46 +197,46 @@ class V {
|
|
|
197
197
|
interceptRequest() {
|
|
198
198
|
const e = this;
|
|
199
199
|
uni.addInterceptor("request", {
|
|
200
|
-
invoke(
|
|
201
|
-
var u,
|
|
202
|
-
const t = e.event.getRequestIndex(),
|
|
203
|
-
`),
|
|
204
|
-
index:
|
|
205
|
-
stack:
|
|
206
|
-
url:
|
|
207
|
-
name:
|
|
200
|
+
invoke(r) {
|
|
201
|
+
var u, S, k;
|
|
202
|
+
const t = e.event.getRequestIndex(), n = e.event.setRequestIndex(t + 1), s = r.url, c = (u = s == null ? void 0 : s.split("?")) == null ? void 0 : u[0], i = c == null ? void 0 : c.lastIndexOf("/"), l = (c == null ? void 0 : c.slice(i + 1)) ?? "", o = (k = (S = new Error()) == null ? void 0 : S.stack) == null ? void 0 : k.split(`
|
|
203
|
+
`), m = o == null ? void 0 : o[5], a = {
|
|
204
|
+
index: n,
|
|
205
|
+
stack: m,
|
|
206
|
+
url: r.url,
|
|
207
|
+
name: l,
|
|
208
208
|
startTime: Date.now(),
|
|
209
209
|
endTime: 0,
|
|
210
210
|
time: "-",
|
|
211
211
|
headers: {
|
|
212
|
-
requestHeader: Object.entries(
|
|
213
|
-
([
|
|
214
|
-
key:
|
|
215
|
-
value:
|
|
212
|
+
requestHeader: Object.entries(r.header ?? {}).map(
|
|
213
|
+
([h, g]) => ({
|
|
214
|
+
key: h,
|
|
215
|
+
value: g
|
|
216
216
|
})
|
|
217
217
|
),
|
|
218
218
|
responseHeader: []
|
|
219
219
|
},
|
|
220
|
-
method:
|
|
220
|
+
method: r.method || "GET",
|
|
221
221
|
status: "pending",
|
|
222
|
-
payload:
|
|
222
|
+
payload: r != null && r.data ? JSON.stringify(r.data) : "",
|
|
223
223
|
response: "",
|
|
224
224
|
size: ""
|
|
225
225
|
};
|
|
226
|
-
e.event.updateNetworkList([
|
|
227
|
-
let d =
|
|
228
|
-
|
|
229
|
-
var
|
|
230
|
-
d && d(
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
const y = ((
|
|
234
|
-
|
|
235
|
-
|
|
226
|
+
e.event.updateNetworkList([a]);
|
|
227
|
+
let d = r.complete;
|
|
228
|
+
r.complete = function(h) {
|
|
229
|
+
var T, w;
|
|
230
|
+
d && d(h), a.status = h.statusCode ?? "error", a.endTime = Date.now();
|
|
231
|
+
const g = Date.now() - a.startTime;
|
|
232
|
+
a.time = g < 1e3 ? g + "ms" : g / 1e3 + "s";
|
|
233
|
+
const y = ((T = h == null ? void 0 : h.header) == null ? void 0 : T["Content-Length"]) || ((w = h == null ? void 0 : h.header) == null ? void 0 : w["content-length"]) || 0;
|
|
234
|
+
a.size = y > 1024 ? (y / 1024).toFixed(2) + "k" : y + "b", a.response = h, a.headers.responseHeader = Object.entries(
|
|
235
|
+
h.header ?? {}
|
|
236
236
|
).map(([L, D]) => ({
|
|
237
237
|
key: L,
|
|
238
238
|
value: D
|
|
239
|
-
})), e.event.updateNetworkList([
|
|
239
|
+
})), e.event.updateNetworkList([a], n);
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
242
|
});
|
|
@@ -247,27 +247,27 @@ class V {
|
|
|
247
247
|
* @memberof DevIntercept
|
|
248
248
|
*/
|
|
249
249
|
interceptSocket() {
|
|
250
|
-
const e = this,
|
|
251
|
-
const
|
|
252
|
-
([
|
|
253
|
-
),
|
|
250
|
+
const e = this, r = function(t) {
|
|
251
|
+
const n = t.url, s = Object.entries(t.header ?? {}).map(
|
|
252
|
+
([a, d]) => ({ key: a, value: d })
|
|
253
|
+
), c = (t.method ?? "GET").toLowerCase(), i = t.protocols ?? [];
|
|
254
254
|
e.event.updateWsList({
|
|
255
|
-
url:
|
|
256
|
-
headers:
|
|
257
|
-
method:
|
|
258
|
-
protocols:
|
|
255
|
+
url: n,
|
|
256
|
+
headers: s,
|
|
257
|
+
method: c,
|
|
258
|
+
protocols: i,
|
|
259
259
|
readyState: "connection",
|
|
260
260
|
message: []
|
|
261
261
|
});
|
|
262
|
-
const
|
|
262
|
+
const l = v.connectSocket({
|
|
263
263
|
...t,
|
|
264
|
-
success: (
|
|
264
|
+
success: (a) => {
|
|
265
265
|
var d;
|
|
266
|
-
(d = t.success) == null || d.call(t,
|
|
267
|
-
url:
|
|
266
|
+
(d = t.success) == null || d.call(t, a), e.event.updateWsList({
|
|
267
|
+
url: n,
|
|
268
268
|
readyState: "open",
|
|
269
|
-
headers:
|
|
270
|
-
protocols:
|
|
269
|
+
headers: s,
|
|
270
|
+
protocols: i,
|
|
271
271
|
message: [
|
|
272
272
|
{
|
|
273
273
|
data: "连接成功",
|
|
@@ -277,13 +277,13 @@ class V {
|
|
|
277
277
|
]
|
|
278
278
|
});
|
|
279
279
|
},
|
|
280
|
-
fail: (
|
|
280
|
+
fail: (a) => {
|
|
281
281
|
var d;
|
|
282
|
-
(d = t.fail) == null || d.call(t,
|
|
283
|
-
url:
|
|
282
|
+
(d = t.fail) == null || d.call(t, a), e.event.updateWsList({
|
|
283
|
+
url: n,
|
|
284
284
|
readyState: "error",
|
|
285
|
-
headers:
|
|
286
|
-
protocols:
|
|
285
|
+
headers: s,
|
|
286
|
+
protocols: i,
|
|
287
287
|
message: [
|
|
288
288
|
{
|
|
289
289
|
data: "连接失败",
|
|
@@ -293,21 +293,21 @@ class V {
|
|
|
293
293
|
]
|
|
294
294
|
});
|
|
295
295
|
},
|
|
296
|
-
complete: (
|
|
296
|
+
complete: (a) => {
|
|
297
297
|
var d;
|
|
298
|
-
(d = t == null ? void 0 : t.complete) == null || d.call(t,
|
|
298
|
+
(d = t == null ? void 0 : t.complete) == null || d.call(t, a);
|
|
299
299
|
}
|
|
300
|
-
}),
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
data:
|
|
300
|
+
}), o = l.send;
|
|
301
|
+
l.send = (a) => {
|
|
302
|
+
o.call(l, {
|
|
303
|
+
data: a.data,
|
|
304
304
|
fail: (d) => {
|
|
305
305
|
var u;
|
|
306
|
-
(u =
|
|
307
|
-
url:
|
|
306
|
+
(u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
|
|
307
|
+
url: n,
|
|
308
308
|
readyState: "error",
|
|
309
|
-
headers:
|
|
310
|
-
protocols:
|
|
309
|
+
headers: s,
|
|
310
|
+
protocols: i,
|
|
311
311
|
message: [
|
|
312
312
|
{
|
|
313
313
|
data: JSON.stringify(d),
|
|
@@ -318,78 +318,78 @@ class V {
|
|
|
318
318
|
});
|
|
319
319
|
},
|
|
320
320
|
success: (d) => {
|
|
321
|
-
var u,
|
|
322
|
-
(u =
|
|
321
|
+
var u, S;
|
|
322
|
+
(u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
|
|
323
323
|
readyState: "open",
|
|
324
|
-
url:
|
|
325
|
-
headers:
|
|
326
|
-
protocols:
|
|
324
|
+
url: n,
|
|
325
|
+
headers: s,
|
|
326
|
+
protocols: i,
|
|
327
327
|
message: [
|
|
328
328
|
{
|
|
329
329
|
type: "success",
|
|
330
330
|
time: Date.now(),
|
|
331
|
-
data: (
|
|
331
|
+
data: (S = a.data) == null ? void 0 : S.toString()
|
|
332
332
|
}
|
|
333
333
|
]
|
|
334
334
|
});
|
|
335
335
|
},
|
|
336
336
|
complete: (d) => {
|
|
337
337
|
var u;
|
|
338
|
-
(u =
|
|
338
|
+
(u = a == null ? void 0 : a.complete) == null || u.call(a, d);
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
341
|
};
|
|
342
|
-
const
|
|
343
|
-
return
|
|
342
|
+
const m = l.close;
|
|
343
|
+
return l.close = (a) => {
|
|
344
344
|
e.event.updateWsList({
|
|
345
|
-
url:
|
|
345
|
+
url: n,
|
|
346
346
|
readyState: "closing",
|
|
347
|
-
headers:
|
|
348
|
-
protocols:
|
|
347
|
+
headers: s,
|
|
348
|
+
protocols: i,
|
|
349
349
|
message: []
|
|
350
|
-
}),
|
|
351
|
-
...
|
|
350
|
+
}), m.call(l, {
|
|
351
|
+
...a,
|
|
352
352
|
fail: (d) => {
|
|
353
353
|
var u;
|
|
354
|
-
(u =
|
|
355
|
-
url:
|
|
356
|
-
headers:
|
|
354
|
+
(u = a == null ? void 0 : a.fail) == null || u.call(a, d), e.event.updateWsList({
|
|
355
|
+
url: n,
|
|
356
|
+
headers: s,
|
|
357
357
|
readyState: "open",
|
|
358
|
-
protocols:
|
|
358
|
+
protocols: i,
|
|
359
359
|
message: []
|
|
360
360
|
});
|
|
361
361
|
},
|
|
362
362
|
success: (d) => {
|
|
363
363
|
var u;
|
|
364
|
-
(u =
|
|
365
|
-
url:
|
|
366
|
-
headers:
|
|
364
|
+
(u = a == null ? void 0 : a.success) == null || u.call(a, d), e.event.updateWsList({
|
|
365
|
+
url: n,
|
|
366
|
+
headers: s,
|
|
367
367
|
readyState: "closed",
|
|
368
|
-
protocols:
|
|
368
|
+
protocols: i,
|
|
369
369
|
message: []
|
|
370
370
|
});
|
|
371
371
|
},
|
|
372
372
|
complete: (d) => {
|
|
373
373
|
var u;
|
|
374
|
-
(u =
|
|
374
|
+
(u = a == null ? void 0 : a.complete) == null || u.call(a, d);
|
|
375
375
|
}
|
|
376
376
|
});
|
|
377
|
-
},
|
|
377
|
+
}, l.onMessage((a) => {
|
|
378
378
|
e.event.updateWsList({
|
|
379
|
-
url:
|
|
380
|
-
headers:
|
|
381
|
-
protocols:
|
|
379
|
+
url: n,
|
|
380
|
+
headers: s,
|
|
381
|
+
protocols: i,
|
|
382
382
|
message: [
|
|
383
383
|
{
|
|
384
384
|
type: "success",
|
|
385
385
|
time: Date.now(),
|
|
386
|
-
data: JSON.parse(
|
|
386
|
+
data: JSON.parse(a.data)
|
|
387
387
|
}
|
|
388
388
|
]
|
|
389
389
|
});
|
|
390
|
-
}),
|
|
390
|
+
}), l;
|
|
391
391
|
};
|
|
392
|
-
uni.connectSocket =
|
|
392
|
+
uni.connectSocket = r;
|
|
393
393
|
}
|
|
394
394
|
/**
|
|
395
395
|
* 拦截 uni.setStorageSync 和 uni.setStorage
|
|
@@ -397,30 +397,32 @@ class V {
|
|
|
397
397
|
* @memberof DevIntercept
|
|
398
398
|
*/
|
|
399
399
|
interceptSetStorage() {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
_oldKey: e.toString(),
|
|
405
|
-
value: s
|
|
406
|
-
}
|
|
407
|
-
]);
|
|
408
|
-
}, uni.setStorage = (e) => {
|
|
409
|
-
var s;
|
|
410
|
-
v.setStorage({
|
|
411
|
-
...e,
|
|
412
|
-
key: (s = e.key) == null ? void 0 : s.toString()
|
|
413
|
-
}).then(() => {
|
|
414
|
-
var t, i;
|
|
415
|
-
this.event.updateStoreList([
|
|
400
|
+
const e = this;
|
|
401
|
+
Object.defineProperty(uni, "setStorageSync", {
|
|
402
|
+
value: function(r, t) {
|
|
403
|
+
v.setStorageSync(r.toString(), t), e.event.updateStoreList([
|
|
416
404
|
{
|
|
417
|
-
key:
|
|
418
|
-
_oldKey:
|
|
419
|
-
value:
|
|
405
|
+
key: r.toString(),
|
|
406
|
+
_oldKey: r.toString(),
|
|
407
|
+
value: t
|
|
420
408
|
}
|
|
421
409
|
]);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
410
|
+
}
|
|
411
|
+
}), uni.addInterceptor("setStorage", {
|
|
412
|
+
invoke(r) {
|
|
413
|
+
const t = r.complete;
|
|
414
|
+
r.complete = function(n) {
|
|
415
|
+
var s, c;
|
|
416
|
+
t && t(n), e.event.updateStoreList([
|
|
417
|
+
{
|
|
418
|
+
key: (s = r.key) == null ? void 0 : s.toString(),
|
|
419
|
+
_oldKey: (c = r.key) == null ? void 0 : c.toString(),
|
|
420
|
+
value: r.data
|
|
421
|
+
}
|
|
422
|
+
]);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
});
|
|
424
426
|
}
|
|
425
427
|
/**
|
|
426
428
|
* 拦截 uni.clearStorageSync 和 uni.clearStorage
|
|
@@ -428,11 +430,16 @@ class V {
|
|
|
428
430
|
* @memberof DevIntercept
|
|
429
431
|
*/
|
|
430
432
|
interceptClearStorage() {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
433
|
+
const e = this;
|
|
434
|
+
Object.defineProperty(uni, "clearStorage", {
|
|
435
|
+
value: function() {
|
|
436
|
+
v.clearStorage(), e.event.clearStorage();
|
|
437
|
+
}
|
|
438
|
+
}), uni.addInterceptor("clearStorage", {
|
|
439
|
+
invoke() {
|
|
440
|
+
e.event.clearStorage();
|
|
441
|
+
}
|
|
442
|
+
});
|
|
436
443
|
}
|
|
437
444
|
/**
|
|
438
445
|
* 拦截 uni.removeStorageSync 和 uni.removeStorage
|
|
@@ -440,25 +447,31 @@ class V {
|
|
|
440
447
|
* @memberof DevIntercept
|
|
441
448
|
*/
|
|
442
449
|
interceptRemoveStorage() {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
+
const e = this;
|
|
451
|
+
Object.defineProperty(uni, "removeStorageSync", {
|
|
452
|
+
value: function(r) {
|
|
453
|
+
v.removeStorageSync(r), e.event.removeStorage(r);
|
|
454
|
+
}
|
|
455
|
+
}), uni.addInterceptor("removeStorage", {
|
|
456
|
+
invoke(r) {
|
|
457
|
+
const t = r.complete;
|
|
458
|
+
r.complete = function(n) {
|
|
459
|
+
t && t(n), e.event.removeStorage(r.key);
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
});
|
|
450
463
|
}
|
|
451
464
|
/** 拦截vuex */
|
|
452
465
|
interceptVuexStorage(e) {
|
|
453
|
-
var
|
|
454
|
-
this.event.setVuexList(e.state), (
|
|
455
|
-
this.event.setVuexList(
|
|
466
|
+
var r;
|
|
467
|
+
this.event.setVuexList(e.state), (r = e == null ? void 0 : e.subscribe) == null || r.call(e, (t, n) => {
|
|
468
|
+
this.event.setVuexList(n);
|
|
456
469
|
});
|
|
457
470
|
}
|
|
458
471
|
/** 拦截pinia */
|
|
459
472
|
interceptPiniaStore(e) {
|
|
460
|
-
var
|
|
461
|
-
return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (
|
|
473
|
+
var r;
|
|
474
|
+
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(() => {
|
|
462
475
|
this.event.setPiniaList({
|
|
463
476
|
[e.store.$id]: e.store.$state
|
|
464
477
|
});
|
|
@@ -470,19 +483,19 @@ class V {
|
|
|
470
483
|
* @memberof DevIntercept
|
|
471
484
|
*/
|
|
472
485
|
interceptUploadFile() {
|
|
473
|
-
const e = this,
|
|
474
|
-
const
|
|
486
|
+
const e = this, r = (t) => {
|
|
487
|
+
const n = e.event.getUploadIndex(), s = e.event.setUploadIndex(n + 1);
|
|
475
488
|
e.event.updateUploadList(
|
|
476
489
|
[
|
|
477
490
|
{
|
|
478
|
-
index:
|
|
491
|
+
index: s,
|
|
479
492
|
name: t.name,
|
|
480
493
|
url: t.url,
|
|
481
494
|
filePath: t.filePath,
|
|
482
495
|
fileType: t.fileType,
|
|
483
496
|
headers: {
|
|
484
497
|
requestHeader: Object.entries(t.header || {}).map(
|
|
485
|
-
([
|
|
498
|
+
([i, l]) => ({ key: i, value: l })
|
|
486
499
|
),
|
|
487
500
|
responseHeader: []
|
|
488
501
|
},
|
|
@@ -494,70 +507,70 @@ class V {
|
|
|
494
507
|
startTime: Date.now()
|
|
495
508
|
}
|
|
496
509
|
],
|
|
497
|
-
|
|
510
|
+
s
|
|
498
511
|
);
|
|
499
|
-
const
|
|
512
|
+
const c = v.uploadFile({
|
|
500
513
|
...t,
|
|
501
|
-
success: (
|
|
502
|
-
var
|
|
503
|
-
(
|
|
514
|
+
success: (i) => {
|
|
515
|
+
var l;
|
|
516
|
+
(l = t == null ? void 0 : t.success) == null || l.call(t, i), e.event.updateUploadList(
|
|
504
517
|
[
|
|
505
518
|
{
|
|
506
|
-
index:
|
|
519
|
+
index: s,
|
|
507
520
|
status: "success",
|
|
508
521
|
endTime: Date.now(),
|
|
509
522
|
response: {
|
|
510
|
-
...
|
|
511
|
-
data: JSON.parse(
|
|
523
|
+
...i,
|
|
524
|
+
data: JSON.parse(i.data)
|
|
512
525
|
}
|
|
513
526
|
}
|
|
514
527
|
],
|
|
515
|
-
|
|
516
|
-
), e.event.removeUploadTask(
|
|
528
|
+
s
|
|
529
|
+
), e.event.removeUploadTask(s);
|
|
517
530
|
},
|
|
518
|
-
fail: (
|
|
519
|
-
var
|
|
520
|
-
(
|
|
531
|
+
fail: (i) => {
|
|
532
|
+
var l;
|
|
533
|
+
(l = t == null ? void 0 : t.fail) == null || l.call(t, i), e.event.updateUploadList(
|
|
521
534
|
[
|
|
522
535
|
{
|
|
523
|
-
index:
|
|
536
|
+
index: s,
|
|
524
537
|
status: "error",
|
|
525
|
-
response:
|
|
538
|
+
response: i,
|
|
526
539
|
endTime: Date.now()
|
|
527
540
|
}
|
|
528
541
|
],
|
|
529
|
-
|
|
530
|
-
), e.event.removeUploadTask(
|
|
542
|
+
s
|
|
543
|
+
), e.event.removeUploadTask(s);
|
|
531
544
|
}
|
|
532
545
|
});
|
|
533
|
-
return
|
|
546
|
+
return c.onProgressUpdate((i) => {
|
|
534
547
|
e.event.updateUploadList(
|
|
535
548
|
[
|
|
536
549
|
{
|
|
537
|
-
index:
|
|
538
|
-
progress:
|
|
539
|
-
totalBytesSent:
|
|
540
|
-
totalBytesExpectedToSend:
|
|
550
|
+
index: s,
|
|
551
|
+
progress: i.progress,
|
|
552
|
+
totalBytesSent: i.totalBytesSent,
|
|
553
|
+
totalBytesExpectedToSend: i.totalBytesExpectedToSend,
|
|
541
554
|
status: "uploading"
|
|
542
555
|
}
|
|
543
556
|
],
|
|
544
|
-
|
|
557
|
+
s
|
|
545
558
|
);
|
|
546
|
-
}), e.event.addUploadTask(
|
|
559
|
+
}), e.event.addUploadTask(s, c), c;
|
|
547
560
|
};
|
|
548
|
-
uni.uploadFile =
|
|
561
|
+
uni.uploadFile = r.bind(uni);
|
|
549
562
|
}
|
|
550
563
|
interceptUniEventFactory(e) {
|
|
551
|
-
const
|
|
552
|
-
uni[`$${e}`] = (t,
|
|
553
|
-
var
|
|
554
|
-
const
|
|
555
|
-
`),
|
|
556
|
-
(
|
|
564
|
+
const r = `$${e}`;
|
|
565
|
+
uni[`$${e}`] = (t, n) => {
|
|
566
|
+
var i, l, o, m;
|
|
567
|
+
const s = (l = (i = new Error()) == null ? void 0 : i.stack) == null ? void 0 : l.split(`
|
|
568
|
+
`), c = s == null ? void 0 : s[2];
|
|
569
|
+
(m = (o = v) == null ? void 0 : o[r]) == null || m.call(o, t, n), this.event.updateUniEventList([
|
|
557
570
|
{
|
|
558
571
|
eventName: t,
|
|
559
|
-
timer:
|
|
560
|
-
stack:
|
|
572
|
+
timer: p(),
|
|
573
|
+
stack: c,
|
|
561
574
|
type: e
|
|
562
575
|
}
|
|
563
576
|
]), this.event.updateUniEventCount(e);
|
|
@@ -576,12 +589,12 @@ class V {
|
|
|
576
589
|
this.event.getDevToolDestroy() || this.event.updateCaptureScreenList([
|
|
577
590
|
{
|
|
578
591
|
position: f(),
|
|
579
|
-
timer:
|
|
592
|
+
timer: p()
|
|
580
593
|
}
|
|
581
594
|
]);
|
|
582
595
|
});
|
|
583
596
|
}
|
|
584
597
|
}
|
|
585
598
|
export {
|
|
586
|
-
|
|
599
|
+
I as DevIntercept
|
|
587
600
|
};
|