@vtj/parser 0.12.57 → 0.12.59
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 +10 -10
- package/dist/index.mjs +199 -198
- package/package.json +3 -3
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
@@ -14,11 +14,11 @@ import * as T from "@babel/types";
|
|
14
14
|
* Copyright (c) 2025, VTJ.PRO All rights reserved.
|
15
15
|
* @name @vtj/parser
|
16
16
|
* @author CHC chenhuachun1549@dingtalk.com
|
17
|
-
* @version 0.12.
|
17
|
+
* @version 0.12.59
|
18
18
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
19
19
|
*/
|
20
|
-
const x0 = "0.12.
|
21
|
-
function
|
20
|
+
const x0 = "0.12.59";
|
21
|
+
function _(e) {
|
22
22
|
const { descriptor: u } = Wu(e), t = u.template?.content || "", a = (u.scriptSetup || u.script)?.content || "", i = u.styles.map((c) => c.content);
|
23
23
|
return {
|
24
24
|
template: t,
|
@@ -64,7 +64,7 @@ function Nu(e, u) {
|
|
64
64
|
})?.code || "";
|
65
65
|
}
|
66
66
|
function g0(e) {
|
67
|
-
const u =
|
67
|
+
const u = _(e), t = cu(u.script), a = {};
|
68
68
|
return u.styles && (a.css = u.styles[0] || ""), su(t, {
|
69
69
|
CallExpression(i) {
|
70
70
|
const c = i.node.callee?.name;
|
@@ -80,8 +80,8 @@ function g0(e) {
|
|
80
80
|
}
|
81
81
|
function J(e, u, t) {
|
82
82
|
const a = new RegExp(`${u}`, "g"), i = /(\@|\_|\-|\$|\.|\,|\w|\{\s)$/, c = /^[\w\_\-\@\$]/, s = new RegExp(`^this.${u}$`, "g");
|
83
|
-
return e.replace(a, (d,
|
84
|
-
const f = b.substring(0,
|
83
|
+
return e.replace(a, (d, n, b) => {
|
84
|
+
const f = b.substring(0, n), I = b.substring(n + u.length);
|
85
85
|
return i.test(f) || c.test(I.trim()) ? d : t;
|
86
86
|
}).replace(s, t);
|
87
87
|
}
|
@@ -91,20 +91,20 @@ function gu(e, u, t) {
|
|
91
91
|
computed: i = [],
|
92
92
|
libs: c = {},
|
93
93
|
members: s = [],
|
94
|
-
platform:
|
94
|
+
platform: r
|
95
95
|
} = t || {}, d = Array.from(a[u || ""] || /* @__PURE__ */ new Set());
|
96
96
|
if (d)
|
97
|
-
for (const
|
98
|
-
e = J(e,
|
99
|
-
for (const
|
100
|
-
e = J(e,
|
101
|
-
for (const [
|
102
|
-
e = J(e,
|
103
|
-
for (const
|
104
|
-
e = J(e,
|
105
|
-
if (
|
106
|
-
const
|
107
|
-
e = e.replace(
|
97
|
+
for (const n of d)
|
98
|
+
e = J(e, n, `this.context.${n}`);
|
99
|
+
for (const n of i)
|
100
|
+
e = J(e, n, `this.${n}.value`);
|
101
|
+
for (const [n, b] of Object.entries(c))
|
102
|
+
e = J(e, n, `this.$libs.${b}.${n}`);
|
103
|
+
for (const n of s)
|
104
|
+
e = J(e, n, `this.${n}`);
|
105
|
+
if (r === "uniapp") {
|
106
|
+
const n = /\buni\./g;
|
107
|
+
e = e.replace(n, "this.$libs.UniH5.uni.");
|
108
108
|
}
|
109
109
|
return e = e.replace(/_ctx\./g, "this."), e;
|
110
110
|
}
|
@@ -439,13 +439,13 @@ function ye(e, u, t, a) {
|
|
439
439
|
const d = a - c;
|
440
440
|
return d < 0 || d >= i ? -1 : e[t + d] - 1;
|
441
441
|
}
|
442
|
-
let s = t,
|
443
|
-
for (; s <=
|
444
|
-
const d = s +
|
445
|
-
if (
|
442
|
+
let s = t, r = s + i - 1;
|
443
|
+
for (; s <= r; ) {
|
444
|
+
const d = s + r >>> 1, n = e[d];
|
445
|
+
if (n < a)
|
446
446
|
s = d + 1;
|
447
|
-
else if (
|
448
|
-
|
447
|
+
else if (n > a)
|
448
|
+
r = d - 1;
|
449
449
|
else
|
450
450
|
return e[d + i];
|
451
451
|
}
|
@@ -914,8 +914,8 @@ const $ = /* @__PURE__ */ new Set([
|
|
914
914
|
]), ve = /\s|\//;
|
915
915
|
class Ae {
|
916
916
|
constructor(u, t = {}) {
|
917
|
-
var a, i, c, s,
|
918
|
-
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 = (i = t.lowerCaseAttributeNames) !== null && i !== void 0 ? i : this.htmlMode, this.recognizeSelfClosing = (c = t.recognizeSelfClosing) !== null && c !== void 0 ? c : !this.htmlMode, this.tokenizer = new ((s = t.Tokenizer) !== null && s !== void 0 ? s : Ie)(this.options, this), this.foreignContext = [!this.htmlMode], (d = (
|
917
|
+
var a, i, c, s, r, d;
|
918
|
+
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 = (i = t.lowerCaseAttributeNames) !== null && i !== void 0 ? i : this.htmlMode, this.recognizeSelfClosing = (c = t.recognizeSelfClosing) !== null && c !== void 0 ? c : !this.htmlMode, this.tokenizer = new ((s = t.Tokenizer) !== null && s !== void 0 ? s : Ie)(this.options, this), this.foreignContext = [!this.htmlMode], (d = (r = this.cbs).onparserinit) === null || d === void 0 || d.call(r, this);
|
919
919
|
}
|
920
920
|
// Tokenizer event handlers
|
921
921
|
/** @internal */
|
@@ -948,8 +948,8 @@ class Ae {
|
|
948
948
|
const s = this.htmlMode && we.get(u);
|
949
949
|
if (s)
|
950
950
|
for (; this.stack.length > 0 && s.has(this.stack[0]); ) {
|
951
|
-
const
|
952
|
-
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t,
|
951
|
+
const r = this.stack.shift();
|
952
|
+
(a = (t = this.cbs).onclosetag) === null || a === void 0 || a.call(t, r, !0);
|
953
953
|
}
|
954
954
|
this.isVoidElement(u) || (this.stack.unshift(u), this.htmlMode && (Eu.has(u) ? this.foreignContext.unshift(!0) : vu.has(u) && this.foreignContext.unshift(!1))), (c = (i = this.cbs).onopentagname) === null || c === void 0 || c.call(i, u), this.cbs.onopentag && (this.attribs = {});
|
955
955
|
}
|
@@ -963,11 +963,11 @@ class Ae {
|
|
963
963
|
}
|
964
964
|
/** @internal */
|
965
965
|
onclosetag(u, t) {
|
966
|
-
var a, i, c, s,
|
966
|
+
var a, i, c, s, r, d, n, b;
|
967
967
|
this.endIndex = t;
|
968
968
|
let f = this.getSlice(u, t);
|
969
969
|
if (this.lowerCaseTagNames && (f = f.toLowerCase()), this.htmlMode && (Eu.has(f) || vu.has(f)) && this.foreignContext.shift(), this.isVoidElement(f))
|
970
|
-
this.htmlMode && f === "br" && ((s = (c = this.cbs).onopentagname) === null || s === void 0 || s.call(c, "br"), (d = (
|
970
|
+
this.htmlMode && f === "br" && ((s = (c = this.cbs).onopentagname) === null || s === void 0 || s.call(c, "br"), (d = (r = this.cbs).onopentag) === null || d === void 0 || d.call(r, "br", {}, !0), (b = (n = this.cbs).onclosetag) === null || b === void 0 || b.call(n, "br", !1));
|
971
971
|
else {
|
972
972
|
const I = this.stack.indexOf(f);
|
973
973
|
if (I !== -1)
|
@@ -1034,15 +1034,15 @@ class Ae {
|
|
1034
1034
|
}
|
1035
1035
|
/** @internal */
|
1036
1036
|
oncomment(u, t, a) {
|
1037
|
-
var i, c, s,
|
1038
|
-
this.endIndex = t, (c = (i = this.cbs).oncomment) === null || c === void 0 || c.call(i, this.getSlice(u, t - a)), (
|
1037
|
+
var i, c, s, r;
|
1038
|
+
this.endIndex = t, (c = (i = this.cbs).oncomment) === null || c === void 0 || c.call(i, this.getSlice(u, t - a)), (r = (s = this.cbs).oncommentend) === null || r === void 0 || r.call(s), this.startIndex = t + 1;
|
1039
1039
|
}
|
1040
1040
|
/** @internal */
|
1041
1041
|
oncdata(u, t, a) {
|
1042
|
-
var i, c, s,
|
1042
|
+
var i, c, s, r, d, n, b, f, I, x;
|
1043
1043
|
this.endIndex = t;
|
1044
1044
|
const N = this.getSlice(u, t - a);
|
1045
|
-
!this.htmlMode || this.options.recognizeCDATA ? ((c = (i = this.cbs).oncdatastart) === null || c === void 0 || c.call(i), (
|
1045
|
+
!this.htmlMode || this.options.recognizeCDATA ? ((c = (i = this.cbs).oncdatastart) === null || c === void 0 || c.call(i), (r = (s = this.cbs).ontext) === null || r === void 0 || r.call(s, N), (n = (d = this.cbs).oncdataend) === null || n === void 0 || n.call(d)) : ((f = (b = this.cbs).oncomment) === null || f === void 0 || f.call(b, `[CDATA[${N}]]`), (x = (I = this.cbs).oncommentend) === null || x === void 0 || x.call(I)), this.startIndex = t + 1;
|
1046
1046
|
}
|
1047
1047
|
/** @internal */
|
1048
1048
|
onend() {
|
@@ -1145,13 +1145,13 @@ function Au(e, u = "web") {
|
|
1145
1145
|
let i = "";
|
1146
1146
|
const c = new Ae(
|
1147
1147
|
{
|
1148
|
-
onopentag: (s,
|
1149
|
-
const
|
1150
|
-
i.trim() && (Array.isArray(
|
1148
|
+
onopentag: (s, r, d) => {
|
1149
|
+
const n = a[a.length - 1];
|
1150
|
+
i.trim() && (Array.isArray(n.children) ? n.children.push({
|
1151
1151
|
name: "span",
|
1152
1152
|
children: i.trim()
|
1153
|
-
}) :
|
1154
|
-
const b = Object.entries(
|
1153
|
+
}) : n.children = i.trim(), i = "");
|
1154
|
+
const b = Object.entries(r || {}).reduce(
|
1155
1155
|
(I, x) => {
|
1156
1156
|
let [N = "", V = ""] = x;
|
1157
1157
|
return N && (I[N] = V), I;
|
@@ -1163,17 +1163,17 @@ function Au(e, u = "web") {
|
|
1163
1163
|
name: ku(s, u),
|
1164
1164
|
props: b
|
1165
1165
|
};
|
1166
|
-
Array.isArray(
|
1166
|
+
Array.isArray(n.children) ? n.children.push(f) : n.children ? n.children = [
|
1167
1167
|
{
|
1168
1168
|
name: "span",
|
1169
|
-
children:
|
1169
|
+
children: n.children
|
1170
1170
|
},
|
1171
1171
|
f
|
1172
|
-
] :
|
1172
|
+
] : n.children = [f], d || a.push(f);
|
1173
1173
|
},
|
1174
1174
|
ontext: (s) => {
|
1175
|
-
const
|
1176
|
-
|
1175
|
+
const r = s.trim();
|
1176
|
+
r && r !== '"' && (i += r);
|
1177
1177
|
},
|
1178
1178
|
onclosetag: () => {
|
1179
1179
|
const s = a.pop();
|
@@ -1197,16 +1197,16 @@ function Te(e, u) {
|
|
1197
1197
|
ExportDefaultDeclaration(c) {
|
1198
1198
|
const s = c.node.declaration;
|
1199
1199
|
if (s.type !== "CallExpression") return;
|
1200
|
-
const
|
1201
|
-
if (
|
1202
|
-
const d =
|
1200
|
+
const r = s.arguments[0];
|
1201
|
+
if (r?.type !== "ObjectExpression") return;
|
1202
|
+
const d = r.properties.filter(
|
1203
1203
|
(f) => f.type === "ObjectProperty"
|
1204
|
-
),
|
1204
|
+
), n = r.properties.filter(
|
1205
1205
|
(f) => f.type == "ObjectMethod"
|
1206
1206
|
), b = d.find(
|
1207
1207
|
(f) => f.key.name === "computed"
|
1208
1208
|
);
|
1209
|
-
b && (a.computed = qu(b.value), a.watchers =
|
1209
|
+
b && (a.computed = qu(b.value), a.watchers = De(b.value));
|
1210
1210
|
for (const f of d)
|
1211
1211
|
switch (f.key.name) {
|
1212
1212
|
case "name":
|
@@ -1219,7 +1219,7 @@ function Te(e, u) {
|
|
1219
1219
|
);
|
1220
1220
|
break;
|
1221
1221
|
case "watch":
|
1222
|
-
a.watch =
|
1222
|
+
a.watch = Le(
|
1223
1223
|
f.value,
|
1224
1224
|
a.watchers
|
1225
1225
|
);
|
@@ -1231,19 +1231,19 @@ function Te(e, u) {
|
|
1231
1231
|
a.inject = Me(f.value);
|
1232
1232
|
break;
|
1233
1233
|
}
|
1234
|
-
for (const f of
|
1234
|
+
for (const f of n)
|
1235
1235
|
switch (f.key.name) {
|
1236
1236
|
case "setup":
|
1237
1237
|
a.state = Ve(f.body);
|
1238
1238
|
break;
|
1239
1239
|
}
|
1240
|
-
a.lifeCycles = _e(
|
1240
|
+
a.lifeCycles = _e(n);
|
1241
1241
|
},
|
1242
1242
|
CallExpression(c) {
|
1243
1243
|
const s = Fe(c.node);
|
1244
1244
|
if (s.length)
|
1245
|
-
for (let
|
1246
|
-
a.emits?.find((
|
1245
|
+
for (let r of s)
|
1246
|
+
a.emits?.find((n) => n.name === r.name) || a.emits?.push(r);
|
1247
1247
|
}
|
1248
1248
|
}), a;
|
1249
1249
|
}
|
@@ -1252,17 +1252,17 @@ function Ne(e) {
|
|
1252
1252
|
let c;
|
1253
1253
|
const s = e.replace(/\n/g, " ");
|
1254
1254
|
for (; (c = u.exec(s)) !== null; ) {
|
1255
|
-
const
|
1255
|
+
const r = c[2] === "@element-plus/icons-vue" ? "@vtj/icons" : c[2];
|
1256
1256
|
i.push({
|
1257
|
-
from:
|
1257
|
+
from: r,
|
1258
1258
|
imports: c[1].split(",").map((d) => d.trim())
|
1259
1259
|
});
|
1260
1260
|
}
|
1261
1261
|
for (; (c = t.exec(s)) !== null; ) {
|
1262
|
-
const
|
1263
|
-
|
1262
|
+
const r = c[1], d = c[2];
|
1263
|
+
r && !a.test(r) && i.push({
|
1264
1264
|
from: d,
|
1265
|
-
imports:
|
1265
|
+
imports: r
|
1266
1266
|
});
|
1267
1267
|
}
|
1268
1268
|
return i;
|
@@ -1293,14 +1293,14 @@ function O(e) {
|
|
1293
1293
|
const { key: u, async: t, params: a, body: i } = e, c = a?.map((s) => s.type === "ObjectPattern" ? `{${s.properties.map((d) => d.key?.name || d.name).join(",")}}` : s.name).join(", ");
|
1294
1294
|
if (u.type === "Identifier") {
|
1295
1295
|
const s = u.name;
|
1296
|
-
let
|
1297
|
-
i && (
|
1296
|
+
let r = "{}";
|
1297
|
+
i && (r = M(i) || "{}");
|
1298
1298
|
const d = e.value;
|
1299
1299
|
if (d && d.type === "CallExpression") {
|
1300
1300
|
let x = M(d) || "";
|
1301
|
-
x = x.replace("function () {", "() => {"),
|
1301
|
+
x = x.replace("function () {", "() => {"), r = `{ return (${x})}`;
|
1302
1302
|
}
|
1303
|
-
const b = `${t ? "async " : ""}(${c}) => ${
|
1303
|
+
const b = `${t ? "async " : ""}(${c}) => ${r}`, f = s.startsWith("watcher_");
|
1304
1304
|
return {
|
1305
1305
|
id: f ? s.replace("watcher_", "") : "",
|
1306
1306
|
name: s,
|
@@ -1322,7 +1322,7 @@ function qe(e, u) {
|
|
1322
1322
|
if (!e) return {};
|
1323
1323
|
const t = {}, a = /apis\[\'([\w]*)\'\]/, i = /\.then\(([\w\W]*)\)/;
|
1324
1324
|
for (const c of e.properties) {
|
1325
|
-
const s = O(c),
|
1325
|
+
const s = O(c), r = c.body.body?.[0], d = (r?.leadingComments?.[0].value || "").trim(), n = oe(d);
|
1326
1326
|
if (s && s.exp.value.includes("this.provider.apis")) {
|
1327
1327
|
const f = (s.exp.value.match(a) || [])[1];
|
1328
1328
|
if (!f) continue;
|
@@ -1332,7 +1332,7 @@ function qe(e, u) {
|
|
1332
1332
|
t[s.name] = {
|
1333
1333
|
ref: f,
|
1334
1334
|
name: I.name,
|
1335
|
-
test:
|
1335
|
+
test: n?.test || {
|
1336
1336
|
type: "JSFunction",
|
1337
1337
|
value: `() => this.runApi({
|
1338
1338
|
/* 在这里可输入接口参数 */
|
@@ -1350,25 +1350,25 @@ function qe(e, u) {
|
|
1350
1350
|
};
|
1351
1351
|
}
|
1352
1352
|
if (s && s.exp.value.includes("this.provider.createMock")) {
|
1353
|
-
const b =
|
1353
|
+
const b = r?.declarations?.[0]?.init?.arguments?.[0], f = s.exp.value.match(i)?.[1];
|
1354
1354
|
t[s.name] = {
|
1355
1355
|
ref: "",
|
1356
1356
|
name: s.name,
|
1357
|
-
test:
|
1357
|
+
test: n?.test || {
|
1358
1358
|
type: "JSFunction",
|
1359
1359
|
value: `() => this.runApi({
|
1360
1360
|
/* 在这里可输入接口参数 */
|
1361
1361
|
})`
|
1362
1362
|
},
|
1363
1363
|
type: "mock",
|
1364
|
-
label:
|
1365
|
-
transform:
|
1364
|
+
label: n?.label || "",
|
1365
|
+
transform: n?.transform || {
|
1366
1366
|
type: "JSFunction",
|
1367
1367
|
value: f || `(res) => {
|
1368
1368
|
return res;
|
1369
1369
|
}`
|
1370
1370
|
},
|
1371
|
-
mockTemplate:
|
1371
|
+
mockTemplate: n?.mockTemplate || {
|
1372
1372
|
type: "JSFunction",
|
1373
1373
|
value: b ? M(b) : ""
|
1374
1374
|
}
|
@@ -1403,7 +1403,7 @@ function Re(e) {
|
|
1403
1403
|
}
|
1404
1404
|
return u;
|
1405
1405
|
}
|
1406
|
-
function
|
1406
|
+
function De(e) {
|
1407
1407
|
if (!e) return {};
|
1408
1408
|
const u = {};
|
1409
1409
|
for (const t of e.properties) {
|
@@ -1427,18 +1427,18 @@ function Tu(e, u) {
|
|
1427
1427
|
if (t)
|
1428
1428
|
return O(t)?.exp;
|
1429
1429
|
}
|
1430
|
-
function
|
1430
|
+
function Le(e, u = {}) {
|
1431
1431
|
const t = [];
|
1432
1432
|
for (const a of e.properties) {
|
1433
1433
|
const { key: i, value: c } = a, s = i.value || i.name || "";
|
1434
1434
|
if (u[s]) {
|
1435
|
-
const
|
1435
|
+
const r = c.properties;
|
1436
1436
|
t.push({
|
1437
1437
|
id: s.replace("watcher_", ""),
|
1438
1438
|
source: u[s],
|
1439
|
-
deep: W(
|
1440
|
-
immediate: W(
|
1441
|
-
handler: Tu(
|
1439
|
+
deep: W(r, "deep"),
|
1440
|
+
immediate: W(r, "immediate"),
|
1441
|
+
handler: Tu(r, "handler")
|
1442
1442
|
});
|
1443
1443
|
} else if (a.type === "ObjectMethod" && t.push({
|
1444
1444
|
id: eu(),
|
@@ -1450,16 +1450,16 @@ function De(e, u = {}) {
|
|
1450
1450
|
immediate: !1,
|
1451
1451
|
handler: O(a)?.exp
|
1452
1452
|
}), a.type === "ObjectProperty") {
|
1453
|
-
const
|
1453
|
+
const r = c.properties;
|
1454
1454
|
t.push({
|
1455
1455
|
id: eu(),
|
1456
1456
|
source: {
|
1457
1457
|
type: "JSFunction",
|
1458
1458
|
value: `() => { return this.${s}; }`
|
1459
1459
|
},
|
1460
|
-
deep: W(
|
1461
|
-
immediate: W(
|
1462
|
-
handler: Tu(
|
1460
|
+
deep: W(r, "deep"),
|
1461
|
+
immediate: W(r, "immediate"),
|
1462
|
+
handler: Tu(r, "handler")
|
1463
1463
|
});
|
1464
1464
|
}
|
1465
1465
|
}
|
@@ -1519,10 +1519,10 @@ function Fe(e) {
|
|
1519
1519
|
function Me(e) {
|
1520
1520
|
let u = [];
|
1521
1521
|
return e.type === "ObjectExpression" && (u = e.properties.map((t) => {
|
1522
|
-
const { key: a, value: i } = t, c = i.properties, s = a.name,
|
1522
|
+
const { key: a, value: i } = t, c = i.properties, s = a.name, r = ju(c, "from"), d = Ru(c);
|
1523
1523
|
return {
|
1524
1524
|
name: s,
|
1525
|
-
from:
|
1525
|
+
from: r || s,
|
1526
1526
|
default: d
|
1527
1527
|
};
|
1528
1528
|
})), u;
|
@@ -1530,16 +1530,16 @@ function Me(e) {
|
|
1530
1530
|
function Oe(e, u) {
|
1531
1531
|
return (e.apis || []).find((t) => t.id === u);
|
1532
1532
|
}
|
1533
|
-
let au = [], X = {},
|
1533
|
+
let au = [], X = {}, Du = {}, Lu = {}, Q = "web", _u = [];
|
1534
1534
|
function Pe(e, u, t = "", a) {
|
1535
|
-
return au = [], X = {},
|
1535
|
+
return au = [], X = {}, Du = a?.handlers || {}, Lu = a?.styles || {}, Q = a?.platform || "web", _u = a?.imports || [], {
|
1536
1536
|
nodes: (Ju({
|
1537
1537
|
id: e,
|
1538
1538
|
filename: u,
|
1539
1539
|
source: t,
|
1540
1540
|
isProd: !0,
|
1541
1541
|
slotted: !0
|
1542
|
-
}).ast?.children || []).map((
|
1542
|
+
}).ast?.children || []).map((r) => U(r)).filter((r) => !!r),
|
1543
1543
|
slots: au,
|
1544
1544
|
context: X
|
1545
1545
|
};
|
@@ -1561,8 +1561,8 @@ function Ue(e) {
|
|
1561
1561
|
for (const t of e) {
|
1562
1562
|
if (t.type === h.ATTRIBUTE)
|
1563
1563
|
if (t.name === "class") {
|
1564
|
-
const a = t.value?.content || "", i = /[\w]+_[\w]{5,}/, c = a.match(i)?.[0] || "", s = a.split(" ").filter((d) => d !== c),
|
1565
|
-
|
1564
|
+
const a = t.value?.content || "", i = /[\w]+_[\w]{5,}/, c = a.match(i)?.[0] || "", s = a.split(" ").filter((d) => d !== c), r = Lu[`.${c}`];
|
1565
|
+
r && (u.style = r), s.length && (u.class = s.join(" "));
|
1566
1566
|
} else if (t.name === "style") {
|
1567
1567
|
const a = t.value?.content || "";
|
1568
1568
|
a && (u.style = Vu(a));
|
@@ -1593,11 +1593,11 @@ function He(e, u = {}) {
|
|
1593
1593
|
);
|
1594
1594
|
let c = a.exp?.loc.source || "";
|
1595
1595
|
/\)$/.test(c) && (c = `($event) => { ${c} } `);
|
1596
|
-
const
|
1597
|
-
if (d &&
|
1596
|
+
const r = new RegExp(`${a.arg.content}_[\\w]{5,}`), d = c.match(r)?.[0] || "", n = u[d];
|
1597
|
+
if (d && n)
|
1598
1598
|
t[a.arg.content] = {
|
1599
1599
|
name: a.arg.content,
|
1600
|
-
handler:
|
1600
|
+
handler: n,
|
1601
1601
|
modifiers: i
|
1602
1602
|
};
|
1603
1603
|
else {
|
@@ -1649,10 +1649,10 @@ function du(e, u) {
|
|
1649
1649
|
name: "vBind",
|
1650
1650
|
value: k(s.exp?.loc.source || "")
|
1651
1651
|
});
|
1652
|
-
const
|
1653
|
-
|
1652
|
+
const r = a.find((d) => d.name === "html");
|
1653
|
+
r && t.push({
|
1654
1654
|
name: "vHtml",
|
1655
|
-
value: k(
|
1655
|
+
value: k(r.exp?.loc.source || "")
|
1656
1656
|
});
|
1657
1657
|
}
|
1658
1658
|
return t;
|
@@ -1661,13 +1661,13 @@ function Bu(e) {
|
|
1661
1661
|
let u = "";
|
1662
1662
|
const { name: t, props: a, events: i = {} } = e, c = a?.class || "";
|
1663
1663
|
if (typeof c == "string") {
|
1664
|
-
const s = new RegExp(`${t}_([\\w]+)`),
|
1665
|
-
n && n[1] && (u = n[1]);
|
1666
|
-
}
|
1667
|
-
for (const { name: s, handler: n } of Object.values(i)) {
|
1668
|
-
const d = new RegExp(`${s}_([\\w]+)`), r = n.value.match(d);
|
1664
|
+
const s = new RegExp(`${t}_([\\w]+)`), r = c.match(s);
|
1669
1665
|
r && r[1] && (u = r[1]);
|
1670
1666
|
}
|
1667
|
+
for (const { name: s, handler: r } of Object.values(i)) {
|
1668
|
+
const d = new RegExp(`${s}_([\\w]+)`), n = r.value.match(d);
|
1669
|
+
n && n[1] && (u = n[1]);
|
1670
|
+
}
|
1671
1671
|
return u || eu();
|
1672
1672
|
}
|
1673
1673
|
function Ge(e) {
|
@@ -1689,13 +1689,13 @@ function iu(e, u) {
|
|
1689
1689
|
const t = new Set(u?.id ? X[u.id] : []), a = (e.directives || []).find((s) => s.name === "vFor");
|
1690
1690
|
let i = new Set(Array.from(t));
|
1691
1691
|
if (a) {
|
1692
|
-
const { item: s = "item", index:
|
1693
|
-
i = /* @__PURE__ */ new Set([s,
|
1692
|
+
const { item: s = "item", index: r = "index" } = a.iterator || {};
|
1693
|
+
i = /* @__PURE__ */ new Set([s, r, ...Array.from(i)]);
|
1694
1694
|
}
|
1695
1695
|
const c = e.slot;
|
1696
1696
|
if (c) {
|
1697
|
-
const s = typeof c == "string" ? [] : c.params || [],
|
1698
|
-
i = /* @__PURE__ */ new Set([...
|
1697
|
+
const s = typeof c == "string" ? [] : c.params || [], r = s.length ? s : [`scope_${u?.id}`];
|
1698
|
+
i = /* @__PURE__ */ new Set([...r, ...Array.from(i)]);
|
1699
1699
|
}
|
1700
1700
|
X[e.id] = i;
|
1701
1701
|
}
|
@@ -1704,7 +1704,7 @@ function uu(e, u, t, a) {
|
|
1704
1704
|
name: ku(e.tag, Q),
|
1705
1705
|
from: Ge(e.tag),
|
1706
1706
|
props: Ue(e.props),
|
1707
|
-
events: He(e.props,
|
1707
|
+
events: He(e.props, Du),
|
1708
1708
|
directives: du(t || e, a)
|
1709
1709
|
};
|
1710
1710
|
i.id = Bu(i), iu(i, u);
|
@@ -1811,14 +1811,14 @@ function Xe(e) {
|
|
1811
1811
|
const u = [], t = {}, a = [];
|
1812
1812
|
try {
|
1813
1813
|
const i = ue.compileString(e, { charset: !1 })?.css || "", c = Yu.parse(i), s = /^.[\w]+_[\w]{5,}/;
|
1814
|
-
for (const
|
1815
|
-
if (
|
1814
|
+
for (const r of c.nodes)
|
1815
|
+
if (r.type === "rule") {
|
1816
1816
|
const d = {};
|
1817
|
-
s.test(
|
1818
|
-
|
1819
|
-
}), t[
|
1817
|
+
s.test(r.selector) ? (r.nodes.forEach((n) => {
|
1818
|
+
n.type === "decl" && (d[n.prop] = n.value);
|
1819
|
+
}), t[r.selector] = d) : a.push(r.toString());
|
1820
1820
|
} else
|
1821
|
-
a.push(
|
1821
|
+
a.push(r.toString());
|
1822
1822
|
} catch (i) {
|
1823
1823
|
u.push(`css解析出错了,错误信息:[ ${i.message} ]
|
1824
1824
|
`);
|
@@ -1834,7 +1834,7 @@ const Cu = "arrow-double-left, arrow-double-right, contact, notes, records, cash
|
|
1834
1834
|
", "
|
1835
1835
|
), Qe = "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(
|
1836
1836
|
", "
|
1837
|
-
), Ze = "user",
|
1837
|
+
), Ze = "user", D = "User";
|
1838
1838
|
class Ke {
|
1839
1839
|
validate(u) {
|
1840
1840
|
const t = {
|
@@ -1847,14 +1847,14 @@ class Ke {
|
|
1847
1847
|
}
|
1848
1848
|
isCompleteSFC(u) {
|
1849
1849
|
try {
|
1850
|
-
const t =
|
1850
|
+
const t = _(u);
|
1851
1851
|
return !!(t.template && t.script && t.styles);
|
1852
1852
|
} catch {
|
1853
1853
|
return !1;
|
1854
1854
|
}
|
1855
1855
|
}
|
1856
1856
|
checkSetup(u) {
|
1857
|
-
const t =
|
1857
|
+
const t = _(u);
|
1858
1858
|
let a = 0;
|
1859
1859
|
return Nu(t.script, {
|
1860
1860
|
ObjectMethod(i) {
|
@@ -1865,10 +1865,10 @@ class Ke {
|
|
1865
1865
|
}), a === 3;
|
1866
1866
|
}
|
1867
1867
|
findVantIcons(u) {
|
1868
|
-
const t =
|
1868
|
+
const t = _(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, i = t.template.match(a) || [], c = [];
|
1869
1869
|
return i.forEach((s) => {
|
1870
|
-
const
|
1871
|
-
|
1870
|
+
const r = s.match(/\bname="([^"]+)"/);
|
1871
|
+
r && c.push(r[1]);
|
1872
1872
|
}), [...new Set(c)];
|
1873
1873
|
}
|
1874
1874
|
checkVantIcons(u) {
|
@@ -1878,7 +1878,7 @@ class Ke {
|
|
1878
1878
|
return a;
|
1879
1879
|
}
|
1880
1880
|
findVtjIcons(u) {
|
1881
|
-
const t =
|
1881
|
+
const t = _(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, i = t.script.match(a);
|
1882
1882
|
return !i || !i[1] ? [] : i[1].split(",").map((c) => c.trim()).filter(Boolean);
|
1883
1883
|
}
|
1884
1884
|
checkVtjIcons(u) {
|
@@ -1902,7 +1902,7 @@ class Ke {
|
|
1902
1902
|
function Ye(e) {
|
1903
1903
|
const u = [];
|
1904
1904
|
let t = e;
|
1905
|
-
const a =
|
1905
|
+
const a = _(e);
|
1906
1906
|
if (!a.template || !a.script)
|
1907
1907
|
return {
|
1908
1908
|
fixed: !1,
|
@@ -1912,15 +1912,15 @@ function Ye(e) {
|
|
1912
1912
|
};
|
1913
1913
|
const i = u0(a.script), c = a.template;
|
1914
1914
|
let s = c;
|
1915
|
-
const
|
1916
|
-
let
|
1917
|
-
for (; (
|
1918
|
-
const m =
|
1915
|
+
const r = [], d = /\{\{([^}]+)\}\}/g;
|
1916
|
+
let n;
|
1917
|
+
for (; (n = d.exec(c)) !== null; ) {
|
1918
|
+
const m = n[0], y = n[1], g = C(y, i);
|
1919
1919
|
if (g !== y) {
|
1920
|
-
const p = B(c,
|
1921
|
-
|
1922
|
-
start:
|
1923
|
-
end:
|
1920
|
+
const p = B(c, n.index);
|
1921
|
+
r.push({
|
1922
|
+
start: n.index,
|
1923
|
+
end: n.index + m.length,
|
1924
1924
|
original: m,
|
1925
1925
|
replacement: `{{${g}}}`,
|
1926
1926
|
line: p.line,
|
@@ -1935,13 +1935,13 @@ function Ye(e) {
|
|
1935
1935
|
}
|
1936
1936
|
}
|
1937
1937
|
const b = /:(\w+)="([^"]+)"/g;
|
1938
|
-
for (; (
|
1939
|
-
const m =
|
1938
|
+
for (; (n = b.exec(c)) !== null; ) {
|
1939
|
+
const m = n[0], y = n[1], g = n[2], p = C(g, i);
|
1940
1940
|
if (p !== g) {
|
1941
|
-
const w = B(c,
|
1942
|
-
|
1943
|
-
start:
|
1944
|
-
end:
|
1941
|
+
const w = B(c, n.index);
|
1942
|
+
r.push({
|
1943
|
+
start: n.index,
|
1944
|
+
end: n.index + m.length,
|
1945
1945
|
original: m,
|
1946
1946
|
replacement: `:${y}="${p}"`,
|
1947
1947
|
line: w.line,
|
@@ -1956,13 +1956,13 @@ function Ye(e) {
|
|
1956
1956
|
}
|
1957
1957
|
}
|
1958
1958
|
const f = /v-(if|else-if|show)="([^"]+)"/g;
|
1959
|
-
for (; (
|
1960
|
-
const m =
|
1959
|
+
for (; (n = f.exec(c)) !== null; ) {
|
1960
|
+
const m = n[0], y = n[1], g = n[2], p = C(g, i);
|
1961
1961
|
if (p !== g) {
|
1962
|
-
const w = B(c,
|
1963
|
-
|
1964
|
-
start:
|
1965
|
-
end:
|
1962
|
+
const w = B(c, n.index);
|
1963
|
+
r.push({
|
1964
|
+
start: n.index,
|
1965
|
+
end: n.index + m.length,
|
1966
1966
|
original: m,
|
1967
1967
|
replacement: `v-${y}="${p}"`,
|
1968
1968
|
line: w.line,
|
@@ -1977,18 +1977,18 @@ function Ye(e) {
|
|
1977
1977
|
}
|
1978
1978
|
}
|
1979
1979
|
const I = /v-for="([^"]+)"/g;
|
1980
|
-
for (; (
|
1981
|
-
const m =
|
1980
|
+
for (; (n = I.exec(c)) !== null; ) {
|
1981
|
+
const m = n[0], g = n[1].match(/^(.+)\s+in\s+(.+)$/);
|
1982
1982
|
if (g) {
|
1983
1983
|
const [, p, w] = g, q = C(
|
1984
1984
|
w,
|
1985
1985
|
i
|
1986
1986
|
);
|
1987
1987
|
if (q !== w) {
|
1988
|
-
const P = B(c,
|
1989
|
-
|
1990
|
-
start:
|
1991
|
-
end:
|
1988
|
+
const P = B(c, n.index), K = `v-for="${p} in ${q}"`;
|
1989
|
+
r.push({
|
1990
|
+
start: n.index,
|
1991
|
+
end: n.index + m.length,
|
1992
1992
|
original: m,
|
1993
1993
|
replacement: K,
|
1994
1994
|
line: P.line,
|
@@ -2004,13 +2004,13 @@ function Ye(e) {
|
|
2004
2004
|
}
|
2005
2005
|
}
|
2006
2006
|
const x = /v-model="([^"]+)"/g;
|
2007
|
-
for (; (
|
2008
|
-
const m =
|
2007
|
+
for (; (n = x.exec(c)) !== null; ) {
|
2008
|
+
const m = n[0], y = n[1], g = C(y, i);
|
2009
2009
|
if (g !== y) {
|
2010
|
-
const p = B(c,
|
2011
|
-
|
2012
|
-
start:
|
2013
|
-
end:
|
2010
|
+
const p = B(c, n.index);
|
2011
|
+
r.push({
|
2012
|
+
start: n.index,
|
2013
|
+
end: n.index + m.length,
|
2014
2014
|
original: m,
|
2015
2015
|
replacement: `v-model="${g}"`,
|
2016
2016
|
line: p.line,
|
@@ -2025,13 +2025,13 @@ function Ye(e) {
|
|
2025
2025
|
}
|
2026
2026
|
}
|
2027
2027
|
const N = /v-bind="([^"]+)"/g;
|
2028
|
-
for (; (
|
2029
|
-
const m =
|
2028
|
+
for (; (n = N.exec(c)) !== null; ) {
|
2029
|
+
const m = n[0], y = n[1], g = C(y, i);
|
2030
2030
|
if (g !== y) {
|
2031
|
-
const p = B(c,
|
2032
|
-
|
2033
|
-
start:
|
2034
|
-
end:
|
2031
|
+
const p = B(c, n.index);
|
2032
|
+
r.push({
|
2033
|
+
start: n.index,
|
2034
|
+
end: n.index + m.length,
|
2035
2035
|
original: m,
|
2036
2036
|
replacement: `v-bind="${g}"`,
|
2037
2037
|
line: p.line,
|
@@ -2046,13 +2046,13 @@ function Ye(e) {
|
|
2046
2046
|
}
|
2047
2047
|
}
|
2048
2048
|
const V = /v-(text|html)="([^"]+)"/g;
|
2049
|
-
for (; (
|
2050
|
-
const m =
|
2049
|
+
for (; (n = V.exec(c)) !== null; ) {
|
2050
|
+
const m = n[0], y = n[1], g = n[2], p = C(g, i);
|
2051
2051
|
if (p !== g) {
|
2052
|
-
const w = B(c,
|
2053
|
-
|
2054
|
-
start:
|
2055
|
-
end:
|
2052
|
+
const w = B(c, n.index);
|
2053
|
+
r.push({
|
2054
|
+
start: n.index,
|
2055
|
+
end: n.index + m.length,
|
2056
2056
|
original: m,
|
2057
2057
|
replacement: `v-${y}="${p}"`,
|
2058
2058
|
line: w.line,
|
@@ -2067,13 +2067,13 @@ function Ye(e) {
|
|
2067
2067
|
}
|
2068
2068
|
}
|
2069
2069
|
const Z = /(@|v-on:)(\w+)="([^"]+)"/g;
|
2070
|
-
for (; (
|
2071
|
-
const m =
|
2070
|
+
for (; (n = Z.exec(c)) !== null; ) {
|
2071
|
+
const m = n[0], y = n[1], g = n[2], p = n[3], w = e0(p, i);
|
2072
2072
|
if (w !== p) {
|
2073
|
-
const q = B(c,
|
2074
|
-
|
2075
|
-
start:
|
2076
|
-
end:
|
2073
|
+
const q = B(c, n.index);
|
2074
|
+
r.push({
|
2075
|
+
start: n.index,
|
2076
|
+
end: n.index + m.length,
|
2077
2077
|
original: m,
|
2078
2078
|
replacement: `${y}${g}="${w}"`,
|
2079
2079
|
line: q.line,
|
@@ -2087,16 +2087,16 @@ function Ye(e) {
|
|
2087
2087
|
});
|
2088
2088
|
}
|
2089
2089
|
}
|
2090
|
-
if (
|
2090
|
+
if (r.sort((m, y) => y.start - m.start), r.forEach((m) => {
|
2091
2091
|
s = s.substring(0, m.start) + m.replacement + s.substring(m.end);
|
2092
|
-
}),
|
2092
|
+
}), r.length > 0) {
|
2093
2093
|
const m = e.indexOf("<template>"), y = e.indexOf("</template>") + 11;
|
2094
2094
|
t = e.substring(0, m) + `<template>
|
2095
2095
|
` + s + `
|
2096
2096
|
</template>` + e.substring(y);
|
2097
2097
|
}
|
2098
2098
|
return {
|
2099
|
-
fixed:
|
2099
|
+
fixed: r.length > 0,
|
2100
2100
|
originalCode: e,
|
2101
2101
|
fixedCode: t,
|
2102
2102
|
changes: u
|
@@ -2138,7 +2138,7 @@ function e0(e, u) {
|
|
2138
2138
|
`(\\+\\+|--)?(?<![\\w.])${a}(?![\\w])`,
|
2139
2139
|
"g"
|
2140
2140
|
);
|
2141
|
-
t.includes(`state.${a}`) || (t = t.replace(i, `state.${a}$1`), t = t.replace(c, (s,
|
2141
|
+
t.includes(`state.${a}`) || (t = t.replace(i, `state.${a}$1`), t = t.replace(c, (s, r) => r ? `${r}state.${a}` : s.includes(a) && !s.includes("state.") ? `state.${a}` : s));
|
2142
2142
|
}), C(t, u);
|
2143
2143
|
}
|
2144
2144
|
function B(e, u) {
|
@@ -2155,28 +2155,29 @@ class t0 {
|
|
2155
2155
|
return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Ye(a).fixedCode;
|
2156
2156
|
}
|
2157
2157
|
fixVantIcons(u) {
|
2158
|
-
const t =
|
2158
|
+
const t = _(u), a = t.template.replace(
|
2159
2159
|
/<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
|
2160
2160
|
(i, c) => Cu.includes(c) ? i : i.replace(c, Ze)
|
2161
2161
|
);
|
2162
2162
|
return this.reconstructSFC(t, a, t.script);
|
2163
2163
|
}
|
2164
2164
|
fixVtjIcons(u, t = []) {
|
2165
|
-
const a =
|
2165
|
+
const a = _(u);
|
2166
2166
|
a.script = Nu(a.script, {
|
2167
2167
|
ImportDeclaration(i) {
|
2168
2168
|
if (i.node.source.value === "@vtj/icons") {
|
2169
2169
|
const c = i.node.specifiers, s = [];
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2170
|
+
let r = !1;
|
2171
|
+
for (const d of c) {
|
2172
|
+
const n = d.imported?.name;
|
2173
|
+
n === D && (r = !0), t.includes(n) || s.push(
|
2174
|
+
T.importSpecifier(d.local, d.imported)
|
2174
2175
|
);
|
2175
2176
|
}
|
2176
|
-
s.push(
|
2177
|
+
r || s.push(
|
2177
2178
|
T.importSpecifier(
|
2178
|
-
T.identifier(
|
2179
|
-
T.identifier(
|
2179
|
+
T.identifier(D),
|
2180
|
+
T.identifier(D)
|
2180
2181
|
)
|
2181
2182
|
), i.node.specifiers = s;
|
2182
2183
|
}
|
@@ -2186,13 +2187,13 @@ class t0 {
|
|
2186
2187
|
const c = i.node.body.body;
|
2187
2188
|
for (const s of c)
|
2188
2189
|
if (T.isReturnStatement(s) && T.isObjectExpression(s.argument)) {
|
2189
|
-
const
|
2190
|
-
s.argument.properties =
|
2190
|
+
const r = s.argument.properties || [];
|
2191
|
+
s.argument.properties = r.filter(
|
2191
2192
|
(d) => !t.includes(d.key.name)
|
2192
2193
|
), s.argument.properties.push(
|
2193
2194
|
T.objectProperty(
|
2194
|
-
T.identifier(
|
2195
|
-
T.identifier(
|
2195
|
+
T.identifier(D),
|
2196
|
+
T.identifier(D),
|
2196
2197
|
!1,
|
2197
2198
|
!0
|
2198
2199
|
)
|
@@ -2201,19 +2202,19 @@ class t0 {
|
|
2201
2202
|
}
|
2202
2203
|
},
|
2203
2204
|
ObjectProperty(i) {
|
2204
|
-
if (T.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = T.identifier(
|
2205
|
+
if (T.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = T.identifier(D)), T.isArrayExpression(i.node.value)) {
|
2205
2206
|
const c = i.node.value.elements;
|
2206
|
-
i.node.value.elements = c.map((s) => T.isIdentifier(s) && t.includes(s.name) ? T.identifier(
|
2207
|
+
i.node.value.elements = c.map((s) => T.isIdentifier(s) && t.includes(s.name) ? T.identifier(D) : s);
|
2207
2208
|
}
|
2208
2209
|
},
|
2209
2210
|
AssignmentExpression(i) {
|
2210
|
-
T.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = T.identifier(
|
2211
|
+
T.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = T.identifier(D));
|
2211
2212
|
}
|
2212
2213
|
});
|
2213
2214
|
for (const i of t)
|
2214
2215
|
a.template = a.template.replace(
|
2215
2216
|
new RegExp(`:icon="${i}"`, "g"),
|
2216
|
-
`:icon="${
|
2217
|
+
`:icon="${D}"`
|
2217
2218
|
);
|
2218
2219
|
return this.reconstructSFC(a, a.template, a.script);
|
2219
2220
|
}
|
@@ -2237,11 +2238,11 @@ ${a}
|
|
2237
2238
|
}
|
2238
2239
|
}
|
2239
2240
|
async function y0(e) {
|
2240
|
-
const { id: u, name: t, source: a, project: i } = e, { dependencies: c = [], platform: s = "web" } = i || {},
|
2241
|
+
const { id: u, name: t, source: a, project: i } = e, { dependencies: c = [], platform: s = "web" } = i || {}, r = new Ke(), d = new t0(), n = r.validate(a);
|
2241
2242
|
let b = [];
|
2242
|
-
if (!
|
2243
|
-
return b =
|
2244
|
-
const f = d.fixBasedOnValidation(a,
|
2243
|
+
if (!n.valid)
|
2244
|
+
return b = n.errors, Promise.reject(b);
|
2245
|
+
const f = d.fixBasedOnValidation(a, n), I = _(f), {
|
2245
2246
|
styles: x,
|
2246
2247
|
css: N,
|
2247
2248
|
errors: V
|
@@ -2339,9 +2340,9 @@ async function a0(e, u, t) {
|
|
2339
2340
|
}, {
|
2340
2341
|
state: c,
|
2341
2342
|
watch: s,
|
2342
|
-
computed:
|
2343
|
+
computed: r,
|
2343
2344
|
props: d,
|
2344
|
-
dataSources:
|
2345
|
+
dataSources: n,
|
2345
2346
|
methods: b,
|
2346
2347
|
lifeCycles: f,
|
2347
2348
|
inject: I
|
@@ -2349,9 +2350,9 @@ async function a0(e, u, t) {
|
|
2349
2350
|
if (await i({
|
2350
2351
|
state: c,
|
2351
2352
|
watch: s,
|
2352
|
-
computed:
|
2353
|
+
computed: r,
|
2353
2354
|
props: d,
|
2354
|
-
dataSources:
|
2355
|
+
dataSources: n,
|
2355
2356
|
methods: b,
|
2356
2357
|
lifeCycles: f,
|
2357
2358
|
inject: I
|
@@ -2385,8 +2386,8 @@ function c0(e = [], u = []) {
|
|
2385
2386
|
for (const { from: i, imports: c } of e)
|
2386
2387
|
if (Array.isArray(c))
|
2387
2388
|
c.forEach((s) => {
|
2388
|
-
const
|
2389
|
-
|
2389
|
+
const r = a[i];
|
2390
|
+
r && (t[s] = r);
|
2390
2391
|
});
|
2391
2392
|
else {
|
2392
2393
|
const s = a[i];
|