@vtj/parser 0.18.1 → 0.18.3
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/index.cjs +8 -8
- package/dist/index.mjs +522 -510
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -13,16 +13,16 @@ import * as q from "@babel/types";
|
|
|
13
13
|
* Copyright (c) 2026, VTJ.PRO All rights reserved.
|
|
14
14
|
* @name @vtj/parser
|
|
15
15
|
* @author CHC chenhuachun1549@dingtalk.com
|
|
16
|
-
* @version 0.18.
|
|
16
|
+
* @version 0.18.3
|
|
17
17
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
18
18
|
*/
|
|
19
|
-
const l0 = "0.18.
|
|
20
|
-
function
|
|
21
|
-
const { descriptor: u, errors: t } = Uu(e), a = u.template?.content || "", r = !!u.scriptSetup, n = (u.scriptSetup || u.script)?.content || "",
|
|
19
|
+
const l0 = "0.18.3";
|
|
20
|
+
function M(e) {
|
|
21
|
+
const { descriptor: u, errors: t } = Uu(e), a = u.template?.content || "", r = !!u.scriptSetup, n = (u.scriptSetup || u.script)?.content || "", s = u.styles.map((i) => i.content);
|
|
22
22
|
return {
|
|
23
23
|
template: a,
|
|
24
24
|
script: n,
|
|
25
|
-
styles:
|
|
25
|
+
styles: s,
|
|
26
26
|
errors: t,
|
|
27
27
|
isScriptSetup: r
|
|
28
28
|
};
|
|
@@ -77,17 +77,17 @@ function au(e) {
|
|
|
77
77
|
u === "type" || u === "loc" || u === "start" || u === "end" || u === "extra" || u === "leadingComments" || u === "trailingComments" || u === "innerComments" || u === "errors" || au(e[u]);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function su(e) {
|
|
81
81
|
return !!e && e.type === "JSExpression";
|
|
82
82
|
}
|
|
83
83
|
function we(e) {
|
|
84
84
|
return typeof e == "object" && !!e && e.type === "JSFunction";
|
|
85
85
|
}
|
|
86
86
|
function du(e) {
|
|
87
|
-
return !!
|
|
87
|
+
return !!su(e) || !!we(e);
|
|
88
88
|
}
|
|
89
89
|
function Ie(e) {
|
|
90
|
-
return !!e && !
|
|
90
|
+
return !!e && !su(e) && typeof e != "string";
|
|
91
91
|
}
|
|
92
92
|
function Ju(e, u) {
|
|
93
93
|
try {
|
|
@@ -139,34 +139,34 @@ function ke(e, u) {
|
|
|
139
139
|
const t = [];
|
|
140
140
|
try {
|
|
141
141
|
const { descriptor: a, errors: r } = Uu(e);
|
|
142
|
-
if (r && r.length > 0 && r.forEach((
|
|
143
|
-
const
|
|
142
|
+
if (r && r.length > 0 && r.forEach((s) => {
|
|
143
|
+
const i = s.message || String(s), o = s.loc;
|
|
144
144
|
o && o.start ? t.push(
|
|
145
|
-
`Vue SFC 错误: ${
|
|
146
|
-
) : t.push(`Vue SFC 错误: ${
|
|
145
|
+
`Vue SFC 错误: ${i} (位置: ${o.start.line}:${o.start.column})`
|
|
146
|
+
) : t.push(`Vue SFC 错误: ${i}`);
|
|
147
147
|
}), a.template)
|
|
148
148
|
try {
|
|
149
|
-
const
|
|
149
|
+
const s = Gu({
|
|
150
150
|
id: "validation",
|
|
151
151
|
filename: u,
|
|
152
152
|
source: a.template.content,
|
|
153
153
|
isProd: !1
|
|
154
154
|
});
|
|
155
|
-
|
|
156
|
-
const o = typeof
|
|
155
|
+
s.errors && s.errors.length > 0 && s.errors.forEach((i) => {
|
|
156
|
+
const o = typeof i == "string" ? i : i.message, c = typeof i == "string" ? null : i.loc;
|
|
157
157
|
c && c.start ? t.push(
|
|
158
158
|
`模板编译错误: ${o} (位置: ${c.start.line}:${c.start.column})`
|
|
159
159
|
) : t.push(`模板编译错误: ${o}`);
|
|
160
160
|
});
|
|
161
|
-
} catch (
|
|
162
|
-
t.push(`模板编译错误: ${
|
|
161
|
+
} catch (s) {
|
|
162
|
+
t.push(`模板编译错误: ${s.message}`);
|
|
163
163
|
}
|
|
164
164
|
const n = (a.scriptSetup || a.script)?.content;
|
|
165
165
|
if (n)
|
|
166
166
|
try {
|
|
167
167
|
B(n);
|
|
168
|
-
} catch (
|
|
169
|
-
t.push(`脚本语法错误: ${
|
|
168
|
+
} catch (s) {
|
|
169
|
+
t.push(`脚本语法错误: ${s.message}`);
|
|
170
170
|
}
|
|
171
171
|
} catch (a) {
|
|
172
172
|
t.push(`Vue SFC 解析错误: ${a.message}`);
|
|
@@ -174,15 +174,15 @@ function ke(e, u) {
|
|
|
174
174
|
return t.length > 0 ? t : null;
|
|
175
175
|
}
|
|
176
176
|
function f0(e) {
|
|
177
|
-
const u =
|
|
177
|
+
const u = M(e), t = B(u.script), a = {};
|
|
178
178
|
return u.styles && (a.css = u.styles[0] || ""), J(t, {
|
|
179
179
|
CallExpression(r) {
|
|
180
180
|
const n = r.node.callee?.name;
|
|
181
181
|
if (n) {
|
|
182
|
-
const
|
|
183
|
-
|
|
182
|
+
const s = A(r.node.arguments[0]);
|
|
183
|
+
s && (a[n] = {
|
|
184
184
|
type: "JSFunction",
|
|
185
|
-
value:
|
|
185
|
+
value: s
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -201,58 +201,58 @@ function Te(e, u, t) {
|
|
|
201
201
|
try {
|
|
202
202
|
a = B(e);
|
|
203
203
|
} catch {
|
|
204
|
-
const
|
|
205
|
-
a = B(c), r =
|
|
204
|
+
const i = "(()=>{", c = i + e + "})";
|
|
205
|
+
a = B(c), r = i.length;
|
|
206
206
|
}
|
|
207
207
|
const n = [];
|
|
208
208
|
if (J(a, {
|
|
209
|
-
Identifier(
|
|
210
|
-
const o =
|
|
209
|
+
Identifier(i) {
|
|
210
|
+
const o = i.node;
|
|
211
211
|
if (o.name !== u) return;
|
|
212
|
-
const c = Ve(
|
|
212
|
+
const c = Ve(i);
|
|
213
213
|
if (c === "skip") return;
|
|
214
214
|
const d = (o.start ?? 0) - r, l = (o.end ?? 0) - r;
|
|
215
215
|
if (d < 0 || l > e.length) return;
|
|
216
216
|
const p = c === "expand" ? `${u}: ${t}` : t;
|
|
217
217
|
n.some((b) => b.start === d && b.end === l) || n.push({ start: d, end: l, text: p });
|
|
218
218
|
},
|
|
219
|
-
StringLiteral(
|
|
220
|
-
Ne(
|
|
219
|
+
StringLiteral(i) {
|
|
220
|
+
Ne(i, u, t, r, e, n);
|
|
221
221
|
},
|
|
222
|
-
TemplateLiteral(
|
|
223
|
-
je(
|
|
222
|
+
TemplateLiteral(i) {
|
|
223
|
+
je(i, u, t, r, e, n);
|
|
224
224
|
},
|
|
225
|
-
MemberExpression(
|
|
226
|
-
wu(
|
|
225
|
+
MemberExpression(i) {
|
|
226
|
+
wu(i, u, t, r, e, n);
|
|
227
227
|
},
|
|
228
|
-
OptionalMemberExpression(
|
|
229
|
-
wu(
|
|
228
|
+
OptionalMemberExpression(i) {
|
|
229
|
+
wu(i, u, t, r, e, n);
|
|
230
230
|
}
|
|
231
231
|
}), n.length === 0) return e;
|
|
232
|
-
n.sort((
|
|
233
|
-
let
|
|
234
|
-
for (const { start:
|
|
235
|
-
|
|
236
|
-
return
|
|
232
|
+
n.sort((i, o) => o.start - i.start);
|
|
233
|
+
let s = e;
|
|
234
|
+
for (const { start: i, end: o, text: c } of n)
|
|
235
|
+
s = s.slice(0, i) + c + s.slice(o);
|
|
236
|
+
return s;
|
|
237
237
|
}
|
|
238
238
|
function Ne(e, u, t, a, r, n) {
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
239
|
+
const s = e.node;
|
|
240
|
+
if (!s.value.includes(u)) return;
|
|
241
|
+
const i = e.parent;
|
|
242
|
+
if (i?.type !== "NewExpression" || i?.callee?.name !== "RegExp")
|
|
243
243
|
return;
|
|
244
|
-
const o =
|
|
244
|
+
const o = s.value;
|
|
245
245
|
let c = 0;
|
|
246
246
|
for (; c < o.length; ) {
|
|
247
247
|
const d = o.indexOf(u, c);
|
|
248
248
|
if (d === -1) break;
|
|
249
|
-
const l = 1 + d, p = (
|
|
249
|
+
const l = 1 + d, p = (s.start ?? 0) - a + l, b = p + u.length;
|
|
250
250
|
p >= 0 && b <= r.length && !n.some((h) => h.start === p && h.end === b) && n.push({ start: p, end: b, text: t }), c = d + u.length;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
function je(e, u, t, a, r, n) {
|
|
254
|
-
const
|
|
255
|
-
if (
|
|
254
|
+
const s = e.parent;
|
|
255
|
+
if (s?.type !== "NewExpression" || s?.callee?.name !== "RegExp")
|
|
256
256
|
return;
|
|
257
257
|
const o = e.node.quasis ?? [];
|
|
258
258
|
for (const c of o) {
|
|
@@ -270,11 +270,11 @@ function je(e, u, t, a, r, n) {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
function wu(e, u, t, a, r, n) {
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
273
|
+
const s = e.node;
|
|
274
|
+
if (s.object?.type !== "ThisExpression" || s.computed || s.property?.type !== "Identifier" || s.property.name !== u)
|
|
275
275
|
return;
|
|
276
|
-
const
|
|
277
|
-
|
|
276
|
+
const i = (s.start ?? 0) - a, o = (s.end ?? 0) - a;
|
|
277
|
+
i < 0 || o > r.length || n.some((c) => c.start === i && c.end === o) || n.push({ start: i, end: o, text: t });
|
|
278
278
|
}
|
|
279
279
|
function Ve(e, u) {
|
|
280
280
|
const t = e.parent, a = t?.type ?? "", r = e.parentPath?.parent;
|
|
@@ -413,8 +413,8 @@ function Iu(e, u, t) {
|
|
|
413
413
|
context: a = {},
|
|
414
414
|
computed: r = [],
|
|
415
415
|
libs: n = {},
|
|
416
|
-
members:
|
|
417
|
-
props:
|
|
416
|
+
members: s = [],
|
|
417
|
+
props: i = [],
|
|
418
418
|
platform: o
|
|
419
419
|
} = t || {}, c = Array.from(a[u || ""] || /* @__PURE__ */ new Set());
|
|
420
420
|
if (c)
|
|
@@ -422,11 +422,11 @@ function Iu(e, u, t) {
|
|
|
422
422
|
e = R(e, d, `this.context.${d}`);
|
|
423
423
|
for (const d of r)
|
|
424
424
|
e.includes(`this.${d}.value`) || (e = R(e, d, `this.${d}.value`));
|
|
425
|
-
for (const d of
|
|
425
|
+
for (const d of i)
|
|
426
426
|
e = R(e, d, `this.${d}`);
|
|
427
427
|
for (const [d, l] of Object.entries(n))
|
|
428
428
|
e = R(e, d, `this.$libs.${l}.${d}`), e = R(e, `this.${d}`, `this.$libs.${l}.${d}`);
|
|
429
|
-
for (const d of
|
|
429
|
+
for (const d of s)
|
|
430
430
|
e = R(e, d, `this.${d}`);
|
|
431
431
|
if (o === "uniapp") {
|
|
432
432
|
const d = /\suni\./g;
|
|
@@ -465,25 +465,25 @@ const Re = [
|
|
|
465
465
|
), _e = "component,slot,template".split(","), Le = "view,swiper,progress,icon,text,button,checkbox,editor,form,input,label,picker,radio,slider,switch,textarea,audio,camera,image,video,map,canvas".split(
|
|
466
466
|
","
|
|
467
467
|
);
|
|
468
|
-
function
|
|
468
|
+
function Me(e, u = "web") {
|
|
469
469
|
return u === "uniapp" && Le.includes(e);
|
|
470
470
|
}
|
|
471
|
-
function
|
|
472
|
-
return (Ce.includes(e) || _e.includes(e)) && !
|
|
471
|
+
function zu(e, u = "web") {
|
|
472
|
+
return (Ce.includes(e) || _e.includes(e)) && !Me(e, u) ? e : ge(e);
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function Xu(e) {
|
|
475
475
|
return e.replace(/\s+/g, " ").split(";").reduce((t, a) => {
|
|
476
|
-
const [r, n] = a.split(":").map((
|
|
476
|
+
const [r, n] = a.split(":").map((s) => s.trim());
|
|
477
477
|
return r && n && (t[r] = n), t;
|
|
478
478
|
}, {});
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function Pe(e, u, t) {
|
|
481
481
|
if (t === "ObjectExpression")
|
|
482
482
|
return `(Object.assign({${e.split(" ").map((r) => `'${r}': true`).join(",")}}, ${u}))`;
|
|
483
483
|
if (t === "ArrayExpression")
|
|
484
484
|
return `([${e.split(" ").map((r) => `'${r}'`).join(",")}].concat(${u}))`;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Zu(e = "") {
|
|
487
487
|
const t = e.trim().match(/DataSource:\s*([^\n=]+={0,2})/)?.[1] || "";
|
|
488
488
|
try {
|
|
489
489
|
return t ? JSON.parse(ye(t)) : null;
|
|
@@ -499,7 +499,7 @@ const Oe = /* @__PURE__ */ new Uint16Array(
|
|
|
499
499
|
/* @__PURE__ */ "Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((e) => e.charCodeAt(0))
|
|
500
500
|
);
|
|
501
501
|
var fu;
|
|
502
|
-
const
|
|
502
|
+
const $e = /* @__PURE__ */ new Map([
|
|
503
503
|
[0, 65533],
|
|
504
504
|
// C1 Unicode control character reference replacements
|
|
505
505
|
[128, 8364],
|
|
@@ -536,9 +536,9 @@ const Fe = /* @__PURE__ */ new Map([
|
|
|
536
536
|
return e > 65535 && (e -= 65536, u += String.fromCharCode(e >>> 10 & 1023 | 55296), e = 56320 | e & 1023), u += String.fromCharCode(e), u;
|
|
537
537
|
}
|
|
538
538
|
);
|
|
539
|
-
function
|
|
539
|
+
function Fe(e) {
|
|
540
540
|
var u;
|
|
541
|
-
return e >= 55296 && e <= 57343 || e > 1114111 ? 65533 : (u =
|
|
541
|
+
return e >= 55296 && e <= 57343 || e > 1114111 ? 65533 : (u = $e.get(e)) !== null && u !== void 0 ? u : e;
|
|
542
542
|
}
|
|
543
543
|
var V;
|
|
544
544
|
(function(e) {
|
|
@@ -565,13 +565,13 @@ var j;
|
|
|
565
565
|
(function(e) {
|
|
566
566
|
e[e.EntityStart = 0] = "EntityStart", e[e.NumericStart = 1] = "NumericStart", e[e.NumericDecimal = 2] = "NumericDecimal", e[e.NumericHex = 3] = "NumericHex", e[e.NamedEntity = 4] = "NamedEntity";
|
|
567
567
|
})(j || (j = {}));
|
|
568
|
-
var
|
|
568
|
+
var P;
|
|
569
569
|
(function(e) {
|
|
570
570
|
e[e.Legacy = 0] = "Legacy", e[e.Strict = 1] = "Strict", e[e.Attribute = 2] = "Attribute";
|
|
571
|
-
})(
|
|
571
|
+
})(P || (P = {}));
|
|
572
572
|
class Je {
|
|
573
573
|
constructor(u, t, a) {
|
|
574
|
-
this.decodeTree = u, this.emitCodePoint = t, this.errors = a, this.state = j.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode =
|
|
574
|
+
this.decodeTree = u, this.emitCodePoint = t, this.errors = a, this.state = j.EntityStart, this.consumed = 1, this.result = 0, this.treeIndex = 0, this.excess = 1, this.decodeMode = P.Strict;
|
|
575
575
|
}
|
|
576
576
|
/** Resets the instance to make it reusable. */
|
|
577
577
|
startEntity(u) {
|
|
@@ -679,9 +679,9 @@ class Je {
|
|
|
679
679
|
return (a = this.errors) === null || a === void 0 || a.absenceOfDigitsInNumericCharacterReference(this.consumed), 0;
|
|
680
680
|
if (u === V.SEMI)
|
|
681
681
|
this.consumed += 1;
|
|
682
|
-
else if (this.decodeMode ===
|
|
682
|
+
else if (this.decodeMode === P.Strict)
|
|
683
683
|
return 0;
|
|
684
|
-
return this.emitCodePoint(
|
|
684
|
+
return this.emitCodePoint(Fe(this.result), this.consumed), this.errors && (u !== V.SEMI && this.errors.missingSemicolonAfterCharacterReference(), this.errors.validateNumericCharacterReference(this.result)), this.consumed;
|
|
685
685
|
}
|
|
686
686
|
/**
|
|
687
687
|
* Parses a named entity.
|
|
@@ -696,16 +696,16 @@ class Je {
|
|
|
696
696
|
const { decodeTree: a } = this;
|
|
697
697
|
let r = a[this.treeIndex], n = (r & W.VALUE_LENGTH) >> 14;
|
|
698
698
|
for (; t < u.length; t++, this.excess++) {
|
|
699
|
-
const
|
|
700
|
-
if (this.treeIndex =
|
|
699
|
+
const s = u.charCodeAt(t);
|
|
700
|
+
if (this.treeIndex = ze(a, r, this.treeIndex + Math.max(1, n), s), this.treeIndex < 0)
|
|
701
701
|
return this.result === 0 || // If we are parsing an attribute
|
|
702
|
-
this.decodeMode ===
|
|
702
|
+
this.decodeMode === P.Attribute && // We shouldn't have consumed any characters after the entity,
|
|
703
703
|
(n === 0 || // And there should be no invalid characters.
|
|
704
|
-
We(
|
|
704
|
+
We(s)) ? 0 : this.emitNotTerminatedNamedEntity();
|
|
705
705
|
if (r = a[this.treeIndex], n = (r & W.VALUE_LENGTH) >> 14, n !== 0) {
|
|
706
|
-
if (
|
|
706
|
+
if (s === V.SEMI)
|
|
707
707
|
return this.emitNamedEntityData(this.treeIndex, n, this.consumed + this.excess);
|
|
708
|
-
this.decodeMode !==
|
|
708
|
+
this.decodeMode !== P.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
return -1;
|
|
@@ -744,7 +744,7 @@ class Je {
|
|
|
744
744
|
var u;
|
|
745
745
|
switch (this.state) {
|
|
746
746
|
case j.NamedEntity:
|
|
747
|
-
return this.result !== 0 && (this.decodeMode !==
|
|
747
|
+
return this.result !== 0 && (this.decodeMode !== P.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
|
|
748
748
|
// Otherwise, emit a numeric entity if we have one.
|
|
749
749
|
case j.NumericDecimal:
|
|
750
750
|
return this.emitNumericEntity(0, 2);
|
|
@@ -757,7 +757,7 @@ class Je {
|
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function ze(e, u, t, a) {
|
|
761
761
|
const r = (u & W.BRANCH_LENGTH) >> 7, n = u & W.JUMP_TABLE;
|
|
762
762
|
if (r === 0)
|
|
763
763
|
return n !== 0 && a === n ? t : -1;
|
|
@@ -765,34 +765,34 @@ function Xe(e, u, t, a) {
|
|
|
765
765
|
const o = a - n;
|
|
766
766
|
return o < 0 || o >= r ? -1 : e[t + o] - 1;
|
|
767
767
|
}
|
|
768
|
-
let
|
|
769
|
-
for (;
|
|
770
|
-
const o =
|
|
768
|
+
let s = t, i = s + r - 1;
|
|
769
|
+
for (; s <= i; ) {
|
|
770
|
+
const o = s + i >>> 1, c = e[o];
|
|
771
771
|
if (c < a)
|
|
772
|
-
|
|
772
|
+
s = o + 1;
|
|
773
773
|
else if (c > a)
|
|
774
|
-
|
|
774
|
+
i = o - 1;
|
|
775
775
|
else
|
|
776
776
|
return e[o + r];
|
|
777
777
|
}
|
|
778
778
|
return -1;
|
|
779
779
|
}
|
|
780
|
-
var
|
|
780
|
+
var y;
|
|
781
781
|
(function(e) {
|
|
782
782
|
e[e.Tab = 9] = "Tab", e[e.NewLine = 10] = "NewLine", e[e.FormFeed = 12] = "FormFeed", e[e.CarriageReturn = 13] = "CarriageReturn", e[e.Space = 32] = "Space", e[e.ExclamationMark = 33] = "ExclamationMark", e[e.Number = 35] = "Number", e[e.Amp = 38] = "Amp", e[e.SingleQuote = 39] = "SingleQuote", e[e.DoubleQuote = 34] = "DoubleQuote", e[e.Dash = 45] = "Dash", e[e.Slash = 47] = "Slash", e[e.Zero = 48] = "Zero", e[e.Nine = 57] = "Nine", e[e.Semi = 59] = "Semi", e[e.Lt = 60] = "Lt", e[e.Eq = 61] = "Eq", e[e.Gt = 62] = "Gt", e[e.Questionmark = 63] = "Questionmark", e[e.UpperA = 65] = "UpperA", e[e.LowerA = 97] = "LowerA", e[e.UpperF = 70] = "UpperF", e[e.LowerF = 102] = "LowerF", e[e.UpperZ = 90] = "UpperZ", e[e.LowerZ = 122] = "LowerZ", e[e.LowerX = 120] = "LowerX", e[e.OpeningSquareBracket = 91] = "OpeningSquareBracket";
|
|
783
|
-
})(
|
|
783
|
+
})(y || (y = {}));
|
|
784
784
|
var f;
|
|
785
785
|
(function(e) {
|
|
786
786
|
e[e.Text = 1] = "Text", e[e.BeforeTagName = 2] = "BeforeTagName", e[e.InTagName = 3] = "InTagName", e[e.InSelfClosingTag = 4] = "InSelfClosingTag", e[e.BeforeClosingTagName = 5] = "BeforeClosingTagName", e[e.InClosingTagName = 6] = "InClosingTagName", e[e.AfterClosingTagName = 7] = "AfterClosingTagName", e[e.BeforeAttributeName = 8] = "BeforeAttributeName", e[e.InAttributeName = 9] = "InAttributeName", e[e.AfterAttributeName = 10] = "AfterAttributeName", e[e.BeforeAttributeValue = 11] = "BeforeAttributeValue", e[e.InAttributeValueDq = 12] = "InAttributeValueDq", e[e.InAttributeValueSq = 13] = "InAttributeValueSq", e[e.InAttributeValueNq = 14] = "InAttributeValueNq", e[e.BeforeDeclaration = 15] = "BeforeDeclaration", e[e.InDeclaration = 16] = "InDeclaration", e[e.InProcessingInstruction = 17] = "InProcessingInstruction", e[e.BeforeComment = 18] = "BeforeComment", e[e.CDATASequence = 19] = "CDATASequence", e[e.InSpecialComment = 20] = "InSpecialComment", e[e.InCommentLike = 21] = "InCommentLike", e[e.BeforeSpecialS = 22] = "BeforeSpecialS", e[e.BeforeSpecialT = 23] = "BeforeSpecialT", e[e.SpecialStartSequence = 24] = "SpecialStartSequence", e[e.InSpecialTag = 25] = "InSpecialTag", e[e.InEntity = 26] = "InEntity";
|
|
787
787
|
})(f || (f = {}));
|
|
788
788
|
function U(e) {
|
|
789
|
-
return e ===
|
|
789
|
+
return e === y.Space || e === y.NewLine || e === y.Tab || e === y.FormFeed || e === y.CarriageReturn;
|
|
790
790
|
}
|
|
791
791
|
function tu(e) {
|
|
792
|
-
return e ===
|
|
792
|
+
return e === y.Slash || e === y.Gt || U(e);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
795
|
-
return e >=
|
|
794
|
+
function Xe(e) {
|
|
795
|
+
return e >= y.LowerA && e <= y.LowerZ || e >= y.UpperA && e <= y.UpperZ;
|
|
796
796
|
}
|
|
797
797
|
var O;
|
|
798
798
|
(function(e) {
|
|
@@ -827,7 +827,7 @@ const N = {
|
|
|
827
827
|
XmpEnd: new Uint8Array([60, 47, 120, 109, 112])
|
|
828
828
|
// `</xmp`
|
|
829
829
|
};
|
|
830
|
-
class
|
|
830
|
+
class Ze {
|
|
831
831
|
constructor({ xmlMode: u = !1, decodeEntities: t = !0 }, a) {
|
|
832
832
|
this.cbs = a, this.state = f.Text, this.buffer = "", this.sectionStart = 0, this.index = 0, this.entityStart = 0, this.baseState = f.Text, this.isSpecial = !1, this.running = !0, this.offset = 0, this.currentSequence = void 0, this.sequenceIndex = 0, this.xmlMode = u, this.decodeEntities = t, this.entityDecoder = new Je(u ? Be : Oe, (r, n) => this.emitCodePoint(r, n));
|
|
833
833
|
}
|
|
@@ -847,7 +847,7 @@ class Qe {
|
|
|
847
847
|
this.running = !0, this.index < this.buffer.length + this.offset && this.parse();
|
|
848
848
|
}
|
|
849
849
|
stateText(u) {
|
|
850
|
-
u ===
|
|
850
|
+
u === y.Lt || !this.decodeEntities && this.fastForwardTo(y.Lt) ? (this.index > this.sectionStart && this.cbs.ontext(this.sectionStart, this.index), this.state = f.BeforeTagName, this.sectionStart = this.index) : this.decodeEntities && u === y.Amp && this.startEntity();
|
|
851
851
|
}
|
|
852
852
|
stateSpecialStartSequence(u) {
|
|
853
853
|
const t = this.sequenceIndex === this.currentSequence.length;
|
|
@@ -868,7 +868,7 @@ class Qe {
|
|
|
868
868
|
/** Look for an end tag. For <title> tags, also decode entities. */
|
|
869
869
|
stateInSpecialTag(u) {
|
|
870
870
|
if (this.sequenceIndex === this.currentSequence.length) {
|
|
871
|
-
if (u ===
|
|
871
|
+
if (u === y.Gt || U(u)) {
|
|
872
872
|
const t = this.index - this.currentSequence.length;
|
|
873
873
|
if (this.sectionStart < t) {
|
|
874
874
|
const a = this.index;
|
|
@@ -879,7 +879,7 @@ class Qe {
|
|
|
879
879
|
}
|
|
880
880
|
this.sequenceIndex = 0;
|
|
881
881
|
}
|
|
882
|
-
(u | 32) === this.currentSequence[this.sequenceIndex] ? this.sequenceIndex += 1 : this.sequenceIndex === 0 ? this.currentSequence === N.TitleEnd ? this.decodeEntities && u ===
|
|
882
|
+
(u | 32) === this.currentSequence[this.sequenceIndex] ? this.sequenceIndex += 1 : this.sequenceIndex === 0 ? this.currentSequence === N.TitleEnd ? this.decodeEntities && u === y.Amp && this.startEntity() : this.fastForwardTo(y.Lt) && (this.sequenceIndex = 1) : this.sequenceIndex = +(u === y.Lt);
|
|
883
883
|
}
|
|
884
884
|
stateCDATASequence(u) {
|
|
885
885
|
u === N.Cdata[this.sequenceIndex] ? ++this.sequenceIndex === N.Cdata.length && (this.state = f.InCommentLike, this.currentSequence = N.CdataEnd, this.sequenceIndex = 0, this.sectionStart = this.index + 1) : (this.sequenceIndex = 0, this.state = f.InDeclaration, this.stateInDeclaration(u));
|
|
@@ -914,74 +914,74 @@ class Qe {
|
|
|
914
914
|
* We allow anything that wouldn't end the tag.
|
|
915
915
|
*/
|
|
916
916
|
isTagStartChar(u) {
|
|
917
|
-
return this.xmlMode ? !tu(u) :
|
|
917
|
+
return this.xmlMode ? !tu(u) : Xe(u);
|
|
918
918
|
}
|
|
919
919
|
startSpecial(u, t) {
|
|
920
920
|
this.isSpecial = !0, this.currentSequence = u, this.sequenceIndex = t, this.state = f.SpecialStartSequence;
|
|
921
921
|
}
|
|
922
922
|
stateBeforeTagName(u) {
|
|
923
|
-
if (u ===
|
|
923
|
+
if (u === y.ExclamationMark)
|
|
924
924
|
this.state = f.BeforeDeclaration, this.sectionStart = this.index + 1;
|
|
925
|
-
else if (u ===
|
|
925
|
+
else if (u === y.Questionmark)
|
|
926
926
|
this.state = f.InProcessingInstruction, this.sectionStart = this.index + 1;
|
|
927
927
|
else if (this.isTagStartChar(u)) {
|
|
928
928
|
const t = u | 32;
|
|
929
929
|
this.sectionStart = this.index, this.xmlMode ? this.state = f.InTagName : t === N.ScriptEnd[2] ? this.state = f.BeforeSpecialS : t === N.TitleEnd[2] || t === N.XmpEnd[2] ? this.state = f.BeforeSpecialT : this.state = f.InTagName;
|
|
930
|
-
} else u ===
|
|
930
|
+
} else u === y.Slash ? this.state = f.BeforeClosingTagName : (this.state = f.Text, this.stateText(u));
|
|
931
931
|
}
|
|
932
932
|
stateInTagName(u) {
|
|
933
933
|
tu(u) && (this.cbs.onopentagname(this.sectionStart, this.index), this.sectionStart = -1, this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u));
|
|
934
934
|
}
|
|
935
935
|
stateBeforeClosingTagName(u) {
|
|
936
|
-
U(u) || (u ===
|
|
936
|
+
U(u) || (u === y.Gt ? this.state = f.Text : (this.state = this.isTagStartChar(u) ? f.InClosingTagName : f.InSpecialComment, this.sectionStart = this.index));
|
|
937
937
|
}
|
|
938
938
|
stateInClosingTagName(u) {
|
|
939
|
-
(u ===
|
|
939
|
+
(u === y.Gt || U(u)) && (this.cbs.onclosetag(this.sectionStart, this.index), this.sectionStart = -1, this.state = f.AfterClosingTagName, this.stateAfterClosingTagName(u));
|
|
940
940
|
}
|
|
941
941
|
stateAfterClosingTagName(u) {
|
|
942
|
-
(u ===
|
|
942
|
+
(u === y.Gt || this.fastForwardTo(y.Gt)) && (this.state = f.Text, this.sectionStart = this.index + 1);
|
|
943
943
|
}
|
|
944
944
|
stateBeforeAttributeName(u) {
|
|
945
|
-
u ===
|
|
945
|
+
u === y.Gt ? (this.cbs.onopentagend(this.index), this.isSpecial ? (this.state = f.InSpecialTag, this.sequenceIndex = 0) : this.state = f.Text, this.sectionStart = this.index + 1) : u === y.Slash ? this.state = f.InSelfClosingTag : U(u) || (this.state = f.InAttributeName, this.sectionStart = this.index);
|
|
946
946
|
}
|
|
947
947
|
stateInSelfClosingTag(u) {
|
|
948
|
-
u ===
|
|
948
|
+
u === y.Gt ? (this.cbs.onselfclosingtag(this.index), this.state = f.Text, this.sectionStart = this.index + 1, this.isSpecial = !1) : U(u) || (this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u));
|
|
949
949
|
}
|
|
950
950
|
stateInAttributeName(u) {
|
|
951
|
-
(u ===
|
|
951
|
+
(u === y.Eq || tu(u)) && (this.cbs.onattribname(this.sectionStart, this.index), this.sectionStart = this.index, this.state = f.AfterAttributeName, this.stateAfterAttributeName(u));
|
|
952
952
|
}
|
|
953
953
|
stateAfterAttributeName(u) {
|
|
954
|
-
u ===
|
|
954
|
+
u === y.Eq ? this.state = f.BeforeAttributeValue : u === y.Slash || u === y.Gt ? (this.cbs.onattribend(O.NoValue, this.sectionStart), this.sectionStart = -1, this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : U(u) || (this.cbs.onattribend(O.NoValue, this.sectionStart), this.state = f.InAttributeName, this.sectionStart = this.index);
|
|
955
955
|
}
|
|
956
956
|
stateBeforeAttributeValue(u) {
|
|
957
|
-
u ===
|
|
957
|
+
u === y.DoubleQuote ? (this.state = f.InAttributeValueDq, this.sectionStart = this.index + 1) : u === y.SingleQuote ? (this.state = f.InAttributeValueSq, this.sectionStart = this.index + 1) : U(u) || (this.sectionStart = this.index, this.state = f.InAttributeValueNq, this.stateInAttributeValueNoQuotes(u));
|
|
958
958
|
}
|
|
959
959
|
handleInAttributeValue(u, t) {
|
|
960
|
-
u === t || !this.decodeEntities && this.fastForwardTo(t) ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(t ===
|
|
960
|
+
u === t || !this.decodeEntities && this.fastForwardTo(t) ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(t === y.DoubleQuote ? O.Double : O.Single, this.index + 1), this.state = f.BeforeAttributeName) : this.decodeEntities && u === y.Amp && this.startEntity();
|
|
961
961
|
}
|
|
962
962
|
stateInAttributeValueDoubleQuotes(u) {
|
|
963
|
-
this.handleInAttributeValue(u,
|
|
963
|
+
this.handleInAttributeValue(u, y.DoubleQuote);
|
|
964
964
|
}
|
|
965
965
|
stateInAttributeValueSingleQuotes(u) {
|
|
966
|
-
this.handleInAttributeValue(u,
|
|
966
|
+
this.handleInAttributeValue(u, y.SingleQuote);
|
|
967
967
|
}
|
|
968
968
|
stateInAttributeValueNoQuotes(u) {
|
|
969
|
-
U(u) || u ===
|
|
969
|
+
U(u) || u === y.Gt ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(O.Unquoted, this.index), this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : this.decodeEntities && u === y.Amp && this.startEntity();
|
|
970
970
|
}
|
|
971
971
|
stateBeforeDeclaration(u) {
|
|
972
|
-
u ===
|
|
972
|
+
u === y.OpeningSquareBracket ? (this.state = f.CDATASequence, this.sequenceIndex = 0) : this.state = u === y.Dash ? f.BeforeComment : f.InDeclaration;
|
|
973
973
|
}
|
|
974
974
|
stateInDeclaration(u) {
|
|
975
|
-
(u ===
|
|
975
|
+
(u === y.Gt || this.fastForwardTo(y.Gt)) && (this.cbs.ondeclaration(this.sectionStart, this.index), this.state = f.Text, this.sectionStart = this.index + 1);
|
|
976
976
|
}
|
|
977
977
|
stateInProcessingInstruction(u) {
|
|
978
|
-
(u ===
|
|
978
|
+
(u === y.Gt || this.fastForwardTo(y.Gt)) && (this.cbs.onprocessinginstruction(this.sectionStart, this.index), this.state = f.Text, this.sectionStart = this.index + 1);
|
|
979
979
|
}
|
|
980
980
|
stateBeforeComment(u) {
|
|
981
|
-
u ===
|
|
981
|
+
u === y.Dash ? (this.state = f.InCommentLike, this.currentSequence = N.CommentEnd, this.sequenceIndex = 2, this.sectionStart = this.index + 1) : this.state = f.InDeclaration;
|
|
982
982
|
}
|
|
983
983
|
stateInSpecialComment(u) {
|
|
984
|
-
(u ===
|
|
984
|
+
(u === y.Gt || this.fastForwardTo(y.Gt)) && (this.cbs.oncomment(this.sectionStart, this.index, 0), this.state = f.Text, this.sectionStart = this.index + 1);
|
|
985
985
|
}
|
|
986
986
|
stateBeforeSpecialS(u) {
|
|
987
987
|
const t = u | 32;
|
|
@@ -1006,7 +1006,7 @@ class Qe {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
1008
|
startEntity() {
|
|
1009
|
-
this.baseState = this.state, this.state = f.InEntity, this.entityStart = this.index, this.entityDecoder.startEntity(this.xmlMode ?
|
|
1009
|
+
this.baseState = this.state, this.state = f.InEntity, this.entityStart = this.index, this.entityDecoder.startEntity(this.xmlMode ? P.Strict : this.baseState === f.Text || this.baseState === f.InSpecialTag ? P.Legacy : P.Attribute);
|
|
1010
1010
|
}
|
|
1011
1011
|
stateInEntity() {
|
|
1012
1012
|
const u = this.entityDecoder.write(this.buffer, this.index - this.offset);
|
|
@@ -1151,7 +1151,7 @@ class Qe {
|
|
|
1151
1151
|
this.baseState !== f.Text && this.baseState !== f.InSpecialTag ? (this.sectionStart < this.entityStart && this.cbs.onattribdata(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.onattribentity(u)) : (this.sectionStart < this.entityStart && this.cbs.ontext(this.sectionStart, this.entityStart), this.sectionStart = this.entityStart + t, this.index = this.sectionStart - 1, this.cbs.ontextentity(u, this.sectionStart));
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
|
-
const
|
|
1154
|
+
const X = /* @__PURE__ */ new Set([
|
|
1155
1155
|
"input",
|
|
1156
1156
|
"option",
|
|
1157
1157
|
"optgroup",
|
|
@@ -1159,7 +1159,7 @@ const z = /* @__PURE__ */ new Set([
|
|
|
1159
1159
|
"button",
|
|
1160
1160
|
"datalist",
|
|
1161
1161
|
"textarea"
|
|
1162
|
-
]), k = /* @__PURE__ */ new Set(["p"]), ku = /* @__PURE__ */ new Set(["thead", "tbody"]), Tu = /* @__PURE__ */ new Set(["dd", "dt"]), Nu = /* @__PURE__ */ new Set(["rt", "rp"]),
|
|
1162
|
+
]), k = /* @__PURE__ */ new Set(["p"]), ku = /* @__PURE__ */ new Set(["thead", "tbody"]), Tu = /* @__PURE__ */ new Set(["dd", "dt"]), Nu = /* @__PURE__ */ new Set(["rt", "rp"]), Qe = /* @__PURE__ */ new Map([
|
|
1163
1163
|
["tr", /* @__PURE__ */ new Set(["tr", "th", "td"])],
|
|
1164
1164
|
["th", /* @__PURE__ */ new Set(["th"])],
|
|
1165
1165
|
["td", /* @__PURE__ */ new Set(["thead", "th", "td"])],
|
|
@@ -1172,12 +1172,12 @@ const z = /* @__PURE__ */ new Set([
|
|
|
1172
1172
|
["h4", k],
|
|
1173
1173
|
["h5", k],
|
|
1174
1174
|
["h6", k],
|
|
1175
|
-
["select",
|
|
1176
|
-
["input",
|
|
1177
|
-
["output",
|
|
1178
|
-
["button",
|
|
1179
|
-
["datalist",
|
|
1180
|
-
["textarea",
|
|
1175
|
+
["select", X],
|
|
1176
|
+
["input", X],
|
|
1177
|
+
["output", X],
|
|
1178
|
+
["button", X],
|
|
1179
|
+
["datalist", X],
|
|
1180
|
+
["textarea", X],
|
|
1181
1181
|
["option", /* @__PURE__ */ new Set(["option"])],
|
|
1182
1182
|
["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])],
|
|
1183
1183
|
["dd", Tu],
|
|
@@ -1240,8 +1240,8 @@ const z = /* @__PURE__ */ new Set([
|
|
|
1240
1240
|
]), Ye = /\s|\//;
|
|
1241
1241
|
class ut {
|
|
1242
1242
|
constructor(u, t = {}) {
|
|
1243
|
-
var a, r, n,
|
|
1244
|
-
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (r = t.lowerCaseAttributeNames) !== null && r !== void 0 ? r : this.htmlMode, this.recognizeSelfClosing = (n = t.recognizeSelfClosing) !== null && n !== void 0 ? n : !this.htmlMode, this.tokenizer = new ((
|
|
1243
|
+
var a, r, n, s, i, o;
|
|
1244
|
+
this.options = t, this.startIndex = 0, this.endIndex = 0, this.openTagStart = 0, this.tagname = "", this.attribname = "", this.attribvalue = "", this.attribs = null, this.stack = [], this.buffers = [], this.bufferOffset = 0, this.writeIndex = 0, this.ended = !1, this.cbs = u ?? {}, this.htmlMode = !this.options.xmlMode, this.lowerCaseTagNames = (a = t.lowerCaseTags) !== null && a !== void 0 ? a : this.htmlMode, this.lowerCaseAttributeNames = (r = t.lowerCaseAttributeNames) !== null && r !== void 0 ? r : this.htmlMode, this.recognizeSelfClosing = (n = t.recognizeSelfClosing) !== null && n !== void 0 ? n : !this.htmlMode, this.tokenizer = new ((s = t.Tokenizer) !== null && s !== void 0 ? s : Ze)(this.options, this), this.foreignContext = [!this.htmlMode], (o = (i = this.cbs).onparserinit) === null || o === void 0 || o.call(i, this);
|
|
1245
1245
|
}
|
|
1246
1246
|
// Tokenizer event handlers
|
|
1247
1247
|
/** @internal */
|
|
@@ -1271,11 +1271,11 @@ class ut {
|
|
|
1271
1271
|
emitOpenTag(u) {
|
|
1272
1272
|
var t, a, r, n;
|
|
1273
1273
|
this.openTagStart = this.startIndex, this.tagname = u;
|
|
1274
|
-
const
|
|
1275
|
-
if (
|
|
1276
|
-
for (; this.stack.length > 0 &&
|
|
1277
|
-
const
|
|
1278
|
-
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t,
|
|
1274
|
+
const s = this.htmlMode && Qe.get(u);
|
|
1275
|
+
if (s)
|
|
1276
|
+
for (; this.stack.length > 0 && s.has(this.stack[0]); ) {
|
|
1277
|
+
const i = this.stack.shift();
|
|
1278
|
+
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t, i, !0);
|
|
1279
1279
|
}
|
|
1280
1280
|
this.isVoidElement(u) || (this.stack.unshift(u), this.htmlMode && (ju.has(u) ? this.foreignContext.unshift(!0) : Vu.has(u) && this.foreignContext.unshift(!1))), (n = (r = this.cbs).onopentagname) === null || n === void 0 || n.call(r, u), this.cbs.onopentag && (this.attribs = {});
|
|
1281
1281
|
}
|
|
@@ -1289,11 +1289,11 @@ class ut {
|
|
|
1289
1289
|
}
|
|
1290
1290
|
/** @internal */
|
|
1291
1291
|
onclosetag(u, t) {
|
|
1292
|
-
var a, r, n,
|
|
1292
|
+
var a, r, n, s, i, o, c, d;
|
|
1293
1293
|
this.endIndex = t;
|
|
1294
1294
|
let l = this.getSlice(u, t);
|
|
1295
1295
|
if (this.lowerCaseTagNames && (l = l.toLowerCase()), this.htmlMode && (ju.has(l) || Vu.has(l)) && this.foreignContext.shift(), this.isVoidElement(l))
|
|
1296
|
-
this.htmlMode && l === "br" && ((
|
|
1296
|
+
this.htmlMode && l === "br" && ((s = (n = this.cbs).onopentagname) === null || s === void 0 || s.call(n, "br"), (o = (i = this.cbs).onopentag) === null || o === void 0 || o.call(i, "br", {}, !0), (d = (c = this.cbs).onclosetag) === null || d === void 0 || d.call(c, "br", !1));
|
|
1297
1297
|
else {
|
|
1298
1298
|
const p = this.stack.indexOf(l);
|
|
1299
1299
|
if (p !== -1)
|
|
@@ -1360,15 +1360,15 @@ class ut {
|
|
|
1360
1360
|
}
|
|
1361
1361
|
/** @internal */
|
|
1362
1362
|
oncomment(u, t, a) {
|
|
1363
|
-
var r, n,
|
|
1364
|
-
this.endIndex = t, (n = (r = this.cbs).oncomment) === null || n === void 0 || n.call(r, this.getSlice(u, t - a)), (
|
|
1363
|
+
var r, n, s, i;
|
|
1364
|
+
this.endIndex = t, (n = (r = this.cbs).oncomment) === null || n === void 0 || n.call(r, this.getSlice(u, t - a)), (i = (s = this.cbs).oncommentend) === null || i === void 0 || i.call(s), this.startIndex = t + 1;
|
|
1365
1365
|
}
|
|
1366
1366
|
/** @internal */
|
|
1367
1367
|
oncdata(u, t, a) {
|
|
1368
|
-
var r, n,
|
|
1368
|
+
var r, n, s, i, o, c, d, l, p, b;
|
|
1369
1369
|
this.endIndex = t;
|
|
1370
1370
|
const h = this.getSlice(u, t - a);
|
|
1371
|
-
!this.htmlMode || this.options.recognizeCDATA ? ((n = (r = this.cbs).oncdatastart) === null || n === void 0 || n.call(r), (
|
|
1371
|
+
!this.htmlMode || this.options.recognizeCDATA ? ((n = (r = this.cbs).oncdatastart) === null || n === void 0 || n.call(r), (i = (s = this.cbs).ontext) === null || i === void 0 || i.call(s, h), (c = (o = this.cbs).oncdataend) === null || c === void 0 || c.call(o)) : ((l = (d = this.cbs).oncomment) === null || l === void 0 || l.call(d, `[CDATA[${h}]]`), (b = (p = this.cbs).oncommentend) === null || b === void 0 || b.call(p)), this.startIndex = t + 1;
|
|
1372
1372
|
}
|
|
1373
1373
|
/** @internal */
|
|
1374
1374
|
onend() {
|
|
@@ -1471,22 +1471,22 @@ function qu(e, u = "web") {
|
|
|
1471
1471
|
let r = "";
|
|
1472
1472
|
const n = new ut(
|
|
1473
1473
|
{
|
|
1474
|
-
onopentag: (
|
|
1474
|
+
onopentag: (s, i, o) => {
|
|
1475
1475
|
const c = a[a.length - 1];
|
|
1476
1476
|
r.trim() && (Array.isArray(c.children) ? c.children.push({
|
|
1477
1477
|
name: "span",
|
|
1478
1478
|
children: r.trim()
|
|
1479
1479
|
}) : c.children = r.trim(), r = "");
|
|
1480
|
-
const d = Object.entries(
|
|
1480
|
+
const d = Object.entries(i || {}).reduce(
|
|
1481
1481
|
(p, b) => {
|
|
1482
1482
|
let [h = "", S = ""] = b;
|
|
1483
1483
|
return h && (p[h] = S), p;
|
|
1484
1484
|
},
|
|
1485
1485
|
{}
|
|
1486
1486
|
);
|
|
1487
|
-
d.style && (d.style =
|
|
1487
|
+
d.style && (d.style = Xu(d.style));
|
|
1488
1488
|
const l = {
|
|
1489
|
-
name:
|
|
1489
|
+
name: zu(s, u),
|
|
1490
1490
|
props: d
|
|
1491
1491
|
};
|
|
1492
1492
|
Array.isArray(c.children) ? c.children.push(l) : c.children ? c.children = [
|
|
@@ -1497,16 +1497,16 @@ function qu(e, u = "web") {
|
|
|
1497
1497
|
l
|
|
1498
1498
|
] : c.children = [l], o || a.push(l);
|
|
1499
1499
|
},
|
|
1500
|
-
ontext: (
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1500
|
+
ontext: (s) => {
|
|
1501
|
+
const i = s.trim();
|
|
1502
|
+
i && i !== '"' && (r += i);
|
|
1503
1503
|
},
|
|
1504
1504
|
onclosetag: () => {
|
|
1505
|
-
const
|
|
1506
|
-
r.trim() && (Array.isArray(
|
|
1505
|
+
const s = a.pop();
|
|
1506
|
+
r.trim() && (Array.isArray(s?.children) ? s.children.push({
|
|
1507
1507
|
name: "span",
|
|
1508
1508
|
children: r.trim()
|
|
1509
|
-
}) :
|
|
1509
|
+
}) : s && (s.children = r.trim()), r = "");
|
|
1510
1510
|
}
|
|
1511
1511
|
},
|
|
1512
1512
|
{ decodeEntities: !0 }
|
|
@@ -1521,25 +1521,25 @@ function et(e, u) {
|
|
|
1521
1521
|
}, r = B(e);
|
|
1522
1522
|
return J(r, {
|
|
1523
1523
|
ExportDefaultDeclaration(n) {
|
|
1524
|
-
const
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1527
|
-
if (
|
|
1528
|
-
const o =
|
|
1524
|
+
const s = n.node.declaration;
|
|
1525
|
+
if (s.type !== "CallExpression") return;
|
|
1526
|
+
const i = s.arguments[0];
|
|
1527
|
+
if (i?.type !== "ObjectExpression") return;
|
|
1528
|
+
const o = i.properties.filter(
|
|
1529
1529
|
(l) => l.type === "ObjectProperty"
|
|
1530
|
-
), c =
|
|
1530
|
+
), c = i.properties.filter(
|
|
1531
1531
|
(l) => l.type == "ObjectMethod"
|
|
1532
1532
|
), d = o.find(
|
|
1533
1533
|
(l) => l.key.name === "computed"
|
|
1534
1534
|
);
|
|
1535
|
-
d && (a.computed =
|
|
1535
|
+
d && (a.computed = Qu(d.value), a.watchers = ct(d.value));
|
|
1536
1536
|
for (const l of o)
|
|
1537
1537
|
switch (l.key.name) {
|
|
1538
1538
|
case "name":
|
|
1539
1539
|
a.name = l.value.value;
|
|
1540
1540
|
break;
|
|
1541
1541
|
case "methods":
|
|
1542
|
-
a.handlers =
|
|
1542
|
+
a.handlers = it(l.value), a.methods = st(l.value), a.dataSources = nt(
|
|
1543
1543
|
l.value,
|
|
1544
1544
|
u
|
|
1545
1545
|
);
|
|
@@ -1572,29 +1572,29 @@ function et(e, u) {
|
|
|
1572
1572
|
a.lifeCycles = dt(c);
|
|
1573
1573
|
},
|
|
1574
1574
|
CallExpression(n) {
|
|
1575
|
-
const
|
|
1576
|
-
if (
|
|
1577
|
-
for (let
|
|
1578
|
-
a.emits?.find((c) => c.name ===
|
|
1575
|
+
const s = bt(n.node);
|
|
1576
|
+
if (s.length)
|
|
1577
|
+
for (let i of s)
|
|
1578
|
+
a.emits?.find((c) => c.name === i.name) || a.emits?.push(i);
|
|
1579
1579
|
}
|
|
1580
1580
|
}), a;
|
|
1581
1581
|
}
|
|
1582
1582
|
function tt(e) {
|
|
1583
1583
|
const u = /import\s+{(.+?)}\s+from\s+['"](.+?)['"]/g, t = /import\s+(.+?)\s+from\s+['"](.+?)['"]/g, a = /^{(.+?)}$/, r = [];
|
|
1584
1584
|
let n;
|
|
1585
|
-
const
|
|
1586
|
-
for (; (n = u.exec(
|
|
1587
|
-
const
|
|
1585
|
+
const s = e.replace(/\n/g, " ");
|
|
1586
|
+
for (; (n = u.exec(s)) !== null; ) {
|
|
1587
|
+
const i = n[2] === "@element-plus/icons-vue" ? "@vtj/icons" : n[2];
|
|
1588
1588
|
r.push({
|
|
1589
|
-
from:
|
|
1589
|
+
from: i,
|
|
1590
1590
|
imports: n[1].split(",").map((o) => o.trim())
|
|
1591
1591
|
});
|
|
1592
1592
|
}
|
|
1593
|
-
for (; (n = t.exec(
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1593
|
+
for (; (n = t.exec(s)) !== null; ) {
|
|
1594
|
+
const i = n[1], o = n[2];
|
|
1595
|
+
i && !a.test(i) && r.push({
|
|
1596
1596
|
from: o,
|
|
1597
|
-
imports:
|
|
1597
|
+
imports: i
|
|
1598
1598
|
});
|
|
1599
1599
|
}
|
|
1600
1600
|
return r;
|
|
@@ -1616,43 +1616,43 @@ function rt(e) {
|
|
|
1616
1616
|
if (a.type === "ObjectProperty") {
|
|
1617
1617
|
const { key: r, value: n } = a;
|
|
1618
1618
|
if (r.type === "Identifier") {
|
|
1619
|
-
const
|
|
1620
|
-
t[r.name] = T(
|
|
1619
|
+
const s = A(n);
|
|
1620
|
+
t[r.name] = T(s);
|
|
1621
1621
|
}
|
|
1622
1622
|
} else if (a.type === "ObjectMethod") {
|
|
1623
|
-
const { key: r, params: n, body:
|
|
1623
|
+
const { key: r, params: n, body: s } = a;
|
|
1624
1624
|
if (r.type === "Identifier") {
|
|
1625
|
-
const
|
|
1625
|
+
const i = A(s), c = `(${n.map((d) => d.name || "none").join(",")}) => ${i}`;
|
|
1626
1626
|
t[r.name] = T(c);
|
|
1627
1627
|
}
|
|
1628
1628
|
}
|
|
1629
1629
|
return t;
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1632
|
-
const { key: u, async: t, params: a, body: r } = e, n = a?.map((
|
|
1631
|
+
function z(e) {
|
|
1632
|
+
const { key: u, async: t, params: a, body: r } = e, n = a?.map((s) => s.type === "ObjectPattern" ? `{${s.properties.map((o) => o.key?.name || o.name).join(",")}}` : s.type === "AssignmentPattern" ? s.left.name + "=" + (s.right?.extra?.raw || "null") : s.name).join(", ");
|
|
1633
1633
|
if (u.type === "Identifier") {
|
|
1634
|
-
const
|
|
1635
|
-
let
|
|
1636
|
-
r && (
|
|
1634
|
+
const s = u.name;
|
|
1635
|
+
let i = "{}";
|
|
1636
|
+
r && (i = A(r) || "{}");
|
|
1637
1637
|
const o = e.value;
|
|
1638
1638
|
if (o && o.type === "CallExpression") {
|
|
1639
1639
|
let b = A(o) || "";
|
|
1640
|
-
b = b.replace("function () {", "() => {"),
|
|
1640
|
+
b = b.replace("function () {", "() => {"), i = `{ return (${b})}`;
|
|
1641
1641
|
}
|
|
1642
|
-
const d = `${t ? "async " : ""}(${n}) => ${
|
|
1642
|
+
const d = `${t ? "async " : ""}(${n}) => ${i}`, l = s.startsWith("watcher_");
|
|
1643
1643
|
return {
|
|
1644
|
-
id: l ?
|
|
1645
|
-
name:
|
|
1644
|
+
id: l ? s.replace("watcher_", "") : "",
|
|
1645
|
+
name: s,
|
|
1646
1646
|
watcher: l,
|
|
1647
1647
|
exp: C(d)
|
|
1648
1648
|
};
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
function
|
|
1651
|
+
function Qu(e) {
|
|
1652
1652
|
if (!e) return {};
|
|
1653
1653
|
const u = {};
|
|
1654
1654
|
for (const t of e.properties) {
|
|
1655
|
-
const a =
|
|
1655
|
+
const a = z(t);
|
|
1656
1656
|
a && !a.watcher && !a.exp.value.includes("this.provider.createMock") && !a.exp.value.includes("this.provider.apis") && (u[a.name] = a.exp);
|
|
1657
1657
|
}
|
|
1658
1658
|
return u;
|
|
@@ -1660,26 +1660,26 @@ function Zu(e) {
|
|
|
1660
1660
|
function nt(e, u) {
|
|
1661
1661
|
if (!e) return {};
|
|
1662
1662
|
const t = {}, a = /apis\['([\w]*)'\]/, r = (n) => {
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1665
|
-
let
|
|
1666
|
-
for (; o < n.length &&
|
|
1663
|
+
const s = n.indexOf(".then(");
|
|
1664
|
+
if (s === -1) return null;
|
|
1665
|
+
let i = 1, o = s + 6;
|
|
1666
|
+
for (; o < n.length && i > 0; ) {
|
|
1667
1667
|
const c = n[o];
|
|
1668
|
-
c === "(" ?
|
|
1668
|
+
c === "(" ? i++ : c === ")" && i--, o++;
|
|
1669
1669
|
}
|
|
1670
|
-
return n.substring(
|
|
1670
|
+
return n.substring(s + 6, o - 1).trim();
|
|
1671
1671
|
};
|
|
1672
1672
|
for (const n of e.properties) {
|
|
1673
|
-
const
|
|
1674
|
-
if (
|
|
1675
|
-
const l = (
|
|
1673
|
+
const s = z(n), i = n.body.body?.[0], o = (i?.leadingComments?.[0].value || "").trim(), c = Zu(o);
|
|
1674
|
+
if (s && s.exp.value.includes("this.provider.apis")) {
|
|
1675
|
+
const l = (s.exp.value.match(a) || [])[1];
|
|
1676
1676
|
if (!l) continue;
|
|
1677
1677
|
const p = mt(u, l);
|
|
1678
1678
|
if (!p) continue;
|
|
1679
|
-
const b = r(
|
|
1680
|
-
t[
|
|
1679
|
+
const b = r(s.exp.value);
|
|
1680
|
+
t[s.name] = {
|
|
1681
1681
|
ref: l,
|
|
1682
|
-
name:
|
|
1682
|
+
name: s.name,
|
|
1683
1683
|
test: c?.test || {
|
|
1684
1684
|
type: "JSFunction",
|
|
1685
1685
|
value: `() => this.runApi({
|
|
@@ -1697,11 +1697,11 @@ function nt(e, u) {
|
|
|
1697
1697
|
mockTemplate: p.mockTemplate
|
|
1698
1698
|
};
|
|
1699
1699
|
}
|
|
1700
|
-
if (
|
|
1701
|
-
const d =
|
|
1702
|
-
t[
|
|
1700
|
+
if (s && s.exp.value.includes("this.provider.createMock")) {
|
|
1701
|
+
const d = i?.declarations?.[0]?.init?.arguments?.[0], l = r(s.exp.value);
|
|
1702
|
+
t[s.name] = {
|
|
1703
1703
|
ref: "",
|
|
1704
|
-
name:
|
|
1704
|
+
name: s.name,
|
|
1705
1705
|
test: c?.test || {
|
|
1706
1706
|
type: "JSFunction",
|
|
1707
1707
|
value: `() => this.runApi({
|
|
@@ -1725,13 +1725,13 @@ function nt(e, u) {
|
|
|
1725
1725
|
}
|
|
1726
1726
|
return t;
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1729
|
-
const u =
|
|
1728
|
+
function st(e) {
|
|
1729
|
+
const u = Qu(e), t = /\_([\w]{5,})$/, a = {};
|
|
1730
1730
|
for (const r of Object.keys(u))
|
|
1731
1731
|
t.test(r) || (a[r] = u[r]);
|
|
1732
1732
|
return a;
|
|
1733
1733
|
}
|
|
1734
|
-
function
|
|
1734
|
+
function it(e) {
|
|
1735
1735
|
if (!e) return {};
|
|
1736
1736
|
const u = {}, t = /\_([\w]{5,})$/;
|
|
1737
1737
|
for (const a of e.properties) {
|
|
@@ -1744,7 +1744,7 @@ function st(e) {
|
|
|
1744
1744
|
);
|
|
1745
1745
|
u[r] = C(n);
|
|
1746
1746
|
} else
|
|
1747
|
-
u[r] =
|
|
1747
|
+
u[r] = z(a)?.exp;
|
|
1748
1748
|
} catch (n) {
|
|
1749
1749
|
console.warn(n);
|
|
1750
1750
|
}
|
|
@@ -1755,7 +1755,7 @@ function ct(e) {
|
|
|
1755
1755
|
if (!e) return {};
|
|
1756
1756
|
const u = {};
|
|
1757
1757
|
for (const t of e.properties) {
|
|
1758
|
-
const a =
|
|
1758
|
+
const a = z(t);
|
|
1759
1759
|
a && a.watcher && (u[a.name] = a.exp);
|
|
1760
1760
|
}
|
|
1761
1761
|
return u;
|
|
@@ -1773,41 +1773,41 @@ function Du(e, u) {
|
|
|
1773
1773
|
(a) => a.key?.name === u
|
|
1774
1774
|
);
|
|
1775
1775
|
if (t)
|
|
1776
|
-
return
|
|
1776
|
+
return z(t)?.exp;
|
|
1777
1777
|
}
|
|
1778
1778
|
function ot(e, u = {}) {
|
|
1779
1779
|
const t = [];
|
|
1780
1780
|
for (const a of e.properties) {
|
|
1781
|
-
const { key: r, value: n } = a,
|
|
1782
|
-
if (u[
|
|
1783
|
-
const
|
|
1781
|
+
const { key: r, value: n } = a, s = r.value || r.name || "";
|
|
1782
|
+
if (u[s]) {
|
|
1783
|
+
const i = n.properties;
|
|
1784
1784
|
t.push({
|
|
1785
|
-
id:
|
|
1786
|
-
source: u[
|
|
1787
|
-
deep: Y(
|
|
1788
|
-
immediate: Y(
|
|
1789
|
-
handler: Du(
|
|
1785
|
+
id: s.replace("watcher_", ""),
|
|
1786
|
+
source: u[s],
|
|
1787
|
+
deep: Y(i, "deep"),
|
|
1788
|
+
immediate: Y(i, "immediate"),
|
|
1789
|
+
handler: Du(i, "handler")
|
|
1790
1790
|
});
|
|
1791
1791
|
} else if (a.type === "ObjectMethod" && t.push({
|
|
1792
1792
|
id: nu(),
|
|
1793
1793
|
source: {
|
|
1794
1794
|
type: "JSFunction",
|
|
1795
|
-
value: `() => { return this.${
|
|
1795
|
+
value: `() => { return this.${s}; }`
|
|
1796
1796
|
},
|
|
1797
1797
|
deep: !1,
|
|
1798
1798
|
immediate: !1,
|
|
1799
|
-
handler:
|
|
1799
|
+
handler: z(a)?.exp
|
|
1800
1800
|
}), a.type === "ObjectProperty") {
|
|
1801
|
-
const
|
|
1801
|
+
const i = n.properties;
|
|
1802
1802
|
t.push({
|
|
1803
1803
|
id: nu(),
|
|
1804
1804
|
source: {
|
|
1805
1805
|
type: "JSFunction",
|
|
1806
|
-
value: `() => { return this.${
|
|
1806
|
+
value: `() => { return this.${s}; }`
|
|
1807
1807
|
},
|
|
1808
|
-
deep: Y(
|
|
1809
|
-
immediate: Y(
|
|
1810
|
-
handler: Du(
|
|
1808
|
+
deep: Y(i, "deep"),
|
|
1809
|
+
immediate: Y(i, "immediate"),
|
|
1810
|
+
handler: Du(i, "handler")
|
|
1811
1811
|
});
|
|
1812
1812
|
}
|
|
1813
1813
|
}
|
|
@@ -1818,7 +1818,7 @@ function dt(e) {
|
|
|
1818
1818
|
for (const t of e) {
|
|
1819
1819
|
const a = t.key.name;
|
|
1820
1820
|
if (Re.includes(a)) {
|
|
1821
|
-
const r =
|
|
1821
|
+
const r = z(t);
|
|
1822
1822
|
r && (u[r.name] = r.exp);
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
@@ -1867,10 +1867,10 @@ function bt(e) {
|
|
|
1867
1867
|
function pt(e) {
|
|
1868
1868
|
let u = [];
|
|
1869
1869
|
return e.type === "ObjectExpression" && (u = e.properties?.map((t) => {
|
|
1870
|
-
const { key: a, value: r } = t, n = r.properties,
|
|
1870
|
+
const { key: a, value: r } = t, n = r.properties, s = a.name, i = Ku(n, "from"), o = Yu(n);
|
|
1871
1871
|
return {
|
|
1872
|
-
name:
|
|
1873
|
-
from:
|
|
1872
|
+
name: s,
|
|
1873
|
+
from: i || s,
|
|
1874
1874
|
default: o
|
|
1875
1875
|
};
|
|
1876
1876
|
})), u;
|
|
@@ -1893,24 +1893,24 @@ function xt(e) {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
return u;
|
|
1895
1895
|
}
|
|
1896
|
-
let hu = [],
|
|
1896
|
+
let hu = [], iu = {}, ue = {}, ee = {}, te = {}, cu = "web", ae = [];
|
|
1897
1897
|
function re(e, u, t = "", a) {
|
|
1898
|
-
hu = [],
|
|
1898
|
+
hu = [], iu = {}, ue = a?.handlers || {}, te = a?.styles || {}, cu = a?.platform || "web", ae = a?.imports || [], ee = a?.directives || {};
|
|
1899
1899
|
const n = Gu({
|
|
1900
1900
|
id: e,
|
|
1901
1901
|
filename: u,
|
|
1902
1902
|
source: t,
|
|
1903
1903
|
isProd: !0,
|
|
1904
1904
|
slotted: !0
|
|
1905
|
-
}).ast?.children || [],
|
|
1906
|
-
for (const
|
|
1907
|
-
const o =
|
|
1908
|
-
Array.isArray(o) ?
|
|
1905
|
+
}).ast?.children || [], s = [];
|
|
1906
|
+
for (const i of n) {
|
|
1907
|
+
const o = Z(i);
|
|
1908
|
+
Array.isArray(o) ? s.push(...o) : s.push(o);
|
|
1909
1909
|
}
|
|
1910
1910
|
return {
|
|
1911
|
-
nodes:
|
|
1911
|
+
nodes: s.filter((i) => !!i),
|
|
1912
1912
|
slots: hu,
|
|
1913
|
-
context:
|
|
1913
|
+
context: iu
|
|
1914
1914
|
};
|
|
1915
1915
|
}
|
|
1916
1916
|
function gt(e) {
|
|
@@ -1930,16 +1930,16 @@ function yt(e) {
|
|
|
1930
1930
|
for (const t of e) {
|
|
1931
1931
|
if (t.type === v.ATTRIBUTE)
|
|
1932
1932
|
if (t.name === "class") {
|
|
1933
|
-
const a = t.value?.content || "", r = /[\w]+_[\w]{5,}/, n = a.match(r)?.[0] || "",
|
|
1934
|
-
|
|
1933
|
+
const a = t.value?.content || "", r = /[\w]+_[\w]{5,}/, n = a.match(r)?.[0] || "", s = a.split(" ").filter((o) => o !== n), i = te[`.${n}`];
|
|
1934
|
+
i && (u.style = i), s.length && (u.class = s.join(" "));
|
|
1935
1935
|
} else if (t.name === "style") {
|
|
1936
1936
|
const a = t.value?.content || "";
|
|
1937
|
-
a && (u.style =
|
|
1937
|
+
a && (u.style = Xu(a));
|
|
1938
1938
|
} else
|
|
1939
1939
|
u[t.name] = t.value?.content || "";
|
|
1940
1940
|
if (t.type === v.DIRECTIVE && t.name === "bind" && (t.exp?.type === v.SIMPLE_EXPRESSION && t.arg?.type === v.SIMPLE_EXPRESSION && (u[t.arg.content] = T(`(${t.exp.content})`)), t.exp?.type === v.COMPOUND_EXPRESSION && t.arg?.type === v.SIMPLE_EXPRESSION))
|
|
1941
1941
|
if (t.arg.content === "class" && u.class) {
|
|
1942
|
-
const a = t.exp.ast.type, r =
|
|
1942
|
+
const a = t.exp.ast.type, r = Pe(
|
|
1943
1943
|
u.class,
|
|
1944
1944
|
t.exp.loc.source,
|
|
1945
1945
|
a
|
|
@@ -1968,18 +1968,30 @@ function vt(e, u = {}) {
|
|
|
1968
1968
|
);
|
|
1969
1969
|
let n = a.exp?.loc.source || "";
|
|
1970
1970
|
n || (n = "() => {}");
|
|
1971
|
-
const
|
|
1972
|
-
if (
|
|
1971
|
+
const s = new RegExp(`${a.arg.content}_[\\w]{5,}`), i = n.match(s)?.[0] || "", o = u[i];
|
|
1972
|
+
if (i && o)
|
|
1973
1973
|
t[a.arg.content] = {
|
|
1974
1974
|
name: a.arg.content,
|
|
1975
1975
|
handler: o,
|
|
1976
1976
|
modifiers: r
|
|
1977
1977
|
};
|
|
1978
1978
|
else {
|
|
1979
|
-
const c = a.exp?.ast?.type === "CallExpression";
|
|
1979
|
+
const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", h = d === "Identifier", S = d === "MemberExpression", E = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
|
|
1980
|
+
let m;
|
|
1981
|
+
if (l)
|
|
1982
|
+
m = T(n);
|
|
1983
|
+
else if (h || S || E)
|
|
1984
|
+
m = C(n);
|
|
1985
|
+
else if (p || b) {
|
|
1986
|
+
const g = c?.body, x = c?.params;
|
|
1987
|
+
g && g.type === "Identifier" && (!x || x.length === 0) ? m = C(g.name) : m = C(n);
|
|
1988
|
+
} else {
|
|
1989
|
+
const x = /\$event\b/.test(n) ? "($event) => " : "() => ";
|
|
1990
|
+
m = C(`${x}${n}`);
|
|
1991
|
+
}
|
|
1980
1992
|
t[a.arg.content] = {
|
|
1981
1993
|
name: a.arg.content,
|
|
1982
|
-
handler:
|
|
1994
|
+
handler: m,
|
|
1983
1995
|
modifiers: r
|
|
1984
1996
|
};
|
|
1985
1997
|
}
|
|
@@ -1990,10 +2002,10 @@ function eu(e, u) {
|
|
|
1990
2002
|
const t = [], a = ["if", "for", "model", "show", "bind", "html"];
|
|
1991
2003
|
if (u && (e.type === v.IF_BRANCH || e.type === v.IF) && u.forEach((r, n) => {
|
|
1992
2004
|
if (e === r) {
|
|
1993
|
-
const
|
|
2005
|
+
const s = n === 0 ? "vIf" : r.condition ? "vElseIf" : "vElse", i = r.condition?.loc.source || "";
|
|
1994
2006
|
t.push({
|
|
1995
|
-
name:
|
|
1996
|
-
value:
|
|
2007
|
+
name: s,
|
|
2008
|
+
value: s === "vElse" ? !0 : T(i)
|
|
1997
2009
|
});
|
|
1998
2010
|
const o = e.children?.[0];
|
|
1999
2011
|
if (o) {
|
|
@@ -2019,15 +2031,15 @@ function eu(e, u) {
|
|
|
2019
2031
|
value: T(d.exp?.loc.source || "")
|
|
2020
2032
|
});
|
|
2021
2033
|
});
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2034
|
+
const s = r.find((d) => d.name === "show");
|
|
2035
|
+
s && t.push({
|
|
2024
2036
|
name: "vShow",
|
|
2025
|
-
value: T(
|
|
2037
|
+
value: T(s.exp?.loc.source || "")
|
|
2026
2038
|
});
|
|
2027
|
-
const
|
|
2028
|
-
|
|
2039
|
+
const i = r.find((d) => d.name === "bind" && !d.arg);
|
|
2040
|
+
i && t.push({
|
|
2029
2041
|
name: "vBind",
|
|
2030
|
-
value: T(
|
|
2042
|
+
value: T(i.exp?.loc.source || "")
|
|
2031
2043
|
});
|
|
2032
2044
|
const o = r.find((d) => d.name === "html");
|
|
2033
2045
|
o && t.push({
|
|
@@ -2056,11 +2068,11 @@ function ne(e) {
|
|
|
2056
2068
|
const { props: t = [], tag: a } = e;
|
|
2057
2069
|
for (const r of t)
|
|
2058
2070
|
if (r.name === "class") {
|
|
2059
|
-
const n = r.value?.content || "",
|
|
2060
|
-
u = n.match(
|
|
2071
|
+
const n = r.value?.content || "", s = new RegExp(`${a}_([\\w]+)`);
|
|
2072
|
+
u = n.match(s)?.[1] || "";
|
|
2061
2073
|
} else if (r.type === v.DIRECTIVE && r.name === "on") {
|
|
2062
|
-
const n = r.arg?.loc?.source || "",
|
|
2063
|
-
u =
|
|
2074
|
+
const n = r.arg?.loc?.source || "", s = r.exp?.loc?.source || "", i = new RegExp(`${n}_([\\w]+)`);
|
|
2075
|
+
u = s.match(i)?.[1] || "";
|
|
2064
2076
|
}
|
|
2065
2077
|
}
|
|
2066
2078
|
return u || nu();
|
|
@@ -2081,22 +2093,22 @@ function Et(e) {
|
|
|
2081
2093
|
}
|
|
2082
2094
|
}
|
|
2083
2095
|
function mu(e, u) {
|
|
2084
|
-
const t = new Set(u?.id ?
|
|
2096
|
+
const t = new Set(u?.id ? iu[u.id] : []), a = (e.directives || []).find((s) => s.name === "vFor");
|
|
2085
2097
|
let r = new Set(Array.from(t));
|
|
2086
2098
|
if (a) {
|
|
2087
|
-
const { item:
|
|
2088
|
-
r = /* @__PURE__ */ new Set([
|
|
2099
|
+
const { item: s = "item", index: i = "index" } = a.iterator || {};
|
|
2100
|
+
r = /* @__PURE__ */ new Set([s, i, ...Array.from(r)]);
|
|
2089
2101
|
}
|
|
2090
2102
|
const n = e.slot;
|
|
2091
2103
|
if (n) {
|
|
2092
|
-
const
|
|
2093
|
-
r = /* @__PURE__ */ new Set([...
|
|
2104
|
+
const s = typeof n == "string" ? [] : n.params || [], i = s.length ? s : [`scope_${u?.id}`];
|
|
2105
|
+
r = /* @__PURE__ */ new Set([...i, ...Array.from(r)]);
|
|
2094
2106
|
}
|
|
2095
|
-
|
|
2107
|
+
iu[e.id] = r;
|
|
2096
2108
|
}
|
|
2097
2109
|
function bu(e, u, t, a) {
|
|
2098
2110
|
const r = {
|
|
2099
|
-
name:
|
|
2111
|
+
name: zu(e.tag, cu),
|
|
2100
2112
|
from: Et(e.tag),
|
|
2101
2113
|
props: yt(e.props),
|
|
2102
2114
|
events: vt(e.props, ue),
|
|
@@ -2107,9 +2119,9 @@ function bu(e, u, t, a) {
|
|
|
2107
2119
|
return mu(r, u), gt(n), n;
|
|
2108
2120
|
}
|
|
2109
2121
|
function wt(e = [], u) {
|
|
2110
|
-
return e.map((t) =>
|
|
2122
|
+
return e.map((t) => Z(t, u, e));
|
|
2111
2123
|
}
|
|
2112
|
-
function
|
|
2124
|
+
function Z(e, u, t) {
|
|
2113
2125
|
if (e.type === v.ELEMENT)
|
|
2114
2126
|
return bu(e, u);
|
|
2115
2127
|
if (e.type === v.IF)
|
|
@@ -2174,11 +2186,11 @@ function ou(e, u = []) {
|
|
|
2174
2186
|
} else if (a.type === v.ELEMENT && a.tag === "template") {
|
|
2175
2187
|
const r = a.props.find((n) => n.name === "slot");
|
|
2176
2188
|
for (const n of a.children) {
|
|
2177
|
-
const
|
|
2189
|
+
const s = n.type === v.TEXT || n.type === v.TEXT_CALL ? {
|
|
2178
2190
|
name: "span",
|
|
2179
|
-
children:
|
|
2180
|
-
} :
|
|
2181
|
-
|
|
2191
|
+
children: Z(n, e)
|
|
2192
|
+
} : Z(n, e);
|
|
2193
|
+
s && (Array.isArray(s) ? s : [s]).forEach((o) => {
|
|
2182
2194
|
Ie(o) && r?.type === v.DIRECTIVE && (o.id = ne(n), o.slot = {
|
|
2183
2195
|
name: r.arg?.content || "default",
|
|
2184
2196
|
params: r.exp?.identifiers || [],
|
|
@@ -2193,17 +2205,17 @@ function ou(e, u = []) {
|
|
|
2193
2205
|
t.push(...n);
|
|
2194
2206
|
}
|
|
2195
2207
|
} else if (a.type === v.TEXT_CALL) {
|
|
2196
|
-
const r =
|
|
2208
|
+
const r = Z(a, e);
|
|
2197
2209
|
r && (Array.isArray(r) ? t.push(...r) : t.push(r));
|
|
2198
2210
|
} else {
|
|
2199
|
-
const r =
|
|
2211
|
+
const r = Z(a, e);
|
|
2200
2212
|
r && (Array.isArray(r) ? t.push(...r) : t.push(r));
|
|
2201
2213
|
}
|
|
2202
2214
|
if (t.length === 1) {
|
|
2203
2215
|
const a = t[0];
|
|
2204
|
-
e.children = typeof a == "string" ||
|
|
2216
|
+
e.children = typeof a == "string" || su(a) ? a : [a];
|
|
2205
2217
|
} else
|
|
2206
|
-
e.children = t.map((a) => typeof a == "string" ||
|
|
2218
|
+
e.children = t.map((a) => typeof a == "string" || su(a) ? { name: "span", children: a } : a);
|
|
2207
2219
|
return e;
|
|
2208
2220
|
}
|
|
2209
2221
|
function It(e) {
|
|
@@ -2257,7 +2269,7 @@ function Nt(e, u) {
|
|
|
2257
2269
|
const t = jt(e), a = Vt(t), { dependencies: r = [] } = u || {}, n = r.reduce(
|
|
2258
2270
|
(c, d) => (c[d.package] = d.library, c),
|
|
2259
2271
|
{}
|
|
2260
|
-
),
|
|
2272
|
+
), s = {
|
|
2261
2273
|
imports: t,
|
|
2262
2274
|
refs: {},
|
|
2263
2275
|
reactives: {},
|
|
@@ -2276,7 +2288,7 @@ function Nt(e, u) {
|
|
|
2276
2288
|
handlers: {},
|
|
2277
2289
|
dataSources: {},
|
|
2278
2290
|
directives: {}
|
|
2279
|
-
},
|
|
2291
|
+
}, i = [], o = B(e);
|
|
2280
2292
|
if (J(o, {
|
|
2281
2293
|
// 顶层变量声明
|
|
2282
2294
|
VariableDeclaration(c) {
|
|
@@ -2291,7 +2303,7 @@ function Nt(e, u) {
|
|
|
2291
2303
|
const E = _(p.id);
|
|
2292
2304
|
if (E) {
|
|
2293
2305
|
const m = b.arguments[0] ? A(b.arguments[0]) : "undefined";
|
|
2294
|
-
|
|
2306
|
+
s.refs[E] = T(m);
|
|
2295
2307
|
}
|
|
2296
2308
|
return;
|
|
2297
2309
|
}
|
|
@@ -2299,10 +2311,10 @@ function Nt(e, u) {
|
|
|
2299
2311
|
const E = _(p.id);
|
|
2300
2312
|
if (E)
|
|
2301
2313
|
if (E === "__state")
|
|
2302
|
-
|
|
2314
|
+
s.state = Dt(b.arguments[0]);
|
|
2303
2315
|
else {
|
|
2304
2316
|
const m = b.arguments[0] ? A(b.arguments[0]) : "{}";
|
|
2305
|
-
|
|
2317
|
+
s.reactives[E] = T(m);
|
|
2306
2318
|
}
|
|
2307
2319
|
return;
|
|
2308
2320
|
}
|
|
@@ -2310,49 +2322,49 @@ function Nt(e, u) {
|
|
|
2310
2322
|
const E = _(p.id);
|
|
2311
2323
|
if (E) {
|
|
2312
2324
|
const m = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
|
|
2313
|
-
|
|
2325
|
+
s.computed[E] = C(m);
|
|
2314
2326
|
}
|
|
2315
2327
|
return;
|
|
2316
2328
|
}
|
|
2317
2329
|
if (h === "inject") {
|
|
2318
2330
|
const E = _(p.id);
|
|
2319
2331
|
if (E) {
|
|
2320
|
-
const m = b.arguments[0],
|
|
2321
|
-
|
|
2332
|
+
const m = b.arguments[0], g = b.arguments[1], x = m ? Lu(m) : E;
|
|
2333
|
+
s.inject.push({
|
|
2322
2334
|
name: E,
|
|
2323
2335
|
from: x || E,
|
|
2324
|
-
default:
|
|
2336
|
+
default: g ? T(A(g)) : void 0
|
|
2325
2337
|
});
|
|
2326
2338
|
}
|
|
2327
2339
|
return;
|
|
2328
2340
|
}
|
|
2329
2341
|
if (h === "defineProps" || h === "withDefaults") {
|
|
2330
|
-
|
|
2342
|
+
s.props = Mu(b);
|
|
2331
2343
|
return;
|
|
2332
2344
|
}
|
|
2333
2345
|
if (h === "defineEmits") {
|
|
2334
|
-
|
|
2346
|
+
s.emits = Ou(b);
|
|
2335
2347
|
return;
|
|
2336
2348
|
}
|
|
2337
2349
|
if (h && /^use[A-Z]/.test(h)) {
|
|
2338
2350
|
const E = a.get(h);
|
|
2339
2351
|
if (qt(h, E)) {
|
|
2340
2352
|
const x = _u(p.id);
|
|
2341
|
-
x.length > 0 && (
|
|
2353
|
+
x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: h, destructure: x }));
|
|
2342
2354
|
return;
|
|
2343
2355
|
}
|
|
2344
2356
|
if (h === "useProvider") return;
|
|
2345
2357
|
if (!E)
|
|
2346
2358
|
continue;
|
|
2347
|
-
const m = _(p.id),
|
|
2348
|
-
if (m ||
|
|
2349
|
-
if (m &&
|
|
2359
|
+
const m = _(p.id), g = _u(p.id);
|
|
2360
|
+
if (m || g.length) {
|
|
2361
|
+
if (m && s.composables.some((D) => D.name === m))
|
|
2350
2362
|
return;
|
|
2351
2363
|
let x;
|
|
2352
2364
|
const w = n[E];
|
|
2353
2365
|
w ? x = `this.$libs.${w}.${h}` : x = h;
|
|
2354
2366
|
const I = {
|
|
2355
|
-
name: m ||
|
|
2367
|
+
name: m || g[0] || h,
|
|
2356
2368
|
composable: {
|
|
2357
2369
|
type: "JSExpression",
|
|
2358
2370
|
value: x
|
|
@@ -2360,7 +2372,7 @@ function Nt(e, u) {
|
|
|
2360
2372
|
};
|
|
2361
2373
|
b.arguments.length > 0 && (I.args = b.arguments.map(
|
|
2362
2374
|
(D) => T(A(D))
|
|
2363
|
-
)),
|
|
2375
|
+
)), g.length > 0 && (I.destructure = g), s.composables.push(I);
|
|
2364
2376
|
}
|
|
2365
2377
|
return;
|
|
2366
2378
|
}
|
|
@@ -2373,13 +2385,13 @@ function Nt(e, u) {
|
|
|
2373
2385
|
if (h) {
|
|
2374
2386
|
const S = A(b);
|
|
2375
2387
|
if (Bu(S)) {
|
|
2376
|
-
const E =
|
|
2388
|
+
const E = $u(h, S, u);
|
|
2377
2389
|
if (E) {
|
|
2378
|
-
|
|
2390
|
+
s.dataSources[h] = E;
|
|
2379
2391
|
return;
|
|
2380
2392
|
}
|
|
2381
2393
|
}
|
|
2382
|
-
|
|
2394
|
+
s.methods[h] = C(S);
|
|
2383
2395
|
}
|
|
2384
2396
|
return;
|
|
2385
2397
|
}
|
|
@@ -2400,7 +2412,7 @@ function Nt(e, u) {
|
|
|
2400
2412
|
}) && d.declarations.length > 0) {
|
|
2401
2413
|
for (const p of d.declarations) {
|
|
2402
2414
|
const b = _(p.id);
|
|
2403
|
-
b && p.init && (
|
|
2415
|
+
b && p.init && (s.reactives[b] = T(A(p.init)));
|
|
2404
2416
|
}
|
|
2405
2417
|
return;
|
|
2406
2418
|
}
|
|
@@ -2424,13 +2436,13 @@ function Nt(e, u) {
|
|
|
2424
2436
|
if (!d.id) return;
|
|
2425
2437
|
const l = d.id.name, p = Lt(d);
|
|
2426
2438
|
if (Bu(p)) {
|
|
2427
|
-
const b =
|
|
2439
|
+
const b = $u(l, p, u);
|
|
2428
2440
|
if (b) {
|
|
2429
|
-
|
|
2441
|
+
s.dataSources[l] = b;
|
|
2430
2442
|
return;
|
|
2431
2443
|
}
|
|
2432
2444
|
}
|
|
2433
|
-
|
|
2445
|
+
s.methods[l] = C(p);
|
|
2434
2446
|
},
|
|
2435
2447
|
// 顶层类声明 → 禁止,抛出异常
|
|
2436
2448
|
ClassDeclaration(c) {
|
|
@@ -2453,12 +2465,12 @@ function Nt(e, u) {
|
|
|
2453
2465
|
const p = Cu(l);
|
|
2454
2466
|
if (p === "watch") {
|
|
2455
2467
|
const h = _t(l);
|
|
2456
|
-
h &&
|
|
2468
|
+
h && s.watch.push(h);
|
|
2457
2469
|
return;
|
|
2458
2470
|
}
|
|
2459
2471
|
if (p && p in At) {
|
|
2460
2472
|
const h = l.arguments[0];
|
|
2461
|
-
h && (
|
|
2473
|
+
h && (s.lifeCycles[p] = C(A(h)));
|
|
2462
2474
|
return;
|
|
2463
2475
|
}
|
|
2464
2476
|
if (p === "provide") {
|
|
@@ -2467,21 +2479,21 @@ function Nt(e, u) {
|
|
|
2467
2479
|
const E = Lu(h);
|
|
2468
2480
|
if (E) {
|
|
2469
2481
|
const m = A(S);
|
|
2470
|
-
S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ?
|
|
2482
|
+
S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[E] = C(m) : s.provide[E] = T(m);
|
|
2471
2483
|
}
|
|
2472
2484
|
}
|
|
2473
2485
|
return;
|
|
2474
2486
|
}
|
|
2475
2487
|
if (p === "defineExpose") {
|
|
2476
|
-
|
|
2488
|
+
s.expose = Ct(l);
|
|
2477
2489
|
return;
|
|
2478
2490
|
}
|
|
2479
2491
|
if (p === "defineProps" || p === "withDefaults") {
|
|
2480
|
-
|
|
2492
|
+
s.props = Mu(l);
|
|
2481
2493
|
return;
|
|
2482
2494
|
}
|
|
2483
2495
|
if (p === "defineEmits") {
|
|
2484
|
-
|
|
2496
|
+
s.emits = Ou(l);
|
|
2485
2497
|
return;
|
|
2486
2498
|
}
|
|
2487
2499
|
const b = A(d);
|
|
@@ -2489,33 +2501,33 @@ function Nt(e, u) {
|
|
|
2489
2501
|
`[vtj/parser] 无法处理顶层调用语句 "${b}":DSL 不支持游离的顶层函数调用,请改用生命周期钩子(如 onMounted)或归类到方法声明中。`
|
|
2490
2502
|
);
|
|
2491
2503
|
}
|
|
2492
|
-
}),
|
|
2493
|
-
const d =
|
|
2494
|
-
|
|
2504
|
+
}), i.length > 0) {
|
|
2505
|
+
const d = i.some((l) => /\bawait\b/.test(l)) ? "async () =>" : "() =>";
|
|
2506
|
+
s.setup = C(
|
|
2495
2507
|
`${d} {
|
|
2496
|
-
${
|
|
2508
|
+
${i.join(`
|
|
2497
2509
|
`)}
|
|
2498
2510
|
}`
|
|
2499
2511
|
);
|
|
2500
2512
|
}
|
|
2501
|
-
return
|
|
2513
|
+
return s;
|
|
2502
2514
|
}
|
|
2503
2515
|
function jt(e) {
|
|
2504
2516
|
const u = /import\s+{(.+?)}\s+from\s+['"](.+?)['"]/g, t = /import\s+(.+?)\s+from\s+['"](.+?)['"]/g, a = /^{(.+?)}$/, r = [];
|
|
2505
2517
|
let n;
|
|
2506
|
-
const
|
|
2507
|
-
for (; (n = u.exec(
|
|
2508
|
-
const
|
|
2518
|
+
const s = e.replace(/\n/g, " ");
|
|
2519
|
+
for (; (n = u.exec(s)) !== null; ) {
|
|
2520
|
+
const i = n[2] === "@element-plus/icons-vue" ? "@vtj/icons" : n[2];
|
|
2509
2521
|
r.push({
|
|
2510
|
-
from:
|
|
2522
|
+
from: i,
|
|
2511
2523
|
imports: n[1].split(",").map((o) => o.trim())
|
|
2512
2524
|
});
|
|
2513
2525
|
}
|
|
2514
|
-
for (; (n = t.exec(
|
|
2515
|
-
const
|
|
2516
|
-
|
|
2526
|
+
for (; (n = t.exec(s)) !== null; ) {
|
|
2527
|
+
const i = n[1], o = n[2];
|
|
2528
|
+
i && !a.test(i) && r.push({
|
|
2517
2529
|
from: o,
|
|
2518
|
-
imports:
|
|
2530
|
+
imports: i
|
|
2519
2531
|
});
|
|
2520
2532
|
}
|
|
2521
2533
|
return r;
|
|
@@ -2557,23 +2569,23 @@ function Dt(e) {
|
|
|
2557
2569
|
} else if (t.type === "ObjectMethod") {
|
|
2558
2570
|
const a = t.key?.name;
|
|
2559
2571
|
if (a) {
|
|
2560
|
-
const r = A(t.body), n = t.params.map((
|
|
2572
|
+
const r = A(t.body), n = t.params.map((s) => s.name || "none").join(",");
|
|
2561
2573
|
u[a] = T(`(${n}) => ${r}`);
|
|
2562
2574
|
}
|
|
2563
2575
|
}
|
|
2564
2576
|
return u;
|
|
2565
2577
|
}
|
|
2566
|
-
function
|
|
2578
|
+
function Mu(e) {
|
|
2567
2579
|
if (e.callee.type === "Identifier" && e.callee.name === "withDefaults") {
|
|
2568
2580
|
const u = e.arguments[0];
|
|
2569
2581
|
if (u?.type === "CallExpression") {
|
|
2570
|
-
const t =
|
|
2582
|
+
const t = Pu(u), a = e.arguments[1];
|
|
2571
2583
|
return a?.type === "ObjectExpression" && Rt(t, a), t;
|
|
2572
2584
|
}
|
|
2573
2585
|
}
|
|
2574
|
-
return
|
|
2586
|
+
return Pu(e);
|
|
2575
2587
|
}
|
|
2576
|
-
function
|
|
2588
|
+
function Pu(e) {
|
|
2577
2589
|
const u = e.arguments[0];
|
|
2578
2590
|
return u ? u.type === "ArrayExpression" ? u.elements.map((t) => t?.type === "StringLiteral" ? t.value : "").filter(Boolean) : u.type === "ObjectExpression" ? u.properties.map((t) => {
|
|
2579
2591
|
if (t.type !== "ObjectProperty") return null;
|
|
@@ -2585,9 +2597,9 @@ function Mu(e) {
|
|
|
2585
2597
|
const r = t.value.properties;
|
|
2586
2598
|
return {
|
|
2587
2599
|
name: a,
|
|
2588
|
-
type:
|
|
2600
|
+
type: Mt(r),
|
|
2589
2601
|
required: xu(r, "required"),
|
|
2590
|
-
default:
|
|
2602
|
+
default: Pt(r)
|
|
2591
2603
|
};
|
|
2592
2604
|
}
|
|
2593
2605
|
return a;
|
|
@@ -2622,10 +2634,10 @@ function _t(e) {
|
|
|
2622
2634
|
const [u, t, a] = e.arguments;
|
|
2623
2635
|
if (!u || !t) return null;
|
|
2624
2636
|
const r = A(u), n = A(t);
|
|
2625
|
-
let
|
|
2637
|
+
let s = !1, i = !1;
|
|
2626
2638
|
if (a?.type === "ObjectExpression") {
|
|
2627
2639
|
const o = a.properties;
|
|
2628
|
-
|
|
2640
|
+
s = xu(o, "deep"), i = xu(o, "immediate");
|
|
2629
2641
|
}
|
|
2630
2642
|
return {
|
|
2631
2643
|
id: nu(),
|
|
@@ -2633,34 +2645,34 @@ function _t(e) {
|
|
|
2633
2645
|
u.type === "ArrowFunctionExpression" || u.type === "FunctionExpression" ? r : `() => { return ${r}; }`
|
|
2634
2646
|
),
|
|
2635
2647
|
handler: C(n),
|
|
2636
|
-
deep:
|
|
2637
|
-
immediate:
|
|
2648
|
+
deep: s,
|
|
2649
|
+
immediate: i
|
|
2638
2650
|
};
|
|
2639
2651
|
}
|
|
2640
2652
|
function Lt(e) {
|
|
2641
|
-
const u = e.async ? "async " : "", t = e.params.map((r) => r.type === "ObjectPattern" ? `{${r.properties.map((
|
|
2653
|
+
const u = e.async ? "async " : "", t = e.params.map((r) => r.type === "ObjectPattern" ? `{${r.properties.map((s) => s.key?.name || s.name).join(",")}}` : r.type === "AssignmentPattern" ? r.left.name + "=" + (r.right?.extra?.raw || "null") : r.name).join(", "), a = A(e.body) || "{}";
|
|
2642
2654
|
return `${u}(${t}) => ${a}`;
|
|
2643
2655
|
}
|
|
2644
2656
|
function Bu(e) {
|
|
2645
2657
|
return e.includes("__provider.apis") || e.includes("__provider.createMock");
|
|
2646
2658
|
}
|
|
2647
|
-
function
|
|
2648
|
-
const a = /apis\['([\w]*)'\]/, n =
|
|
2649
|
-
const o =
|
|
2659
|
+
function $u(e, u, t) {
|
|
2660
|
+
const a = /apis\['([\w]*)'\]/, n = Zu(""), s = (i) => {
|
|
2661
|
+
const o = i.indexOf(".then(");
|
|
2650
2662
|
if (o === -1) return null;
|
|
2651
2663
|
let c = 1, d = o + 6;
|
|
2652
|
-
for (; d <
|
|
2653
|
-
const l =
|
|
2664
|
+
for (; d < i.length && c > 0; ) {
|
|
2665
|
+
const l = i[d];
|
|
2654
2666
|
l === "(" ? c++ : l === ")" && c--, d++;
|
|
2655
2667
|
}
|
|
2656
|
-
return
|
|
2668
|
+
return i.substring(o + 6, d - 1).trim();
|
|
2657
2669
|
};
|
|
2658
2670
|
if (u.includes("__provider.apis")) {
|
|
2659
2671
|
const o = (u.match(a) || [])[1];
|
|
2660
2672
|
if (!o) return null;
|
|
2661
2673
|
const c = (t.apis || []).find((l) => l.id === o || l.name === o);
|
|
2662
2674
|
if (!c) return null;
|
|
2663
|
-
const d =
|
|
2675
|
+
const d = s(u);
|
|
2664
2676
|
return {
|
|
2665
2677
|
ref: o,
|
|
2666
2678
|
name: e,
|
|
@@ -2682,7 +2694,7 @@ function Fu(e, u, t) {
|
|
|
2682
2694
|
};
|
|
2683
2695
|
}
|
|
2684
2696
|
if (u.includes("__provider.createMock")) {
|
|
2685
|
-
const
|
|
2697
|
+
const i = s(u);
|
|
2686
2698
|
return {
|
|
2687
2699
|
ref: "",
|
|
2688
2700
|
name: e,
|
|
@@ -2696,7 +2708,7 @@ function Fu(e, u, t) {
|
|
|
2696
2708
|
label: n?.label || "",
|
|
2697
2709
|
transform: n?.transform || {
|
|
2698
2710
|
type: "JSFunction",
|
|
2699
|
-
value:
|
|
2711
|
+
value: i || `(res) => {
|
|
2700
2712
|
return res;
|
|
2701
2713
|
}`
|
|
2702
2714
|
},
|
|
@@ -2713,14 +2725,14 @@ function xu(e, u) {
|
|
|
2713
2725
|
(a) => a.key?.name === u
|
|
2714
2726
|
)?.value?.value;
|
|
2715
2727
|
}
|
|
2716
|
-
function
|
|
2728
|
+
function Mt(e) {
|
|
2717
2729
|
const u = e?.find(
|
|
2718
2730
|
(t) => t.key?.name === "type"
|
|
2719
2731
|
);
|
|
2720
2732
|
if (u)
|
|
2721
2733
|
return u.value.type === "ArrayExpression" ? u.value.elements.map((t) => t.name) : u.value.name;
|
|
2722
2734
|
}
|
|
2723
|
-
function
|
|
2735
|
+
function Pt(e) {
|
|
2724
2736
|
const u = e?.find(
|
|
2725
2737
|
(t) => t.key?.name === "default"
|
|
2726
2738
|
);
|
|
@@ -2730,15 +2742,15 @@ function Mt(e) {
|
|
|
2730
2742
|
function Ot(e) {
|
|
2731
2743
|
const u = [], t = {}, a = [];
|
|
2732
2744
|
try {
|
|
2733
|
-
const r = ve.compileString(e, { charset: !1 })?.css || "", n = Se.parse(r),
|
|
2734
|
-
for (const
|
|
2735
|
-
if (
|
|
2745
|
+
const r = ve.compileString(e, { charset: !1 })?.css || "", n = Se.parse(r), s = /^.[\w]+_[\w]{5,}/;
|
|
2746
|
+
for (const i of n.nodes)
|
|
2747
|
+
if (i.type === "rule") {
|
|
2736
2748
|
const o = {};
|
|
2737
|
-
|
|
2749
|
+
s.test(i.selector) ? (i.nodes.forEach((c) => {
|
|
2738
2750
|
c.type === "decl" && (o[c.prop] = c.value);
|
|
2739
|
-
}), t[
|
|
2751
|
+
}), t[i.selector] = o) : a.push(i.toString());
|
|
2740
2752
|
} else
|
|
2741
|
-
a.push(
|
|
2753
|
+
a.push(i.toString());
|
|
2742
2754
|
} catch (r) {
|
|
2743
2755
|
u.push(`css解析出错了,错误信息:[ ${r.message} ]
|
|
2744
2756
|
`);
|
|
@@ -2753,41 +2765,41 @@ function Ot(e) {
|
|
|
2753
2765
|
function uu(e, u, t) {
|
|
2754
2766
|
let a = "", r = 0;
|
|
2755
2767
|
const n = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g;
|
|
2756
|
-
let
|
|
2757
|
-
for (; (
|
|
2758
|
-
const
|
|
2759
|
-
a +=
|
|
2760
|
-
const o =
|
|
2761
|
-
o.startsWith("`") ? a += Bt(o, u, t) : a += o, r =
|
|
2768
|
+
let s;
|
|
2769
|
+
for (; (s = n.exec(e)) !== null; ) {
|
|
2770
|
+
const i = e.slice(r, s.index);
|
|
2771
|
+
a += i.replace(u, t);
|
|
2772
|
+
const o = s[0];
|
|
2773
|
+
o.startsWith("`") ? a += Bt(o, u, t) : a += o, r = s.index + s[0].length;
|
|
2762
2774
|
}
|
|
2763
2775
|
return a += e.slice(r).replace(u, t), a;
|
|
2764
2776
|
}
|
|
2765
2777
|
function Bt(e, u, t) {
|
|
2766
2778
|
let a = "", r = 0;
|
|
2767
2779
|
const n = /\$\{([^}]*)\}/g;
|
|
2768
|
-
let
|
|
2769
|
-
for (; (
|
|
2770
|
-
a += e.slice(r,
|
|
2771
|
-
const o =
|
|
2772
|
-
a += "${" + o + "}", r =
|
|
2780
|
+
let s;
|
|
2781
|
+
for (; (s = n.exec(e)) !== null; ) {
|
|
2782
|
+
a += e.slice(r, s.index);
|
|
2783
|
+
const o = s[1].replace(u, t);
|
|
2784
|
+
a += "${" + o + "}", r = s.index + s[0].length;
|
|
2773
2785
|
}
|
|
2774
2786
|
return a += e.slice(r), a;
|
|
2775
2787
|
}
|
|
2776
|
-
function
|
|
2788
|
+
function $t(e, u) {
|
|
2777
2789
|
if (!e) return e;
|
|
2778
2790
|
let t = e;
|
|
2779
2791
|
const a = [...u.refs, ...u.computed];
|
|
2780
2792
|
for (const r of a)
|
|
2781
2793
|
t = uu(
|
|
2782
2794
|
t,
|
|
2783
|
-
new RegExp(`(?<!\\.)\\b${
|
|
2795
|
+
new RegExp(`(?<!\\.)\\b${Q(r)}\\.value\\b`, "g"),
|
|
2784
2796
|
`this.${r}.value`
|
|
2785
2797
|
);
|
|
2786
2798
|
for (const r of a)
|
|
2787
2799
|
t = uu(
|
|
2788
2800
|
t,
|
|
2789
2801
|
new RegExp(
|
|
2790
|
-
`(?<!this\\.)(?:(?<=_ctx\\.)|(?<!\\.))\\b${
|
|
2802
|
+
`(?<!this\\.)(?:(?<=_ctx\\.)|(?<!\\.))\\b${Q(r)}\\b(?!\\.value)`,
|
|
2791
2803
|
"g"
|
|
2792
2804
|
),
|
|
2793
2805
|
`this.${r}.value`
|
|
@@ -2800,15 +2812,15 @@ function Ft(e, u) {
|
|
|
2800
2812
|
for (const [r, n] of Object.entries(
|
|
2801
2813
|
u.reverseMemberApiMap || {}
|
|
2802
2814
|
))
|
|
2803
|
-
for (const [
|
|
2815
|
+
for (const [s, i] of Object.entries(n)) {
|
|
2804
2816
|
const o = new RegExp(
|
|
2805
|
-
`\\b${
|
|
2817
|
+
`\\b${Q(r)}\\.${Q(s)}\\b`,
|
|
2806
2818
|
"g"
|
|
2807
2819
|
);
|
|
2808
|
-
t = uu(t, o, `this.${
|
|
2820
|
+
t = uu(t, o, `this.${i}`);
|
|
2809
2821
|
}
|
|
2810
2822
|
for (const r of u.props)
|
|
2811
|
-
t =
|
|
2823
|
+
t = Ft(t, "__props", r, `this.${r}`);
|
|
2812
2824
|
for (const r of u.props)
|
|
2813
2825
|
t = R(t, r, `this.${r}`);
|
|
2814
2826
|
for (const [r, n] of Object.entries(u.reverseApiMap))
|
|
@@ -2826,23 +2838,23 @@ function Ft(e, u) {
|
|
|
2826
2838
|
t = R(t, r, `this.${r}`);
|
|
2827
2839
|
return t = t.replace(/this\.this\./g, "this."), t;
|
|
2828
2840
|
}
|
|
2829
|
-
function
|
|
2841
|
+
function Q(e) {
|
|
2830
2842
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2831
2843
|
}
|
|
2832
|
-
function
|
|
2844
|
+
function Ft(e, u, t, a) {
|
|
2833
2845
|
const r = new RegExp(
|
|
2834
|
-
`\\b${
|
|
2846
|
+
`\\b${Q(u)}\\.${Q(t)}\\b`,
|
|
2835
2847
|
"g"
|
|
2836
2848
|
);
|
|
2837
2849
|
return uu(e, r, a);
|
|
2838
2850
|
}
|
|
2839
|
-
function
|
|
2851
|
+
function se(e) {
|
|
2840
2852
|
const u = {}, t = {};
|
|
2841
2853
|
for (const [a, r] of Object.entries(gu))
|
|
2842
2854
|
if (r.replace)
|
|
2843
2855
|
if (r.replace.includes(".")) {
|
|
2844
|
-
const n = r.replace.lastIndexOf("."),
|
|
2845
|
-
t[
|
|
2856
|
+
const n = r.replace.lastIndexOf("."), s = r.replace.substring(0, n), i = r.replace.substring(n + 1);
|
|
2857
|
+
t[s] || (t[s] = {}), t[s][i] = a, u[a] = a;
|
|
2846
2858
|
} else
|
|
2847
2859
|
u[r.replace] = a;
|
|
2848
2860
|
if (e) {
|
|
@@ -2851,8 +2863,8 @@ function ie(e) {
|
|
|
2851
2863
|
for (const [r, n] of Object.entries(a))
|
|
2852
2864
|
if (n.replace)
|
|
2853
2865
|
if (n.replace.includes(".")) {
|
|
2854
|
-
const
|
|
2855
|
-
t[
|
|
2866
|
+
const s = n.replace.lastIndexOf("."), i = n.replace.substring(0, s), o = n.replace.substring(s + 1);
|
|
2867
|
+
t[i] || (t[i] = {}), t[i][o] = r, u[r] = r;
|
|
2856
2868
|
} else
|
|
2857
2869
|
u[n.replace] = r;
|
|
2858
2870
|
}
|
|
@@ -2869,8 +2881,8 @@ function Gt(e) {
|
|
|
2869
2881
|
if (!n.composable || !n.replace || !n.replace.includes("."))
|
|
2870
2882
|
continue;
|
|
2871
2883
|
u[n.composable] || (u[n.composable] = {});
|
|
2872
|
-
const
|
|
2873
|
-
u[n.composable][
|
|
2884
|
+
const s = n.replace.substring(n.replace.lastIndexOf(".") + 1);
|
|
2885
|
+
u[n.composable][s] = r;
|
|
2874
2886
|
}
|
|
2875
2887
|
};
|
|
2876
2888
|
if (t(gu), e) {
|
|
@@ -2879,7 +2891,7 @@ function Gt(e) {
|
|
|
2879
2891
|
}
|
|
2880
2892
|
return u;
|
|
2881
2893
|
}
|
|
2882
|
-
function
|
|
2894
|
+
function Fu(e, u) {
|
|
2883
2895
|
if (!e) return e;
|
|
2884
2896
|
const t = {
|
|
2885
2897
|
refs: new Set(u.refs),
|
|
@@ -2892,29 +2904,29 @@ function $u(e, u) {
|
|
|
2892
2904
|
dataSources: new Set(u.dataSources),
|
|
2893
2905
|
hasState: u.hasState,
|
|
2894
2906
|
reverseApiMap: u.globalApiVars,
|
|
2895
|
-
reverseMemberApiMap: u.reverseMemberApiMap ||
|
|
2907
|
+
reverseMemberApiMap: u.reverseMemberApiMap || se().member
|
|
2896
2908
|
};
|
|
2897
|
-
let a =
|
|
2909
|
+
let a = $t(e, t);
|
|
2898
2910
|
a = a.replace(/_ctx\./g, "this."), a = a.replace(/this\.this\./g, "this.");
|
|
2899
2911
|
for (const [r, n] of Object.entries(u.libs || {}))
|
|
2900
2912
|
a = R(a, r, `this.$libs.${n}.${r}`);
|
|
2901
2913
|
return a;
|
|
2902
2914
|
}
|
|
2903
2915
|
function Ht(e) {
|
|
2904
|
-
const u = Ut(e.imports || []), { simple: t, member: a } =
|
|
2916
|
+
const u = Ut(e.imports || []), { simple: t, member: a } = se(u);
|
|
2905
2917
|
if (e.globalApiDestructured && e.globalApiDestructured.length > 0) {
|
|
2906
2918
|
const n = Gt(u);
|
|
2907
|
-
for (const { callee:
|
|
2908
|
-
const o = n[
|
|
2919
|
+
for (const { callee: s, destructure: i } of e.globalApiDestructured) {
|
|
2920
|
+
const o = n[s];
|
|
2909
2921
|
if (o)
|
|
2910
|
-
for (const c of
|
|
2922
|
+
for (const c of i)
|
|
2911
2923
|
o[c] && (t[c] = o[c]);
|
|
2912
2924
|
}
|
|
2913
2925
|
}
|
|
2914
2926
|
const r = /* @__PURE__ */ new Set();
|
|
2915
2927
|
for (const n of e.composables || [])
|
|
2916
2928
|
if (n.destructure && n.destructure.length > 0)
|
|
2917
|
-
for (const
|
|
2929
|
+
for (const s of n.destructure) r.add(s);
|
|
2918
2930
|
else n.name && r.add(n.name);
|
|
2919
2931
|
return {
|
|
2920
2932
|
refs: new Set(Object.keys(e.refs || {})),
|
|
@@ -2932,12 +2944,12 @@ function Ht(e) {
|
|
|
2932
2944
|
reverseMemberApiMap: a
|
|
2933
2945
|
};
|
|
2934
2946
|
}
|
|
2935
|
-
const
|
|
2947
|
+
const ie = "arrow-double-left, arrow-double-right, contact, notes, records, cash-back-record, newspaper, discount, completed, user, description, list-switch, list-switching, link-o, miniprogram-o, qq, wechat-moments, weibo, cash-o, guide-o, invitation, shield-o, exchange, eye, enlarge, expand-o, eye-o, expand, filter-o, fire, fail, failure, fire-o, flag-o, font, font-o, gem-o, flower-o, gem, gift-card, friends, friends-o, gold-coin, gold-coin-o, good-job-o, gift, gift-o, gift-card-o, good-job, home-o, goods-collect, graphic, goods-collect-o, hot-o, info, hotel-o, info-o, hot-sale-o, hot, like, idcard, like-o, hot-sale, location-o, location, label, lock, label-o, map-marked, logistics, manager, more, live, manager-o, medal, more-o, music-o, music, new-arrival-o, medal-o, new-o, free-postage, newspaper-o, new-arrival, minus, orders-o, new, paid, notes-o, other-pay, pause-circle, pause, pause-circle-o, peer-pay, pending-payment, passed, plus, phone-circle-o, phone-o, printer, photo-fail, phone, photo-o, play-circle, play, phone-circle, point-gift-o, point-gift, play-circle-o, shrink, photo, qr, qr-invalid, question-o, revoke, replay, service, question, search, refund-o, service-o, scan, share, send-gift-o, share-o, setting, points, photograph, shop, shop-o, shop-collect-o, shop-collect, smile, shopping-cart-o, sign, sort, star-o, smile-comment-o, stop, stop-circle-o, smile-o, star, success, stop-circle, records-o, shopping-cart, tosend, todo-list, thumb-circle-o, thumb-circle, umbrella-circle, underway, upgrade, todo-list-o, tv-o, underway-o, user-o, vip-card-o, vip-card, send-gift, wap-home, wap-nav, volume-o, video, wap-home-o, volume, warning, weapp-nav, wechat-pay, wechat, setting-o, youzan-shield, warn-o, smile-comment, user-circle-o, video-o, add-square, add, arrow-down, arrow-up, arrow, after-sale, add-o, alipay, ascending, apps-o, aim, award, arrow-left, award-o, audio, bag-o, balance-list, back-top, bag, balance-pay, balance-o, bar-chart-o, bars, balance-list-o, birthday-cake-o, bookmark, bill, bell, browsing-history-o, browsing-history, bookmark-o, bulb-o, bullhorn-o, bill-o, calendar-o, brush-o, card, cart-o, cart-circle, cart-circle-o, cart, cash-on-deliver, cash-back-record-o, cashier-o, chart-trending-o, certificate, chat, clear, chat-o, checked, clock, clock-o, close, closed-eye, circle, cluster-o, column, comment-circle-o, cluster, comment, comment-o, comment-circle, completed-o, credit-pay, coupon, debit-pay, coupon-o, contact-o, descending, desktop-o, diamond-o, description-o, delete, diamond, delete-o, cross, edit, ellipsis, down, discount-o, ecard-pay, envelop-o".split(
|
|
2936
2948
|
", "
|
|
2937
2949
|
), Wt = "AddLocation, Aim, AlarmClock, Apple, ArrowDownBold, ArrowDown, ArrowLeftBold, ArrowLeft, ArrowRightBold, ArrowRight, ArrowUpBold, ArrowUp, Avatar, Back, Baseball, Basketball, BellFilled, Bell, Bicycle, BottomLeft, BottomRight, Bottom, Bowl, Box, Briefcase, BrushFilled, Brush, Burger, Calendar, CameraFilled, Camera, CaretBottom, CaretLeft, CaretRight, CaretTop, Cellphone, ChatDotRound, ChatDotSquare, ChatLineRound, ChatLineSquare, ChatRound, ChatSquare, Check, Checked, Cherry, Chicken, ChromeFilled, CircleCheckFilled, CircleCheck, CircleCloseFilled, CircleClose, CirclePlusFilled, CirclePlus, Clock, CloseBold, Close, Cloudy, CoffeeCup, Coffee, Coin, ColdDrink, CollectionTag, Collection, Comment, Compass, Connection, Coordinate, CopyDocument, Cpu, CreditCard, Crop, DArrowLeft, DArrowRight, DCaret, DataAnalysis, DataBoard, DataLine, DeleteFilled, DeleteLocation, Delete, Dessert, Discount, DishDot, Dish, DocumentAdd, DocumentChecked, DocumentCopy, DocumentDelete, DocumentRemove, Document, Download, Drizzling, EditPen, Edit, ElemeFilled, Eleme, ElementPlus, Expand, Failed, Female, Files, Film, Filter, Finished, FirstAidKit, Flag, Fold, FolderAdd, FolderChecked, FolderDelete, FolderOpened, FolderRemove, Folder, Food, Football, ForkSpoon, Fries, FullScreen, GobletFull, GobletSquareFull, GobletSquare, Goblet, GoldMedal, GoodsFilled, Goods, Grape, Grid, Guide, Handbag, Headset, HelpFilled, Help, Hide, Histogram, HomeFilled, HotWater, House, IceCreamRound, IceCreamSquare, IceCream, IceDrink, IceTea, InfoFilled, Iphone, Key, KnifeFork, Lightning, Link, List, Loading, LocationFilled, LocationInformation, Location, Lock, Lollipop, MagicStick, Magnet, Male, Management, MapLocation, Medal, Memo, Menu, MessageBox, Message, Mic, Microphone, MilkTea, Minus, Money, Monitor, MoonNight, Moon, MoreFilled, More, MostlyCloudy, Mouse, Mug, MuteNotification, Mute, NoSmoking, Notebook, Notification, Odometer, OfficeBuilding, Open, Operation, Opportunity, Orange, Paperclip, PartlyCloudy, Pear, PhoneFilled, Phone, PictureFilled, PictureRounded, Picture, PieChart, Place, Platform, Plus, Pointer, Position, Postcard, Pouring, Present, PriceTag, Printer, Promotion, QuartzWatch, QuestionFilled, Rank, ReadingLamp, Reading, RefreshLeft, RefreshRight, Refresh, Refrigerator, RemoveFilled, Remove, Right, ScaleToOriginal, School, Scissor, Search, Select, Sell, SemiSelect, Service, SetUp, Setting, Share, Ship, Shop, ShoppingBag, ShoppingCartFull, ShoppingCart, ShoppingTrolley, Smoking, Soccer, SoldOut, SortDown, SortUp, Sort, Stamp, StarFilled, Star, Stopwatch, SuccessFilled, Sugar, SuitcaseLine, Suitcase, Sunny, Sunrise, Sunset, SwitchButton, SwitchFilled, Switch, TakeawayBox, Ticket, Tickets, Timer, ToiletPaper, Tools, TopLeft, TopRight, Top, TrendCharts, TrophyBase, Trophy, TurnOff, Umbrella, Unlock, UploadFilled, Upload, UserFilled, User, Van, VideoCameraFilled, VideoCamera, VideoPause, VideoPlay, View, WalletFilled, Wallet, WarnTriangleFilled, WarningFilled, Warning, Watch, Watermelon, WindPower, ZoomIn, ZoomOut, VtjIconChatRecord, VtjIconNewChat, VtjIconAi, VtjIconUniapp, VtjIconWindowMax, VtjIconWindowMin, VtjIconWindowClose, VtjIconWindowNormal, VtjIconWindowDown, VtjIconWindowUp, VtjIconNpSave, VtjIconNpFile, VtjIconNpEdit, VtjIconNpShare, VtjIconNpSearch, VtjIconNpExport, VtjIconNpImport, VtjIconNpList, VtjIconNpPrint, VtjIconNpCancel, VtjIconNpConfirm, VtjIconNpReset, VtjIconNpReturnAll, VtjIconNpReturn, VtjIconNpRemove, VtjIconNpRemoveRow, VtjIconNpDelete, VtjIconNpExit, VtjIconNpRefresh, VtjIconNpAdd, VtjIconNpSelect, VtjIconNpAddRow, VtjIconNpExtend, VtjIconNpClose, VtjIconNpSubmit, VtjIconDeps, VtjIconBack, VtjIconHome, VtjIconApi, VtjIconExport, VtjIconImport, VtjIconGreater, VtjIconSmaller, VtjIconCheck, VtjIconSwitch, VtjIconCopy, VtjIconLock, VtjIconUnlock, VtjIconLayers, VtjIconConsole, VtjIconTeam, VtjIconPublish, VtjIconPreview, VtjIconSave, VtjIconPc, VtjIconPhone, VtjIconPad, VtjIconRedo, VtjIconRefresh, VtjIconUndo, VtjIconCategory, VtjIconProject, VtjIconNotice, VtjIconFav, VtjIconBug, VtjIconFile, VtjIconFolder, VtjIconUpload, VtjIconDownload, VtjIconUser, VtjIconSetting, VtjIconArrowRight, VtjIconArrowLeft, VtjIconArrowDown, VtjIconArrowUp, VtjIconShare, VtjIconData, VtjIconTemplate, VtjIconExitFullscreen, VtjIconFullscreen, VtjIconEdit, VtjIconRemove, VtjIconJs, VtjIconDatabase, VtjIconInfo, VtjIconPlus, VtjIconMinus, VtjIconHelp, VtjIconVars, VtjIconOutline, VtjIconVisible, VtjIconInvisible, VtjIconDocument, VtjIconHistory, VtjIconFixed, VtjIconUnfixed, VtjIconSearch, VtjIconMore, VtjIconClose, VtjIconComponents, VtjIconBlock".split(
|
|
2938
2950
|
", "
|
|
2939
2951
|
), Jt = "user", L = "User";
|
|
2940
|
-
class
|
|
2952
|
+
class zt {
|
|
2941
2953
|
validate(u) {
|
|
2942
2954
|
const t = {
|
|
2943
2955
|
valid: !0,
|
|
@@ -2951,7 +2963,7 @@ class Xt {
|
|
|
2951
2963
|
}
|
|
2952
2964
|
isCompleteSFC(u) {
|
|
2953
2965
|
try {
|
|
2954
|
-
const t =
|
|
2966
|
+
const t = M(u);
|
|
2955
2967
|
return !!(t.template && t.script && t.styles);
|
|
2956
2968
|
} catch {
|
|
2957
2969
|
return !1;
|
|
@@ -2960,7 +2972,7 @@ class Xt {
|
|
|
2960
2972
|
checkSyntax(u) {
|
|
2961
2973
|
let t = "";
|
|
2962
2974
|
try {
|
|
2963
|
-
const a =
|
|
2975
|
+
const a = M(u);
|
|
2964
2976
|
B(a.script);
|
|
2965
2977
|
} catch (a) {
|
|
2966
2978
|
a instanceof SyntaxError && (t = a.message);
|
|
@@ -2968,33 +2980,33 @@ class Xt {
|
|
|
2968
2980
|
return t;
|
|
2969
2981
|
}
|
|
2970
2982
|
checkSetup(u) {
|
|
2971
|
-
const t =
|
|
2983
|
+
const t = M(u);
|
|
2972
2984
|
if (t.isScriptSetup)
|
|
2973
2985
|
return !0;
|
|
2974
2986
|
let a = 0;
|
|
2975
2987
|
return Ju(t.script, {
|
|
2976
2988
|
ObjectMethod(r) {
|
|
2977
2989
|
r.node.key.name === "setup" && (a = r.node.body.body.filter(
|
|
2978
|
-
(
|
|
2990
|
+
(s) => !q.isEmptyStatement(s)
|
|
2979
2991
|
).length);
|
|
2980
2992
|
}
|
|
2981
2993
|
}), a === 3;
|
|
2982
2994
|
}
|
|
2983
2995
|
findVantIcons(u) {
|
|
2984
|
-
const t =
|
|
2985
|
-
return r.forEach((
|
|
2986
|
-
const
|
|
2987
|
-
|
|
2996
|
+
const t = M(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
|
|
2997
|
+
return r.forEach((s) => {
|
|
2998
|
+
const i = s.match(/\bname="([^"]+)"/);
|
|
2999
|
+
i && n.push(i[1]);
|
|
2988
3000
|
}), [...new Set(n)];
|
|
2989
3001
|
}
|
|
2990
3002
|
checkVantIcons(u) {
|
|
2991
3003
|
const t = this.findVantIcons(u), a = [];
|
|
2992
3004
|
for (const r of t)
|
|
2993
|
-
|
|
3005
|
+
ie.includes(r) || a.push(r);
|
|
2994
3006
|
return a;
|
|
2995
3007
|
}
|
|
2996
3008
|
findVtjIcons(u) {
|
|
2997
|
-
const t =
|
|
3009
|
+
const t = M(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
|
|
2998
3010
|
return !r || !r[1] ? [] : r[1].split(",").map((n) => n.trim()).filter(Boolean);
|
|
2999
3011
|
}
|
|
3000
3012
|
checkVtjIcons(u) {
|
|
@@ -3010,15 +3022,15 @@ class Xt {
|
|
|
3010
3022
|
...u.match(a) || [],
|
|
3011
3023
|
...u.match(r) || []
|
|
3012
3024
|
].some(
|
|
3013
|
-
(
|
|
3025
|
+
(s) => /不变/.test(s.replace(/\*/g, ""))
|
|
3014
3026
|
// 移除多行注释的星号避免干扰
|
|
3015
3027
|
);
|
|
3016
3028
|
}
|
|
3017
3029
|
}
|
|
3018
|
-
function
|
|
3030
|
+
function Xt(e) {
|
|
3019
3031
|
const u = [];
|
|
3020
3032
|
let t = e;
|
|
3021
|
-
const a =
|
|
3033
|
+
const a = M(e);
|
|
3022
3034
|
if (!a.template || !a.script)
|
|
3023
3035
|
return {
|
|
3024
3036
|
fixed: !1,
|
|
@@ -3026,15 +3038,15 @@ function zt(e) {
|
|
|
3026
3038
|
fixedCode: e,
|
|
3027
3039
|
changes: []
|
|
3028
3040
|
};
|
|
3029
|
-
const r =
|
|
3030
|
-
let
|
|
3031
|
-
const
|
|
3041
|
+
const r = Zt(a.script), n = a.template;
|
|
3042
|
+
let s = n;
|
|
3043
|
+
const i = [], o = /\{\{([^}]+)\}\}/g;
|
|
3032
3044
|
let c;
|
|
3033
3045
|
for (; (c = o.exec(n)) !== null; ) {
|
|
3034
|
-
const m = c[0],
|
|
3035
|
-
if (x !==
|
|
3046
|
+
const m = c[0], g = c[1], x = H(g, r);
|
|
3047
|
+
if (x !== g) {
|
|
3036
3048
|
const w = G(n, c.index);
|
|
3037
|
-
|
|
3049
|
+
i.push({
|
|
3038
3050
|
start: c.index,
|
|
3039
3051
|
end: c.index + m.length,
|
|
3040
3052
|
original: m,
|
|
@@ -3044,7 +3056,7 @@ function zt(e) {
|
|
|
3044
3056
|
}), u.push({
|
|
3045
3057
|
line: w.line + 1,
|
|
3046
3058
|
column: w.column,
|
|
3047
|
-
original:
|
|
3059
|
+
original: g.trim(),
|
|
3048
3060
|
fixed: x.trim(),
|
|
3049
3061
|
message: "修复插值表达式:添加 state. 前缀"
|
|
3050
3062
|
});
|
|
@@ -3052,14 +3064,14 @@ function zt(e) {
|
|
|
3052
3064
|
}
|
|
3053
3065
|
const d = /:(\w+)="([^"]+)"/g;
|
|
3054
3066
|
for (; (c = d.exec(n)) !== null; ) {
|
|
3055
|
-
const m = c[0],
|
|
3067
|
+
const m = c[0], g = c[1], x = c[2], w = H(x, r);
|
|
3056
3068
|
if (w !== x) {
|
|
3057
3069
|
const I = G(n, c.index);
|
|
3058
|
-
|
|
3070
|
+
i.push({
|
|
3059
3071
|
start: c.index,
|
|
3060
3072
|
end: c.index + m.length,
|
|
3061
3073
|
original: m,
|
|
3062
|
-
replacement: `:${
|
|
3074
|
+
replacement: `:${g}="${w}"`,
|
|
3063
3075
|
line: I.line,
|
|
3064
3076
|
column: I.column
|
|
3065
3077
|
}), u.push({
|
|
@@ -3073,14 +3085,14 @@ function zt(e) {
|
|
|
3073
3085
|
}
|
|
3074
3086
|
const l = /v-(if|else-if|show)="([^"]+)"/g;
|
|
3075
3087
|
for (; (c = l.exec(n)) !== null; ) {
|
|
3076
|
-
const m = c[0],
|
|
3088
|
+
const m = c[0], g = c[1], x = c[2], w = H(x, r);
|
|
3077
3089
|
if (w !== x) {
|
|
3078
3090
|
const I = G(n, c.index);
|
|
3079
|
-
|
|
3091
|
+
i.push({
|
|
3080
3092
|
start: c.index,
|
|
3081
3093
|
end: c.index + m.length,
|
|
3082
3094
|
original: m,
|
|
3083
|
-
replacement: `v-${
|
|
3095
|
+
replacement: `v-${g}="${w}"`,
|
|
3084
3096
|
line: I.line,
|
|
3085
3097
|
column: I.column
|
|
3086
3098
|
}), u.push({
|
|
@@ -3088,7 +3100,7 @@ function zt(e) {
|
|
|
3088
3100
|
column: I.column,
|
|
3089
3101
|
original: x,
|
|
3090
3102
|
fixed: w,
|
|
3091
|
-
message: `修复 v-${
|
|
3103
|
+
message: `修复 v-${g} 指令:添加 state. 前缀`
|
|
3092
3104
|
});
|
|
3093
3105
|
}
|
|
3094
3106
|
}
|
|
@@ -3101,17 +3113,17 @@ function zt(e) {
|
|
|
3101
3113
|
r
|
|
3102
3114
|
);
|
|
3103
3115
|
if (D !== I) {
|
|
3104
|
-
const
|
|
3105
|
-
|
|
3116
|
+
const $ = G(n, c.index), lu = `v-for="${w} in ${D}"`;
|
|
3117
|
+
i.push({
|
|
3106
3118
|
start: c.index,
|
|
3107
3119
|
end: c.index + m.length,
|
|
3108
3120
|
original: m,
|
|
3109
3121
|
replacement: lu,
|
|
3110
|
-
line:
|
|
3111
|
-
column:
|
|
3122
|
+
line: $.line,
|
|
3123
|
+
column: $.column
|
|
3112
3124
|
}), u.push({
|
|
3113
|
-
line:
|
|
3114
|
-
column:
|
|
3125
|
+
line: $.line + 1,
|
|
3126
|
+
column: $.column,
|
|
3115
3127
|
original: I,
|
|
3116
3128
|
fixed: D,
|
|
3117
3129
|
message: "修复 v-for 指令:添加 state. 前缀"
|
|
@@ -3121,10 +3133,10 @@ function zt(e) {
|
|
|
3121
3133
|
}
|
|
3122
3134
|
const b = /v-model="([^"]+)"/g;
|
|
3123
3135
|
for (; (c = b.exec(n)) !== null; ) {
|
|
3124
|
-
const m = c[0],
|
|
3125
|
-
if (x !==
|
|
3136
|
+
const m = c[0], g = c[1], x = H(g, r);
|
|
3137
|
+
if (x !== g) {
|
|
3126
3138
|
const w = G(n, c.index);
|
|
3127
|
-
|
|
3139
|
+
i.push({
|
|
3128
3140
|
start: c.index,
|
|
3129
3141
|
end: c.index + m.length,
|
|
3130
3142
|
original: m,
|
|
@@ -3134,7 +3146,7 @@ function zt(e) {
|
|
|
3134
3146
|
}), u.push({
|
|
3135
3147
|
line: w.line + 1,
|
|
3136
3148
|
column: w.column,
|
|
3137
|
-
original:
|
|
3149
|
+
original: g,
|
|
3138
3150
|
fixed: x,
|
|
3139
3151
|
message: "修复 v-model 指令:添加 state. 前缀"
|
|
3140
3152
|
});
|
|
@@ -3142,10 +3154,10 @@ function zt(e) {
|
|
|
3142
3154
|
}
|
|
3143
3155
|
const h = /v-bind="([^"]+)"/g;
|
|
3144
3156
|
for (; (c = h.exec(n)) !== null; ) {
|
|
3145
|
-
const m = c[0],
|
|
3146
|
-
if (x !==
|
|
3157
|
+
const m = c[0], g = c[1], x = H(g, r);
|
|
3158
|
+
if (x !== g) {
|
|
3147
3159
|
const w = G(n, c.index);
|
|
3148
|
-
|
|
3160
|
+
i.push({
|
|
3149
3161
|
start: c.index,
|
|
3150
3162
|
end: c.index + m.length,
|
|
3151
3163
|
original: m,
|
|
@@ -3155,7 +3167,7 @@ function zt(e) {
|
|
|
3155
3167
|
}), u.push({
|
|
3156
3168
|
line: w.line + 1,
|
|
3157
3169
|
column: w.column,
|
|
3158
|
-
original:
|
|
3170
|
+
original: g,
|
|
3159
3171
|
fixed: x,
|
|
3160
3172
|
message: "修复 v-bind 指令:添加 state. 前缀"
|
|
3161
3173
|
});
|
|
@@ -3163,14 +3175,14 @@ function zt(e) {
|
|
|
3163
3175
|
}
|
|
3164
3176
|
const S = /v-(text|html)="([^"]+)"/g;
|
|
3165
3177
|
for (; (c = S.exec(n)) !== null; ) {
|
|
3166
|
-
const m = c[0],
|
|
3178
|
+
const m = c[0], g = c[1], x = c[2], w = H(x, r);
|
|
3167
3179
|
if (w !== x) {
|
|
3168
3180
|
const I = G(n, c.index);
|
|
3169
|
-
|
|
3181
|
+
i.push({
|
|
3170
3182
|
start: c.index,
|
|
3171
3183
|
end: c.index + m.length,
|
|
3172
3184
|
original: m,
|
|
3173
|
-
replacement: `v-${
|
|
3185
|
+
replacement: `v-${g}="${w}"`,
|
|
3174
3186
|
line: I.line,
|
|
3175
3187
|
column: I.column
|
|
3176
3188
|
}), u.push({
|
|
@@ -3178,20 +3190,20 @@ function zt(e) {
|
|
|
3178
3190
|
column: I.column,
|
|
3179
3191
|
original: x,
|
|
3180
3192
|
fixed: w,
|
|
3181
|
-
message: `修复 v-${
|
|
3193
|
+
message: `修复 v-${g} 指令:添加 state. 前缀`
|
|
3182
3194
|
});
|
|
3183
3195
|
}
|
|
3184
3196
|
}
|
|
3185
3197
|
const E = /(@|v-on:)(\w+)="([^"]+)"/g;
|
|
3186
3198
|
for (; (c = E.exec(n)) !== null; ) {
|
|
3187
|
-
const m = c[0],
|
|
3199
|
+
const m = c[0], g = c[1], x = c[2], w = c[3], I = Qt(w, r);
|
|
3188
3200
|
if (I !== w) {
|
|
3189
3201
|
const D = G(n, c.index);
|
|
3190
|
-
|
|
3202
|
+
i.push({
|
|
3191
3203
|
start: c.index,
|
|
3192
3204
|
end: c.index + m.length,
|
|
3193
3205
|
original: m,
|
|
3194
|
-
replacement: `${
|
|
3206
|
+
replacement: `${g}${x}="${I}"`,
|
|
3195
3207
|
line: D.line,
|
|
3196
3208
|
column: D.column
|
|
3197
3209
|
}), u.push({
|
|
@@ -3203,22 +3215,22 @@ function zt(e) {
|
|
|
3203
3215
|
});
|
|
3204
3216
|
}
|
|
3205
3217
|
}
|
|
3206
|
-
if (
|
|
3207
|
-
|
|
3208
|
-
}),
|
|
3209
|
-
const m = e.indexOf("<template>"),
|
|
3218
|
+
if (i.sort((m, g) => g.start - m.start), i.forEach((m) => {
|
|
3219
|
+
s = s.substring(0, m.start) + m.replacement + s.substring(m.end);
|
|
3220
|
+
}), i.length > 0) {
|
|
3221
|
+
const m = e.indexOf("<template>"), g = e.lastIndexOf("</template>") + 11;
|
|
3210
3222
|
t = e.substring(0, m) + `<template>
|
|
3211
|
-
` +
|
|
3212
|
-
</template>` + e.substring(
|
|
3223
|
+
` + s + `
|
|
3224
|
+
</template>` + e.substring(g);
|
|
3213
3225
|
}
|
|
3214
3226
|
return {
|
|
3215
|
-
fixed:
|
|
3227
|
+
fixed: i.length > 0,
|
|
3216
3228
|
originalCode: e,
|
|
3217
3229
|
fixedCode: t,
|
|
3218
3230
|
changes: u
|
|
3219
3231
|
};
|
|
3220
3232
|
}
|
|
3221
|
-
function
|
|
3233
|
+
function Zt(e) {
|
|
3222
3234
|
const u = /* @__PURE__ */ new Set();
|
|
3223
3235
|
try {
|
|
3224
3236
|
const t = B(e);
|
|
@@ -3226,8 +3238,8 @@ function Qt(e) {
|
|
|
3226
3238
|
CallExpression(a) {
|
|
3227
3239
|
if (a.node.callee.type === "Identifier" && a.node.callee.name === "reactive" && a.node.arguments.length > 0 && a.node.arguments[0].type === "ObjectExpression") {
|
|
3228
3240
|
const r = a.parent;
|
|
3229
|
-
r.type === "VariableDeclarator" && r.id.type === "Identifier" && r.id.name === "state" && a.node.arguments[0].properties.forEach((
|
|
3230
|
-
|
|
3241
|
+
r.type === "VariableDeclarator" && r.id.type === "Identifier" && r.id.name === "state" && a.node.arguments[0].properties.forEach((s) => {
|
|
3242
|
+
s.type === "ObjectProperty" && s.key.type === "Identifier" && u.add(s.key.name);
|
|
3231
3243
|
});
|
|
3232
3244
|
}
|
|
3233
3245
|
}
|
|
@@ -3244,7 +3256,7 @@ function H(e, u) {
|
|
|
3244
3256
|
r.test(t) && !t.includes(`state.${a}`) && (t = t.replace(r, `state.${a}`));
|
|
3245
3257
|
}), t;
|
|
3246
3258
|
}
|
|
3247
|
-
function
|
|
3259
|
+
function Qt(e, u) {
|
|
3248
3260
|
let t = e.trim();
|
|
3249
3261
|
return u.forEach((a) => {
|
|
3250
3262
|
const r = new RegExp(
|
|
@@ -3254,7 +3266,7 @@ function Zt(e, u) {
|
|
|
3254
3266
|
`(\\+\\+|--)?(?<![\\w.])${a}(?![\\w])`,
|
|
3255
3267
|
"g"
|
|
3256
3268
|
);
|
|
3257
|
-
t.includes(`state.${a}`) || (t = t.replace(r, `state.${a}$1`), t = t.replace(n, (
|
|
3269
|
+
t.includes(`state.${a}`) || (t = t.replace(r, `state.${a}$1`), t = t.replace(n, (s, i) => i ? `${i}state.${a}` : s.includes(a) && !s.includes("state.") ? `state.${a}` : s));
|
|
3258
3270
|
}), H(t, u);
|
|
3259
3271
|
}
|
|
3260
3272
|
function G(e, u) {
|
|
@@ -3268,22 +3280,22 @@ function G(e, u) {
|
|
|
3268
3280
|
class Kt {
|
|
3269
3281
|
fixBasedOnValidation(u, t) {
|
|
3270
3282
|
let a = u;
|
|
3271
|
-
return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)),
|
|
3283
|
+
return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Xt(a).fixedCode;
|
|
3272
3284
|
}
|
|
3273
3285
|
fixVantIcons(u) {
|
|
3274
|
-
const t =
|
|
3286
|
+
const t = M(u), a = t.template.replace(
|
|
3275
3287
|
/<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
|
|
3276
|
-
(r, n) => r.includes(":name=") || r.includes("v-bind:name=") ||
|
|
3288
|
+
(r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, Jt)
|
|
3277
3289
|
);
|
|
3278
3290
|
return this.reconstructSFC(t, a, t.script);
|
|
3279
3291
|
}
|
|
3280
3292
|
fixVtjIcons(u, t = []) {
|
|
3281
|
-
const a =
|
|
3293
|
+
const a = M(u);
|
|
3282
3294
|
let r = !1;
|
|
3283
3295
|
a.script = Ju(a.script, {
|
|
3284
|
-
ImportDeclaration(
|
|
3285
|
-
if (
|
|
3286
|
-
const o =
|
|
3296
|
+
ImportDeclaration(i) {
|
|
3297
|
+
if (i.node.source.value === "@vtj/icons") {
|
|
3298
|
+
const o = i.node.specifiers, c = [];
|
|
3287
3299
|
let d = !1;
|
|
3288
3300
|
for (const l of o) {
|
|
3289
3301
|
const p = l.imported?.name;
|
|
@@ -3296,12 +3308,12 @@ class Kt {
|
|
|
3296
3308
|
q.identifier(L),
|
|
3297
3309
|
q.identifier(L)
|
|
3298
3310
|
)
|
|
3299
|
-
)),
|
|
3311
|
+
)), i.node.specifiers = c;
|
|
3300
3312
|
}
|
|
3301
3313
|
},
|
|
3302
|
-
ObjectMethod(
|
|
3303
|
-
if (
|
|
3304
|
-
const o =
|
|
3314
|
+
ObjectMethod(i) {
|
|
3315
|
+
if (i.node.key.name === "setup") {
|
|
3316
|
+
const o = i.node.body.body;
|
|
3305
3317
|
for (const c of o)
|
|
3306
3318
|
if (q.isReturnStatement(c) && q.isObjectExpression(c.argument)) {
|
|
3307
3319
|
const d = c.argument.properties || [];
|
|
@@ -3318,27 +3330,27 @@ class Kt {
|
|
|
3318
3330
|
}
|
|
3319
3331
|
}
|
|
3320
3332
|
},
|
|
3321
|
-
ObjectProperty(
|
|
3322
|
-
if (q.isIdentifier(
|
|
3323
|
-
const o =
|
|
3324
|
-
|
|
3333
|
+
ObjectProperty(i) {
|
|
3334
|
+
if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(L)), q.isArrayExpression(i.node.value)) {
|
|
3335
|
+
const o = i.node.value.elements;
|
|
3336
|
+
i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(L) : c);
|
|
3325
3337
|
}
|
|
3326
3338
|
},
|
|
3327
|
-
AssignmentExpression(
|
|
3328
|
-
q.isIdentifier(
|
|
3339
|
+
AssignmentExpression(i) {
|
|
3340
|
+
q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(L));
|
|
3329
3341
|
}
|
|
3330
3342
|
});
|
|
3331
|
-
const n = /:icon\s*=\s*["']([^"']+)["']/g,
|
|
3332
|
-
if (
|
|
3333
|
-
for (const
|
|
3334
|
-
let o =
|
|
3343
|
+
const n = /:icon\s*=\s*["']([^"']+)["']/g, s = a.template.match(n);
|
|
3344
|
+
if (s)
|
|
3345
|
+
for (const i of s) {
|
|
3346
|
+
let o = i;
|
|
3335
3347
|
for (const c of t)
|
|
3336
3348
|
o = o.replace(new RegExp(c, "g"), L);
|
|
3337
|
-
a.template = a.template.replace(
|
|
3349
|
+
a.template = a.template.replace(i, o);
|
|
3338
3350
|
}
|
|
3339
|
-
for (const
|
|
3351
|
+
for (const i of t)
|
|
3340
3352
|
a.template = a.template.replace(
|
|
3341
|
-
new RegExp(`:icon="${
|
|
3353
|
+
new RegExp(`:icon="${i}"`, "g"),
|
|
3342
3354
|
`:icon="${L}"`
|
|
3343
3355
|
);
|
|
3344
3356
|
return this.reconstructSFC(a, a.template, a.script);
|
|
@@ -3370,11 +3382,11 @@ async function b0(e) {
|
|
|
3370
3382
|
const { id: u, name: t, source: a, project: r } = e, n = ke(a, t);
|
|
3371
3383
|
if (n)
|
|
3372
3384
|
return Promise.reject(n);
|
|
3373
|
-
const { dependencies:
|
|
3385
|
+
const { dependencies: s = [], platform: i = "web" } = r || {}, o = new zt(), c = new Kt(), d = o.validate(a);
|
|
3374
3386
|
let l = [];
|
|
3375
3387
|
if (!d.valid)
|
|
3376
3388
|
return l = d.errors, Promise.reject(l);
|
|
3377
|
-
const p = c.fixBasedOnValidation(a, d), b =
|
|
3389
|
+
const p = c.fixBasedOnValidation(a, d), b = M(p);
|
|
3378
3390
|
b.script = Ae(b.script);
|
|
3379
3391
|
const {
|
|
3380
3392
|
styles: h,
|
|
@@ -3386,22 +3398,22 @@ async function b0(e) {
|
|
|
3386
3398
|
id: u,
|
|
3387
3399
|
name: t,
|
|
3388
3400
|
project: r,
|
|
3389
|
-
platform:
|
|
3390
|
-
dependencies:
|
|
3401
|
+
platform: i,
|
|
3402
|
+
dependencies: s,
|
|
3391
3403
|
styles: h,
|
|
3392
3404
|
css: S
|
|
3393
3405
|
}) : Yt(b, {
|
|
3394
3406
|
id: u,
|
|
3395
3407
|
name: t,
|
|
3396
3408
|
project: r,
|
|
3397
|
-
platform:
|
|
3398
|
-
dependencies:
|
|
3409
|
+
platform: i,
|
|
3410
|
+
dependencies: s,
|
|
3399
3411
|
styles: h,
|
|
3400
3412
|
css: S
|
|
3401
3413
|
});
|
|
3402
3414
|
}
|
|
3403
3415
|
async function Yt(e, u) {
|
|
3404
|
-
const { id: t, name: a, project: r, platform: n, dependencies:
|
|
3416
|
+
const { id: t, name: a, project: r, platform: n, dependencies: s, styles: i, css: o } = u, {
|
|
3405
3417
|
state: c,
|
|
3406
3418
|
watch: d,
|
|
3407
3419
|
lifeCycles: l,
|
|
@@ -3411,14 +3423,14 @@ async function Yt(e, u) {
|
|
|
3411
3423
|
emits: S,
|
|
3412
3424
|
expose: E,
|
|
3413
3425
|
inject: m,
|
|
3414
|
-
handlers:
|
|
3426
|
+
handlers: g,
|
|
3415
3427
|
imports: x,
|
|
3416
3428
|
dataSources: w,
|
|
3417
3429
|
directives: I
|
|
3418
|
-
} = et(e.script, r), { nodes: D, slots:
|
|
3430
|
+
} = et(e.script, r), { nodes: D, slots: $, context: lu } = re(t, a, e.template, {
|
|
3419
3431
|
platform: n,
|
|
3420
|
-
handlers:
|
|
3421
|
-
styles:
|
|
3432
|
+
handlers: g,
|
|
3433
|
+
styles: i,
|
|
3422
3434
|
imports: x,
|
|
3423
3435
|
directives: I
|
|
3424
3436
|
}), yu = {
|
|
@@ -3432,13 +3444,13 @@ async function Yt(e, u) {
|
|
|
3432
3444
|
computed: p,
|
|
3433
3445
|
methods: b,
|
|
3434
3446
|
dataSources: w,
|
|
3435
|
-
slots:
|
|
3447
|
+
slots: $,
|
|
3436
3448
|
emits: S,
|
|
3437
3449
|
expose: E,
|
|
3438
3450
|
nodes: D,
|
|
3439
3451
|
css: o
|
|
3440
3452
|
}, le = Object.keys(p || {}), fe = (h || []).map(
|
|
3441
|
-
(
|
|
3453
|
+
(F) => typeof F == "string" ? F : F.name
|
|
3442
3454
|
), be = [
|
|
3443
3455
|
"$el",
|
|
3444
3456
|
"$emit",
|
|
@@ -3456,7 +3468,7 @@ async function Yt(e, u) {
|
|
|
3456
3468
|
"$props",
|
|
3457
3469
|
"props",
|
|
3458
3470
|
...Object.keys(b || {})
|
|
3459
|
-
], { libs: pe } = de(x,
|
|
3471
|
+
], { libs: pe } = de(x, s), Su = {
|
|
3460
3472
|
platform: n,
|
|
3461
3473
|
context: lu,
|
|
3462
3474
|
computed: le,
|
|
@@ -3466,25 +3478,25 @@ async function Yt(e, u) {
|
|
|
3466
3478
|
};
|
|
3467
3479
|
return await ce(
|
|
3468
3480
|
yu,
|
|
3469
|
-
async (
|
|
3470
|
-
await oe(
|
|
3481
|
+
async (F) => {
|
|
3482
|
+
await oe(F, async (K) => {
|
|
3471
3483
|
if (du(K)) {
|
|
3472
3484
|
const he = await ru(K.value);
|
|
3473
|
-
K.value = Iu(he,
|
|
3485
|
+
K.value = Iu(he, F.id, Su);
|
|
3474
3486
|
}
|
|
3475
3487
|
});
|
|
3476
3488
|
},
|
|
3477
|
-
async (
|
|
3478
|
-
const K = await ru(
|
|
3479
|
-
|
|
3489
|
+
async (F) => {
|
|
3490
|
+
const K = await ru(F.value);
|
|
3491
|
+
F.value = Iu(K, "", Su);
|
|
3480
3492
|
}
|
|
3481
3493
|
), new Hu(yu).toDsl();
|
|
3482
3494
|
}
|
|
3483
3495
|
async function u0(e, u) {
|
|
3484
|
-
const { id: t, name: a, project: r, platform: n, styles:
|
|
3496
|
+
const { id: t, name: a, project: r, platform: n, styles: s, css: i, dependencies: o } = u, c = Nt(e.script, r), { nodes: d, slots: l, context: p } = re(t, a, e.template, {
|
|
3485
3497
|
platform: n,
|
|
3486
3498
|
handlers: c.handlers,
|
|
3487
|
-
styles:
|
|
3499
|
+
styles: s,
|
|
3488
3500
|
imports: c.imports,
|
|
3489
3501
|
directives: c.directives
|
|
3490
3502
|
}), b = {
|
|
@@ -3508,7 +3520,7 @@ async function u0(e, u) {
|
|
|
3508
3520
|
emits: c.emits,
|
|
3509
3521
|
expose: c.expose,
|
|
3510
3522
|
nodes: d,
|
|
3511
|
-
css:
|
|
3523
|
+
css: i
|
|
3512
3524
|
}, { libs: h } = de(c.imports, o), S = Ht(c), E = {
|
|
3513
3525
|
refs: Array.from(S.refs),
|
|
3514
3526
|
reactives: Array.from(S.reactives),
|
|
@@ -3525,29 +3537,29 @@ async function u0(e, u) {
|
|
|
3525
3537
|
};
|
|
3526
3538
|
return await ce(
|
|
3527
3539
|
b,
|
|
3528
|
-
async (
|
|
3529
|
-
await oe(
|
|
3540
|
+
async (g) => {
|
|
3541
|
+
await oe(g, async (x) => {
|
|
3530
3542
|
if (du(x)) {
|
|
3531
3543
|
const w = await ru(x.value);
|
|
3532
|
-
let I =
|
|
3544
|
+
let I = Fu(w, E);
|
|
3533
3545
|
const D = Array.from(
|
|
3534
|
-
p[
|
|
3546
|
+
p[g.id] || /* @__PURE__ */ new Set()
|
|
3535
3547
|
);
|
|
3536
|
-
for (const
|
|
3537
|
-
I = R(I,
|
|
3548
|
+
for (const $ of D)
|
|
3549
|
+
I = R(I, $, `this.context.${$}`);
|
|
3538
3550
|
x.value = I;
|
|
3539
3551
|
}
|
|
3540
3552
|
});
|
|
3541
3553
|
},
|
|
3542
|
-
async (
|
|
3543
|
-
const x = await ru(
|
|
3544
|
-
|
|
3554
|
+
async (g) => {
|
|
3555
|
+
const x = await ru(g.value);
|
|
3556
|
+
g.value = Fu(x, E);
|
|
3545
3557
|
}
|
|
3546
3558
|
), new Hu(b).toDsl();
|
|
3547
3559
|
}
|
|
3548
3560
|
async function ce(e, u, t) {
|
|
3549
|
-
const a = async (m,
|
|
3550
|
-
if (await u(m,
|
|
3561
|
+
const a = async (m, g) => {
|
|
3562
|
+
if (await u(m, g), Array.isArray(m?.children))
|
|
3551
3563
|
for (const x of m?.children || [])
|
|
3552
3564
|
await a(x, m);
|
|
3553
3565
|
}, r = async (m) => {
|
|
@@ -3557,13 +3569,13 @@ async function ce(e, u, t) {
|
|
|
3557
3569
|
await r(x);
|
|
3558
3570
|
return;
|
|
3559
3571
|
}
|
|
3560
|
-
const
|
|
3561
|
-
for (const x of
|
|
3572
|
+
const g = Object.values(m);
|
|
3573
|
+
for (const x of g)
|
|
3562
3574
|
du(x) ? await t(x) : await r(x);
|
|
3563
3575
|
}, {
|
|
3564
3576
|
state: n,
|
|
3565
|
-
watch:
|
|
3566
|
-
computed:
|
|
3577
|
+
watch: s,
|
|
3578
|
+
computed: i,
|
|
3567
3579
|
props: o,
|
|
3568
3580
|
dataSources: c,
|
|
3569
3581
|
methods: d,
|
|
@@ -3576,8 +3588,8 @@ async function ce(e, u, t) {
|
|
|
3576
3588
|
} = e;
|
|
3577
3589
|
if (await r({
|
|
3578
3590
|
state: n,
|
|
3579
|
-
watch:
|
|
3580
|
-
computed:
|
|
3591
|
+
watch: s,
|
|
3592
|
+
computed: i,
|
|
3581
3593
|
props: o,
|
|
3582
3594
|
dataSources: c,
|
|
3583
3595
|
methods: d,
|
|
@@ -3616,13 +3628,13 @@ function de(e = [], u = []) {
|
|
|
3616
3628
|
);
|
|
3617
3629
|
for (const { from: r, imports: n } of e)
|
|
3618
3630
|
if (Array.isArray(n))
|
|
3619
|
-
n.forEach((
|
|
3620
|
-
const
|
|
3621
|
-
|
|
3631
|
+
n.forEach((s) => {
|
|
3632
|
+
const i = a[r];
|
|
3633
|
+
i && (t[s] = i);
|
|
3622
3634
|
});
|
|
3623
3635
|
else {
|
|
3624
|
-
const
|
|
3625
|
-
|
|
3636
|
+
const s = a[r];
|
|
3637
|
+
s && (t[n] = s);
|
|
3626
3638
|
}
|
|
3627
3639
|
return {
|
|
3628
3640
|
libs: t
|
|
@@ -3630,7 +3642,7 @@ function de(e = [], u = []) {
|
|
|
3630
3642
|
}
|
|
3631
3643
|
export {
|
|
3632
3644
|
Kt as AutoFixer,
|
|
3633
|
-
|
|
3645
|
+
zt as ComponentValidator,
|
|
3634
3646
|
l0 as VTJ_PARSER_VERSION,
|
|
3635
3647
|
qu as htmlToNodes,
|
|
3636
3648
|
f0 as parseUniApp,
|