@vtj/parser 0.18.3 → 0.18.5
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 +11 -11
- package/dist/index.mjs +365 -346
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parse as Uu, compileTemplate as Gu } from "@vue/compiler-sfc";
|
|
2
|
-
import { parse as
|
|
2
|
+
import { parse as he } from "@babel/parser";
|
|
3
3
|
import vu from "@babel/traverse";
|
|
4
4
|
import Eu from "@babel/generator";
|
|
5
5
|
import { BlockModel as Hu } from "@vtj/core";
|
|
6
6
|
import { GLOBAL_API_MAP as gu, UI_PACKAGES as xe, UI_GLOBAL_API_MAPS as Wu, tsFormatter as ru } from "@vtj/coder";
|
|
7
|
-
import { NodeTypes as
|
|
7
|
+
import { NodeTypes as E } from "@vue/compiler-core";
|
|
8
8
|
import { upperFirstCamelCase as ge, unBase64 as ye, uid as nu } from "@vtj/base";
|
|
9
9
|
import Se from "postcss";
|
|
10
10
|
import * as ve from "sass";
|
|
@@ -13,11 +13,11 @@ 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.5
|
|
17
17
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
20
|
-
function
|
|
19
|
+
const f0 = "0.18.5";
|
|
20
|
+
function P(e) {
|
|
21
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,
|
|
@@ -27,8 +27,8 @@ function M(e) {
|
|
|
27
27
|
isScriptSetup: r
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function _(e) {
|
|
31
|
+
return he(e, { sourceType: "module", plugins: ["typescript"] });
|
|
32
32
|
}
|
|
33
33
|
function J(e, u) {
|
|
34
34
|
return (vu.default || vu)(e, u);
|
|
@@ -91,7 +91,7 @@ function Ie(e) {
|
|
|
91
91
|
}
|
|
92
92
|
function Ju(e, u) {
|
|
93
93
|
try {
|
|
94
|
-
const t =
|
|
94
|
+
const t = _(e);
|
|
95
95
|
return J(t, u), A(t) || "";
|
|
96
96
|
} catch {
|
|
97
97
|
return "";
|
|
@@ -100,7 +100,7 @@ function Ju(e, u) {
|
|
|
100
100
|
function Ae(e) {
|
|
101
101
|
if (!e) return "";
|
|
102
102
|
try {
|
|
103
|
-
const u =
|
|
103
|
+
const u = _(e);
|
|
104
104
|
return J(u, {
|
|
105
105
|
// TS as 断言 / <T> 断言 / 非空断言 → 只保留表达式本身
|
|
106
106
|
TSAsExpression: (t) => {
|
|
@@ -164,7 +164,7 @@ function ke(e, u) {
|
|
|
164
164
|
const n = (a.scriptSetup || a.script)?.content;
|
|
165
165
|
if (n)
|
|
166
166
|
try {
|
|
167
|
-
|
|
167
|
+
_(n);
|
|
168
168
|
} catch (s) {
|
|
169
169
|
t.push(`脚本语法错误: ${s.message}`);
|
|
170
170
|
}
|
|
@@ -173,8 +173,8 @@ function ke(e, u) {
|
|
|
173
173
|
}
|
|
174
174
|
return t.length > 0 ? t : null;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
const u =
|
|
176
|
+
function b0(e) {
|
|
177
|
+
const u = P(e), t = _(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;
|
|
@@ -199,10 +199,10 @@ function R(e, u, t) {
|
|
|
199
199
|
function Te(e, u, t) {
|
|
200
200
|
let a, r = 0;
|
|
201
201
|
try {
|
|
202
|
-
a =
|
|
202
|
+
a = _(e);
|
|
203
203
|
} catch {
|
|
204
204
|
const i = "(()=>{", c = i + e + "})";
|
|
205
|
-
a =
|
|
205
|
+
a = _(c), r = i.length;
|
|
206
206
|
}
|
|
207
207
|
const n = [];
|
|
208
208
|
if (J(a, {
|
|
@@ -247,7 +247,7 @@ function Ne(e, u, t, a, r, n) {
|
|
|
247
247
|
const d = o.indexOf(u, c);
|
|
248
248
|
if (d === -1) break;
|
|
249
249
|
const l = 1 + d, p = (s.start ?? 0) - a + l, b = p + u.length;
|
|
250
|
-
p >= 0 && b <= r.length && !n.some((
|
|
250
|
+
p >= 0 && b <= r.length && !n.some((m) => m.start === p && m.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) {
|
|
@@ -264,8 +264,8 @@ function je(e, u, t, a, r, n) {
|
|
|
264
264
|
if (p === -1) break;
|
|
265
265
|
const b = (c.start ?? 0) - a;
|
|
266
266
|
if (b < 0 || b > r.length) break;
|
|
267
|
-
const
|
|
268
|
-
|
|
267
|
+
const m = b + p, S = m + u.length;
|
|
268
|
+
m >= 0 && S <= r.length && !n.some((w) => w.start === m && w.end === S) && n.push({ start: m, end: S, text: t }), l = p + u.length;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
}
|
|
@@ -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 O;
|
|
569
569
|
(function(e) {
|
|
570
570
|
e[e.Legacy = 0] = "Legacy", e[e.Strict = 1] = "Strict", e[e.Attribute = 2] = "Attribute";
|
|
571
|
-
})(
|
|
571
|
+
})(O || (O = {}));
|
|
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 = O.Strict;
|
|
575
575
|
}
|
|
576
576
|
/** Resets the instance to make it reusable. */
|
|
577
577
|
startEntity(u) {
|
|
@@ -679,7 +679,7 @@ 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 === O.Strict)
|
|
683
683
|
return 0;
|
|
684
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
|
}
|
|
@@ -699,13 +699,13 @@ class Je {
|
|
|
699
699
|
const s = u.charCodeAt(t);
|
|
700
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 === O.Attribute && // We shouldn't have consumed any characters after the entity,
|
|
703
703
|
(n === 0 || // And there should be no invalid characters.
|
|
704
704
|
We(s)) ? 0 : this.emitNotTerminatedNamedEntity();
|
|
705
705
|
if (r = a[this.treeIndex], n = (r & W.VALUE_LENGTH) >> 14, n !== 0) {
|
|
706
706
|
if (s === V.SEMI)
|
|
707
707
|
return this.emitNamedEntityData(this.treeIndex, n, this.consumed + this.excess);
|
|
708
|
-
this.decodeMode !==
|
|
708
|
+
this.decodeMode !== O.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 !== O.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);
|
|
@@ -794,10 +794,10 @@ function tu(e) {
|
|
|
794
794
|
function Xe(e) {
|
|
795
795
|
return e >= y.LowerA && e <= y.LowerZ || e >= y.UpperA && e <= y.UpperZ;
|
|
796
796
|
}
|
|
797
|
-
var
|
|
797
|
+
var B;
|
|
798
798
|
(function(e) {
|
|
799
799
|
e[e.NoValue = 0] = "NoValue", e[e.Unquoted = 1] = "Unquoted", e[e.Single = 2] = "Single", e[e.Double = 3] = "Double";
|
|
800
|
-
})(
|
|
800
|
+
})(B || (B = {}));
|
|
801
801
|
const N = {
|
|
802
802
|
Cdata: new Uint8Array([67, 68, 65, 84, 65, 91]),
|
|
803
803
|
// CDATA[
|
|
@@ -951,13 +951,13 @@ class Ze {
|
|
|
951
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 === y.Eq ? this.state = f.BeforeAttributeValue : u === y.Slash || u === y.Gt ? (this.cbs.onattribend(
|
|
954
|
+
u === y.Eq ? this.state = f.BeforeAttributeValue : u === y.Slash || u === y.Gt ? (this.cbs.onattribend(B.NoValue, this.sectionStart), this.sectionStart = -1, this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : U(u) || (this.cbs.onattribend(B.NoValue, this.sectionStart), this.state = f.InAttributeName, this.sectionStart = this.index);
|
|
955
955
|
}
|
|
956
956
|
stateBeforeAttributeValue(u) {
|
|
957
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 === y.DoubleQuote ?
|
|
960
|
+
u === t || !this.decodeEntities && this.fastForwardTo(t) ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(t === y.DoubleQuote ? B.Double : B.Single, this.index + 1), this.state = f.BeforeAttributeName) : this.decodeEntities && u === y.Amp && this.startEntity();
|
|
961
961
|
}
|
|
962
962
|
stateInAttributeValueDoubleQuotes(u) {
|
|
963
963
|
this.handleInAttributeValue(u, y.DoubleQuote);
|
|
@@ -966,7 +966,7 @@ class Ze {
|
|
|
966
966
|
this.handleInAttributeValue(u, y.SingleQuote);
|
|
967
967
|
}
|
|
968
968
|
stateInAttributeValueNoQuotes(u) {
|
|
969
|
-
U(u) || u === y.Gt ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(
|
|
969
|
+
U(u) || u === y.Gt ? (this.cbs.onattribdata(this.sectionStart, this.index), this.sectionStart = -1, this.cbs.onattribend(B.Unquoted, this.index), this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : this.decodeEntities && u === y.Amp && this.startEntity();
|
|
970
970
|
}
|
|
971
971
|
stateBeforeDeclaration(u) {
|
|
972
972
|
u === y.OpeningSquareBracket ? (this.state = f.CDATASequence, this.sequenceIndex = 0) : this.state = u === y.Dash ? f.BeforeComment : f.InDeclaration;
|
|
@@ -1006,7 +1006,7 @@ class Ze {
|
|
|
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 ? O.Strict : this.baseState === f.Text || this.baseState === f.InSpecialTag ? O.Legacy : O.Attribute);
|
|
1010
1010
|
}
|
|
1011
1011
|
stateInEntity() {
|
|
1012
1012
|
const u = this.entityDecoder.write(this.buffer, this.index - this.offset);
|
|
@@ -1298,8 +1298,8 @@ class ut {
|
|
|
1298
1298
|
const p = this.stack.indexOf(l);
|
|
1299
1299
|
if (p !== -1)
|
|
1300
1300
|
for (let b = 0; b <= p; b++) {
|
|
1301
|
-
const
|
|
1302
|
-
(r = (a = this.cbs).onclosetag) === null || r === void 0 || r.call(a,
|
|
1301
|
+
const m = this.stack.shift();
|
|
1302
|
+
(r = (a = this.cbs).onclosetag) === null || r === void 0 || r.call(a, m, b !== p);
|
|
1303
1303
|
}
|
|
1304
1304
|
else this.htmlMode && l === "p" && (this.emitOpenTag("p"), this.closeCurrentTag(!0));
|
|
1305
1305
|
}
|
|
@@ -1331,7 +1331,7 @@ class ut {
|
|
|
1331
1331
|
/** @internal */
|
|
1332
1332
|
onattribend(u, t) {
|
|
1333
1333
|
var a, r;
|
|
1334
|
-
this.endIndex = t, (r = (a = this.cbs).onattribute) === null || r === void 0 || r.call(a, this.attribname, this.attribvalue, u ===
|
|
1334
|
+
this.endIndex = t, (r = (a = this.cbs).onattribute) === null || r === void 0 || r.call(a, this.attribname, this.attribvalue, u === B.Double ? '"' : u === B.Single ? "'" : u === B.NoValue ? void 0 : null), this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname) && (this.attribs[this.attribname] = this.attribvalue), this.attribvalue = "";
|
|
1335
1335
|
}
|
|
1336
1336
|
getInstructionName(u) {
|
|
1337
1337
|
const t = u.search(Ye);
|
|
@@ -1367,8 +1367,8 @@ class ut {
|
|
|
1367
1367
|
oncdata(u, t, a) {
|
|
1368
1368
|
var r, n, s, i, o, c, d, l, p, b;
|
|
1369
1369
|
this.endIndex = t;
|
|
1370
|
-
const
|
|
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,
|
|
1370
|
+
const m = this.getSlice(u, t - a);
|
|
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, m), (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[${m}]]`), (b = (p = this.cbs).oncommentend) === null || b === void 0 || b.call(p)), this.startIndex = t + 1;
|
|
1372
1372
|
}
|
|
1373
1373
|
/** @internal */
|
|
1374
1374
|
onend() {
|
|
@@ -1479,8 +1479,8 @@ function qu(e, u = "web") {
|
|
|
1479
1479
|
}) : c.children = r.trim(), r = "");
|
|
1480
1480
|
const d = Object.entries(i || {}).reduce(
|
|
1481
1481
|
(p, b) => {
|
|
1482
|
-
let [
|
|
1483
|
-
return
|
|
1482
|
+
let [m = "", S = ""] = b;
|
|
1483
|
+
return m && (p[m] = S), p;
|
|
1484
1484
|
},
|
|
1485
1485
|
{}
|
|
1486
1486
|
);
|
|
@@ -1518,7 +1518,7 @@ function et(e, u) {
|
|
|
1518
1518
|
imports: tt(e),
|
|
1519
1519
|
emits: [],
|
|
1520
1520
|
errors: []
|
|
1521
|
-
}, r =
|
|
1521
|
+
}, r = _(e);
|
|
1522
1522
|
return J(r, {
|
|
1523
1523
|
ExportDefaultDeclaration(n) {
|
|
1524
1524
|
const s = n.node.declaration;
|
|
@@ -1557,10 +1557,13 @@ function et(e, u) {
|
|
|
1557
1557
|
a.inject = pt(l.value);
|
|
1558
1558
|
break;
|
|
1559
1559
|
case "expose":
|
|
1560
|
-
a.expose =
|
|
1560
|
+
a.expose = mt(l.value);
|
|
1561
|
+
break;
|
|
1562
|
+
case "emits":
|
|
1563
|
+
a.emits = ht(l.value);
|
|
1561
1564
|
break;
|
|
1562
1565
|
case "directives":
|
|
1563
|
-
a.directives =
|
|
1566
|
+
a.directives = gt(l.value);
|
|
1564
1567
|
break;
|
|
1565
1568
|
}
|
|
1566
1569
|
for (const l of c)
|
|
@@ -1674,7 +1677,7 @@ function nt(e, u) {
|
|
|
1674
1677
|
if (s && s.exp.value.includes("this.provider.apis")) {
|
|
1675
1678
|
const l = (s.exp.value.match(a) || [])[1];
|
|
1676
1679
|
if (!l) continue;
|
|
1677
|
-
const p =
|
|
1680
|
+
const p = xt(u, l);
|
|
1678
1681
|
if (!p) continue;
|
|
1679
1682
|
const b = r(s.exp.value);
|
|
1680
1683
|
t[s.name] = {
|
|
@@ -1875,13 +1878,16 @@ function pt(e) {
|
|
|
1875
1878
|
};
|
|
1876
1879
|
})), u;
|
|
1877
1880
|
}
|
|
1878
|
-
function
|
|
1881
|
+
function mt(e) {
|
|
1879
1882
|
return e && e.elements ? e.elements.map((u) => u?.type === "StringLiteral" ? u.value : "").filter((u) => !!u) : [];
|
|
1880
1883
|
}
|
|
1881
|
-
function
|
|
1884
|
+
function ht(e) {
|
|
1885
|
+
return e && e.elements ? e.elements.map((u) => u?.type === "StringLiteral" && u.value ? { name: u.value, params: [] } : null).filter((u) => !!u) : [];
|
|
1886
|
+
}
|
|
1887
|
+
function xt(e, u) {
|
|
1882
1888
|
return (e.apis || []).find((t) => t.id === u || t.name === u);
|
|
1883
1889
|
}
|
|
1884
|
-
function
|
|
1890
|
+
function gt(e) {
|
|
1885
1891
|
if (!e?.properties) return {};
|
|
1886
1892
|
const u = {};
|
|
1887
1893
|
for (const t of e.properties) {
|
|
@@ -1893,9 +1899,9 @@ function xt(e) {
|
|
|
1893
1899
|
}
|
|
1894
1900
|
return u;
|
|
1895
1901
|
}
|
|
1896
|
-
let
|
|
1902
|
+
let mu = [], iu = {}, ue = {}, ee = {}, te = {}, cu = "web", ae = [];
|
|
1897
1903
|
function re(e, u, t = "", a) {
|
|
1898
|
-
|
|
1904
|
+
mu = [], iu = {}, ue = a?.handlers || {}, te = a?.styles || {}, cu = a?.platform || "web", ae = a?.imports || [], ee = a?.directives || {};
|
|
1899
1905
|
const n = Gu({
|
|
1900
1906
|
id: e,
|
|
1901
1907
|
filename: u,
|
|
@@ -1909,26 +1915,26 @@ function re(e, u, t = "", a) {
|
|
|
1909
1915
|
}
|
|
1910
1916
|
return {
|
|
1911
1917
|
nodes: s.filter((i) => !!i),
|
|
1912
|
-
slots:
|
|
1918
|
+
slots: mu,
|
|
1913
1919
|
context: iu
|
|
1914
1920
|
};
|
|
1915
1921
|
}
|
|
1916
|
-
function
|
|
1922
|
+
function yt(e) {
|
|
1917
1923
|
if (e.name === "slot") {
|
|
1918
1924
|
let u = "default";
|
|
1919
1925
|
const t = [];
|
|
1920
1926
|
for (const [a, r] of Object.entries(e.props || {}))
|
|
1921
1927
|
a === "name" ? u = r : t.push(a);
|
|
1922
|
-
|
|
1928
|
+
mu.push({
|
|
1923
1929
|
name: u,
|
|
1924
1930
|
params: t
|
|
1925
1931
|
});
|
|
1926
1932
|
}
|
|
1927
1933
|
}
|
|
1928
|
-
function
|
|
1934
|
+
function St(e) {
|
|
1929
1935
|
const u = {};
|
|
1930
1936
|
for (const t of e) {
|
|
1931
|
-
if (t.type ===
|
|
1937
|
+
if (t.type === E.ATTRIBUTE)
|
|
1932
1938
|
if (t.name === "class") {
|
|
1933
1939
|
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
1940
|
i && (u.style = i), s.length && (u.class = s.join(" "));
|
|
@@ -1937,7 +1943,7 @@ function yt(e) {
|
|
|
1937
1943
|
a && (u.style = Xu(a));
|
|
1938
1944
|
} else
|
|
1939
1945
|
u[t.name] = t.value?.content || "";
|
|
1940
|
-
if (t.type ===
|
|
1946
|
+
if (t.type === E.DIRECTIVE && t.name === "bind" && (t.exp?.type === E.SIMPLE_EXPRESSION && t.arg?.type === E.SIMPLE_EXPRESSION && (u[t.arg.content] = T(`(${t.exp.content})`)), t.exp?.type === E.COMPOUND_EXPRESSION && t.arg?.type === E.SIMPLE_EXPRESSION))
|
|
1941
1947
|
if (t.arg.content === "class" && u.class) {
|
|
1942
1948
|
const a = t.exp.ast.type, r = Pe(
|
|
1943
1949
|
u.class,
|
|
@@ -1952,16 +1958,16 @@ function yt(e) {
|
|
|
1952
1958
|
}
|
|
1953
1959
|
return u;
|
|
1954
1960
|
}
|
|
1955
|
-
function
|
|
1961
|
+
function vt(e = {}) {
|
|
1956
1962
|
const u = {};
|
|
1957
1963
|
for (const [t, a] of Object.entries(e))
|
|
1958
1964
|
u[t === "tap" ? "click" : t] = a;
|
|
1959
1965
|
return u;
|
|
1960
1966
|
}
|
|
1961
|
-
function
|
|
1967
|
+
function Et(e, u = {}) {
|
|
1962
1968
|
const t = {};
|
|
1963
1969
|
for (const a of e)
|
|
1964
|
-
if (a.type ===
|
|
1970
|
+
if (a.type === E.DIRECTIVE && a.name === "on" && a.arg?.type === E.SIMPLE_EXPRESSION) {
|
|
1965
1971
|
const r = a.modifiers.reduce(
|
|
1966
1972
|
(c, d) => (d.content && (c[d.content] = !0), c),
|
|
1967
1973
|
{}
|
|
@@ -1976,31 +1982,44 @@ function vt(e, u = {}) {
|
|
|
1976
1982
|
modifiers: r
|
|
1977
1983
|
};
|
|
1978
1984
|
else {
|
|
1979
|
-
const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression",
|
|
1980
|
-
let
|
|
1985
|
+
const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", m = d === "Identifier", S = d === "MemberExpression", w = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
|
|
1986
|
+
let h;
|
|
1981
1987
|
if (l)
|
|
1982
|
-
|
|
1983
|
-
else if (
|
|
1984
|
-
|
|
1988
|
+
h = T(n);
|
|
1989
|
+
else if (m || S || w)
|
|
1990
|
+
h = C(n);
|
|
1985
1991
|
else if (p || b) {
|
|
1986
1992
|
const g = c?.body, x = c?.params;
|
|
1987
|
-
g && g.type === "Identifier" && (!x || x.length === 0) ?
|
|
1993
|
+
g && g.type === "Identifier" && (!x || x.length === 0) ? h = C(g.name) : h = C(n);
|
|
1988
1994
|
} else {
|
|
1989
|
-
|
|
1990
|
-
|
|
1995
|
+
let g = !1;
|
|
1996
|
+
try {
|
|
1997
|
+
const v = _(n).program.body;
|
|
1998
|
+
if (v.length === 1 && v[0].type === "ExpressionStatement") {
|
|
1999
|
+
const I = v[0].expression?.type;
|
|
2000
|
+
g = I === "ArrowFunctionExpression" || I === "FunctionExpression";
|
|
2001
|
+
}
|
|
2002
|
+
} catch {
|
|
2003
|
+
}
|
|
2004
|
+
if (g)
|
|
2005
|
+
h = C(n);
|
|
2006
|
+
else {
|
|
2007
|
+
const v = /\$event\b/.test(n) ? "($event) => " : "() => ";
|
|
2008
|
+
h = C(`${v}${n}`);
|
|
2009
|
+
}
|
|
1991
2010
|
}
|
|
1992
2011
|
t[a.arg.content] = {
|
|
1993
2012
|
name: a.arg.content,
|
|
1994
|
-
handler:
|
|
2013
|
+
handler: h,
|
|
1995
2014
|
modifiers: r
|
|
1996
2015
|
};
|
|
1997
2016
|
}
|
|
1998
2017
|
}
|
|
1999
|
-
return
|
|
2018
|
+
return vt(t);
|
|
2000
2019
|
}
|
|
2001
2020
|
function eu(e, u) {
|
|
2002
2021
|
const t = [], a = ["if", "for", "model", "show", "bind", "html"];
|
|
2003
|
-
if (u && (e.type ===
|
|
2022
|
+
if (u && (e.type === E.IF_BRANCH || e.type === E.IF) && u.forEach((r, n) => {
|
|
2004
2023
|
if (e === r) {
|
|
2005
2024
|
const s = n === 0 ? "vIf" : r.condition ? "vElseIf" : "vElse", i = r.condition?.loc.source || "";
|
|
2006
2025
|
t.push({
|
|
@@ -2013,16 +2032,16 @@ function eu(e, u) {
|
|
|
2013
2032
|
t.push(...c);
|
|
2014
2033
|
}
|
|
2015
2034
|
}
|
|
2016
|
-
}), e.type ===
|
|
2035
|
+
}), e.type === E.FOR && t.push({
|
|
2017
2036
|
name: "vFor",
|
|
2018
2037
|
value: T(e.source.loc.source),
|
|
2019
2038
|
iterator: {
|
|
2020
2039
|
item: e.valueAlias?.loc.source || "item",
|
|
2021
2040
|
index: e.keyAlias?.loc.source || "index"
|
|
2022
2041
|
}
|
|
2023
|
-
}), e.type ===
|
|
2042
|
+
}), e.type === E.ELEMENT) {
|
|
2024
2043
|
const r = e.props.filter(
|
|
2025
|
-
(d) => d.type ===
|
|
2044
|
+
(d) => d.type === E.DIRECTIVE
|
|
2026
2045
|
), n = r.filter((d) => d.name === "model");
|
|
2027
2046
|
n.length && n.forEach((d) => {
|
|
2028
2047
|
t.push({
|
|
@@ -2049,7 +2068,7 @@ function eu(e, u) {
|
|
|
2049
2068
|
const c = r.filter((d) => !a.includes(d.name));
|
|
2050
2069
|
for (const d of c) {
|
|
2051
2070
|
const l = (d.modifiers || []).reduce(
|
|
2052
|
-
(
|
|
2071
|
+
(m, S) => (m[S.content] = !0, m),
|
|
2053
2072
|
{}
|
|
2054
2073
|
), p = d.arg?.content || void 0, b = ee[d.name];
|
|
2055
2074
|
b && t.push({
|
|
@@ -2064,20 +2083,20 @@ function eu(e, u) {
|
|
|
2064
2083
|
}
|
|
2065
2084
|
function ne(e) {
|
|
2066
2085
|
let u = "";
|
|
2067
|
-
if (e.type ===
|
|
2086
|
+
if (e.type === E.ELEMENT) {
|
|
2068
2087
|
const { props: t = [], tag: a } = e;
|
|
2069
2088
|
for (const r of t)
|
|
2070
2089
|
if (r.name === "class") {
|
|
2071
2090
|
const n = r.value?.content || "", s = new RegExp(`${a}_([\\w]+)`);
|
|
2072
2091
|
u = n.match(s)?.[1] || "";
|
|
2073
|
-
} else if (r.type ===
|
|
2092
|
+
} else if (r.type === E.DIRECTIVE && r.name === "on") {
|
|
2074
2093
|
const n = r.arg?.loc?.source || "", s = r.exp?.loc?.source || "", i = new RegExp(`${n}_([\\w]+)`);
|
|
2075
2094
|
u = s.match(i)?.[1] || "";
|
|
2076
2095
|
}
|
|
2077
2096
|
}
|
|
2078
2097
|
return u || nu();
|
|
2079
2098
|
}
|
|
2080
|
-
function
|
|
2099
|
+
function wt(e) {
|
|
2081
2100
|
const u = /\.\/(.+?)\.vue/;
|
|
2082
2101
|
for (const { from: t, imports: a } of ae) {
|
|
2083
2102
|
if (Array.isArray(a) && a.includes(e))
|
|
@@ -2092,7 +2111,7 @@ function Et(e) {
|
|
|
2092
2111
|
}
|
|
2093
2112
|
}
|
|
2094
2113
|
}
|
|
2095
|
-
function
|
|
2114
|
+
function hu(e, u) {
|
|
2096
2115
|
const t = new Set(u?.id ? iu[u.id] : []), a = (e.directives || []).find((s) => s.name === "vFor");
|
|
2097
2116
|
let r = new Set(Array.from(t));
|
|
2098
2117
|
if (a) {
|
|
@@ -2109,65 +2128,65 @@ function mu(e, u) {
|
|
|
2109
2128
|
function bu(e, u, t, a) {
|
|
2110
2129
|
const r = {
|
|
2111
2130
|
name: zu(e.tag, cu),
|
|
2112
|
-
from:
|
|
2113
|
-
props:
|
|
2114
|
-
events:
|
|
2131
|
+
from: wt(e.tag),
|
|
2132
|
+
props: St(e.props),
|
|
2133
|
+
events: Et(e.props, ue),
|
|
2115
2134
|
directives: eu(t || e, a)
|
|
2116
2135
|
};
|
|
2117
|
-
r.id = ne(e),
|
|
2136
|
+
r.id = ne(e), hu(r, u);
|
|
2118
2137
|
const n = ou(r, e.children);
|
|
2119
|
-
return
|
|
2138
|
+
return hu(r, u), yt(n), n;
|
|
2120
2139
|
}
|
|
2121
|
-
function
|
|
2140
|
+
function It(e = [], u) {
|
|
2122
2141
|
return e.map((t) => Z(t, u, e));
|
|
2123
2142
|
}
|
|
2124
2143
|
function Z(e, u, t) {
|
|
2125
|
-
if (e.type ===
|
|
2144
|
+
if (e.type === E.ELEMENT)
|
|
2126
2145
|
return bu(e, u);
|
|
2127
|
-
if (e.type ===
|
|
2128
|
-
return
|
|
2129
|
-
if (t && e.type ===
|
|
2146
|
+
if (e.type === E.IF)
|
|
2147
|
+
return At(e);
|
|
2148
|
+
if (t && e.type === E.IF_BRANCH) {
|
|
2130
2149
|
const a = e.children.find(
|
|
2131
|
-
(r) => r.type ===
|
|
2150
|
+
(r) => r.type === E.ELEMENT || r.type === E.FOR
|
|
2132
2151
|
);
|
|
2133
2152
|
if (a) {
|
|
2134
|
-
if (a.type ===
|
|
2153
|
+
if (a.type === E.ELEMENT)
|
|
2135
2154
|
return bu(a, u, e, t);
|
|
2136
|
-
if (a.type ===
|
|
2155
|
+
if (a.type === E.FOR) {
|
|
2137
2156
|
const n = { name: "div", directives: eu(e) };
|
|
2138
2157
|
return ou(n, e.children || []);
|
|
2139
2158
|
}
|
|
2140
2159
|
}
|
|
2141
2160
|
return "";
|
|
2142
2161
|
}
|
|
2143
|
-
if (e.type ===
|
|
2162
|
+
if (e.type === E.FOR) {
|
|
2144
2163
|
const a = e.children[0];
|
|
2145
|
-
if (e.children.length > 1 || a.type !==
|
|
2164
|
+
if (e.children.length > 1 || a.type !== E.ELEMENT) {
|
|
2146
2165
|
const n = { name: "span", directives: eu(e) };
|
|
2147
2166
|
return ou(n, e.children);
|
|
2148
2167
|
} else
|
|
2149
2168
|
return bu(a, u, e);
|
|
2150
2169
|
}
|
|
2151
|
-
if (e.type ===
|
|
2152
|
-
return e.content.type ==
|
|
2170
|
+
if (e.type === E.TEXT_CALL)
|
|
2171
|
+
return e.content.type == E.TEXT ? e.content.content : e.content.type === E.INTERPOLATION ? T(e.content.content.loc.source) : e.content.type === E.COMPOUND_EXPRESSION ? Ru(
|
|
2153
2172
|
e.content.children
|
|
2154
2173
|
) : "";
|
|
2155
|
-
if (e.type ===
|
|
2174
|
+
if (e.type === E.TEXT)
|
|
2156
2175
|
return e.content;
|
|
2157
|
-
if (e.type ===
|
|
2176
|
+
if (e.type === E.INTERPOLATION && (e.content.type === E.SIMPLE_EXPRESSION || e.content.type === E.COMPOUND_EXPRESSION))
|
|
2158
2177
|
return T(e.content.loc.source);
|
|
2159
|
-
if (e.type ===
|
|
2178
|
+
if (e.type === E.COMPOUND_EXPRESSION)
|
|
2160
2179
|
return Ru(
|
|
2161
2180
|
e.children
|
|
2162
2181
|
);
|
|
2163
|
-
e.type !==
|
|
2182
|
+
e.type !== E.COMMENT && console.warn("未处理", e.type);
|
|
2164
2183
|
}
|
|
2165
2184
|
function Ru(e = []) {
|
|
2166
2185
|
const u = e.filter((a) => typeof a != "string"), t = [];
|
|
2167
2186
|
for (const a of u)
|
|
2168
2187
|
t.push({
|
|
2169
2188
|
name: "span",
|
|
2170
|
-
children: a.type ===
|
|
2189
|
+
children: a.type === E.TEXT ? a.loc.source : T(a.content?.loc.source)
|
|
2171
2190
|
});
|
|
2172
2191
|
return {
|
|
2173
2192
|
name: "span",
|
|
@@ -2177,34 +2196,34 @@ function Ru(e = []) {
|
|
|
2177
2196
|
function ou(e, u = []) {
|
|
2178
2197
|
const t = [];
|
|
2179
2198
|
for (const a of u)
|
|
2180
|
-
if (a.type ===
|
|
2199
|
+
if (a.type === E.ELEMENT && a.codegenNode?.value?.arguments) {
|
|
2181
2200
|
const r = a.codegenNode.value.arguments[0];
|
|
2182
2201
|
if (r) {
|
|
2183
2202
|
const n = qu(r, cu);
|
|
2184
2203
|
t.push(...n);
|
|
2185
2204
|
}
|
|
2186
|
-
} else if (a.type ===
|
|
2205
|
+
} else if (a.type === E.ELEMENT && a.tag === "template") {
|
|
2187
2206
|
const r = a.props.find((n) => n.name === "slot");
|
|
2188
2207
|
for (const n of a.children) {
|
|
2189
|
-
const s = n.type ===
|
|
2208
|
+
const s = n.type === E.TEXT || n.type === E.TEXT_CALL ? {
|
|
2190
2209
|
name: "span",
|
|
2191
2210
|
children: Z(n, e)
|
|
2192
2211
|
} : Z(n, e);
|
|
2193
2212
|
s && (Array.isArray(s) ? s : [s]).forEach((o) => {
|
|
2194
|
-
Ie(o) && r?.type ===
|
|
2213
|
+
Ie(o) && r?.type === E.DIRECTIVE && (o.id = ne(n), o.slot = {
|
|
2195
2214
|
name: r.arg?.content || "default",
|
|
2196
2215
|
params: r.exp?.identifiers || [],
|
|
2197
|
-
scope: r.exp?.type ===
|
|
2198
|
-
},
|
|
2216
|
+
scope: r.exp?.type === E.SIMPLE_EXPRESSION ? r.exp.content : ""
|
|
2217
|
+
}, hu(o, e)), t.push(o);
|
|
2199
2218
|
});
|
|
2200
2219
|
}
|
|
2201
|
-
} else if (a.type ===
|
|
2220
|
+
} else if (a.type === E.JS_CALL_EXPRESSION) {
|
|
2202
2221
|
const r = a.arguments?.[0];
|
|
2203
2222
|
if (r) {
|
|
2204
2223
|
const n = qu(r, cu);
|
|
2205
2224
|
t.push(...n);
|
|
2206
2225
|
}
|
|
2207
|
-
} else if (a.type ===
|
|
2226
|
+
} else if (a.type === E.TEXT_CALL) {
|
|
2208
2227
|
const r = Z(a, e);
|
|
2209
2228
|
r && (Array.isArray(r) ? t.push(...r) : t.push(r));
|
|
2210
2229
|
} else {
|
|
@@ -2218,15 +2237,15 @@ function ou(e, u = []) {
|
|
|
2218
2237
|
e.children = t.map((a) => typeof a == "string" || su(a) ? { name: "span", children: a } : a);
|
|
2219
2238
|
return e;
|
|
2220
2239
|
}
|
|
2221
|
-
function
|
|
2240
|
+
function At(e) {
|
|
2222
2241
|
const u = e.branches || [], t = u[0], a = t.children || [];
|
|
2223
|
-
if (t?.isTemplateIf || a.length > 1 || a[0].type !==
|
|
2242
|
+
if (t?.isTemplateIf || a.length > 1 || a[0].type !== E.ELEMENT) {
|
|
2224
2243
|
const n = { name: "span", directives: eu(t, u) };
|
|
2225
2244
|
return ou(n, t.children);
|
|
2226
2245
|
} else
|
|
2227
|
-
return
|
|
2246
|
+
return It(u);
|
|
2228
2247
|
}
|
|
2229
|
-
const
|
|
2248
|
+
const kt = {
|
|
2230
2249
|
onBeforeMount: "beforeMount",
|
|
2231
2250
|
onMounted: "mounted",
|
|
2232
2251
|
onBeforeUpdate: "beforeUpdate",
|
|
@@ -2257,16 +2276,16 @@ const At = {
|
|
|
2257
2276
|
onNavigationBarSearchInputClicked: "onNavigationBarSearchInputClicked",
|
|
2258
2277
|
onShareTimeline: "onShareTimeline",
|
|
2259
2278
|
onAddToFavorites: "onAddToFavorites"
|
|
2260
|
-
},
|
|
2279
|
+
}, Tt = /* @__PURE__ */ new Set([
|
|
2261
2280
|
"vue-router",
|
|
2262
2281
|
"pinia",
|
|
2263
2282
|
"vue-i18n",
|
|
2264
2283
|
"@vtj/renderer"
|
|
2265
|
-
]),
|
|
2284
|
+
]), Nt = new Set(
|
|
2266
2285
|
Object.values(gu).map((e) => e.composable).filter((e) => !!e)
|
|
2267
2286
|
);
|
|
2268
|
-
function
|
|
2269
|
-
const t =
|
|
2287
|
+
function jt(e, u) {
|
|
2288
|
+
const t = Vt(e), a = qt(t), { dependencies: r = [] } = u || {}, n = r.reduce(
|
|
2270
2289
|
(c, d) => (c[d.package] = d.library, c),
|
|
2271
2290
|
{}
|
|
2272
2291
|
), s = {
|
|
@@ -2288,7 +2307,7 @@ function Nt(e, u) {
|
|
|
2288
2307
|
handlers: {},
|
|
2289
2308
|
dataSources: {},
|
|
2290
2309
|
directives: {}
|
|
2291
|
-
}, i = [], o =
|
|
2310
|
+
}, i = [], o = _(e);
|
|
2292
2311
|
if (J(o, {
|
|
2293
2312
|
// 顶层变量声明
|
|
2294
2313
|
VariableDeclaration(c) {
|
|
@@ -2298,73 +2317,73 @@ function Nt(e, u) {
|
|
|
2298
2317
|
if (!p.init) continue;
|
|
2299
2318
|
const b = p.init;
|
|
2300
2319
|
if (b.type === "CallExpression") {
|
|
2301
|
-
const
|
|
2302
|
-
if (
|
|
2303
|
-
const
|
|
2304
|
-
if (
|
|
2305
|
-
const
|
|
2306
|
-
s.refs[
|
|
2320
|
+
const m = Cu(b);
|
|
2321
|
+
if (m === "ref") {
|
|
2322
|
+
const w = L(p.id);
|
|
2323
|
+
if (w) {
|
|
2324
|
+
const h = b.arguments[0] ? A(b.arguments[0]) : "undefined";
|
|
2325
|
+
s.refs[w] = T(h);
|
|
2307
2326
|
}
|
|
2308
2327
|
return;
|
|
2309
2328
|
}
|
|
2310
|
-
if (
|
|
2311
|
-
const
|
|
2312
|
-
if (
|
|
2313
|
-
if (
|
|
2314
|
-
s.state =
|
|
2329
|
+
if (m === "reactive") {
|
|
2330
|
+
const w = L(p.id);
|
|
2331
|
+
if (w)
|
|
2332
|
+
if (w === "__state")
|
|
2333
|
+
s.state = Rt(b.arguments[0]);
|
|
2315
2334
|
else {
|
|
2316
|
-
const
|
|
2317
|
-
s.reactives[
|
|
2335
|
+
const h = b.arguments[0] ? A(b.arguments[0]) : "{}";
|
|
2336
|
+
s.reactives[w] = T(h);
|
|
2318
2337
|
}
|
|
2319
2338
|
return;
|
|
2320
2339
|
}
|
|
2321
|
-
if (
|
|
2322
|
-
const
|
|
2323
|
-
if (
|
|
2324
|
-
const
|
|
2325
|
-
s.computed[
|
|
2340
|
+
if (m === "computed") {
|
|
2341
|
+
const w = L(p.id);
|
|
2342
|
+
if (w) {
|
|
2343
|
+
const h = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
|
|
2344
|
+
s.computed[w] = C(h);
|
|
2326
2345
|
}
|
|
2327
2346
|
return;
|
|
2328
2347
|
}
|
|
2329
|
-
if (
|
|
2330
|
-
const
|
|
2331
|
-
if (
|
|
2332
|
-
const
|
|
2348
|
+
if (m === "inject") {
|
|
2349
|
+
const w = L(p.id);
|
|
2350
|
+
if (w) {
|
|
2351
|
+
const h = b.arguments[0], g = b.arguments[1], x = h ? Lu(h) : w;
|
|
2333
2352
|
s.inject.push({
|
|
2334
|
-
name:
|
|
2335
|
-
from: x ||
|
|
2353
|
+
name: w,
|
|
2354
|
+
from: x || w,
|
|
2336
2355
|
default: g ? T(A(g)) : void 0
|
|
2337
2356
|
});
|
|
2338
2357
|
}
|
|
2339
2358
|
return;
|
|
2340
2359
|
}
|
|
2341
|
-
if (
|
|
2360
|
+
if (m === "defineProps" || m === "withDefaults") {
|
|
2342
2361
|
s.props = Mu(b);
|
|
2343
2362
|
return;
|
|
2344
2363
|
}
|
|
2345
|
-
if (
|
|
2364
|
+
if (m === "defineEmits") {
|
|
2346
2365
|
s.emits = Ou(b);
|
|
2347
2366
|
return;
|
|
2348
2367
|
}
|
|
2349
|
-
if (
|
|
2350
|
-
const
|
|
2351
|
-
if (
|
|
2368
|
+
if (m && /^use[A-Z]/.test(m)) {
|
|
2369
|
+
const w = a.get(m);
|
|
2370
|
+
if (Dt(m, w)) {
|
|
2352
2371
|
const x = _u(p.id);
|
|
2353
|
-
x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee:
|
|
2372
|
+
x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: m, destructure: x }));
|
|
2354
2373
|
return;
|
|
2355
2374
|
}
|
|
2356
|
-
if (
|
|
2357
|
-
if (!
|
|
2375
|
+
if (m === "useProvider") return;
|
|
2376
|
+
if (!w)
|
|
2358
2377
|
continue;
|
|
2359
|
-
const
|
|
2360
|
-
if (
|
|
2361
|
-
if (
|
|
2378
|
+
const h = L(p.id), g = _u(p.id);
|
|
2379
|
+
if (h || g.length) {
|
|
2380
|
+
if (h && s.composables.some((D) => D.name === h))
|
|
2362
2381
|
return;
|
|
2363
2382
|
let x;
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2383
|
+
const v = n[w];
|
|
2384
|
+
v ? x = `this.$libs.${v}.${m}` : x = m;
|
|
2366
2385
|
const I = {
|
|
2367
|
-
name:
|
|
2386
|
+
name: h || g[0] || m,
|
|
2368
2387
|
composable: {
|
|
2369
2388
|
type: "JSExpression",
|
|
2370
2389
|
value: x
|
|
@@ -2376,33 +2395,33 @@ function Nt(e, u) {
|
|
|
2376
2395
|
}
|
|
2377
2396
|
return;
|
|
2378
2397
|
}
|
|
2379
|
-
const S =
|
|
2380
|
-
if (S && S.startsWith("__") ||
|
|
2398
|
+
const S = L(p.id);
|
|
2399
|
+
if (S && S.startsWith("__") || m === "getCurrentInstance")
|
|
2381
2400
|
return;
|
|
2382
2401
|
}
|
|
2383
2402
|
if (b.type === "ArrowFunctionExpression" || b.type === "FunctionExpression") {
|
|
2384
|
-
const
|
|
2385
|
-
if (
|
|
2403
|
+
const m = L(p.id);
|
|
2404
|
+
if (m) {
|
|
2386
2405
|
const S = A(b);
|
|
2387
2406
|
if (Bu(S)) {
|
|
2388
|
-
const
|
|
2389
|
-
if (
|
|
2390
|
-
s.dataSources[
|
|
2407
|
+
const w = $u(m, S, u);
|
|
2408
|
+
if (w) {
|
|
2409
|
+
s.dataSources[m] = w;
|
|
2391
2410
|
return;
|
|
2392
2411
|
}
|
|
2393
2412
|
}
|
|
2394
|
-
s.methods[
|
|
2413
|
+
s.methods[m] = C(S);
|
|
2395
2414
|
}
|
|
2396
2415
|
return;
|
|
2397
2416
|
}
|
|
2398
2417
|
if (b.type === "MemberExpression") {
|
|
2399
|
-
const
|
|
2418
|
+
const m = b.object, S = m.type === "Identifier" ? m.name : m.type === "MemberExpression" && m.object.type === "Identifier" ? m.object.name : null;
|
|
2400
2419
|
if (S && a.has(S))
|
|
2401
2420
|
return;
|
|
2402
2421
|
}
|
|
2403
2422
|
}
|
|
2404
2423
|
if (d.declarations.some((p) => {
|
|
2405
|
-
const b =
|
|
2424
|
+
const b = L(p.id);
|
|
2406
2425
|
return b && b.startsWith("__");
|
|
2407
2426
|
}))
|
|
2408
2427
|
return;
|
|
@@ -2411,7 +2430,7 @@ function Nt(e, u) {
|
|
|
2411
2430
|
return b && (b.type === "ObjectExpression" || b.type === "ArrayExpression");
|
|
2412
2431
|
}) && d.declarations.length > 0) {
|
|
2413
2432
|
for (const p of d.declarations) {
|
|
2414
|
-
const b =
|
|
2433
|
+
const b = L(p.id);
|
|
2415
2434
|
b && p.init && (s.reactives[b] = T(A(p.init)));
|
|
2416
2435
|
}
|
|
2417
2436
|
return;
|
|
@@ -2419,9 +2438,9 @@ function Nt(e, u) {
|
|
|
2419
2438
|
for (const p of d.declarations) {
|
|
2420
2439
|
const b = p.init;
|
|
2421
2440
|
if (b) {
|
|
2422
|
-
const
|
|
2441
|
+
const m = L(p.id) || "(unknown)", S = A(b), w = b.type;
|
|
2423
2442
|
throw new Error(
|
|
2424
|
-
`[vtj/parser] 无法处理顶层变量声明 "const ${
|
|
2443
|
+
`[vtj/parser] 无法处理顶层变量声明 "const ${m} = ${S}":不支持的类型 "${w}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
|
|
2425
2444
|
);
|
|
2426
2445
|
}
|
|
2427
2446
|
}
|
|
@@ -2434,7 +2453,7 @@ function Nt(e, u) {
|
|
|
2434
2453
|
if (c.parent.type !== "Program") return;
|
|
2435
2454
|
const d = c.node;
|
|
2436
2455
|
if (!d.id) return;
|
|
2437
|
-
const l = d.id.name, p =
|
|
2456
|
+
const l = d.id.name, p = Mt(d);
|
|
2438
2457
|
if (Bu(p)) {
|
|
2439
2458
|
const b = $u(l, p, u);
|
|
2440
2459
|
if (b) {
|
|
@@ -2457,35 +2476,35 @@ function Nt(e, u) {
|
|
|
2457
2476
|
if (c.parent.type !== "Program") return;
|
|
2458
2477
|
const d = c.node, l = d.expression;
|
|
2459
2478
|
if (l.type !== "CallExpression") {
|
|
2460
|
-
const
|
|
2479
|
+
const m = A(d);
|
|
2461
2480
|
throw new Error(
|
|
2462
|
-
`[vtj/parser] 无法处理顶层表达式语句 "${
|
|
2481
|
+
`[vtj/parser] 无法处理顶层表达式语句 "${m}":DSL 不支持游离的顶层表达式,请改用生命周期钩子(如 onMounted)或声明确赋值。`
|
|
2463
2482
|
);
|
|
2464
2483
|
}
|
|
2465
2484
|
const p = Cu(l);
|
|
2466
2485
|
if (p === "watch") {
|
|
2467
|
-
const
|
|
2468
|
-
|
|
2486
|
+
const m = Lt(l);
|
|
2487
|
+
m && s.watch.push(m);
|
|
2469
2488
|
return;
|
|
2470
2489
|
}
|
|
2471
|
-
if (p && p in
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2490
|
+
if (p && p in kt) {
|
|
2491
|
+
const m = l.arguments[0];
|
|
2492
|
+
m && (s.lifeCycles[p] = C(A(m)));
|
|
2474
2493
|
return;
|
|
2475
2494
|
}
|
|
2476
2495
|
if (p === "provide") {
|
|
2477
|
-
const
|
|
2478
|
-
if (
|
|
2479
|
-
const
|
|
2480
|
-
if (
|
|
2481
|
-
const
|
|
2482
|
-
S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[
|
|
2496
|
+
const m = l.arguments[0], S = l.arguments[1];
|
|
2497
|
+
if (m && S) {
|
|
2498
|
+
const w = Lu(m);
|
|
2499
|
+
if (w) {
|
|
2500
|
+
const h = A(S);
|
|
2501
|
+
S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[w] = C(h) : s.provide[w] = T(h);
|
|
2483
2502
|
}
|
|
2484
2503
|
}
|
|
2485
2504
|
return;
|
|
2486
2505
|
}
|
|
2487
2506
|
if (p === "defineExpose") {
|
|
2488
|
-
s.expose =
|
|
2507
|
+
s.expose = _t(l);
|
|
2489
2508
|
return;
|
|
2490
2509
|
}
|
|
2491
2510
|
if (p === "defineProps" || p === "withDefaults") {
|
|
@@ -2512,7 +2531,7 @@ ${i.join(`
|
|
|
2512
2531
|
}
|
|
2513
2532
|
return s;
|
|
2514
2533
|
}
|
|
2515
|
-
function
|
|
2534
|
+
function Vt(e) {
|
|
2516
2535
|
const u = /import\s+{(.+?)}\s+from\s+['"](.+?)['"]/g, t = /import\s+(.+?)\s+from\s+['"](.+?)['"]/g, a = /^{(.+?)}$/, r = [];
|
|
2517
2536
|
let n;
|
|
2518
2537
|
const s = e.replace(/\n/g, " ");
|
|
@@ -2532,7 +2551,7 @@ function jt(e) {
|
|
|
2532
2551
|
}
|
|
2533
2552
|
return r;
|
|
2534
2553
|
}
|
|
2535
|
-
function
|
|
2554
|
+
function qt(e) {
|
|
2536
2555
|
const u = /* @__PURE__ */ new Map();
|
|
2537
2556
|
for (const t of e)
|
|
2538
2557
|
if (Array.isArray(t.imports))
|
|
@@ -2544,13 +2563,13 @@ function Vt(e) {
|
|
|
2544
2563
|
u.set(t.imports, t.from);
|
|
2545
2564
|
return u;
|
|
2546
2565
|
}
|
|
2547
|
-
function
|
|
2548
|
-
return u &&
|
|
2566
|
+
function Dt(e, u) {
|
|
2567
|
+
return u && Tt.has(u) ? !0 : Nt.has(e);
|
|
2549
2568
|
}
|
|
2550
2569
|
function Cu(e) {
|
|
2551
2570
|
return e.callee.type === "Identifier" ? e.callee.name : null;
|
|
2552
2571
|
}
|
|
2553
|
-
function
|
|
2572
|
+
function L(e) {
|
|
2554
2573
|
return e?.type === "Identifier" ? e.name : null;
|
|
2555
2574
|
}
|
|
2556
2575
|
function _u(e) {
|
|
@@ -2559,7 +2578,7 @@ function _u(e) {
|
|
|
2559
2578
|
function Lu(e) {
|
|
2560
2579
|
return e.type === "StringLiteral" ? e.value : null;
|
|
2561
2580
|
}
|
|
2562
|
-
function
|
|
2581
|
+
function Rt(e) {
|
|
2563
2582
|
if (!e || e.type !== "ObjectExpression") return {};
|
|
2564
2583
|
const u = {};
|
|
2565
2584
|
for (const t of e.properties)
|
|
@@ -2580,7 +2599,7 @@ function Mu(e) {
|
|
|
2580
2599
|
const u = e.arguments[0];
|
|
2581
2600
|
if (u?.type === "CallExpression") {
|
|
2582
2601
|
const t = Pu(u), a = e.arguments[1];
|
|
2583
|
-
return a?.type === "ObjectExpression" &&
|
|
2602
|
+
return a?.type === "ObjectExpression" && Ct(t, a), t;
|
|
2584
2603
|
}
|
|
2585
2604
|
}
|
|
2586
2605
|
return Pu(e);
|
|
@@ -2597,15 +2616,15 @@ function Pu(e) {
|
|
|
2597
2616
|
const r = t.value.properties;
|
|
2598
2617
|
return {
|
|
2599
2618
|
name: a,
|
|
2600
|
-
type:
|
|
2619
|
+
type: Pt(r),
|
|
2601
2620
|
required: xu(r, "required"),
|
|
2602
|
-
default:
|
|
2621
|
+
default: Ot(r)
|
|
2603
2622
|
};
|
|
2604
2623
|
}
|
|
2605
2624
|
return a;
|
|
2606
2625
|
}).filter(Boolean) : [] : [];
|
|
2607
2626
|
}
|
|
2608
|
-
function
|
|
2627
|
+
function Ct(e, u) {
|
|
2609
2628
|
for (const t of u.properties) {
|
|
2610
2629
|
if (t.type !== "ObjectProperty") continue;
|
|
2611
2630
|
const a = t.key?.name;
|
|
@@ -2626,11 +2645,11 @@ function Ou(e) {
|
|
|
2626
2645
|
const u = e.arguments[0];
|
|
2627
2646
|
return u ? u.type === "ArrayExpression" ? u.elements.map((t) => t?.type === "StringLiteral" ? { name: t.value, params: [] } : null).filter(Boolean) : [] : [];
|
|
2628
2647
|
}
|
|
2629
|
-
function
|
|
2648
|
+
function _t(e) {
|
|
2630
2649
|
const u = e.arguments[0];
|
|
2631
2650
|
return !u || u.type !== "ObjectExpression" ? [] : u.properties.map((t) => (t.type === "ObjectProperty" || t.type === "ObjectMethod") && t.key?.name || "").filter(Boolean);
|
|
2632
2651
|
}
|
|
2633
|
-
function
|
|
2652
|
+
function Lt(e) {
|
|
2634
2653
|
const [u, t, a] = e.arguments;
|
|
2635
2654
|
if (!u || !t) return null;
|
|
2636
2655
|
const r = A(u), n = A(t);
|
|
@@ -2649,7 +2668,7 @@ function _t(e) {
|
|
|
2649
2668
|
immediate: i
|
|
2650
2669
|
};
|
|
2651
2670
|
}
|
|
2652
|
-
function
|
|
2671
|
+
function Mt(e) {
|
|
2653
2672
|
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) || "{}";
|
|
2654
2673
|
return `${u}(${t}) => ${a}`;
|
|
2655
2674
|
}
|
|
@@ -2725,21 +2744,21 @@ function xu(e, u) {
|
|
|
2725
2744
|
(a) => a.key?.name === u
|
|
2726
2745
|
)?.value?.value;
|
|
2727
2746
|
}
|
|
2728
|
-
function
|
|
2747
|
+
function Pt(e) {
|
|
2729
2748
|
const u = e?.find(
|
|
2730
2749
|
(t) => t.key?.name === "type"
|
|
2731
2750
|
);
|
|
2732
2751
|
if (u)
|
|
2733
2752
|
return u.value.type === "ArrayExpression" ? u.value.elements.map((t) => t.name) : u.value.name;
|
|
2734
2753
|
}
|
|
2735
|
-
function
|
|
2754
|
+
function Ot(e) {
|
|
2736
2755
|
const u = e?.find(
|
|
2737
2756
|
(t) => t.key?.name === "default"
|
|
2738
2757
|
);
|
|
2739
2758
|
if (u)
|
|
2740
2759
|
return T(A(u.value));
|
|
2741
2760
|
}
|
|
2742
|
-
function
|
|
2761
|
+
function Bt(e) {
|
|
2743
2762
|
const u = [], t = {}, a = [];
|
|
2744
2763
|
try {
|
|
2745
2764
|
const r = ve.compileString(e, { charset: !1 })?.css || "", n = Se.parse(r), s = /^.[\w]+_[\w]{5,}/;
|
|
@@ -2770,11 +2789,11 @@ function uu(e, u, t) {
|
|
|
2770
2789
|
const i = e.slice(r, s.index);
|
|
2771
2790
|
a += i.replace(u, t);
|
|
2772
2791
|
const o = s[0];
|
|
2773
|
-
o.startsWith("`") ? a +=
|
|
2792
|
+
o.startsWith("`") ? a += $t(o, u, t) : a += o, r = s.index + s[0].length;
|
|
2774
2793
|
}
|
|
2775
2794
|
return a += e.slice(r).replace(u, t), a;
|
|
2776
2795
|
}
|
|
2777
|
-
function
|
|
2796
|
+
function $t(e, u, t) {
|
|
2778
2797
|
let a = "", r = 0;
|
|
2779
2798
|
const n = /\$\{([^}]*)\}/g;
|
|
2780
2799
|
let s;
|
|
@@ -2785,7 +2804,7 @@ function Bt(e, u, t) {
|
|
|
2785
2804
|
}
|
|
2786
2805
|
return a += e.slice(r), a;
|
|
2787
2806
|
}
|
|
2788
|
-
function
|
|
2807
|
+
function Ft(e, u) {
|
|
2789
2808
|
if (!e) return e;
|
|
2790
2809
|
let t = e;
|
|
2791
2810
|
const a = [...u.refs, ...u.computed];
|
|
@@ -2820,7 +2839,7 @@ function $t(e, u) {
|
|
|
2820
2839
|
t = uu(t, o, `this.${i}`);
|
|
2821
2840
|
}
|
|
2822
2841
|
for (const r of u.props)
|
|
2823
|
-
t =
|
|
2842
|
+
t = Ut(t, "__props", r, `this.${r}`);
|
|
2824
2843
|
for (const r of u.props)
|
|
2825
2844
|
t = R(t, r, `this.${r}`);
|
|
2826
2845
|
for (const [r, n] of Object.entries(u.reverseApiMap))
|
|
@@ -2841,7 +2860,7 @@ function $t(e, u) {
|
|
|
2841
2860
|
function Q(e) {
|
|
2842
2861
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2843
2862
|
}
|
|
2844
|
-
function
|
|
2863
|
+
function Ut(e, u, t, a) {
|
|
2845
2864
|
const r = new RegExp(
|
|
2846
2865
|
`\\b${Q(u)}\\.${Q(t)}\\b`,
|
|
2847
2866
|
"g"
|
|
@@ -2871,11 +2890,11 @@ function se(e) {
|
|
|
2871
2890
|
}
|
|
2872
2891
|
return { simple: u, member: t };
|
|
2873
2892
|
}
|
|
2874
|
-
function
|
|
2893
|
+
function Gt(e) {
|
|
2875
2894
|
for (const u of e)
|
|
2876
2895
|
if (xe.includes(u.from)) return u.from;
|
|
2877
2896
|
}
|
|
2878
|
-
function
|
|
2897
|
+
function Ht(e) {
|
|
2879
2898
|
const u = {}, t = (a) => {
|
|
2880
2899
|
for (const [r, n] of Object.entries(a)) {
|
|
2881
2900
|
if (!n.composable || !n.replace || !n.replace.includes("."))
|
|
@@ -2906,16 +2925,16 @@ function Fu(e, u) {
|
|
|
2906
2925
|
reverseApiMap: u.globalApiVars,
|
|
2907
2926
|
reverseMemberApiMap: u.reverseMemberApiMap || se().member
|
|
2908
2927
|
};
|
|
2909
|
-
let a =
|
|
2928
|
+
let a = Ft(e, t);
|
|
2910
2929
|
a = a.replace(/_ctx\./g, "this."), a = a.replace(/this\.this\./g, "this.");
|
|
2911
2930
|
for (const [r, n] of Object.entries(u.libs || {}))
|
|
2912
2931
|
a = R(a, r, `this.$libs.${n}.${r}`);
|
|
2913
2932
|
return a;
|
|
2914
2933
|
}
|
|
2915
|
-
function
|
|
2916
|
-
const u =
|
|
2934
|
+
function Wt(e) {
|
|
2935
|
+
const u = Gt(e.imports || []), { simple: t, member: a } = se(u);
|
|
2917
2936
|
if (e.globalApiDestructured && e.globalApiDestructured.length > 0) {
|
|
2918
|
-
const n =
|
|
2937
|
+
const n = Ht(u);
|
|
2919
2938
|
for (const { callee: s, destructure: i } of e.globalApiDestructured) {
|
|
2920
2939
|
const o = n[s];
|
|
2921
2940
|
if (o)
|
|
@@ -2946,10 +2965,10 @@ function Ht(e) {
|
|
|
2946
2965
|
}
|
|
2947
2966
|
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(
|
|
2948
2967
|
", "
|
|
2949
|
-
),
|
|
2968
|
+
), Jt = "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(
|
|
2950
2969
|
", "
|
|
2951
|
-
),
|
|
2952
|
-
class
|
|
2970
|
+
), zt = "user", M = "User";
|
|
2971
|
+
class Xt {
|
|
2953
2972
|
validate(u) {
|
|
2954
2973
|
const t = {
|
|
2955
2974
|
valid: !0,
|
|
@@ -2963,7 +2982,7 @@ class zt {
|
|
|
2963
2982
|
}
|
|
2964
2983
|
isCompleteSFC(u) {
|
|
2965
2984
|
try {
|
|
2966
|
-
const t =
|
|
2985
|
+
const t = P(u);
|
|
2967
2986
|
return !!(t.template && t.script && t.styles);
|
|
2968
2987
|
} catch {
|
|
2969
2988
|
return !1;
|
|
@@ -2972,15 +2991,15 @@ class zt {
|
|
|
2972
2991
|
checkSyntax(u) {
|
|
2973
2992
|
let t = "";
|
|
2974
2993
|
try {
|
|
2975
|
-
const a =
|
|
2976
|
-
|
|
2994
|
+
const a = P(u);
|
|
2995
|
+
_(a.script);
|
|
2977
2996
|
} catch (a) {
|
|
2978
2997
|
a instanceof SyntaxError && (t = a.message);
|
|
2979
2998
|
}
|
|
2980
2999
|
return t;
|
|
2981
3000
|
}
|
|
2982
3001
|
checkSetup(u) {
|
|
2983
|
-
const t =
|
|
3002
|
+
const t = P(u);
|
|
2984
3003
|
if (t.isScriptSetup)
|
|
2985
3004
|
return !0;
|
|
2986
3005
|
let a = 0;
|
|
@@ -2993,7 +3012,7 @@ class zt {
|
|
|
2993
3012
|
}), a === 3;
|
|
2994
3013
|
}
|
|
2995
3014
|
findVantIcons(u) {
|
|
2996
|
-
const t =
|
|
3015
|
+
const t = P(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
|
|
2997
3016
|
return r.forEach((s) => {
|
|
2998
3017
|
const i = s.match(/\bname="([^"]+)"/);
|
|
2999
3018
|
i && n.push(i[1]);
|
|
@@ -3006,13 +3025,13 @@ class zt {
|
|
|
3006
3025
|
return a;
|
|
3007
3026
|
}
|
|
3008
3027
|
findVtjIcons(u) {
|
|
3009
|
-
const t =
|
|
3028
|
+
const t = P(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
|
|
3010
3029
|
return !r || !r[1] ? [] : r[1].split(",").map((n) => n.trim()).filter(Boolean);
|
|
3011
3030
|
}
|
|
3012
3031
|
checkVtjIcons(u) {
|
|
3013
3032
|
const t = this.findVtjIcons(u), a = [];
|
|
3014
3033
|
for (const r of t)
|
|
3015
|
-
|
|
3034
|
+
Jt.includes(r) || a.push(r);
|
|
3016
3035
|
return a;
|
|
3017
3036
|
}
|
|
3018
3037
|
hasUnchangedComment(u) {
|
|
@@ -3027,10 +3046,10 @@ class zt {
|
|
|
3027
3046
|
);
|
|
3028
3047
|
}
|
|
3029
3048
|
}
|
|
3030
|
-
function
|
|
3049
|
+
function Zt(e) {
|
|
3031
3050
|
const u = [];
|
|
3032
3051
|
let t = e;
|
|
3033
|
-
const a =
|
|
3052
|
+
const a = P(e);
|
|
3034
3053
|
if (!a.template || !a.script)
|
|
3035
3054
|
return {
|
|
3036
3055
|
fixed: !1,
|
|
@@ -3038,24 +3057,24 @@ function Xt(e) {
|
|
|
3038
3057
|
fixedCode: e,
|
|
3039
3058
|
changes: []
|
|
3040
3059
|
};
|
|
3041
|
-
const r =
|
|
3060
|
+
const r = Qt(a.script), n = a.template;
|
|
3042
3061
|
let s = n;
|
|
3043
3062
|
const i = [], o = /\{\{([^}]+)\}\}/g;
|
|
3044
3063
|
let c;
|
|
3045
3064
|
for (; (c = o.exec(n)) !== null; ) {
|
|
3046
|
-
const
|
|
3065
|
+
const h = c[0], g = c[1], x = H(g, r);
|
|
3047
3066
|
if (x !== g) {
|
|
3048
|
-
const
|
|
3067
|
+
const v = G(n, c.index);
|
|
3049
3068
|
i.push({
|
|
3050
3069
|
start: c.index,
|
|
3051
|
-
end: c.index +
|
|
3052
|
-
original:
|
|
3070
|
+
end: c.index + h.length,
|
|
3071
|
+
original: h,
|
|
3053
3072
|
replacement: `{{${x}}}`,
|
|
3054
|
-
line:
|
|
3055
|
-
column:
|
|
3073
|
+
line: v.line,
|
|
3074
|
+
column: v.column
|
|
3056
3075
|
}), u.push({
|
|
3057
|
-
line:
|
|
3058
|
-
column:
|
|
3076
|
+
line: v.line + 1,
|
|
3077
|
+
column: v.column,
|
|
3059
3078
|
original: g.trim(),
|
|
3060
3079
|
fixed: x.trim(),
|
|
3061
3080
|
message: "修复插值表达式:添加 state. 前缀"
|
|
@@ -3064,60 +3083,60 @@ function Xt(e) {
|
|
|
3064
3083
|
}
|
|
3065
3084
|
const d = /:(\w+)="([^"]+)"/g;
|
|
3066
3085
|
for (; (c = d.exec(n)) !== null; ) {
|
|
3067
|
-
const
|
|
3068
|
-
if (
|
|
3086
|
+
const h = c[0], g = c[1], x = c[2], v = H(x, r);
|
|
3087
|
+
if (v !== x) {
|
|
3069
3088
|
const I = G(n, c.index);
|
|
3070
3089
|
i.push({
|
|
3071
3090
|
start: c.index,
|
|
3072
|
-
end: c.index +
|
|
3073
|
-
original:
|
|
3074
|
-
replacement: `:${g}="${
|
|
3091
|
+
end: c.index + h.length,
|
|
3092
|
+
original: h,
|
|
3093
|
+
replacement: `:${g}="${v}"`,
|
|
3075
3094
|
line: I.line,
|
|
3076
3095
|
column: I.column
|
|
3077
3096
|
}), u.push({
|
|
3078
3097
|
line: I.line + 1,
|
|
3079
3098
|
column: I.column,
|
|
3080
3099
|
original: x,
|
|
3081
|
-
fixed:
|
|
3100
|
+
fixed: v,
|
|
3082
3101
|
message: "修复绑定属性:添加 state. 前缀"
|
|
3083
3102
|
});
|
|
3084
3103
|
}
|
|
3085
3104
|
}
|
|
3086
3105
|
const l = /v-(if|else-if|show)="([^"]+)"/g;
|
|
3087
3106
|
for (; (c = l.exec(n)) !== null; ) {
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3107
|
+
const h = c[0], g = c[1], x = c[2], v = H(x, r);
|
|
3108
|
+
if (v !== x) {
|
|
3090
3109
|
const I = G(n, c.index);
|
|
3091
3110
|
i.push({
|
|
3092
3111
|
start: c.index,
|
|
3093
|
-
end: c.index +
|
|
3094
|
-
original:
|
|
3095
|
-
replacement: `v-${g}="${
|
|
3112
|
+
end: c.index + h.length,
|
|
3113
|
+
original: h,
|
|
3114
|
+
replacement: `v-${g}="${v}"`,
|
|
3096
3115
|
line: I.line,
|
|
3097
3116
|
column: I.column
|
|
3098
3117
|
}), u.push({
|
|
3099
3118
|
line: I.line + 1,
|
|
3100
3119
|
column: I.column,
|
|
3101
3120
|
original: x,
|
|
3102
|
-
fixed:
|
|
3121
|
+
fixed: v,
|
|
3103
3122
|
message: `修复 v-${g} 指令:添加 state. 前缀`
|
|
3104
3123
|
});
|
|
3105
3124
|
}
|
|
3106
3125
|
}
|
|
3107
3126
|
const p = /v-for="([^"]+)"/g;
|
|
3108
3127
|
for (; (c = p.exec(n)) !== null; ) {
|
|
3109
|
-
const
|
|
3128
|
+
const h = c[0], x = c[1].match(/^(.+)\s+in\s+(.+)$/);
|
|
3110
3129
|
if (x) {
|
|
3111
|
-
const [,
|
|
3130
|
+
const [, v, I] = x, D = H(
|
|
3112
3131
|
I,
|
|
3113
3132
|
r
|
|
3114
3133
|
);
|
|
3115
3134
|
if (D !== I) {
|
|
3116
|
-
const $ = G(n, c.index), lu = `v-for="${
|
|
3135
|
+
const $ = G(n, c.index), lu = `v-for="${v} in ${D}"`;
|
|
3117
3136
|
i.push({
|
|
3118
3137
|
start: c.index,
|
|
3119
|
-
end: c.index +
|
|
3120
|
-
original:
|
|
3138
|
+
end: c.index + h.length,
|
|
3139
|
+
original: h,
|
|
3121
3140
|
replacement: lu,
|
|
3122
3141
|
line: $.line,
|
|
3123
3142
|
column: $.column
|
|
@@ -3133,40 +3152,40 @@ function Xt(e) {
|
|
|
3133
3152
|
}
|
|
3134
3153
|
const b = /v-model="([^"]+)"/g;
|
|
3135
3154
|
for (; (c = b.exec(n)) !== null; ) {
|
|
3136
|
-
const
|
|
3155
|
+
const h = c[0], g = c[1], x = H(g, r);
|
|
3137
3156
|
if (x !== g) {
|
|
3138
|
-
const
|
|
3157
|
+
const v = G(n, c.index);
|
|
3139
3158
|
i.push({
|
|
3140
3159
|
start: c.index,
|
|
3141
|
-
end: c.index +
|
|
3142
|
-
original:
|
|
3160
|
+
end: c.index + h.length,
|
|
3161
|
+
original: h,
|
|
3143
3162
|
replacement: `v-model="${x}"`,
|
|
3144
|
-
line:
|
|
3145
|
-
column:
|
|
3163
|
+
line: v.line,
|
|
3164
|
+
column: v.column
|
|
3146
3165
|
}), u.push({
|
|
3147
|
-
line:
|
|
3148
|
-
column:
|
|
3166
|
+
line: v.line + 1,
|
|
3167
|
+
column: v.column,
|
|
3149
3168
|
original: g,
|
|
3150
3169
|
fixed: x,
|
|
3151
3170
|
message: "修复 v-model 指令:添加 state. 前缀"
|
|
3152
3171
|
});
|
|
3153
3172
|
}
|
|
3154
3173
|
}
|
|
3155
|
-
const
|
|
3156
|
-
for (; (c =
|
|
3157
|
-
const
|
|
3174
|
+
const m = /v-bind="([^"]+)"/g;
|
|
3175
|
+
for (; (c = m.exec(n)) !== null; ) {
|
|
3176
|
+
const h = c[0], g = c[1], x = H(g, r);
|
|
3158
3177
|
if (x !== g) {
|
|
3159
|
-
const
|
|
3178
|
+
const v = G(n, c.index);
|
|
3160
3179
|
i.push({
|
|
3161
3180
|
start: c.index,
|
|
3162
|
-
end: c.index +
|
|
3163
|
-
original:
|
|
3181
|
+
end: c.index + h.length,
|
|
3182
|
+
original: h,
|
|
3164
3183
|
replacement: `v-bind="${x}"`,
|
|
3165
|
-
line:
|
|
3166
|
-
column:
|
|
3184
|
+
line: v.line,
|
|
3185
|
+
column: v.column
|
|
3167
3186
|
}), u.push({
|
|
3168
|
-
line:
|
|
3169
|
-
column:
|
|
3187
|
+
line: v.line + 1,
|
|
3188
|
+
column: v.column,
|
|
3170
3189
|
original: g,
|
|
3171
3190
|
fixed: x,
|
|
3172
3191
|
message: "修复 v-bind 指令:添加 state. 前缀"
|
|
@@ -3175,51 +3194,51 @@ function Xt(e) {
|
|
|
3175
3194
|
}
|
|
3176
3195
|
const S = /v-(text|html)="([^"]+)"/g;
|
|
3177
3196
|
for (; (c = S.exec(n)) !== null; ) {
|
|
3178
|
-
const
|
|
3179
|
-
if (
|
|
3197
|
+
const h = c[0], g = c[1], x = c[2], v = H(x, r);
|
|
3198
|
+
if (v !== x) {
|
|
3180
3199
|
const I = G(n, c.index);
|
|
3181
3200
|
i.push({
|
|
3182
3201
|
start: c.index,
|
|
3183
|
-
end: c.index +
|
|
3184
|
-
original:
|
|
3185
|
-
replacement: `v-${g}="${
|
|
3202
|
+
end: c.index + h.length,
|
|
3203
|
+
original: h,
|
|
3204
|
+
replacement: `v-${g}="${v}"`,
|
|
3186
3205
|
line: I.line,
|
|
3187
3206
|
column: I.column
|
|
3188
3207
|
}), u.push({
|
|
3189
3208
|
line: I.line + 1,
|
|
3190
3209
|
column: I.column,
|
|
3191
3210
|
original: x,
|
|
3192
|
-
fixed:
|
|
3211
|
+
fixed: v,
|
|
3193
3212
|
message: `修复 v-${g} 指令:添加 state. 前缀`
|
|
3194
3213
|
});
|
|
3195
3214
|
}
|
|
3196
3215
|
}
|
|
3197
|
-
const
|
|
3198
|
-
for (; (c =
|
|
3199
|
-
const
|
|
3200
|
-
if (I !==
|
|
3216
|
+
const w = /(@|v-on:)(\w+)="([^"]+)"/g;
|
|
3217
|
+
for (; (c = w.exec(n)) !== null; ) {
|
|
3218
|
+
const h = c[0], g = c[1], x = c[2], v = c[3], I = Kt(v, r);
|
|
3219
|
+
if (I !== v) {
|
|
3201
3220
|
const D = G(n, c.index);
|
|
3202
3221
|
i.push({
|
|
3203
3222
|
start: c.index,
|
|
3204
|
-
end: c.index +
|
|
3205
|
-
original:
|
|
3223
|
+
end: c.index + h.length,
|
|
3224
|
+
original: h,
|
|
3206
3225
|
replacement: `${g}${x}="${I}"`,
|
|
3207
3226
|
line: D.line,
|
|
3208
3227
|
column: D.column
|
|
3209
3228
|
}), u.push({
|
|
3210
3229
|
line: D.line + 1,
|
|
3211
3230
|
column: D.column,
|
|
3212
|
-
original:
|
|
3231
|
+
original: v,
|
|
3213
3232
|
fixed: I,
|
|
3214
3233
|
message: "修复事件处理器:添加 state. 前缀"
|
|
3215
3234
|
});
|
|
3216
3235
|
}
|
|
3217
3236
|
}
|
|
3218
|
-
if (i.sort((
|
|
3219
|
-
s = s.substring(0,
|
|
3237
|
+
if (i.sort((h, g) => g.start - h.start), i.forEach((h) => {
|
|
3238
|
+
s = s.substring(0, h.start) + h.replacement + s.substring(h.end);
|
|
3220
3239
|
}), i.length > 0) {
|
|
3221
|
-
const
|
|
3222
|
-
t = e.substring(0,
|
|
3240
|
+
const h = e.indexOf("<template>"), g = e.lastIndexOf("</template>") + 11;
|
|
3241
|
+
t = e.substring(0, h) + `<template>
|
|
3223
3242
|
` + s + `
|
|
3224
3243
|
</template>` + e.substring(g);
|
|
3225
3244
|
}
|
|
@@ -3230,10 +3249,10 @@ function Xt(e) {
|
|
|
3230
3249
|
changes: u
|
|
3231
3250
|
};
|
|
3232
3251
|
}
|
|
3233
|
-
function
|
|
3252
|
+
function Qt(e) {
|
|
3234
3253
|
const u = /* @__PURE__ */ new Set();
|
|
3235
3254
|
try {
|
|
3236
|
-
const t =
|
|
3255
|
+
const t = _(e);
|
|
3237
3256
|
J(t, {
|
|
3238
3257
|
CallExpression(a) {
|
|
3239
3258
|
if (a.node.callee.type === "Identifier" && a.node.callee.name === "reactive" && a.node.arguments.length > 0 && a.node.arguments[0].type === "ObjectExpression") {
|
|
@@ -3256,7 +3275,7 @@ function H(e, u) {
|
|
|
3256
3275
|
r.test(t) && !t.includes(`state.${a}`) && (t = t.replace(r, `state.${a}`));
|
|
3257
3276
|
}), t;
|
|
3258
3277
|
}
|
|
3259
|
-
function
|
|
3278
|
+
function Kt(e, u) {
|
|
3260
3279
|
let t = e.trim();
|
|
3261
3280
|
return u.forEach((a) => {
|
|
3262
3281
|
const r = new RegExp(
|
|
@@ -3277,20 +3296,20 @@ function G(e, u) {
|
|
|
3277
3296
|
column: t[t.length - 1].length
|
|
3278
3297
|
};
|
|
3279
3298
|
}
|
|
3280
|
-
class
|
|
3299
|
+
class Yt {
|
|
3281
3300
|
fixBasedOnValidation(u, t) {
|
|
3282
3301
|
let a = u;
|
|
3283
|
-
return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)),
|
|
3302
|
+
return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Zt(a).fixedCode;
|
|
3284
3303
|
}
|
|
3285
3304
|
fixVantIcons(u) {
|
|
3286
|
-
const t =
|
|
3305
|
+
const t = P(u), a = t.template.replace(
|
|
3287
3306
|
/<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
|
|
3288
|
-
(r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n,
|
|
3307
|
+
(r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, zt)
|
|
3289
3308
|
);
|
|
3290
3309
|
return this.reconstructSFC(t, a, t.script);
|
|
3291
3310
|
}
|
|
3292
3311
|
fixVtjIcons(u, t = []) {
|
|
3293
|
-
const a =
|
|
3312
|
+
const a = P(u);
|
|
3294
3313
|
let r = !1;
|
|
3295
3314
|
a.script = Ju(a.script, {
|
|
3296
3315
|
ImportDeclaration(i) {
|
|
@@ -3299,14 +3318,14 @@ class Kt {
|
|
|
3299
3318
|
let d = !1;
|
|
3300
3319
|
for (const l of o) {
|
|
3301
3320
|
const p = l.imported?.name;
|
|
3302
|
-
p ===
|
|
3321
|
+
p === M && (d = !0, r = !0), t.includes(p) || c.push(
|
|
3303
3322
|
q.importSpecifier(l.local, l.imported)
|
|
3304
3323
|
);
|
|
3305
3324
|
}
|
|
3306
3325
|
!d && !r && (r = !0, c.push(
|
|
3307
3326
|
q.importSpecifier(
|
|
3308
|
-
q.identifier(
|
|
3309
|
-
q.identifier(
|
|
3327
|
+
q.identifier(M),
|
|
3328
|
+
q.identifier(M)
|
|
3310
3329
|
)
|
|
3311
3330
|
)), i.node.specifiers = c;
|
|
3312
3331
|
}
|
|
@@ -3321,8 +3340,8 @@ class Kt {
|
|
|
3321
3340
|
(l) => !t.includes(l.key.name)
|
|
3322
3341
|
), c.argument.properties.push(
|
|
3323
3342
|
q.objectProperty(
|
|
3324
|
-
q.identifier(
|
|
3325
|
-
q.identifier(
|
|
3343
|
+
q.identifier(M),
|
|
3344
|
+
q.identifier(M),
|
|
3326
3345
|
!1,
|
|
3327
3346
|
!0
|
|
3328
3347
|
)
|
|
@@ -3331,13 +3350,13 @@ class Kt {
|
|
|
3331
3350
|
}
|
|
3332
3351
|
},
|
|
3333
3352
|
ObjectProperty(i) {
|
|
3334
|
-
if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(
|
|
3353
|
+
if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(M)), q.isArrayExpression(i.node.value)) {
|
|
3335
3354
|
const o = i.node.value.elements;
|
|
3336
|
-
i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(
|
|
3355
|
+
i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(M) : c);
|
|
3337
3356
|
}
|
|
3338
3357
|
},
|
|
3339
3358
|
AssignmentExpression(i) {
|
|
3340
|
-
q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(
|
|
3359
|
+
q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(M));
|
|
3341
3360
|
}
|
|
3342
3361
|
});
|
|
3343
3362
|
const n = /:icon\s*=\s*["']([^"']+)["']/g, s = a.template.match(n);
|
|
@@ -3345,13 +3364,13 @@ class Kt {
|
|
|
3345
3364
|
for (const i of s) {
|
|
3346
3365
|
let o = i;
|
|
3347
3366
|
for (const c of t)
|
|
3348
|
-
o = o.replace(new RegExp(c, "g"),
|
|
3367
|
+
o = o.replace(new RegExp(c, "g"), M);
|
|
3349
3368
|
a.template = a.template.replace(i, o);
|
|
3350
3369
|
}
|
|
3351
3370
|
for (const i of t)
|
|
3352
3371
|
a.template = a.template.replace(
|
|
3353
3372
|
new RegExp(`:icon="${i}"`, "g"),
|
|
3354
|
-
`:icon="${
|
|
3373
|
+
`:icon="${M}"`
|
|
3355
3374
|
);
|
|
3356
3375
|
return this.reconstructSFC(a, a.template, a.script);
|
|
3357
3376
|
}
|
|
@@ -3378,54 +3397,54 @@ ${a}
|
|
|
3378
3397
|
}), r;
|
|
3379
3398
|
}
|
|
3380
3399
|
}
|
|
3381
|
-
async function
|
|
3400
|
+
async function p0(e) {
|
|
3382
3401
|
const { id: u, name: t, source: a, project: r } = e, n = ke(a, t);
|
|
3383
3402
|
if (n)
|
|
3384
3403
|
return Promise.reject(n);
|
|
3385
|
-
const { dependencies: s = [], platform: i = "web" } = r || {}, o = new
|
|
3404
|
+
const { dependencies: s = [], platform: i = "web" } = r || {}, o = new Xt(), c = new Yt(), d = o.validate(a);
|
|
3386
3405
|
let l = [];
|
|
3387
3406
|
if (!d.valid)
|
|
3388
3407
|
return l = d.errors, Promise.reject(l);
|
|
3389
|
-
const p = c.fixBasedOnValidation(a, d), b =
|
|
3408
|
+
const p = c.fixBasedOnValidation(a, d), b = P(p);
|
|
3390
3409
|
b.script = Ae(b.script);
|
|
3391
3410
|
const {
|
|
3392
|
-
styles:
|
|
3411
|
+
styles: m,
|
|
3393
3412
|
css: S,
|
|
3394
|
-
errors:
|
|
3395
|
-
} =
|
|
3413
|
+
errors: w
|
|
3414
|
+
} = Bt(b.styles.join(`
|
|
3396
3415
|
`));
|
|
3397
|
-
return l.push(...
|
|
3416
|
+
return l.push(...w), l.length ? Promise.reject(l) : b.isScriptSetup ? e0(b, {
|
|
3398
3417
|
id: u,
|
|
3399
3418
|
name: t,
|
|
3400
3419
|
project: r,
|
|
3401
3420
|
platform: i,
|
|
3402
3421
|
dependencies: s,
|
|
3403
|
-
styles:
|
|
3422
|
+
styles: m,
|
|
3404
3423
|
css: S
|
|
3405
|
-
}) :
|
|
3424
|
+
}) : u0(b, {
|
|
3406
3425
|
id: u,
|
|
3407
3426
|
name: t,
|
|
3408
3427
|
project: r,
|
|
3409
3428
|
platform: i,
|
|
3410
3429
|
dependencies: s,
|
|
3411
|
-
styles:
|
|
3430
|
+
styles: m,
|
|
3412
3431
|
css: S
|
|
3413
3432
|
});
|
|
3414
3433
|
}
|
|
3415
|
-
async function
|
|
3434
|
+
async function u0(e, u) {
|
|
3416
3435
|
const { id: t, name: a, project: r, platform: n, dependencies: s, styles: i, css: o } = u, {
|
|
3417
3436
|
state: c,
|
|
3418
3437
|
watch: d,
|
|
3419
3438
|
lifeCycles: l,
|
|
3420
3439
|
computed: p,
|
|
3421
3440
|
methods: b,
|
|
3422
|
-
props:
|
|
3441
|
+
props: m,
|
|
3423
3442
|
emits: S,
|
|
3424
|
-
expose:
|
|
3425
|
-
inject:
|
|
3443
|
+
expose: w,
|
|
3444
|
+
inject: h,
|
|
3426
3445
|
handlers: g,
|
|
3427
3446
|
imports: x,
|
|
3428
|
-
dataSources:
|
|
3447
|
+
dataSources: v,
|
|
3429
3448
|
directives: I
|
|
3430
3449
|
} = et(e.script, r), { nodes: D, slots: $, context: lu } = re(t, a, e.template, {
|
|
3431
3450
|
platform: n,
|
|
@@ -3436,20 +3455,20 @@ async function Yt(e, u) {
|
|
|
3436
3455
|
}), yu = {
|
|
3437
3456
|
id: t,
|
|
3438
3457
|
name: a,
|
|
3439
|
-
inject:
|
|
3440
|
-
props:
|
|
3458
|
+
inject: h,
|
|
3459
|
+
props: m,
|
|
3441
3460
|
state: c,
|
|
3442
3461
|
watch: d,
|
|
3443
3462
|
lifeCycles: l,
|
|
3444
3463
|
computed: p,
|
|
3445
3464
|
methods: b,
|
|
3446
|
-
dataSources:
|
|
3465
|
+
dataSources: v,
|
|
3447
3466
|
slots: $,
|
|
3448
3467
|
emits: S,
|
|
3449
|
-
expose:
|
|
3468
|
+
expose: w,
|
|
3450
3469
|
nodes: D,
|
|
3451
3470
|
css: o
|
|
3452
|
-
}, le = Object.keys(p || {}), fe = (
|
|
3471
|
+
}, le = Object.keys(p || {}), fe = (m || []).map(
|
|
3453
3472
|
(F) => typeof F == "string" ? F : F.name
|
|
3454
3473
|
), be = [
|
|
3455
3474
|
"$el",
|
|
@@ -3481,8 +3500,8 @@ async function Yt(e, u) {
|
|
|
3481
3500
|
async (F) => {
|
|
3482
3501
|
await oe(F, async (K) => {
|
|
3483
3502
|
if (du(K)) {
|
|
3484
|
-
const
|
|
3485
|
-
K.value = Iu(
|
|
3503
|
+
const me = await ru(K.value);
|
|
3504
|
+
K.value = Iu(me, F.id, Su);
|
|
3486
3505
|
}
|
|
3487
3506
|
});
|
|
3488
3507
|
},
|
|
@@ -3492,8 +3511,8 @@ async function Yt(e, u) {
|
|
|
3492
3511
|
}
|
|
3493
3512
|
), new Hu(yu).toDsl();
|
|
3494
3513
|
}
|
|
3495
|
-
async function
|
|
3496
|
-
const { id: t, name: a, project: r, platform: n, styles: s, css: i, dependencies: o } = u, c =
|
|
3514
|
+
async function e0(e, u) {
|
|
3515
|
+
const { id: t, name: a, project: r, platform: n, styles: s, css: i, dependencies: o } = u, c = jt(e.script, r), { nodes: d, slots: l, context: p } = re(t, a, e.template, {
|
|
3497
3516
|
platform: n,
|
|
3498
3517
|
handlers: c.handlers,
|
|
3499
3518
|
styles: s,
|
|
@@ -3521,7 +3540,7 @@ async function u0(e, u) {
|
|
|
3521
3540
|
expose: c.expose,
|
|
3522
3541
|
nodes: d,
|
|
3523
3542
|
css: i
|
|
3524
|
-
}, { libs:
|
|
3543
|
+
}, { libs: m } = de(c.imports, o), S = Wt(c), w = {
|
|
3525
3544
|
refs: Array.from(S.refs),
|
|
3526
3545
|
reactives: Array.from(S.reactives),
|
|
3527
3546
|
hasState: S.hasState,
|
|
@@ -3533,15 +3552,15 @@ async function u0(e, u) {
|
|
|
3533
3552
|
dataSources: Array.from(S.dataSources),
|
|
3534
3553
|
globalApiVars: S.reverseApiMap,
|
|
3535
3554
|
reverseMemberApiMap: S.reverseMemberApiMap,
|
|
3536
|
-
libs:
|
|
3555
|
+
libs: m
|
|
3537
3556
|
};
|
|
3538
3557
|
return await ce(
|
|
3539
3558
|
b,
|
|
3540
3559
|
async (g) => {
|
|
3541
3560
|
await oe(g, async (x) => {
|
|
3542
3561
|
if (du(x)) {
|
|
3543
|
-
const
|
|
3544
|
-
let I = Fu(
|
|
3562
|
+
const v = await ru(x.value);
|
|
3563
|
+
let I = Fu(v, w);
|
|
3545
3564
|
const D = Array.from(
|
|
3546
3565
|
p[g.id] || /* @__PURE__ */ new Set()
|
|
3547
3566
|
);
|
|
@@ -3553,23 +3572,23 @@ async function u0(e, u) {
|
|
|
3553
3572
|
},
|
|
3554
3573
|
async (g) => {
|
|
3555
3574
|
const x = await ru(g.value);
|
|
3556
|
-
g.value = Fu(x,
|
|
3575
|
+
g.value = Fu(x, w);
|
|
3557
3576
|
}
|
|
3558
3577
|
), new Hu(b).toDsl();
|
|
3559
3578
|
}
|
|
3560
3579
|
async function ce(e, u, t) {
|
|
3561
|
-
const a = async (
|
|
3562
|
-
if (await u(
|
|
3563
|
-
for (const x of
|
|
3564
|
-
await a(x,
|
|
3565
|
-
}, r = async (
|
|
3566
|
-
if (!
|
|
3567
|
-
if (Array.isArray(
|
|
3568
|
-
for (let x of
|
|
3580
|
+
const a = async (h, g) => {
|
|
3581
|
+
if (await u(h, g), Array.isArray(h?.children))
|
|
3582
|
+
for (const x of h?.children || [])
|
|
3583
|
+
await a(x, h);
|
|
3584
|
+
}, r = async (h) => {
|
|
3585
|
+
if (!h || typeof h != "object") return;
|
|
3586
|
+
if (Array.isArray(h)) {
|
|
3587
|
+
for (let x of h)
|
|
3569
3588
|
await r(x);
|
|
3570
3589
|
return;
|
|
3571
3590
|
}
|
|
3572
|
-
const g = Object.values(
|
|
3591
|
+
const g = Object.values(h);
|
|
3573
3592
|
for (const x of g)
|
|
3574
3593
|
du(x) ? await t(x) : await r(x);
|
|
3575
3594
|
}, {
|
|
@@ -3582,9 +3601,9 @@ async function ce(e, u, t) {
|
|
|
3582
3601
|
lifeCycles: l,
|
|
3583
3602
|
inject: p,
|
|
3584
3603
|
setup: b,
|
|
3585
|
-
provide:
|
|
3604
|
+
provide: m,
|
|
3586
3605
|
refs: S,
|
|
3587
|
-
reactives:
|
|
3606
|
+
reactives: w
|
|
3588
3607
|
} = e;
|
|
3589
3608
|
if (await r({
|
|
3590
3609
|
state: n,
|
|
@@ -3596,12 +3615,12 @@ async function ce(e, u, t) {
|
|
|
3596
3615
|
lifeCycles: l,
|
|
3597
3616
|
inject: p,
|
|
3598
3617
|
setup: b,
|
|
3599
|
-
provide:
|
|
3618
|
+
provide: m,
|
|
3600
3619
|
refs: S,
|
|
3601
|
-
reactives:
|
|
3620
|
+
reactives: w
|
|
3602
3621
|
}), Array.isArray(e.nodes))
|
|
3603
|
-
for (const
|
|
3604
|
-
await a(
|
|
3622
|
+
for (const h of e.nodes)
|
|
3623
|
+
await a(h);
|
|
3605
3624
|
}
|
|
3606
3625
|
async function oe(e, u) {
|
|
3607
3626
|
const t = async (a) => {
|
|
@@ -3641,12 +3660,12 @@ function de(e = [], u = []) {
|
|
|
3641
3660
|
};
|
|
3642
3661
|
}
|
|
3643
3662
|
export {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3663
|
+
Yt as AutoFixer,
|
|
3664
|
+
Xt as ComponentValidator,
|
|
3665
|
+
f0 as VTJ_PARSER_VERSION,
|
|
3647
3666
|
qu as htmlToNodes,
|
|
3648
|
-
|
|
3649
|
-
|
|
3667
|
+
b0 as parseUniApp,
|
|
3668
|
+
p0 as parseVue,
|
|
3650
3669
|
Iu as patchCode,
|
|
3651
3670
|
R as replacer
|
|
3652
3671
|
};
|