@vtj/parser 0.18.2 → 0.18.4

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.mjs CHANGED
@@ -4,7 +4,7 @@ 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 v } from "@vue/compiler-core";
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.2
16
+ * @version 0.18.4
17
17
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
18
18
  */
19
- const l0 = "0.18.2";
20
- function M(e) {
19
+ const l0 = "0.18.4";
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,7 +27,7 @@ function M(e) {
27
27
  isScriptSetup: r
28
28
  };
29
29
  }
30
- function B(e) {
30
+ function _(e) {
31
31
  return me(e, { sourceType: "module", plugins: ["typescript"] });
32
32
  }
33
33
  function J(e, u) {
@@ -91,7 +91,7 @@ function Ie(e) {
91
91
  }
92
92
  function Ju(e, u) {
93
93
  try {
94
- const t = B(e);
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 = B(e);
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
- B(n);
167
+ _(n);
168
168
  } catch (s) {
169
169
  t.push(`脚本语法错误: ${s.message}`);
170
170
  }
@@ -174,7 +174,7 @@ function ke(e, u) {
174
174
  return t.length > 0 ? t : null;
175
175
  }
176
176
  function f0(e) {
177
- const u = M(e), t = B(u.script), a = {};
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 = B(e);
202
+ a = _(e);
203
203
  } catch {
204
204
  const i = "(()=>{", c = i + e + "})";
205
- a = B(c), r = i.length;
205
+ a = _(c), r = i.length;
206
206
  }
207
207
  const n = [];
208
208
  if (J(a, {
@@ -265,7 +265,7 @@ function je(e, u, t, a, r, n) {
265
265
  const b = (c.start ?? 0) - a;
266
266
  if (b < 0 || b > r.length) break;
267
267
  const h = b + p, S = h + u.length;
268
- h >= 0 && S <= r.length && !n.some((E) => E.start === h && E.end === S) && n.push({ start: h, end: S, text: t }), l = p + u.length;
268
+ h >= 0 && S <= r.length && !n.some((w) => w.start === h && w.end === S) && n.push({ start: h, 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 P;
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
- })(P || (P = {}));
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 = P.Strict;
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 === P.Strict)
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 === P.Attribute && // We shouldn't have consumed any characters after the entity,
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 !== P.Strict && (this.result = this.treeIndex, this.consumed += this.excess, this.excess = 0);
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 !== P.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
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 O;
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
- })(O || (O = {}));
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(O.NoValue, this.sectionStart), this.sectionStart = -1, this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : U(u) || (this.cbs.onattribend(O.NoValue, this.sectionStart), this.state = f.InAttributeName, this.sectionStart = this.index);
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 ? O.Double : O.Single, this.index + 1), this.state = f.BeforeAttributeName) : this.decodeEntities && u === y.Amp && this.startEntity();
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(O.Unquoted, this.index), this.state = f.BeforeAttributeName, this.stateBeforeAttributeName(u)) : this.decodeEntities && u === y.Amp && this.startEntity();
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 ? P.Strict : this.baseState === f.Text || this.baseState === f.InSpecialTag ? P.Legacy : P.Attribute);
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);
@@ -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 === O.Double ? '"' : u === O.Single ? "'" : u === O.NoValue ? void 0 : null), this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname) && (this.attribs[this.attribname] = this.attribvalue), this.attribvalue = "";
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);
@@ -1518,7 +1518,7 @@ function et(e, u) {
1518
1518
  imports: tt(e),
1519
1519
  emits: [],
1520
1520
  errors: []
1521
- }, r = B(e);
1521
+ }, r = _(e);
1522
1522
  return J(r, {
1523
1523
  ExportDefaultDeclaration(n) {
1524
1524
  const s = n.node.declaration;
@@ -1928,7 +1928,7 @@ function gt(e) {
1928
1928
  function yt(e) {
1929
1929
  const u = {};
1930
1930
  for (const t of e) {
1931
- if (t.type === v.ATTRIBUTE)
1931
+ if (t.type === E.ATTRIBUTE)
1932
1932
  if (t.name === "class") {
1933
1933
  const a = t.value?.content || "", r = /[\w]+_[\w]{5,}/, n = a.match(r)?.[0] || "", s = a.split(" ").filter((o) => o !== n), i = te[`.${n}`];
1934
1934
  i && (u.style = i), s.length && (u.class = s.join(" "));
@@ -1937,7 +1937,7 @@ function yt(e) {
1937
1937
  a && (u.style = Xu(a));
1938
1938
  } else
1939
1939
  u[t.name] = t.value?.content || "";
1940
- if (t.type === v.DIRECTIVE && t.name === "bind" && (t.exp?.type === v.SIMPLE_EXPRESSION && t.arg?.type === v.SIMPLE_EXPRESSION && (u[t.arg.content] = T(`(${t.exp.content})`)), t.exp?.type === v.COMPOUND_EXPRESSION && t.arg?.type === v.SIMPLE_EXPRESSION))
1940
+ 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
1941
  if (t.arg.content === "class" && u.class) {
1942
1942
  const a = t.exp.ast.type, r = Pe(
1943
1943
  u.class,
@@ -1961,7 +1961,7 @@ function St(e = {}) {
1961
1961
  function vt(e, u = {}) {
1962
1962
  const t = {};
1963
1963
  for (const a of e)
1964
- if (a.type === v.DIRECTIVE && a.name === "on" && a.arg?.type === v.SIMPLE_EXPRESSION) {
1964
+ if (a.type === E.DIRECTIVE && a.name === "on" && a.arg?.type === E.SIMPLE_EXPRESSION) {
1965
1965
  const r = a.modifiers.reduce(
1966
1966
  (c, d) => (d.content && (c[d.content] = !0), c),
1967
1967
  {}
@@ -1976,18 +1976,31 @@ function vt(e, u = {}) {
1976
1976
  modifiers: r
1977
1977
  };
1978
1978
  else {
1979
- const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", h = d === "Identifier", S = d === "MemberExpression", E = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
1979
+ const c = a.exp?.ast, d = c?.type, l = d === "CallExpression", p = d === "ArrowFunctionExpression", b = d === "FunctionExpression", h = d === "Identifier", S = d === "MemberExpression", w = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
1980
1980
  let m;
1981
1981
  if (l)
1982
1982
  m = T(n);
1983
- else if (h || S || E)
1983
+ else if (h || S || w)
1984
1984
  m = C(n);
1985
1985
  else if (p || b) {
1986
1986
  const g = c?.body, x = c?.params;
1987
1987
  g && g.type === "Identifier" && (!x || x.length === 0) ? m = C(g.name) : m = C(n);
1988
1988
  } else {
1989
- const x = /\$event\b/.test(n) ? "($event) => " : "() => ";
1990
- m = C(`${x}${n}`);
1989
+ let g = !1;
1990
+ try {
1991
+ const v = _(n).program.body;
1992
+ if (v.length === 1 && v[0].type === "ExpressionStatement") {
1993
+ const I = v[0].expression?.type;
1994
+ g = I === "ArrowFunctionExpression" || I === "FunctionExpression";
1995
+ }
1996
+ } catch {
1997
+ }
1998
+ if (g)
1999
+ m = C(n);
2000
+ else {
2001
+ const v = /\$event\b/.test(n) ? "($event) => " : "() => ";
2002
+ m = C(`${v}${n}`);
2003
+ }
1991
2004
  }
1992
2005
  t[a.arg.content] = {
1993
2006
  name: a.arg.content,
@@ -2000,7 +2013,7 @@ function vt(e, u = {}) {
2000
2013
  }
2001
2014
  function eu(e, u) {
2002
2015
  const t = [], a = ["if", "for", "model", "show", "bind", "html"];
2003
- if (u && (e.type === v.IF_BRANCH || e.type === v.IF) && u.forEach((r, n) => {
2016
+ if (u && (e.type === E.IF_BRANCH || e.type === E.IF) && u.forEach((r, n) => {
2004
2017
  if (e === r) {
2005
2018
  const s = n === 0 ? "vIf" : r.condition ? "vElseIf" : "vElse", i = r.condition?.loc.source || "";
2006
2019
  t.push({
@@ -2013,16 +2026,16 @@ function eu(e, u) {
2013
2026
  t.push(...c);
2014
2027
  }
2015
2028
  }
2016
- }), e.type === v.FOR && t.push({
2029
+ }), e.type === E.FOR && t.push({
2017
2030
  name: "vFor",
2018
2031
  value: T(e.source.loc.source),
2019
2032
  iterator: {
2020
2033
  item: e.valueAlias?.loc.source || "item",
2021
2034
  index: e.keyAlias?.loc.source || "index"
2022
2035
  }
2023
- }), e.type === v.ELEMENT) {
2036
+ }), e.type === E.ELEMENT) {
2024
2037
  const r = e.props.filter(
2025
- (d) => d.type === v.DIRECTIVE
2038
+ (d) => d.type === E.DIRECTIVE
2026
2039
  ), n = r.filter((d) => d.name === "model");
2027
2040
  n.length && n.forEach((d) => {
2028
2041
  t.push({
@@ -2064,13 +2077,13 @@ function eu(e, u) {
2064
2077
  }
2065
2078
  function ne(e) {
2066
2079
  let u = "";
2067
- if (e.type === v.ELEMENT) {
2080
+ if (e.type === E.ELEMENT) {
2068
2081
  const { props: t = [], tag: a } = e;
2069
2082
  for (const r of t)
2070
2083
  if (r.name === "class") {
2071
2084
  const n = r.value?.content || "", s = new RegExp(`${a}_([\\w]+)`);
2072
2085
  u = n.match(s)?.[1] || "";
2073
- } else if (r.type === v.DIRECTIVE && r.name === "on") {
2086
+ } else if (r.type === E.DIRECTIVE && r.name === "on") {
2074
2087
  const n = r.arg?.loc?.source || "", s = r.exp?.loc?.source || "", i = new RegExp(`${n}_([\\w]+)`);
2075
2088
  u = s.match(i)?.[1] || "";
2076
2089
  }
@@ -2122,52 +2135,52 @@ function wt(e = [], u) {
2122
2135
  return e.map((t) => Z(t, u, e));
2123
2136
  }
2124
2137
  function Z(e, u, t) {
2125
- if (e.type === v.ELEMENT)
2138
+ if (e.type === E.ELEMENT)
2126
2139
  return bu(e, u);
2127
- if (e.type === v.IF)
2140
+ if (e.type === E.IF)
2128
2141
  return It(e);
2129
- if (t && e.type === v.IF_BRANCH) {
2142
+ if (t && e.type === E.IF_BRANCH) {
2130
2143
  const a = e.children.find(
2131
- (r) => r.type === v.ELEMENT || r.type === v.FOR
2144
+ (r) => r.type === E.ELEMENT || r.type === E.FOR
2132
2145
  );
2133
2146
  if (a) {
2134
- if (a.type === v.ELEMENT)
2147
+ if (a.type === E.ELEMENT)
2135
2148
  return bu(a, u, e, t);
2136
- if (a.type === v.FOR) {
2149
+ if (a.type === E.FOR) {
2137
2150
  const n = { name: "div", directives: eu(e) };
2138
2151
  return ou(n, e.children || []);
2139
2152
  }
2140
2153
  }
2141
2154
  return "";
2142
2155
  }
2143
- if (e.type === v.FOR) {
2156
+ if (e.type === E.FOR) {
2144
2157
  const a = e.children[0];
2145
- if (e.children.length > 1 || a.type !== v.ELEMENT) {
2158
+ if (e.children.length > 1 || a.type !== E.ELEMENT) {
2146
2159
  const n = { name: "span", directives: eu(e) };
2147
2160
  return ou(n, e.children);
2148
2161
  } else
2149
2162
  return bu(a, u, e);
2150
2163
  }
2151
- if (e.type === v.TEXT_CALL)
2152
- return e.content.type == v.TEXT ? e.content.content : e.content.type === v.INTERPOLATION ? T(e.content.content.loc.source) : e.content.type === v.COMPOUND_EXPRESSION ? Ru(
2164
+ if (e.type === E.TEXT_CALL)
2165
+ 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
2166
  e.content.children
2154
2167
  ) : "";
2155
- if (e.type === v.TEXT)
2168
+ if (e.type === E.TEXT)
2156
2169
  return e.content;
2157
- if (e.type === v.INTERPOLATION && (e.content.type === v.SIMPLE_EXPRESSION || e.content.type === v.COMPOUND_EXPRESSION))
2170
+ if (e.type === E.INTERPOLATION && (e.content.type === E.SIMPLE_EXPRESSION || e.content.type === E.COMPOUND_EXPRESSION))
2158
2171
  return T(e.content.loc.source);
2159
- if (e.type === v.COMPOUND_EXPRESSION)
2172
+ if (e.type === E.COMPOUND_EXPRESSION)
2160
2173
  return Ru(
2161
2174
  e.children
2162
2175
  );
2163
- e.type !== v.COMMENT && console.warn("未处理", e.type);
2176
+ e.type !== E.COMMENT && console.warn("未处理", e.type);
2164
2177
  }
2165
2178
  function Ru(e = []) {
2166
2179
  const u = e.filter((a) => typeof a != "string"), t = [];
2167
2180
  for (const a of u)
2168
2181
  t.push({
2169
2182
  name: "span",
2170
- children: a.type === v.TEXT ? a.loc.source : T(a.content?.loc.source)
2183
+ children: a.type === E.TEXT ? a.loc.source : T(a.content?.loc.source)
2171
2184
  });
2172
2185
  return {
2173
2186
  name: "span",
@@ -2177,34 +2190,34 @@ function Ru(e = []) {
2177
2190
  function ou(e, u = []) {
2178
2191
  const t = [];
2179
2192
  for (const a of u)
2180
- if (a.type === v.ELEMENT && a.codegenNode?.value?.arguments) {
2193
+ if (a.type === E.ELEMENT && a.codegenNode?.value?.arguments) {
2181
2194
  const r = a.codegenNode.value.arguments[0];
2182
2195
  if (r) {
2183
2196
  const n = qu(r, cu);
2184
2197
  t.push(...n);
2185
2198
  }
2186
- } else if (a.type === v.ELEMENT && a.tag === "template") {
2199
+ } else if (a.type === E.ELEMENT && a.tag === "template") {
2187
2200
  const r = a.props.find((n) => n.name === "slot");
2188
2201
  for (const n of a.children) {
2189
- const s = n.type === v.TEXT || n.type === v.TEXT_CALL ? {
2202
+ const s = n.type === E.TEXT || n.type === E.TEXT_CALL ? {
2190
2203
  name: "span",
2191
2204
  children: Z(n, e)
2192
2205
  } : Z(n, e);
2193
2206
  s && (Array.isArray(s) ? s : [s]).forEach((o) => {
2194
- Ie(o) && r?.type === v.DIRECTIVE && (o.id = ne(n), o.slot = {
2207
+ Ie(o) && r?.type === E.DIRECTIVE && (o.id = ne(n), o.slot = {
2195
2208
  name: r.arg?.content || "default",
2196
2209
  params: r.exp?.identifiers || [],
2197
- scope: r.exp?.type === v.SIMPLE_EXPRESSION ? r.exp.content : ""
2210
+ scope: r.exp?.type === E.SIMPLE_EXPRESSION ? r.exp.content : ""
2198
2211
  }, mu(o, e)), t.push(o);
2199
2212
  });
2200
2213
  }
2201
- } else if (a.type === v.JS_CALL_EXPRESSION) {
2214
+ } else if (a.type === E.JS_CALL_EXPRESSION) {
2202
2215
  const r = a.arguments?.[0];
2203
2216
  if (r) {
2204
2217
  const n = qu(r, cu);
2205
2218
  t.push(...n);
2206
2219
  }
2207
- } else if (a.type === v.TEXT_CALL) {
2220
+ } else if (a.type === E.TEXT_CALL) {
2208
2221
  const r = Z(a, e);
2209
2222
  r && (Array.isArray(r) ? t.push(...r) : t.push(r));
2210
2223
  } else {
@@ -2220,7 +2233,7 @@ function ou(e, u = []) {
2220
2233
  }
2221
2234
  function It(e) {
2222
2235
  const u = e.branches || [], t = u[0], a = t.children || [];
2223
- if (t?.isTemplateIf || a.length > 1 || a[0].type !== v.ELEMENT) {
2236
+ if (t?.isTemplateIf || a.length > 1 || a[0].type !== E.ELEMENT) {
2224
2237
  const n = { name: "span", directives: eu(t, u) };
2225
2238
  return ou(n, t.children);
2226
2239
  } else
@@ -2288,7 +2301,7 @@ function Nt(e, u) {
2288
2301
  handlers: {},
2289
2302
  dataSources: {},
2290
2303
  directives: {}
2291
- }, i = [], o = B(e);
2304
+ }, i = [], o = _(e);
2292
2305
  if (J(o, {
2293
2306
  // 顶层变量声明
2294
2307
  VariableDeclaration(c) {
@@ -2300,39 +2313,39 @@ function Nt(e, u) {
2300
2313
  if (b.type === "CallExpression") {
2301
2314
  const h = Cu(b);
2302
2315
  if (h === "ref") {
2303
- const E = _(p.id);
2304
- if (E) {
2316
+ const w = L(p.id);
2317
+ if (w) {
2305
2318
  const m = b.arguments[0] ? A(b.arguments[0]) : "undefined";
2306
- s.refs[E] = T(m);
2319
+ s.refs[w] = T(m);
2307
2320
  }
2308
2321
  return;
2309
2322
  }
2310
2323
  if (h === "reactive") {
2311
- const E = _(p.id);
2312
- if (E)
2313
- if (E === "__state")
2324
+ const w = L(p.id);
2325
+ if (w)
2326
+ if (w === "__state")
2314
2327
  s.state = Dt(b.arguments[0]);
2315
2328
  else {
2316
2329
  const m = b.arguments[0] ? A(b.arguments[0]) : "{}";
2317
- s.reactives[E] = T(m);
2330
+ s.reactives[w] = T(m);
2318
2331
  }
2319
2332
  return;
2320
2333
  }
2321
2334
  if (h === "computed") {
2322
- const E = _(p.id);
2323
- if (E) {
2335
+ const w = L(p.id);
2336
+ if (w) {
2324
2337
  const m = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
2325
- s.computed[E] = C(m);
2338
+ s.computed[w] = C(m);
2326
2339
  }
2327
2340
  return;
2328
2341
  }
2329
2342
  if (h === "inject") {
2330
- const E = _(p.id);
2331
- if (E) {
2332
- const m = b.arguments[0], g = b.arguments[1], x = m ? Lu(m) : E;
2343
+ const w = L(p.id);
2344
+ if (w) {
2345
+ const m = b.arguments[0], g = b.arguments[1], x = m ? Lu(m) : w;
2333
2346
  s.inject.push({
2334
- name: E,
2335
- from: x || E,
2347
+ name: w,
2348
+ from: x || w,
2336
2349
  default: g ? T(A(g)) : void 0
2337
2350
  });
2338
2351
  }
@@ -2347,22 +2360,22 @@ function Nt(e, u) {
2347
2360
  return;
2348
2361
  }
2349
2362
  if (h && /^use[A-Z]/.test(h)) {
2350
- const E = a.get(h);
2351
- if (qt(h, E)) {
2363
+ const w = a.get(h);
2364
+ if (qt(h, w)) {
2352
2365
  const x = _u(p.id);
2353
2366
  x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: h, destructure: x }));
2354
2367
  return;
2355
2368
  }
2356
2369
  if (h === "useProvider") return;
2357
- if (!E)
2370
+ if (!w)
2358
2371
  continue;
2359
- const m = _(p.id), g = _u(p.id);
2372
+ const m = L(p.id), g = _u(p.id);
2360
2373
  if (m || g.length) {
2361
2374
  if (m && s.composables.some((D) => D.name === m))
2362
2375
  return;
2363
2376
  let x;
2364
- const w = n[E];
2365
- w ? x = `this.$libs.${w}.${h}` : x = h;
2377
+ const v = n[w];
2378
+ v ? x = `this.$libs.${v}.${h}` : x = h;
2366
2379
  const I = {
2367
2380
  name: m || g[0] || h,
2368
2381
  composable: {
@@ -2376,18 +2389,18 @@ function Nt(e, u) {
2376
2389
  }
2377
2390
  return;
2378
2391
  }
2379
- const S = _(p.id);
2392
+ const S = L(p.id);
2380
2393
  if (S && S.startsWith("__") || h === "getCurrentInstance")
2381
2394
  return;
2382
2395
  }
2383
2396
  if (b.type === "ArrowFunctionExpression" || b.type === "FunctionExpression") {
2384
- const h = _(p.id);
2397
+ const h = L(p.id);
2385
2398
  if (h) {
2386
2399
  const S = A(b);
2387
2400
  if (Bu(S)) {
2388
- const E = $u(h, S, u);
2389
- if (E) {
2390
- s.dataSources[h] = E;
2401
+ const w = $u(h, S, u);
2402
+ if (w) {
2403
+ s.dataSources[h] = w;
2391
2404
  return;
2392
2405
  }
2393
2406
  }
@@ -2402,7 +2415,7 @@ function Nt(e, u) {
2402
2415
  }
2403
2416
  }
2404
2417
  if (d.declarations.some((p) => {
2405
- const b = _(p.id);
2418
+ const b = L(p.id);
2406
2419
  return b && b.startsWith("__");
2407
2420
  }))
2408
2421
  return;
@@ -2411,7 +2424,7 @@ function Nt(e, u) {
2411
2424
  return b && (b.type === "ObjectExpression" || b.type === "ArrayExpression");
2412
2425
  }) && d.declarations.length > 0) {
2413
2426
  for (const p of d.declarations) {
2414
- const b = _(p.id);
2427
+ const b = L(p.id);
2415
2428
  b && p.init && (s.reactives[b] = T(A(p.init)));
2416
2429
  }
2417
2430
  return;
@@ -2419,9 +2432,9 @@ function Nt(e, u) {
2419
2432
  for (const p of d.declarations) {
2420
2433
  const b = p.init;
2421
2434
  if (b) {
2422
- const h = _(p.id) || "(unknown)", S = A(b), E = b.type;
2435
+ const h = L(p.id) || "(unknown)", S = A(b), w = b.type;
2423
2436
  throw new Error(
2424
- `[vtj/parser] 无法处理顶层变量声明 "const ${h} = ${S}":不支持的类型 "${E}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2437
+ `[vtj/parser] 无法处理顶层变量声明 "const ${h} = ${S}":不支持的类型 "${w}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2425
2438
  );
2426
2439
  }
2427
2440
  }
@@ -2476,10 +2489,10 @@ function Nt(e, u) {
2476
2489
  if (p === "provide") {
2477
2490
  const h = l.arguments[0], S = l.arguments[1];
2478
2491
  if (h && S) {
2479
- const E = Lu(h);
2480
- if (E) {
2492
+ const w = Lu(h);
2493
+ if (w) {
2481
2494
  const m = A(S);
2482
- S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[E] = C(m) : s.provide[E] = T(m);
2495
+ S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[w] = C(m) : s.provide[w] = T(m);
2483
2496
  }
2484
2497
  }
2485
2498
  return;
@@ -2550,7 +2563,7 @@ function qt(e, u) {
2550
2563
  function Cu(e) {
2551
2564
  return e.callee.type === "Identifier" ? e.callee.name : null;
2552
2565
  }
2553
- function _(e) {
2566
+ function L(e) {
2554
2567
  return e?.type === "Identifier" ? e.name : null;
2555
2568
  }
2556
2569
  function _u(e) {
@@ -2948,7 +2961,7 @@ const ie = "arrow-double-left, arrow-double-right, contact, notes, records, cash
2948
2961
  ", "
2949
2962
  ), Wt = "AddLocation, Aim, AlarmClock, Apple, ArrowDownBold, ArrowDown, ArrowLeftBold, ArrowLeft, ArrowRightBold, ArrowRight, ArrowUpBold, ArrowUp, Avatar, Back, Baseball, Basketball, BellFilled, Bell, Bicycle, BottomLeft, BottomRight, Bottom, Bowl, Box, Briefcase, BrushFilled, Brush, Burger, Calendar, CameraFilled, Camera, CaretBottom, CaretLeft, CaretRight, CaretTop, Cellphone, ChatDotRound, ChatDotSquare, ChatLineRound, ChatLineSquare, ChatRound, ChatSquare, Check, Checked, Cherry, Chicken, ChromeFilled, CircleCheckFilled, CircleCheck, CircleCloseFilled, CircleClose, CirclePlusFilled, CirclePlus, Clock, CloseBold, Close, Cloudy, CoffeeCup, Coffee, Coin, ColdDrink, CollectionTag, Collection, Comment, Compass, Connection, Coordinate, CopyDocument, Cpu, CreditCard, Crop, DArrowLeft, DArrowRight, DCaret, DataAnalysis, DataBoard, DataLine, DeleteFilled, DeleteLocation, Delete, Dessert, Discount, DishDot, Dish, DocumentAdd, DocumentChecked, DocumentCopy, DocumentDelete, DocumentRemove, Document, Download, Drizzling, EditPen, Edit, ElemeFilled, Eleme, ElementPlus, Expand, Failed, Female, Files, Film, Filter, Finished, FirstAidKit, Flag, Fold, FolderAdd, FolderChecked, FolderDelete, FolderOpened, FolderRemove, Folder, Food, Football, ForkSpoon, Fries, FullScreen, GobletFull, GobletSquareFull, GobletSquare, Goblet, GoldMedal, GoodsFilled, Goods, Grape, Grid, Guide, Handbag, Headset, HelpFilled, Help, Hide, Histogram, HomeFilled, HotWater, House, IceCreamRound, IceCreamSquare, IceCream, IceDrink, IceTea, InfoFilled, Iphone, Key, KnifeFork, Lightning, Link, List, Loading, LocationFilled, LocationInformation, Location, Lock, Lollipop, MagicStick, Magnet, Male, Management, MapLocation, Medal, Memo, Menu, MessageBox, Message, Mic, Microphone, MilkTea, Minus, Money, Monitor, MoonNight, Moon, MoreFilled, More, MostlyCloudy, Mouse, Mug, MuteNotification, Mute, NoSmoking, Notebook, Notification, Odometer, OfficeBuilding, Open, Operation, Opportunity, Orange, Paperclip, PartlyCloudy, Pear, PhoneFilled, Phone, PictureFilled, PictureRounded, Picture, PieChart, Place, Platform, Plus, Pointer, Position, Postcard, Pouring, Present, PriceTag, Printer, Promotion, QuartzWatch, QuestionFilled, Rank, ReadingLamp, Reading, RefreshLeft, RefreshRight, Refresh, Refrigerator, RemoveFilled, Remove, Right, ScaleToOriginal, School, Scissor, Search, Select, Sell, SemiSelect, Service, SetUp, Setting, Share, Ship, Shop, ShoppingBag, ShoppingCartFull, ShoppingCart, ShoppingTrolley, Smoking, Soccer, SoldOut, SortDown, SortUp, Sort, Stamp, StarFilled, Star, Stopwatch, SuccessFilled, Sugar, SuitcaseLine, Suitcase, Sunny, Sunrise, Sunset, SwitchButton, SwitchFilled, Switch, TakeawayBox, Ticket, Tickets, Timer, ToiletPaper, Tools, TopLeft, TopRight, Top, TrendCharts, TrophyBase, Trophy, TurnOff, Umbrella, Unlock, UploadFilled, Upload, UserFilled, User, Van, VideoCameraFilled, VideoCamera, VideoPause, VideoPlay, View, WalletFilled, Wallet, WarnTriangleFilled, WarningFilled, Warning, Watch, Watermelon, WindPower, ZoomIn, ZoomOut, VtjIconChatRecord, VtjIconNewChat, VtjIconAi, VtjIconUniapp, VtjIconWindowMax, VtjIconWindowMin, VtjIconWindowClose, VtjIconWindowNormal, VtjIconWindowDown, VtjIconWindowUp, VtjIconNpSave, VtjIconNpFile, VtjIconNpEdit, VtjIconNpShare, VtjIconNpSearch, VtjIconNpExport, VtjIconNpImport, VtjIconNpList, VtjIconNpPrint, VtjIconNpCancel, VtjIconNpConfirm, VtjIconNpReset, VtjIconNpReturnAll, VtjIconNpReturn, VtjIconNpRemove, VtjIconNpRemoveRow, VtjIconNpDelete, VtjIconNpExit, VtjIconNpRefresh, VtjIconNpAdd, VtjIconNpSelect, VtjIconNpAddRow, VtjIconNpExtend, VtjIconNpClose, VtjIconNpSubmit, VtjIconDeps, VtjIconBack, VtjIconHome, VtjIconApi, VtjIconExport, VtjIconImport, VtjIconGreater, VtjIconSmaller, VtjIconCheck, VtjIconSwitch, VtjIconCopy, VtjIconLock, VtjIconUnlock, VtjIconLayers, VtjIconConsole, VtjIconTeam, VtjIconPublish, VtjIconPreview, VtjIconSave, VtjIconPc, VtjIconPhone, VtjIconPad, VtjIconRedo, VtjIconRefresh, VtjIconUndo, VtjIconCategory, VtjIconProject, VtjIconNotice, VtjIconFav, VtjIconBug, VtjIconFile, VtjIconFolder, VtjIconUpload, VtjIconDownload, VtjIconUser, VtjIconSetting, VtjIconArrowRight, VtjIconArrowLeft, VtjIconArrowDown, VtjIconArrowUp, VtjIconShare, VtjIconData, VtjIconTemplate, VtjIconExitFullscreen, VtjIconFullscreen, VtjIconEdit, VtjIconRemove, VtjIconJs, VtjIconDatabase, VtjIconInfo, VtjIconPlus, VtjIconMinus, VtjIconHelp, VtjIconVars, VtjIconOutline, VtjIconVisible, VtjIconInvisible, VtjIconDocument, VtjIconHistory, VtjIconFixed, VtjIconUnfixed, VtjIconSearch, VtjIconMore, VtjIconClose, VtjIconComponents, VtjIconBlock".split(
2950
2963
  ", "
2951
- ), Jt = "user", L = "User";
2964
+ ), Jt = "user", M = "User";
2952
2965
  class zt {
2953
2966
  validate(u) {
2954
2967
  const t = {
@@ -2963,7 +2976,7 @@ class zt {
2963
2976
  }
2964
2977
  isCompleteSFC(u) {
2965
2978
  try {
2966
- const t = M(u);
2979
+ const t = P(u);
2967
2980
  return !!(t.template && t.script && t.styles);
2968
2981
  } catch {
2969
2982
  return !1;
@@ -2972,15 +2985,15 @@ class zt {
2972
2985
  checkSyntax(u) {
2973
2986
  let t = "";
2974
2987
  try {
2975
- const a = M(u);
2976
- B(a.script);
2988
+ const a = P(u);
2989
+ _(a.script);
2977
2990
  } catch (a) {
2978
2991
  a instanceof SyntaxError && (t = a.message);
2979
2992
  }
2980
2993
  return t;
2981
2994
  }
2982
2995
  checkSetup(u) {
2983
- const t = M(u);
2996
+ const t = P(u);
2984
2997
  if (t.isScriptSetup)
2985
2998
  return !0;
2986
2999
  let a = 0;
@@ -2993,7 +3006,7 @@ class zt {
2993
3006
  }), a === 3;
2994
3007
  }
2995
3008
  findVantIcons(u) {
2996
- const t = M(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
3009
+ const t = P(u), a = /<(?:VanIcon|van-icon)\b[^>]*>/g, r = t.template.match(a) || [], n = [];
2997
3010
  return r.forEach((s) => {
2998
3011
  const i = s.match(/\bname="([^"]+)"/);
2999
3012
  i && n.push(i[1]);
@@ -3006,7 +3019,7 @@ class zt {
3006
3019
  return a;
3007
3020
  }
3008
3021
  findVtjIcons(u) {
3009
- const t = M(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
3022
+ const t = P(u), a = /import\s*{([^}]+)}\s*from\s*['"]\@vtj\/icons['"]/, r = t.script.match(a);
3010
3023
  return !r || !r[1] ? [] : r[1].split(",").map((n) => n.trim()).filter(Boolean);
3011
3024
  }
3012
3025
  checkVtjIcons(u) {
@@ -3030,7 +3043,7 @@ class zt {
3030
3043
  function Xt(e) {
3031
3044
  const u = [];
3032
3045
  let t = e;
3033
- const a = M(e);
3046
+ const a = P(e);
3034
3047
  if (!a.template || !a.script)
3035
3048
  return {
3036
3049
  fixed: !1,
@@ -3045,17 +3058,17 @@ function Xt(e) {
3045
3058
  for (; (c = o.exec(n)) !== null; ) {
3046
3059
  const m = c[0], g = c[1], x = H(g, r);
3047
3060
  if (x !== g) {
3048
- const w = G(n, c.index);
3061
+ const v = G(n, c.index);
3049
3062
  i.push({
3050
3063
  start: c.index,
3051
3064
  end: c.index + m.length,
3052
3065
  original: m,
3053
3066
  replacement: `{{${x}}}`,
3054
- line: w.line,
3055
- column: w.column
3067
+ line: v.line,
3068
+ column: v.column
3056
3069
  }), u.push({
3057
- line: w.line + 1,
3058
- column: w.column,
3070
+ line: v.line + 1,
3071
+ column: v.column,
3059
3072
  original: g.trim(),
3060
3073
  fixed: x.trim(),
3061
3074
  message: "修复插值表达式:添加 state. 前缀"
@@ -3064,42 +3077,42 @@ function Xt(e) {
3064
3077
  }
3065
3078
  const d = /:(\w+)="([^"]+)"/g;
3066
3079
  for (; (c = d.exec(n)) !== null; ) {
3067
- const m = c[0], g = c[1], x = c[2], w = H(x, r);
3068
- if (w !== x) {
3080
+ const m = c[0], g = c[1], x = c[2], v = H(x, r);
3081
+ if (v !== x) {
3069
3082
  const I = G(n, c.index);
3070
3083
  i.push({
3071
3084
  start: c.index,
3072
3085
  end: c.index + m.length,
3073
3086
  original: m,
3074
- replacement: `:${g}="${w}"`,
3087
+ replacement: `:${g}="${v}"`,
3075
3088
  line: I.line,
3076
3089
  column: I.column
3077
3090
  }), u.push({
3078
3091
  line: I.line + 1,
3079
3092
  column: I.column,
3080
3093
  original: x,
3081
- fixed: w,
3094
+ fixed: v,
3082
3095
  message: "修复绑定属性:添加 state. 前缀"
3083
3096
  });
3084
3097
  }
3085
3098
  }
3086
3099
  const l = /v-(if|else-if|show)="([^"]+)"/g;
3087
3100
  for (; (c = l.exec(n)) !== null; ) {
3088
- const m = c[0], g = c[1], x = c[2], w = H(x, r);
3089
- if (w !== x) {
3101
+ const m = c[0], g = c[1], x = c[2], v = H(x, r);
3102
+ if (v !== x) {
3090
3103
  const I = G(n, c.index);
3091
3104
  i.push({
3092
3105
  start: c.index,
3093
3106
  end: c.index + m.length,
3094
3107
  original: m,
3095
- replacement: `v-${g}="${w}"`,
3108
+ replacement: `v-${g}="${v}"`,
3096
3109
  line: I.line,
3097
3110
  column: I.column
3098
3111
  }), u.push({
3099
3112
  line: I.line + 1,
3100
3113
  column: I.column,
3101
3114
  original: x,
3102
- fixed: w,
3115
+ fixed: v,
3103
3116
  message: `修复 v-${g} 指令:添加 state. 前缀`
3104
3117
  });
3105
3118
  }
@@ -3108,12 +3121,12 @@ function Xt(e) {
3108
3121
  for (; (c = p.exec(n)) !== null; ) {
3109
3122
  const m = c[0], x = c[1].match(/^(.+)\s+in\s+(.+)$/);
3110
3123
  if (x) {
3111
- const [, w, I] = x, D = H(
3124
+ const [, v, I] = x, D = H(
3112
3125
  I,
3113
3126
  r
3114
3127
  );
3115
3128
  if (D !== I) {
3116
- const $ = G(n, c.index), lu = `v-for="${w} in ${D}"`;
3129
+ const $ = G(n, c.index), lu = `v-for="${v} in ${D}"`;
3117
3130
  i.push({
3118
3131
  start: c.index,
3119
3132
  end: c.index + m.length,
@@ -3135,17 +3148,17 @@ function Xt(e) {
3135
3148
  for (; (c = b.exec(n)) !== null; ) {
3136
3149
  const m = c[0], g = c[1], x = H(g, r);
3137
3150
  if (x !== g) {
3138
- const w = G(n, c.index);
3151
+ const v = G(n, c.index);
3139
3152
  i.push({
3140
3153
  start: c.index,
3141
3154
  end: c.index + m.length,
3142
3155
  original: m,
3143
3156
  replacement: `v-model="${x}"`,
3144
- line: w.line,
3145
- column: w.column
3157
+ line: v.line,
3158
+ column: v.column
3146
3159
  }), u.push({
3147
- line: w.line + 1,
3148
- column: w.column,
3160
+ line: v.line + 1,
3161
+ column: v.column,
3149
3162
  original: g,
3150
3163
  fixed: x,
3151
3164
  message: "修复 v-model 指令:添加 state. 前缀"
@@ -3156,17 +3169,17 @@ function Xt(e) {
3156
3169
  for (; (c = h.exec(n)) !== null; ) {
3157
3170
  const m = c[0], g = c[1], x = H(g, r);
3158
3171
  if (x !== g) {
3159
- const w = G(n, c.index);
3172
+ const v = G(n, c.index);
3160
3173
  i.push({
3161
3174
  start: c.index,
3162
3175
  end: c.index + m.length,
3163
3176
  original: m,
3164
3177
  replacement: `v-bind="${x}"`,
3165
- line: w.line,
3166
- column: w.column
3178
+ line: v.line,
3179
+ column: v.column
3167
3180
  }), u.push({
3168
- line: w.line + 1,
3169
- column: w.column,
3181
+ line: v.line + 1,
3182
+ column: v.column,
3170
3183
  original: g,
3171
3184
  fixed: x,
3172
3185
  message: "修复 v-bind 指令:添加 state. 前缀"
@@ -3175,29 +3188,29 @@ function Xt(e) {
3175
3188
  }
3176
3189
  const S = /v-(text|html)="([^"]+)"/g;
3177
3190
  for (; (c = S.exec(n)) !== null; ) {
3178
- const m = c[0], g = c[1], x = c[2], w = H(x, r);
3179
- if (w !== x) {
3191
+ const m = c[0], g = c[1], x = c[2], v = H(x, r);
3192
+ if (v !== x) {
3180
3193
  const I = G(n, c.index);
3181
3194
  i.push({
3182
3195
  start: c.index,
3183
3196
  end: c.index + m.length,
3184
3197
  original: m,
3185
- replacement: `v-${g}="${w}"`,
3198
+ replacement: `v-${g}="${v}"`,
3186
3199
  line: I.line,
3187
3200
  column: I.column
3188
3201
  }), u.push({
3189
3202
  line: I.line + 1,
3190
3203
  column: I.column,
3191
3204
  original: x,
3192
- fixed: w,
3205
+ fixed: v,
3193
3206
  message: `修复 v-${g} 指令:添加 state. 前缀`
3194
3207
  });
3195
3208
  }
3196
3209
  }
3197
- const E = /(@|v-on:)(\w+)="([^"]+)"/g;
3198
- for (; (c = E.exec(n)) !== null; ) {
3199
- const m = c[0], g = c[1], x = c[2], w = c[3], I = Qt(w, r);
3200
- if (I !== w) {
3210
+ const w = /(@|v-on:)(\w+)="([^"]+)"/g;
3211
+ for (; (c = w.exec(n)) !== null; ) {
3212
+ const m = c[0], g = c[1], x = c[2], v = c[3], I = Qt(v, r);
3213
+ if (I !== v) {
3201
3214
  const D = G(n, c.index);
3202
3215
  i.push({
3203
3216
  start: c.index,
@@ -3209,7 +3222,7 @@ function Xt(e) {
3209
3222
  }), u.push({
3210
3223
  line: D.line + 1,
3211
3224
  column: D.column,
3212
- original: w,
3225
+ original: v,
3213
3226
  fixed: I,
3214
3227
  message: "修复事件处理器:添加 state. 前缀"
3215
3228
  });
@@ -3233,7 +3246,7 @@ function Xt(e) {
3233
3246
  function Zt(e) {
3234
3247
  const u = /* @__PURE__ */ new Set();
3235
3248
  try {
3236
- const t = B(e);
3249
+ const t = _(e);
3237
3250
  J(t, {
3238
3251
  CallExpression(a) {
3239
3252
  if (a.node.callee.type === "Identifier" && a.node.callee.name === "reactive" && a.node.arguments.length > 0 && a.node.arguments[0].type === "ObjectExpression") {
@@ -3283,14 +3296,14 @@ class Kt {
3283
3296
  return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Xt(a).fixedCode;
3284
3297
  }
3285
3298
  fixVantIcons(u) {
3286
- const t = M(u), a = t.template.replace(
3299
+ const t = P(u), a = t.template.replace(
3287
3300
  /<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
3288
3301
  (r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, Jt)
3289
3302
  );
3290
3303
  return this.reconstructSFC(t, a, t.script);
3291
3304
  }
3292
3305
  fixVtjIcons(u, t = []) {
3293
- const a = M(u);
3306
+ const a = P(u);
3294
3307
  let r = !1;
3295
3308
  a.script = Ju(a.script, {
3296
3309
  ImportDeclaration(i) {
@@ -3299,14 +3312,14 @@ class Kt {
3299
3312
  let d = !1;
3300
3313
  for (const l of o) {
3301
3314
  const p = l.imported?.name;
3302
- p === L && (d = !0, r = !0), t.includes(p) || c.push(
3315
+ p === M && (d = !0, r = !0), t.includes(p) || c.push(
3303
3316
  q.importSpecifier(l.local, l.imported)
3304
3317
  );
3305
3318
  }
3306
3319
  !d && !r && (r = !0, c.push(
3307
3320
  q.importSpecifier(
3308
- q.identifier(L),
3309
- q.identifier(L)
3321
+ q.identifier(M),
3322
+ q.identifier(M)
3310
3323
  )
3311
3324
  )), i.node.specifiers = c;
3312
3325
  }
@@ -3321,8 +3334,8 @@ class Kt {
3321
3334
  (l) => !t.includes(l.key.name)
3322
3335
  ), c.argument.properties.push(
3323
3336
  q.objectProperty(
3324
- q.identifier(L),
3325
- q.identifier(L),
3337
+ q.identifier(M),
3338
+ q.identifier(M),
3326
3339
  !1,
3327
3340
  !0
3328
3341
  )
@@ -3331,13 +3344,13 @@ class Kt {
3331
3344
  }
3332
3345
  },
3333
3346
  ObjectProperty(i) {
3334
- if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(L)), q.isArrayExpression(i.node.value)) {
3347
+ if (q.isIdentifier(i.node.value) && t.includes(i.node.value.name) && (i.node.value = q.identifier(M)), q.isArrayExpression(i.node.value)) {
3335
3348
  const o = i.node.value.elements;
3336
- i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(L) : c);
3349
+ i.node.value.elements = o.map((c) => q.isIdentifier(c) && t.includes(c.name) ? q.identifier(M) : c);
3337
3350
  }
3338
3351
  },
3339
3352
  AssignmentExpression(i) {
3340
- q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(L));
3353
+ q.isIdentifier(i.node.right) && t.includes(i.node.right.name) && (i.node.right = q.identifier(M));
3341
3354
  }
3342
3355
  });
3343
3356
  const n = /:icon\s*=\s*["']([^"']+)["']/g, s = a.template.match(n);
@@ -3345,13 +3358,13 @@ class Kt {
3345
3358
  for (const i of s) {
3346
3359
  let o = i;
3347
3360
  for (const c of t)
3348
- o = o.replace(new RegExp(c, "g"), L);
3361
+ o = o.replace(new RegExp(c, "g"), M);
3349
3362
  a.template = a.template.replace(i, o);
3350
3363
  }
3351
3364
  for (const i of t)
3352
3365
  a.template = a.template.replace(
3353
3366
  new RegExp(`:icon="${i}"`, "g"),
3354
- `:icon="${L}"`
3367
+ `:icon="${M}"`
3355
3368
  );
3356
3369
  return this.reconstructSFC(a, a.template, a.script);
3357
3370
  }
@@ -3386,15 +3399,15 @@ async function b0(e) {
3386
3399
  let l = [];
3387
3400
  if (!d.valid)
3388
3401
  return l = d.errors, Promise.reject(l);
3389
- const p = c.fixBasedOnValidation(a, d), b = M(p);
3402
+ const p = c.fixBasedOnValidation(a, d), b = P(p);
3390
3403
  b.script = Ae(b.script);
3391
3404
  const {
3392
3405
  styles: h,
3393
3406
  css: S,
3394
- errors: E
3407
+ errors: w
3395
3408
  } = Ot(b.styles.join(`
3396
3409
  `));
3397
- return l.push(...E), l.length ? Promise.reject(l) : b.isScriptSetup ? u0(b, {
3410
+ return l.push(...w), l.length ? Promise.reject(l) : b.isScriptSetup ? u0(b, {
3398
3411
  id: u,
3399
3412
  name: t,
3400
3413
  project: r,
@@ -3421,11 +3434,11 @@ async function Yt(e, u) {
3421
3434
  methods: b,
3422
3435
  props: h,
3423
3436
  emits: S,
3424
- expose: E,
3437
+ expose: w,
3425
3438
  inject: m,
3426
3439
  handlers: g,
3427
3440
  imports: x,
3428
- dataSources: w,
3441
+ dataSources: v,
3429
3442
  directives: I
3430
3443
  } = et(e.script, r), { nodes: D, slots: $, context: lu } = re(t, a, e.template, {
3431
3444
  platform: n,
@@ -3443,10 +3456,10 @@ async function Yt(e, u) {
3443
3456
  lifeCycles: l,
3444
3457
  computed: p,
3445
3458
  methods: b,
3446
- dataSources: w,
3459
+ dataSources: v,
3447
3460
  slots: $,
3448
3461
  emits: S,
3449
- expose: E,
3462
+ expose: w,
3450
3463
  nodes: D,
3451
3464
  css: o
3452
3465
  }, le = Object.keys(p || {}), fe = (h || []).map(
@@ -3521,7 +3534,7 @@ async function u0(e, u) {
3521
3534
  expose: c.expose,
3522
3535
  nodes: d,
3523
3536
  css: i
3524
- }, { libs: h } = de(c.imports, o), S = Ht(c), E = {
3537
+ }, { libs: h } = de(c.imports, o), S = Ht(c), w = {
3525
3538
  refs: Array.from(S.refs),
3526
3539
  reactives: Array.from(S.reactives),
3527
3540
  hasState: S.hasState,
@@ -3540,8 +3553,8 @@ async function u0(e, u) {
3540
3553
  async (g) => {
3541
3554
  await oe(g, async (x) => {
3542
3555
  if (du(x)) {
3543
- const w = await ru(x.value);
3544
- let I = Fu(w, E);
3556
+ const v = await ru(x.value);
3557
+ let I = Fu(v, w);
3545
3558
  const D = Array.from(
3546
3559
  p[g.id] || /* @__PURE__ */ new Set()
3547
3560
  );
@@ -3553,7 +3566,7 @@ async function u0(e, u) {
3553
3566
  },
3554
3567
  async (g) => {
3555
3568
  const x = await ru(g.value);
3556
- g.value = Fu(x, E);
3569
+ g.value = Fu(x, w);
3557
3570
  }
3558
3571
  ), new Hu(b).toDsl();
3559
3572
  }
@@ -3584,7 +3597,7 @@ async function ce(e, u, t) {
3584
3597
  setup: b,
3585
3598
  provide: h,
3586
3599
  refs: S,
3587
- reactives: E
3600
+ reactives: w
3588
3601
  } = e;
3589
3602
  if (await r({
3590
3603
  state: n,
@@ -3598,7 +3611,7 @@ async function ce(e, u, t) {
3598
3611
  setup: b,
3599
3612
  provide: h,
3600
3613
  refs: S,
3601
- reactives: E
3614
+ reactives: w
3602
3615
  }), Array.isArray(e.nodes))
3603
3616
  for (const m of e.nodes)
3604
3617
  await a(m);