vite-uni-dev-tool 0.0.18 → 0.0.20

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.
@@ -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 S } from "../utils/date.js";
5
+ import { getCurrentDate as p } from "../utils/date.js";
6
6
  import { parseValue as C } from "../utils/object.js";
7
- import { escapeHTML as U } from "../utils/string.js";
8
- class V {
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(s, t, ...i) {
25
- const a = f();
26
- v.__log__(s, t, ...i), e.event.updateConsoleList([
24
+ uni.__log__ = function(r, t, ...n) {
25
+ const s = f();
26
+ v.__log__(r, t, ...n), e.event.updateConsoleList([
27
27
  {
28
- type: s,
29
- position: a,
30
- time: S(),
31
- args: i.map((l) => ({
32
- type: E(l),
33
- value: C(l)
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 s = (i, a, l) => {
49
- this.event.getDevToolDestroy() || this.interceptErrorVue(i);
50
- }, t = (i, a, l) => {
51
- this.event.getDevToolDestroy() || this.interceptWarnVue(i + `
52
- ` + l);
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 = s, e.appContext.config.warnHandler = t) : (e.config.errorHandler = s, e.config.warnHandler = t);
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 i, a;
63
+ var n, s;
64
64
  if (this.event.getDevToolDestroy())
65
65
  return;
66
- const s = e.toString(), t = ((a = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
67
- `)) == null ? void 0 : a[1]) ?? "";
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: s
74
+ value: r
75
75
  }
76
76
  ],
77
77
  position: f(),
78
- time: S(),
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 i;
92
- const s = (i = e == null ? void 0 : e.stack) == null ? void 0 : i.split(`
93
- `), t = s == null ? void 0 : s[1];
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: S(),
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 l, n, c, h;
117
+ var c, i, l, o;
118
118
  if (this.preWarn === e)
119
119
  return;
120
120
  this.preWarn = e;
121
- const s = f(), t = (n = (l = new Error()) == null ? void 0 : l.stack) == null ? void 0 : n.split(`
122
- `), i = (c = t == null ? void 0 : t.slice(2)) == null ? void 0 : c[0];
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 a = (h = e.split(`
125
- `)) == null ? void 0 : h.map((o) => U(o)).join(`
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: a
133
+ value: s
134
134
  }
135
135
  ],
136
- position: s,
137
- time: S(),
138
- stack: i
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(s) {
163
- const t = s.complete;
164
- s.complete = function(i) {
165
- var l, n, c;
166
- t && t(i);
167
- const a = ((c = (n = (l = s.url) == null ? void 0 : l.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : c[0]) || "/";
168
- e.event.updateCurrentPagePath(a);
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(s) {
182
- const t = s.complete;
183
- s.complete = function(i) {
184
- var l, n, c;
185
- t && t(i);
186
- const a = ((c = (n = (l = s.url) == null ? void 0 : l.slice(1)) == null ? void 0 : n.split("?")) == null ? void 0 : c[0]) || "/";
187
- e.event.updateCurrentPagePath(a);
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(s) {
201
- var u, g, T;
202
- const t = e.event.getRequestIndex(), i = e.event.setRequestIndex(t + 1), a = s.url, l = (u = a == null ? void 0 : a.split("?")) == null ? void 0 : u[0], n = l == null ? void 0 : l.lastIndexOf("/"), c = (l == null ? void 0 : l.slice(n + 1)) ?? "", h = (T = (g = new Error()) == null ? void 0 : g.stack) == null ? void 0 : T.split(`
203
- `), o = h == null ? void 0 : h[5], r = {
204
- index: i,
205
- stack: o,
206
- url: s.url,
207
- name: c,
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(s.header ?? {}).map(
213
- ([m, p]) => ({
214
- key: m,
215
- value: p
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: s.method || "GET",
220
+ method: r.method || "GET",
221
221
  status: "pending",
222
- payload: s != null && s.data ? JSON.stringify(s.data) : "",
222
+ payload: r != null && r.data ? JSON.stringify(r.data) : "",
223
223
  response: "",
224
224
  size: ""
225
225
  };
226
- e.event.updateNetworkList([r]);
227
- let d = s.complete;
228
- s.complete = function(m) {
229
- var k, w;
230
- d && d(m), r.status = m.statusCode ?? "error", r.endTime = Date.now();
231
- const p = Date.now() - r.startTime;
232
- r.time = p < 1e3 ? p + "ms" : p / 1e3 + "s";
233
- const y = ((k = m == null ? void 0 : m.header) == null ? void 0 : k["Content-Length"]) || ((w = m == null ? void 0 : m.header) == null ? void 0 : w["content-length"]) || 0;
234
- r.size = y > 1024 ? (y / 1024).toFixed(2) + "k" : y + "b", r.response = m, r.headers.responseHeader = Object.entries(
235
- m.header ?? {}
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([r], i);
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, s = function(t) {
251
- const i = t.url, a = Object.entries(t.header ?? {}).map(
252
- ([r, d]) => ({ key: r, value: d })
253
- ), l = (t.method ?? "GET").toLowerCase(), n = t.protocols ?? [];
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: i,
256
- headers: a,
257
- method: l,
258
- protocols: n,
255
+ url: n,
256
+ headers: s,
257
+ method: c,
258
+ protocols: i,
259
259
  readyState: "connection",
260
260
  message: []
261
261
  });
262
- const c = v.connectSocket({
262
+ const l = v.connectSocket({
263
263
  ...t,
264
- success: (r) => {
264
+ success: (a) => {
265
265
  var d;
266
- (d = t.success) == null || d.call(t, r), e.event.updateWsList({
267
- url: i,
266
+ (d = t.success) == null || d.call(t, a), e.event.updateWsList({
267
+ url: n,
268
268
  readyState: "open",
269
- headers: a,
270
- protocols: n,
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: (r) => {
280
+ fail: (a) => {
281
281
  var d;
282
- (d = t.fail) == null || d.call(t, r), e.event.updateWsList({
283
- url: i,
282
+ (d = t.fail) == null || d.call(t, a), e.event.updateWsList({
283
+ url: n,
284
284
  readyState: "error",
285
- headers: a,
286
- protocols: n,
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: (r) => {
296
+ complete: (a) => {
297
297
  var d;
298
- (d = t == null ? void 0 : t.complete) == null || d.call(t, r);
298
+ (d = t == null ? void 0 : t.complete) == null || d.call(t, a);
299
299
  }
300
- }), h = c.send;
301
- c.send = (r) => {
302
- h.call(c, {
303
- data: r.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 = r == null ? void 0 : r.fail) == null || u.call(r, d), e.event.updateWsList({
307
- url: i,
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: a,
310
- protocols: n,
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, g;
322
- (u = r == null ? void 0 : r.success) == null || u.call(r, d), e.event.updateWsList({
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: i,
325
- headers: a,
326
- protocols: n,
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: (g = r.data) == null ? void 0 : g.toString()
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 = r == null ? void 0 : r.complete) == null || u.call(r, d);
338
+ (u = a == null ? void 0 : a.complete) == null || u.call(a, d);
339
339
  }
340
340
  });
341
341
  };
342
- const o = c.close;
343
- return c.close = (r) => {
342
+ const m = l.close;
343
+ return l.close = (a) => {
344
344
  e.event.updateWsList({
345
- url: i,
345
+ url: n,
346
346
  readyState: "closing",
347
- headers: a,
348
- protocols: n,
347
+ headers: s,
348
+ protocols: i,
349
349
  message: []
350
- }), o.call(c, {
351
- ...r,
350
+ }), m.call(l, {
351
+ ...a,
352
352
  fail: (d) => {
353
353
  var u;
354
- (u = r == null ? void 0 : r.fail) == null || u.call(r, d), e.event.updateWsList({
355
- url: i,
356
- headers: a,
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: n,
358
+ protocols: i,
359
359
  message: []
360
360
  });
361
361
  },
362
362
  success: (d) => {
363
363
  var u;
364
- (u = r == null ? void 0 : r.success) == null || u.call(r, d), e.event.updateWsList({
365
- url: i,
366
- headers: a,
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: n,
368
+ protocols: i,
369
369
  message: []
370
370
  });
371
371
  },
372
372
  complete: (d) => {
373
373
  var u;
374
- (u = r == null ? void 0 : r.complete) == null || u.call(r, d);
374
+ (u = a == null ? void 0 : a.complete) == null || u.call(a, d);
375
375
  }
376
376
  });
377
- }, c.onMessage((r) => {
377
+ }, l.onMessage((a) => {
378
378
  e.event.updateWsList({
379
- url: i,
380
- headers: a,
381
- protocols: n,
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(r.data)
386
+ data: JSON.parse(a.data)
387
387
  }
388
388
  ]
389
389
  });
390
- }), c;
390
+ }), l;
391
391
  };
392
- uni.connectSocket = s;
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
- uni.setStorageSync = (e, s) => {
401
- v.setStorageSync(e.toString(), s), this.event.updateStoreList([
402
- {
403
- key: e.toString(),
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: (t = e.key) == null ? void 0 : t.toString(),
418
- _oldKey: (i = e.key) == null ? void 0 : i.toString(),
419
- value: e.data
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
- uni.clearStorageSync = () => {
432
- v.clearStorageSync(), this.event.clearStorage();
433
- }, uni.clearStorage = () => {
434
- v.clearStorage(), this.event.clearStorage();
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
- uni.removeStorageSync = (e) => {
444
- v.removeStorageSync(e), this.event.removeStorage(e);
445
- }, uni.removeStorage = (e) => {
446
- v.removeStorage(e).then(() => {
447
- this.event.removeStorage(e.key);
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 s;
454
- this.event.setVuexList(e.state), (s = e == null ? void 0 : e.subscribe) == null || s.call(e, (t, i) => {
455
- this.event.setVuexList(i);
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 s;
461
- return this.initPinia || (this.initPinia = !0, this.event.setPiniaStore(e.pinia)), this.event.setPiniaList(e.pinia.state.value), (s = e == null ? void 0 : e.store) == null || s.$subscribe(() => {
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, s = (t) => {
474
- const i = e.event.getUploadIndex(), a = e.event.setUploadIndex(i + 1);
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: a,
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
- ([n, c]) => ({ key: n, value: c })
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
- a
510
+ s
498
511
  );
499
- const l = v.uploadFile({
512
+ const c = v.uploadFile({
500
513
  ...t,
501
- success: (n) => {
502
- var c;
503
- (c = t == null ? void 0 : t.success) == null || c.call(t, n), e.event.updateUploadList(
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: a,
519
+ index: s,
507
520
  status: "success",
508
521
  endTime: Date.now(),
509
522
  response: {
510
- ...n,
511
- data: JSON.parse(n.data)
523
+ ...i,
524
+ data: JSON.parse(i.data)
512
525
  }
513
526
  }
514
527
  ],
515
- a
516
- ), e.event.removeUploadTask(a);
528
+ s
529
+ ), e.event.removeUploadTask(s);
517
530
  },
518
- fail: (n) => {
519
- var c;
520
- (c = t == null ? void 0 : t.fail) == null || c.call(t, n), e.event.updateUploadList(
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: a,
536
+ index: s,
524
537
  status: "error",
525
- response: n,
538
+ response: i,
526
539
  endTime: Date.now()
527
540
  }
528
541
  ],
529
- a
530
- ), e.event.removeUploadTask(a);
542
+ s
543
+ ), e.event.removeUploadTask(s);
531
544
  }
532
545
  });
533
- return l.onProgressUpdate((n) => {
546
+ return c.onProgressUpdate((i) => {
534
547
  e.event.updateUploadList(
535
548
  [
536
549
  {
537
- index: a,
538
- progress: n.progress,
539
- totalBytesSent: n.totalBytesSent,
540
- totalBytesExpectedToSend: n.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
- a
557
+ s
545
558
  );
546
- }), e.event.addUploadTask(a, l), l;
559
+ }), e.event.addUploadTask(s, c), c;
547
560
  };
548
- uni.uploadFile = s.bind(uni);
561
+ uni.uploadFile = r.bind(uni);
549
562
  }
550
563
  interceptUniEventFactory(e) {
551
- const s = `$${e}`;
552
- uni[`$${e}`] = (t, i) => {
553
- var n, c, h, o;
554
- const a = (c = (n = new Error()) == null ? void 0 : n.stack) == null ? void 0 : c.split(`
555
- `), l = a == null ? void 0 : a[2];
556
- (o = (h = v) == null ? void 0 : h[s]) == null || o.call(h, t, i), this.event.updateUniEventList([
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: S(),
560
- stack: l,
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: S()
592
+ timer: p()
580
593
  }
581
594
  ]);
582
595
  });
583
596
  }
584
597
  }
585
598
  export {
586
- V as DevIntercept
599
+ I as DevIntercept
587
600
  };