vite-uni-dev-tool 0.0.14 → 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/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;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface TransformMainOptions {
|
|
2
|
+
code: string;
|
|
3
|
+
vueVersion: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 转换 main.ts|js 文件
|
|
7
|
+
* 注入全局组件
|
|
8
|
+
*
|
|
9
|
+
* @param {{
|
|
10
|
+
* code: string;
|
|
11
|
+
* vueVersion: number;
|
|
12
|
+
* }} {
|
|
13
|
+
* code,
|
|
14
|
+
* vueVersion,
|
|
15
|
+
* }
|
|
16
|
+
* @return {*} {{
|
|
17
|
+
* code: string;
|
|
18
|
+
* map: any;
|
|
19
|
+
* }}
|
|
20
|
+
*/
|
|
21
|
+
export declare const transformMain: ({ code, vueVersion, }: TransformMainOptions) => {
|
|
22
|
+
code: string;
|
|
23
|
+
map: any;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=transformMain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformMain.d.ts","sourceRoot":"","sources":["../../../../../plugins/src/plugins/uniDevTool/transform/transformMain.ts"],"names":[],"mappings":"AAEA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AA0FD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,0BAGvB,oBAAoB;UACf,MAAM;SACP,GAAG;CAgCT,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/index.js");function l(t){if(![2,3].includes(t))throw new Error("vite-uni-dev-tool: vueVersion 只支持 2 或 3")}function p(t){const{lines:r}=t,e=[...r],i=s.findInsertionIndex(e,n=>n.trim().startsWith("import")||n.trim().startsWith("export"));i!==-1&&e.splice(i,0,"import DevTool from 'vite-uni-dev-tool/dist/v3/DevTool/index.vue';");const o=s.findInsertionIndex(e,n=>n.includes("const app = createSSRApp(App)"));return o!==-1&&e.splice(o+1,0," app.component('DevTool', DevTool);"),e}function d(t){const{lines:r}=t,e=[...r],i=s.findInsertionIndex(e,n=>n.trim().startsWith("import")||n.trim().startsWith("export"));i!==-1&&e.splice(i,0,"import DevTool from 'vite-uni-dev-tool/dist/v2/DevTool/index.vue';");const o=s.findInsertionIndex(e,n=>n.includes("new Vue("));return o!==-1&&e.splice(o,0,"Vue.component('DevTool', DevTool);"),e}const u=({code:t,vueVersion:r})=>{try{l(r);const e=t.split(`
|
|
2
|
+
`),i={lines:e,vueVersion:r},o=r===2?d(i):p(i);return o.length===e.length&&o.every((n,c)=>n===e[c])?{code:t,map:null}:{code:o.join(`
|
|
3
|
+
`),map:null}}catch(e){return console.error("[DevTool] 转换 main 文件时出错:",e),{code:t,map:null}}};exports.transformMain=u;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface TransformVueOptions {
|
|
2
|
+
id: string;
|
|
3
|
+
code: string;
|
|
4
|
+
pages: {
|
|
5
|
+
pages: {
|
|
6
|
+
path: string;
|
|
7
|
+
}[];
|
|
8
|
+
subPackages?: {
|
|
9
|
+
root: string;
|
|
10
|
+
pages: {
|
|
11
|
+
path: string;
|
|
12
|
+
}[];
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
scriptRow: string;
|
|
16
|
+
importConsole?: boolean;
|
|
17
|
+
excludeImportConsole: string[];
|
|
18
|
+
excludeImportDevTool: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* vue 文件中注入 console 功能
|
|
23
|
+
* vue 文件中注入 DevTool 组件
|
|
24
|
+
*
|
|
25
|
+
* @param {TransformVueOptions} {
|
|
26
|
+
* id,
|
|
27
|
+
* code,
|
|
28
|
+
* pages,
|
|
29
|
+
* scriptRow,
|
|
30
|
+
* importConsole,
|
|
31
|
+
* excludeImportConsole,
|
|
32
|
+
* excludeImportDevTool,
|
|
33
|
+
* }
|
|
34
|
+
* @return {*} {{ code: string; map: any }}
|
|
35
|
+
*/
|
|
36
|
+
export declare const transformVue: ({ id, code, pages, scriptRow, importConsole, excludeImportConsole, excludeImportDevTool, }: TransformVueOptions) => {
|
|
37
|
+
code: string;
|
|
38
|
+
map: any;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=transformVue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformVue.d.ts","sourceRoot":"","sources":["../../../../../plugins/src/plugins/uniDevTool/transform/transformVue.ts"],"names":[],"mappings":"AAQA,UAAU,mBAAmB;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE;QACL,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,EAAE,CAAC;SAC3B,EAAE,CAAC;KACL,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AA+HD;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,YAAY,+FAQtB,mBAAmB;UAAW,MAAM;SAAO,GAAG;CAmDhD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../utils/index.js");function m(e,o){var s;const t=o.pages.some(r=>e.includes(r.path)),n=((s=o.subPackages)==null?void 0:s.some(r=>r.pages.some(l=>e.includes(`${r.root}/${l.path}`))))??!1;return{isPage:t,isSubPage:n}}function p(e,o,t,n){return{shouldInjectConsole:!!n,hasExistingConsoleImport:i.hasImportConsole(e),usesConsole:i.hasUseConsole(e),isExcludedFromConsole:!i.hasDirOrFile(o,t)}}function h(e,o,t,n){const{isPage:s,isSubPage:r}=m(e,t);return{isPageOrSubPage:s||r,hasTemplate:o.includes("<template>"),isExcludedFromDevTool:!i.hasDirOrFile(e,n)}}function C(e,o,t){const n=e.match(i.regScript);if(!n||!n[1])return e;const s=n[1],l=`
|
|
2
|
+
${t?"import { console } from 'vite-uni-dev-tool/dist/core';":""}
|
|
3
|
+
${s}
|
|
4
|
+
`.trim();return e.replace(i.regScript,`${o}
|
|
5
|
+
${l}
|
|
6
|
+
<\/script>`)}function f(e){const o=i.getTemplateContent(e);if(!o)return e;const t=`<view>
|
|
7
|
+
${o}
|
|
8
|
+
<DevTool />
|
|
9
|
+
</view>`;return e.replace(o,t)}const g=({id:e,code:o,pages:t,scriptRow:n,importConsole:s,excludeImportConsole:r,excludeImportDevTool:l})=>{try{let c=o;const u=p(o,e,r,s);u.shouldInjectConsole&&!u.hasExistingConsoleImport&&u.usesConsole&&u.isExcludedFromConsole&&(c=C(c,n,s));const a=h(e,o,t,l);return a.isPageOrSubPage&&a.hasTemplate&&a.isExcludedFromDevTool&&(c=f(c)),{code:c,map:null}}catch(c){return console.error("[DevTool] 转换 Vue 文件时出错:",c),{code:o,map:null}}};exports.transformVue=g;
|
|
@@ -3,7 +3,7 @@ import { Plugin } from 'vite';
|
|
|
3
3
|
/**
|
|
4
4
|
* vite-uni-dev-tool 插件
|
|
5
5
|
*
|
|
6
|
-
* 自动在 main.ts 中注入调试插件,并在每个页面的模板中注入 DevTool 组件。
|
|
6
|
+
* 自动在 main.ts|js 中注入调试插件,并在每个页面的模板中注入 DevTool 组件。
|
|
7
7
|
*
|
|
8
8
|
* 如果组件不是用 template 定义的,则不会被该插件添加。
|
|
9
9
|
*
|
|
@@ -20,7 +20,7 @@ import { Plugin } from 'vite';
|
|
|
20
20
|
* }
|
|
21
21
|
* @return {*} {Plugin}
|
|
22
22
|
*/
|
|
23
|
-
export default function uniDevTool({ pages, sourceFileServers, importConsole, vueVersion, ...reset }: {
|
|
23
|
+
export default function uniDevTool({ pages, sourceFileServers, importConsole, vueVersion, excludeImportConsole, excludeImportDevTool, ...reset }: {
|
|
24
24
|
/** 是否拦截Promise.reject 最好不要拦截 默认禁用 */
|
|
25
25
|
enableInterceptPromiseReject?: boolean;
|
|
26
26
|
/** 打开窗口时隐藏按钮 */
|
|
@@ -63,7 +63,7 @@ export default function uniDevTool({ pages, sourceFileServers, importConsole, vu
|
|
|
63
63
|
* 开发环境 source file 服务器地址,默认 [] ,配合 useDevSource 使用
|
|
64
64
|
*/
|
|
65
65
|
sourceFileServers?: string[];
|
|
66
|
-
/** 是否导入 console 默认不导入, 只会捕获error 和 warn , */
|
|
66
|
+
/** 是否导入 console 默认不导入, 只会捕获 error 和 warn , */
|
|
67
67
|
importConsole?: boolean;
|
|
68
68
|
/**
|
|
69
69
|
* 该属性处于实验当中,目前只支持 vue3
|
|
@@ -83,5 +83,9 @@ export default function uniDevTool({ pages, sourceFileServers, importConsole, vu
|
|
|
83
83
|
}[];
|
|
84
84
|
}[];
|
|
85
85
|
};
|
|
86
|
+
/** 排除导入 console 的目录 */
|
|
87
|
+
excludeImportConsole?: string[];
|
|
88
|
+
/** 排除导入 DevTool 的目录 */
|
|
89
|
+
excludeImportDevTool?: string[];
|
|
86
90
|
}): Plugin;
|
|
87
91
|
//# sourceMappingURL=uniDevTool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"uniDevTool.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/uniDevTool/uniDevTool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAsBnC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,KAAK,EACL,iBAAiB,EACjB,aAAa,EACb,UAAc,EACd,oBAAqE,EACrE,oBAAsD,EACtD,GAAG,KAAK,EACT,EAAE;IACD,qCAAqC;IACrC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,gBAAgB;IAChB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe;IACf,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa;IACb,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,wBAAwB;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB;IAClB,KAAK,EAAE;QACL,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1B,WAAW,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,EAAE,CAAA;SAAE,EAAE,CAAC;KAC7D,CAAC;IACF,wBAAwB;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,wBAAwB;IACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC,GAAG,MAAM,CA0GT"}
|
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const y=require("path"),j=require("fs"),o=require("../utils/index.js"),b=require("./transform/transformMain.js"),q=require("./transform/transformApp.js"),w=require("./transform/transformVue.js");function d(i){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const u in i)if(u!=="default"){const p=Object.getOwnPropertyDescriptor(i,u);Object.defineProperty(a,u,p.get?p:{enumerable:!0,get:()=>i[u]})}}return a.default=i,Object.freeze(a)}const A=d(y),T=d(j),f={isReady:!1,urls:[]};function L({pages:i,sourceFileServers:a,importConsole:u,vueVersion:p=3,excludeImportConsole:S=["uni_modules","node_modules","src/App.vue"],excludeImportDevTool:v=["uni_modules","node_modules"],..._}){return{name:"vite-uni-dev-tool",enforce:"pre",configureServer(t){var c;t.middlewares.use((n,s,r)=>{const{originalUrl:e}=n;if(_.useDevSource&&(e!=null&&e.includes("__dev_sourcefile__"))){const l=e.replace("/__dev_sourcefile__","");try{const m=t.config.root,g=A.join(m,l),h=T.readFileSync(g,"utf-8");s.setHeader("Content-Type",o.getContentType(g)),s.end(h)}catch{r()}}else r()}),(c=t.httpServer)==null||c.once("listening",()=>{var r;const n=(r=t.httpServer)==null?void 0:r.address(),s=o.getLocalIPs();if(n&&!Array.isArray(n)&&typeof n!="string"){const e=s.map(l=>`http://${l}:${n.port}/__dev_sourcefile__`);f.isReady=!0,f.urls=e,console.warn(`
|
|
2
2
|
⚡️ vite-uni-dev-tool source file server running at:
|
|
3
|
-
${
|
|
3
|
+
${s.map(l=>`➜ Source File Network: http://${l}:${n==null?void 0:n.port}/__dev_sourcefile__`).join(`
|
|
4
4
|
`)}
|
|
5
|
-
`)}})},transform(t,
|
|
6
|
-
`);let e=[...n];const r=o.findInsertionIndex(e,p=>p.trim().startsWith("import")||p.trim().startsWith("export"));r!==-1&&e.splice(r,0,`import DevTool from 'vite-uni-dev-tool/dist/v${d}/DevTool/index.vue';`);const c=o.findInsertionIndex(e,p=>p.includes(".mount(")||p.includes("createApp("));if(c!==-1&&e.splice(c+1,0," app.component('DevTool', DevTool);"),e.length!==n.length)return{code:e.join(`
|
|
7
|
-
`),map:null}}catch(n){return console.error("[DevTool] 转换 main 文件时出错:",n),{code:t,map:null}}if(a.endsWith("/src/App.vue")){const n=t.match(_);if(n&&n[1]){const e=n[1].trim(),r=o.hasImportCurrentInstance(e),c=o.hasImportOnLaunch(e),p=r?"":"import { getCurrentInstance } from 'vue'",f=c?"":"import { onLaunch } from '@dcloudio/uni-app'",s=`
|
|
8
|
-
import { initDevTool${u?", console":""} } from 'vite-uni-dev-tool/dist/core';
|
|
9
|
-
import pagesJson from './pages.json';
|
|
10
|
-
${e}
|
|
11
|
-
onLaunch(() => {
|
|
12
|
-
const vue3instance = getCurrentInstance();
|
|
13
|
-
initDevTool({
|
|
14
|
-
pagesJson,
|
|
15
|
-
vue3instance,
|
|
16
|
-
mode: import.meta.env.MODE,
|
|
17
|
-
sourceFileServers: [
|
|
18
|
-
${[...S.urls??[],...v??[]].map(g=>`'${g}'`)}
|
|
19
|
-
],
|
|
20
|
-
...${JSON.stringify($)},
|
|
21
|
-
});
|
|
22
|
-
});`;return{code:t.replace(_,`
|
|
23
|
-
<script lang="ts" setup>
|
|
24
|
-
${p}
|
|
25
|
-
${f}
|
|
26
|
-
${s}
|
|
27
|
-
<\/script>`),map:null}}return{code:t,map:null}}if(a.endsWith(".vue")){const n=t.includes("<template>"),e=l.pages.some(s=>a.includes(s.path)),r=(i=l.subPackages)==null?void 0:i.some(s=>s.pages.some(m=>a.includes(`${s.root}/${m.path}`))),c=["<DevTool />"],p=o.hasImportConsole(t),f=o.hasUseConsole(t);if(!p&&f&&!a.endsWith("/src/App.vue")){const s=t.match(_);if(s&&s[1]){const m=s[1],g=`
|
|
28
|
-
${u?"import { console } from 'vite-uni-dev-tool/dist/core';":""}
|
|
29
|
-
${m}
|
|
30
|
-
`;let h="<script>";o.hasLangTS(t)||o.hasSetup(t)?h='<script lang="ts" setup>':o.hasLangJS(t)||o.hasSetup(t)?h='<script lang="js" setup>':o.hasLangJS(t)?h='<script lang="js">':o.hasLangTS(t)?h='<script lang="ts">':o.hasSetup(t)&&(h="<script setup>"),t=t.replace(_,`
|
|
31
|
-
${h}
|
|
32
|
-
${g}
|
|
33
|
-
<\/script>`)}}if((e||r)&&n){const s=o.getTemplateContent(t);let m=t;if(s){const g=`<view>${s}
|
|
34
|
-
${c.join(`
|
|
35
|
-
`)}</view>`;m=t.replace(s,g)}return{code:m,map:null}}}return{code:t,map:null}}}}module.exports=D;
|
|
5
|
+
`)}})},transform(t,c){const n=o.hasLangTS(t),s=o.hasLangJS(t),r=o.hasSetup(t);let e="<script>";return n&&r?e='<script lang="ts" setup>':s&&r?e='<script lang="js" setup>':s?e='<script lang="js">':n?e='<script lang="ts">':r&&(e="<script setup>"),o.isMainFile(c)?b.transformMain({code:t,vueVersion:p}):o.isAppVue(c)?q.transformApp({code:t,isSetup:r,importConsole:u,scriptRow:e,netWorkInfo:f,sourceFileServers:a,reset:_}):o.isVueFile(c)?w.transformVue({id:c,code:t,pages:i,scriptRow:e,importConsole:u,excludeImportConsole:S,excludeImportDevTool:v}):{code:t,map:null}}}}module.exports=L;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export declare const regScript: RegExp;
|
|
1
2
|
export declare function findInsertionIndex(lines: string[], condition: (p: string) => boolean): number;
|
|
2
3
|
export declare function getContentType(filePath: string): string;
|
|
3
4
|
export declare function getLocalIPs(): string[];
|
|
5
|
+
export declare function hasImportVue(str: string): boolean;
|
|
4
6
|
export declare function hasImportOnLaunch(str: string): boolean;
|
|
5
7
|
export declare function hasImportCurrentInstance(str: string): boolean;
|
|
6
8
|
export declare function hasImportConsole(str: string): boolean;
|
|
@@ -61,4 +63,34 @@ export declare function parseQueryString(queryString: string): any;
|
|
|
61
63
|
* @return {*}
|
|
62
64
|
*/
|
|
63
65
|
export declare function getTemplateContent(code: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* 检查路径中是否包含指定的目录或文件名
|
|
68
|
+
*
|
|
69
|
+
* @export
|
|
70
|
+
* @param {string} path 路径
|
|
71
|
+
* @param {string[]} dirs 待检查的目录或文件名
|
|
72
|
+
* @return {*}
|
|
73
|
+
*/
|
|
74
|
+
export declare function hasDirOrFile(path: string, dirs: string[]): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 判断是否是 App.vue 文件
|
|
77
|
+
*
|
|
78
|
+
* @param {string} id
|
|
79
|
+
* @return {*}
|
|
80
|
+
*/
|
|
81
|
+
export declare const isAppVue: (id: string) => boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 判断是否是 main.ts|js 文件
|
|
84
|
+
*
|
|
85
|
+
* @param {string} id
|
|
86
|
+
* @return {*}
|
|
87
|
+
*/
|
|
88
|
+
export declare const isMainFile: (id: string) => boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 判断是否是 .vue 文件
|
|
91
|
+
*
|
|
92
|
+
* @param {string} id
|
|
93
|
+
* @return {*}
|
|
94
|
+
*/
|
|
95
|
+
export declare const isVueFile: (id: string) => boolean;
|
|
64
96
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugins/src/plugins/utils/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EAAE,EACf,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,GAChC,MAAM,CAOR;AAGD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,UAe9C;AAGD,wBAAgB,WAAW,aAiB1B;AAKD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEtD;AAKD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE7D;AAID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAGD,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAID,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,WAarC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,WAWrC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,WAYpC;AAID;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;;;;;EAQvC;AAGD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,UAGtC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAGvC;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,UAG5C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,OA4BnD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,C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C,IAAI,EAAE,MAAM,UAqD9C;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAkCxD;AAED;;;;;GAKG;AAEH,eAAO,MAAM,QAAQ,OAAQ,MAAM,YAElC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,OAAQ,MAAM,YAEpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,OAAQ,MAAM,YAEnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("path"),f=require("os");function p(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const m=p(h),d=p(f),S=/<script[^>]*>([\s\S]*?)<\/script>/;function x(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n+1;return-1}function I(t){const e=m.extname(t).toLowerCase();return{".html":"text/html",".js":"text/javascript",".css":"text/css",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".woff":"font/woff",".woff2":"font/woff2"}[e]||"text/plain"}function y(){const t=d.networkInterfaces(),e=[];return Object.keys(t).forEach(n=>{var s;t!=null&&t[n]&&Array.isArray(t==null?void 0:t[n])&&((s=t==null?void 0:t[n])==null||s.forEach(o=>{o.family==="IPv4"&&!o.internal&&e.push(o.address)}))}),e.push("localhost"),e}const T=/import\s*\{[^}]*Vue[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function L(t){return T.test(t)}const j=/import\s*\{[^}]*onLaunch[^}]*\}\s*from\s+['"]@dcloudio\/uni-app['"];?/;function C(t){return j.test(t)}const v=/import\s*\{[^}]*getCurrentInstance[^}]*\}\s*from\s+['"]vue['"];?/;function b(t){return v.test(t)}const O=/import\s*\{[^}]*console[^}]*\}\s*from\s+['"]vite-uni-dev-tool['"];?/;function w(t){return O.test(t)}const M=/console\.\w+\(/;function P(t){return M.test(t)}const l=/<script[^>]*>/;function R(t){const e=t.match(l);if(!e)return!1;const n=e[0];return/lang=['"]ts['"]/.test(n)}function V(t){const e=t.match(l);if(!e)return!1;const n=e[0];return/lang=['"]js['"]/.test(n)}function D(t){const e=t.match(l);if(!e)return!1;const n=e[0];return/\ssetup(?=\s|>)/.test(n)}function F(t){let e=0,n=-1,s=-1,o="";const a=/<template(\s[^>]*)?>/g,c=/<\/template>/g,r=[];let u;for(;(u=a.exec(t))!==null;)r.push({index:u.index,type:"start",length:u[0].length});for(;(u=c.exec(t))!==null;)r.push({index:u.index,type:"end",length:u[0].length});r.sort((i,g)=>i.index-g.index);for(const i of r)if(i.type==="start")e===0&&(n=i.index+i.length),e++;else if(i.type==="end"&&(e--,e===0)){s=i.index,o=t.substring(n,s);break}return o.trim()}function A(t,e){const n=t.replace(/\\/g,"/");return n.split("/").filter(a=>a.length>0).some(a=>e.some(c=>{const r=c.replace(/\\/g,"/");return r.includes("/")?n.endsWith(r):r===a}))?!0:e.some(a=>{const c=a.replace(/\\/g,"/");return c.includes("/")?n.includes(c):!1})}const _=t=>t.endsWith("/src/App.vue"),k=t=>t.includes("/src/main.ts")||t.includes("/src/main.js"),z=t=>t.endsWith(".vue");exports.findInsertionIndex=x;exports.getContentType=I;exports.getLocalIPs=y;exports.getTemplateContent=F;exports.hasDirOrFile=A;exports.hasImportConsole=w;exports.hasImportCurrentInstance=b;exports.hasImportOnLaunch=C;exports.hasImportVue=L;exports.hasLangJS=V;exports.hasLangTS=R;exports.hasSetup=D;exports.hasUseConsole=P;exports.isAppVue=_;exports.isMainFile=k;exports.isVueFile=z;exports.regScript=S;
|
package/dist/type.d.ts
CHANGED
|
@@ -73,8 +73,8 @@ export declare namespace DevTool {
|
|
|
73
73
|
sourceFileServers?: string[];
|
|
74
74
|
/** 用于区分生产环境和开发环境,开发环境下,为了获取 Android 异常栈源码会获取本地源码进行展示 */
|
|
75
75
|
mode: string;
|
|
76
|
-
/** 用于捕获
|
|
77
|
-
|
|
76
|
+
/** 用于捕获 vue 抛出的错误和警告 */
|
|
77
|
+
vueInstance?: any;
|
|
78
78
|
/**
|
|
79
79
|
* 该属性处于实验当中,谨慎使用
|
|
80
80
|
* 读取开发环境 source file,source map,默认 禁用
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../dev/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,IAAI,GAAG;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,EAAE;YACL,sBAAsB,CAAC,EAAE,MAAM,CAAC;SACjC,CAAC;KACH,CAAC;IAEF,KAAK,OAAO,GAAG;QACb,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAC1B,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IAEF,KAAK,EAAE,GAAG;QACR,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAA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