@vtj/parser 0.18.4 → 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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parse as Uu, compileTemplate as Gu } from "@vue/compiler-sfc";
2
- import { parse as me } from "@babel/parser";
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";
@@ -13,10 +13,10 @@ 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.4
16
+ * @version 0.18.5
17
17
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
18
18
  */
19
- const l0 = "0.18.4";
19
+ const f0 = "0.18.5";
20
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 {
@@ -28,7 +28,7 @@ function P(e) {
28
28
  };
29
29
  }
30
30
  function _(e) {
31
- return me(e, { sourceType: "module", plugins: ["typescript"] });
31
+ return he(e, { sourceType: "module", plugins: ["typescript"] });
32
32
  }
33
33
  function J(e, u) {
34
34
  return (vu.default || vu)(e, u);
@@ -173,7 +173,7 @@ function ke(e, u) {
173
173
  }
174
174
  return t.length > 0 ? t : null;
175
175
  }
176
- function f0(e) {
176
+ function b0(e) {
177
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) {
@@ -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((h) => h.start === p && h.end === b) && n.push({ start: p, end: b, text: t }), c = d + u.length;
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 h = b + p, S = h + 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;
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
  }
@@ -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 h = this.stack.shift();
1302
- (r = (a = this.cbs).onclosetag) === null || r === void 0 || r.call(a, h, b !== p);
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
  }
@@ -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 h = 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, h), (c = (o = this.cbs).oncdataend) === null || c === void 0 || c.call(o)) : ((l = (d = this.cbs).oncomment) === null || l === void 0 || l.call(d, `[CDATA[${h}]]`), (b = (p = this.cbs).oncommentend) === null || b === void 0 || b.call(p)), this.startIndex = t + 1;
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 [h = "", S = ""] = b;
1483
- return h && (p[h] = S), p;
1482
+ let [m = "", S = ""] = b;
1483
+ return m && (p[m] = S), p;
1484
1484
  },
1485
1485
  {}
1486
1486
  );
@@ -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 = ht(l.value);
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 = xt(l.value);
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 = mt(u, l);
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 ht(e) {
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 mt(e, u) {
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 xt(e) {
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 hu = [], iu = {}, ue = {}, ee = {}, te = {}, cu = "web", ae = [];
1902
+ let mu = [], iu = {}, ue = {}, ee = {}, te = {}, cu = "web", ae = [];
1897
1903
  function re(e, u, t = "", a) {
1898
- hu = [], iu = {}, ue = a?.handlers || {}, te = a?.styles || {}, cu = a?.platform || "web", ae = a?.imports || [], ee = a?.directives || {};
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,23 +1915,23 @@ function re(e, u, t = "", a) {
1909
1915
  }
1910
1916
  return {
1911
1917
  nodes: s.filter((i) => !!i),
1912
- slots: hu,
1918
+ slots: mu,
1913
1919
  context: iu
1914
1920
  };
1915
1921
  }
1916
- function gt(e) {
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
- hu.push({
1928
+ mu.push({
1923
1929
  name: u,
1924
1930
  params: t
1925
1931
  });
1926
1932
  }
1927
1933
  }
1928
- function yt(e) {
1934
+ function St(e) {
1929
1935
  const u = {};
1930
1936
  for (const t of e) {
1931
1937
  if (t.type === E.ATTRIBUTE)
@@ -1952,13 +1958,13 @@ function yt(e) {
1952
1958
  }
1953
1959
  return u;
1954
1960
  }
1955
- function St(e = {}) {
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 vt(e, u = {}) {
1967
+ function Et(e, u = {}) {
1962
1968
  const t = {};
1963
1969
  for (const a of e)
1964
1970
  if (a.type === E.DIRECTIVE && a.name === "on" && a.arg?.type === E.SIMPLE_EXPRESSION) {
@@ -1976,15 +1982,15 @@ 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", h = d === "Identifier", S = d === "MemberExpression", w = !c && /^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(n);
1980
- let m;
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
- m = T(n);
1983
- else if (h || S || w)
1984
- m = C(n);
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) ? m = C(g.name) : m = C(n);
1993
+ g && g.type === "Identifier" && (!x || x.length === 0) ? h = C(g.name) : h = C(n);
1988
1994
  } else {
1989
1995
  let g = !1;
1990
1996
  try {
@@ -1996,20 +2002,20 @@ function vt(e, u = {}) {
1996
2002
  } catch {
1997
2003
  }
1998
2004
  if (g)
1999
- m = C(n);
2005
+ h = C(n);
2000
2006
  else {
2001
2007
  const v = /\$event\b/.test(n) ? "($event) => " : "() => ";
2002
- m = C(`${v}${n}`);
2008
+ h = C(`${v}${n}`);
2003
2009
  }
2004
2010
  }
2005
2011
  t[a.arg.content] = {
2006
2012
  name: a.arg.content,
2007
- handler: m,
2013
+ handler: h,
2008
2014
  modifiers: r
2009
2015
  };
2010
2016
  }
2011
2017
  }
2012
- return St(t);
2018
+ return vt(t);
2013
2019
  }
2014
2020
  function eu(e, u) {
2015
2021
  const t = [], a = ["if", "for", "model", "show", "bind", "html"];
@@ -2062,7 +2068,7 @@ function eu(e, u) {
2062
2068
  const c = r.filter((d) => !a.includes(d.name));
2063
2069
  for (const d of c) {
2064
2070
  const l = (d.modifiers || []).reduce(
2065
- (h, S) => (h[S.content] = !0, h),
2071
+ (m, S) => (m[S.content] = !0, m),
2066
2072
  {}
2067
2073
  ), p = d.arg?.content || void 0, b = ee[d.name];
2068
2074
  b && t.push({
@@ -2090,7 +2096,7 @@ function ne(e) {
2090
2096
  }
2091
2097
  return u || nu();
2092
2098
  }
2093
- function Et(e) {
2099
+ function wt(e) {
2094
2100
  const u = /\.\/(.+?)\.vue/;
2095
2101
  for (const { from: t, imports: a } of ae) {
2096
2102
  if (Array.isArray(a) && a.includes(e))
@@ -2105,7 +2111,7 @@ function Et(e) {
2105
2111
  }
2106
2112
  }
2107
2113
  }
2108
- function mu(e, u) {
2114
+ function hu(e, u) {
2109
2115
  const t = new Set(u?.id ? iu[u.id] : []), a = (e.directives || []).find((s) => s.name === "vFor");
2110
2116
  let r = new Set(Array.from(t));
2111
2117
  if (a) {
@@ -2122,23 +2128,23 @@ function mu(e, u) {
2122
2128
  function bu(e, u, t, a) {
2123
2129
  const r = {
2124
2130
  name: zu(e.tag, cu),
2125
- from: Et(e.tag),
2126
- props: yt(e.props),
2127
- events: vt(e.props, ue),
2131
+ from: wt(e.tag),
2132
+ props: St(e.props),
2133
+ events: Et(e.props, ue),
2128
2134
  directives: eu(t || e, a)
2129
2135
  };
2130
- r.id = ne(e), mu(r, u);
2136
+ r.id = ne(e), hu(r, u);
2131
2137
  const n = ou(r, e.children);
2132
- return mu(r, u), gt(n), n;
2138
+ return hu(r, u), yt(n), n;
2133
2139
  }
2134
- function wt(e = [], u) {
2140
+ function It(e = [], u) {
2135
2141
  return e.map((t) => Z(t, u, e));
2136
2142
  }
2137
2143
  function Z(e, u, t) {
2138
2144
  if (e.type === E.ELEMENT)
2139
2145
  return bu(e, u);
2140
2146
  if (e.type === E.IF)
2141
- return It(e);
2147
+ return At(e);
2142
2148
  if (t && e.type === E.IF_BRANCH) {
2143
2149
  const a = e.children.find(
2144
2150
  (r) => r.type === E.ELEMENT || r.type === E.FOR
@@ -2208,7 +2214,7 @@ function ou(e, u = []) {
2208
2214
  name: r.arg?.content || "default",
2209
2215
  params: r.exp?.identifiers || [],
2210
2216
  scope: r.exp?.type === E.SIMPLE_EXPRESSION ? r.exp.content : ""
2211
- }, mu(o, e)), t.push(o);
2217
+ }, hu(o, e)), t.push(o);
2212
2218
  });
2213
2219
  }
2214
2220
  } else if (a.type === E.JS_CALL_EXPRESSION) {
@@ -2231,15 +2237,15 @@ function ou(e, u = []) {
2231
2237
  e.children = t.map((a) => typeof a == "string" || su(a) ? { name: "span", children: a } : a);
2232
2238
  return e;
2233
2239
  }
2234
- function It(e) {
2240
+ function At(e) {
2235
2241
  const u = e.branches || [], t = u[0], a = t.children || [];
2236
2242
  if (t?.isTemplateIf || a.length > 1 || a[0].type !== E.ELEMENT) {
2237
2243
  const n = { name: "span", directives: eu(t, u) };
2238
2244
  return ou(n, t.children);
2239
2245
  } else
2240
- return wt(u);
2246
+ return It(u);
2241
2247
  }
2242
- const At = {
2248
+ const kt = {
2243
2249
  onBeforeMount: "beforeMount",
2244
2250
  onMounted: "mounted",
2245
2251
  onBeforeUpdate: "beforeUpdate",
@@ -2270,16 +2276,16 @@ const At = {
2270
2276
  onNavigationBarSearchInputClicked: "onNavigationBarSearchInputClicked",
2271
2277
  onShareTimeline: "onShareTimeline",
2272
2278
  onAddToFavorites: "onAddToFavorites"
2273
- }, kt = /* @__PURE__ */ new Set([
2279
+ }, Tt = /* @__PURE__ */ new Set([
2274
2280
  "vue-router",
2275
2281
  "pinia",
2276
2282
  "vue-i18n",
2277
2283
  "@vtj/renderer"
2278
- ]), Tt = new Set(
2284
+ ]), Nt = new Set(
2279
2285
  Object.values(gu).map((e) => e.composable).filter((e) => !!e)
2280
2286
  );
2281
- function Nt(e, u) {
2282
- const t = jt(e), a = Vt(t), { dependencies: r = [] } = u || {}, n = r.reduce(
2287
+ function jt(e, u) {
2288
+ const t = Vt(e), a = qt(t), { dependencies: r = [] } = u || {}, n = r.reduce(
2283
2289
  (c, d) => (c[d.package] = d.library, c),
2284
2290
  {}
2285
2291
  ), s = {
@@ -2311,38 +2317,38 @@ function Nt(e, u) {
2311
2317
  if (!p.init) continue;
2312
2318
  const b = p.init;
2313
2319
  if (b.type === "CallExpression") {
2314
- const h = Cu(b);
2315
- if (h === "ref") {
2320
+ const m = Cu(b);
2321
+ if (m === "ref") {
2316
2322
  const w = L(p.id);
2317
2323
  if (w) {
2318
- const m = b.arguments[0] ? A(b.arguments[0]) : "undefined";
2319
- s.refs[w] = T(m);
2324
+ const h = b.arguments[0] ? A(b.arguments[0]) : "undefined";
2325
+ s.refs[w] = T(h);
2320
2326
  }
2321
2327
  return;
2322
2328
  }
2323
- if (h === "reactive") {
2329
+ if (m === "reactive") {
2324
2330
  const w = L(p.id);
2325
2331
  if (w)
2326
2332
  if (w === "__state")
2327
- s.state = Dt(b.arguments[0]);
2333
+ s.state = Rt(b.arguments[0]);
2328
2334
  else {
2329
- const m = b.arguments[0] ? A(b.arguments[0]) : "{}";
2330
- s.reactives[w] = T(m);
2335
+ const h = b.arguments[0] ? A(b.arguments[0]) : "{}";
2336
+ s.reactives[w] = T(h);
2331
2337
  }
2332
2338
  return;
2333
2339
  }
2334
- if (h === "computed") {
2340
+ if (m === "computed") {
2335
2341
  const w = L(p.id);
2336
2342
  if (w) {
2337
- const m = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
2338
- s.computed[w] = C(m);
2343
+ const h = b.arguments[0] ? A(b.arguments[0]) : "() => {}";
2344
+ s.computed[w] = C(h);
2339
2345
  }
2340
2346
  return;
2341
2347
  }
2342
- if (h === "inject") {
2348
+ if (m === "inject") {
2343
2349
  const w = L(p.id);
2344
2350
  if (w) {
2345
- const m = b.arguments[0], g = b.arguments[1], x = m ? Lu(m) : w;
2351
+ const h = b.arguments[0], g = b.arguments[1], x = h ? Lu(h) : w;
2346
2352
  s.inject.push({
2347
2353
  name: w,
2348
2354
  from: x || w,
@@ -2351,33 +2357,33 @@ function Nt(e, u) {
2351
2357
  }
2352
2358
  return;
2353
2359
  }
2354
- if (h === "defineProps" || h === "withDefaults") {
2360
+ if (m === "defineProps" || m === "withDefaults") {
2355
2361
  s.props = Mu(b);
2356
2362
  return;
2357
2363
  }
2358
- if (h === "defineEmits") {
2364
+ if (m === "defineEmits") {
2359
2365
  s.emits = Ou(b);
2360
2366
  return;
2361
2367
  }
2362
- if (h && /^use[A-Z]/.test(h)) {
2363
- const w = a.get(h);
2364
- if (qt(h, w)) {
2368
+ if (m && /^use[A-Z]/.test(m)) {
2369
+ const w = a.get(m);
2370
+ if (Dt(m, w)) {
2365
2371
  const x = _u(p.id);
2366
- x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: h, destructure: x }));
2372
+ x.length > 0 && (s.globalApiDestructured ??= [], s.globalApiDestructured.push({ callee: m, destructure: x }));
2367
2373
  return;
2368
2374
  }
2369
- if (h === "useProvider") return;
2375
+ if (m === "useProvider") return;
2370
2376
  if (!w)
2371
2377
  continue;
2372
- const m = L(p.id), g = _u(p.id);
2373
- if (m || g.length) {
2374
- if (m && s.composables.some((D) => D.name === m))
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))
2375
2381
  return;
2376
2382
  let x;
2377
2383
  const v = n[w];
2378
- v ? x = `this.$libs.${v}.${h}` : x = h;
2384
+ v ? x = `this.$libs.${v}.${m}` : x = m;
2379
2385
  const I = {
2380
- name: m || g[0] || h,
2386
+ name: h || g[0] || m,
2381
2387
  composable: {
2382
2388
  type: "JSExpression",
2383
2389
  value: x
@@ -2390,26 +2396,26 @@ function Nt(e, u) {
2390
2396
  return;
2391
2397
  }
2392
2398
  const S = L(p.id);
2393
- if (S && S.startsWith("__") || h === "getCurrentInstance")
2399
+ if (S && S.startsWith("__") || m === "getCurrentInstance")
2394
2400
  return;
2395
2401
  }
2396
2402
  if (b.type === "ArrowFunctionExpression" || b.type === "FunctionExpression") {
2397
- const h = L(p.id);
2398
- if (h) {
2403
+ const m = L(p.id);
2404
+ if (m) {
2399
2405
  const S = A(b);
2400
2406
  if (Bu(S)) {
2401
- const w = $u(h, S, u);
2407
+ const w = $u(m, S, u);
2402
2408
  if (w) {
2403
- s.dataSources[h] = w;
2409
+ s.dataSources[m] = w;
2404
2410
  return;
2405
2411
  }
2406
2412
  }
2407
- s.methods[h] = C(S);
2413
+ s.methods[m] = C(S);
2408
2414
  }
2409
2415
  return;
2410
2416
  }
2411
2417
  if (b.type === "MemberExpression") {
2412
- const h = b.object, S = h.type === "Identifier" ? h.name : h.type === "MemberExpression" && h.object.type === "Identifier" ? h.object.name : null;
2418
+ const m = b.object, S = m.type === "Identifier" ? m.name : m.type === "MemberExpression" && m.object.type === "Identifier" ? m.object.name : null;
2413
2419
  if (S && a.has(S))
2414
2420
  return;
2415
2421
  }
@@ -2432,9 +2438,9 @@ function Nt(e, u) {
2432
2438
  for (const p of d.declarations) {
2433
2439
  const b = p.init;
2434
2440
  if (b) {
2435
- const h = L(p.id) || "(unknown)", S = A(b), w = b.type;
2441
+ const m = L(p.id) || "(unknown)", S = A(b), w = b.type;
2436
2442
  throw new Error(
2437
- `[vtj/parser] 无法处理顶层变量声明 "const ${h} = ${S}":不支持的类型 "${w}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2443
+ `[vtj/parser] 无法处理顶层变量声明 "const ${m} = ${S}":不支持的类型 "${w}"。仅支持 ObjectExpression / ArrayExpression 兜底自动转换为 reactive()。请改用 ref()、reactive()、computed() 或函数声明。`
2438
2444
  );
2439
2445
  }
2440
2446
  }
@@ -2447,7 +2453,7 @@ function Nt(e, u) {
2447
2453
  if (c.parent.type !== "Program") return;
2448
2454
  const d = c.node;
2449
2455
  if (!d.id) return;
2450
- const l = d.id.name, p = Lt(d);
2456
+ const l = d.id.name, p = Mt(d);
2451
2457
  if (Bu(p)) {
2452
2458
  const b = $u(l, p, u);
2453
2459
  if (b) {
@@ -2470,35 +2476,35 @@ function Nt(e, u) {
2470
2476
  if (c.parent.type !== "Program") return;
2471
2477
  const d = c.node, l = d.expression;
2472
2478
  if (l.type !== "CallExpression") {
2473
- const h = A(d);
2479
+ const m = A(d);
2474
2480
  throw new Error(
2475
- `[vtj/parser] 无法处理顶层表达式语句 "${h}":DSL 不支持游离的顶层表达式,请改用生命周期钩子(如 onMounted)或声明确赋值。`
2481
+ `[vtj/parser] 无法处理顶层表达式语句 "${m}":DSL 不支持游离的顶层表达式,请改用生命周期钩子(如 onMounted)或声明确赋值。`
2476
2482
  );
2477
2483
  }
2478
2484
  const p = Cu(l);
2479
2485
  if (p === "watch") {
2480
- const h = _t(l);
2481
- h && s.watch.push(h);
2486
+ const m = Lt(l);
2487
+ m && s.watch.push(m);
2482
2488
  return;
2483
2489
  }
2484
- if (p && p in At) {
2485
- const h = l.arguments[0];
2486
- h && (s.lifeCycles[p] = C(A(h)));
2490
+ if (p && p in kt) {
2491
+ const m = l.arguments[0];
2492
+ m && (s.lifeCycles[p] = C(A(m)));
2487
2493
  return;
2488
2494
  }
2489
2495
  if (p === "provide") {
2490
- const h = l.arguments[0], S = l.arguments[1];
2491
- if (h && S) {
2492
- const w = Lu(h);
2496
+ const m = l.arguments[0], S = l.arguments[1];
2497
+ if (m && S) {
2498
+ const w = Lu(m);
2493
2499
  if (w) {
2494
- const m = A(S);
2495
- S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[w] = C(m) : s.provide[w] = T(m);
2500
+ const h = A(S);
2501
+ S.type === "ArrowFunctionExpression" || S.type === "FunctionExpression" ? s.provide[w] = C(h) : s.provide[w] = T(h);
2496
2502
  }
2497
2503
  }
2498
2504
  return;
2499
2505
  }
2500
2506
  if (p === "defineExpose") {
2501
- s.expose = Ct(l);
2507
+ s.expose = _t(l);
2502
2508
  return;
2503
2509
  }
2504
2510
  if (p === "defineProps" || p === "withDefaults") {
@@ -2525,7 +2531,7 @@ ${i.join(`
2525
2531
  }
2526
2532
  return s;
2527
2533
  }
2528
- function jt(e) {
2534
+ function Vt(e) {
2529
2535
  const u = /import\s+{(.+?)}\s+from\s+['"](.+?)['"]/g, t = /import\s+(.+?)\s+from\s+['"](.+?)['"]/g, a = /^{(.+?)}$/, r = [];
2530
2536
  let n;
2531
2537
  const s = e.replace(/\n/g, " ");
@@ -2545,7 +2551,7 @@ function jt(e) {
2545
2551
  }
2546
2552
  return r;
2547
2553
  }
2548
- function Vt(e) {
2554
+ function qt(e) {
2549
2555
  const u = /* @__PURE__ */ new Map();
2550
2556
  for (const t of e)
2551
2557
  if (Array.isArray(t.imports))
@@ -2557,8 +2563,8 @@ function Vt(e) {
2557
2563
  u.set(t.imports, t.from);
2558
2564
  return u;
2559
2565
  }
2560
- function qt(e, u) {
2561
- return u && kt.has(u) ? !0 : Tt.has(e);
2566
+ function Dt(e, u) {
2567
+ return u && Tt.has(u) ? !0 : Nt.has(e);
2562
2568
  }
2563
2569
  function Cu(e) {
2564
2570
  return e.callee.type === "Identifier" ? e.callee.name : null;
@@ -2572,7 +2578,7 @@ function _u(e) {
2572
2578
  function Lu(e) {
2573
2579
  return e.type === "StringLiteral" ? e.value : null;
2574
2580
  }
2575
- function Dt(e) {
2581
+ function Rt(e) {
2576
2582
  if (!e || e.type !== "ObjectExpression") return {};
2577
2583
  const u = {};
2578
2584
  for (const t of e.properties)
@@ -2593,7 +2599,7 @@ function Mu(e) {
2593
2599
  const u = e.arguments[0];
2594
2600
  if (u?.type === "CallExpression") {
2595
2601
  const t = Pu(u), a = e.arguments[1];
2596
- return a?.type === "ObjectExpression" && Rt(t, a), t;
2602
+ return a?.type === "ObjectExpression" && Ct(t, a), t;
2597
2603
  }
2598
2604
  }
2599
2605
  return Pu(e);
@@ -2610,15 +2616,15 @@ function Pu(e) {
2610
2616
  const r = t.value.properties;
2611
2617
  return {
2612
2618
  name: a,
2613
- type: Mt(r),
2619
+ type: Pt(r),
2614
2620
  required: xu(r, "required"),
2615
- default: Pt(r)
2621
+ default: Ot(r)
2616
2622
  };
2617
2623
  }
2618
2624
  return a;
2619
2625
  }).filter(Boolean) : [] : [];
2620
2626
  }
2621
- function Rt(e, u) {
2627
+ function Ct(e, u) {
2622
2628
  for (const t of u.properties) {
2623
2629
  if (t.type !== "ObjectProperty") continue;
2624
2630
  const a = t.key?.name;
@@ -2639,11 +2645,11 @@ function Ou(e) {
2639
2645
  const u = e.arguments[0];
2640
2646
  return u ? u.type === "ArrayExpression" ? u.elements.map((t) => t?.type === "StringLiteral" ? { name: t.value, params: [] } : null).filter(Boolean) : [] : [];
2641
2647
  }
2642
- function Ct(e) {
2648
+ function _t(e) {
2643
2649
  const u = e.arguments[0];
2644
2650
  return !u || u.type !== "ObjectExpression" ? [] : u.properties.map((t) => (t.type === "ObjectProperty" || t.type === "ObjectMethod") && t.key?.name || "").filter(Boolean);
2645
2651
  }
2646
- function _t(e) {
2652
+ function Lt(e) {
2647
2653
  const [u, t, a] = e.arguments;
2648
2654
  if (!u || !t) return null;
2649
2655
  const r = A(u), n = A(t);
@@ -2662,7 +2668,7 @@ function _t(e) {
2662
2668
  immediate: i
2663
2669
  };
2664
2670
  }
2665
- function Lt(e) {
2671
+ function Mt(e) {
2666
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) || "{}";
2667
2673
  return `${u}(${t}) => ${a}`;
2668
2674
  }
@@ -2738,21 +2744,21 @@ function xu(e, u) {
2738
2744
  (a) => a.key?.name === u
2739
2745
  )?.value?.value;
2740
2746
  }
2741
- function Mt(e) {
2747
+ function Pt(e) {
2742
2748
  const u = e?.find(
2743
2749
  (t) => t.key?.name === "type"
2744
2750
  );
2745
2751
  if (u)
2746
2752
  return u.value.type === "ArrayExpression" ? u.value.elements.map((t) => t.name) : u.value.name;
2747
2753
  }
2748
- function Pt(e) {
2754
+ function Ot(e) {
2749
2755
  const u = e?.find(
2750
2756
  (t) => t.key?.name === "default"
2751
2757
  );
2752
2758
  if (u)
2753
2759
  return T(A(u.value));
2754
2760
  }
2755
- function Ot(e) {
2761
+ function Bt(e) {
2756
2762
  const u = [], t = {}, a = [];
2757
2763
  try {
2758
2764
  const r = ve.compileString(e, { charset: !1 })?.css || "", n = Se.parse(r), s = /^.[\w]+_[\w]{5,}/;
@@ -2783,11 +2789,11 @@ function uu(e, u, t) {
2783
2789
  const i = e.slice(r, s.index);
2784
2790
  a += i.replace(u, t);
2785
2791
  const o = s[0];
2786
- o.startsWith("`") ? a += Bt(o, u, t) : a += o, r = s.index + s[0].length;
2792
+ o.startsWith("`") ? a += $t(o, u, t) : a += o, r = s.index + s[0].length;
2787
2793
  }
2788
2794
  return a += e.slice(r).replace(u, t), a;
2789
2795
  }
2790
- function Bt(e, u, t) {
2796
+ function $t(e, u, t) {
2791
2797
  let a = "", r = 0;
2792
2798
  const n = /\$\{([^}]*)\}/g;
2793
2799
  let s;
@@ -2798,7 +2804,7 @@ function Bt(e, u, t) {
2798
2804
  }
2799
2805
  return a += e.slice(r), a;
2800
2806
  }
2801
- function $t(e, u) {
2807
+ function Ft(e, u) {
2802
2808
  if (!e) return e;
2803
2809
  let t = e;
2804
2810
  const a = [...u.refs, ...u.computed];
@@ -2833,7 +2839,7 @@ function $t(e, u) {
2833
2839
  t = uu(t, o, `this.${i}`);
2834
2840
  }
2835
2841
  for (const r of u.props)
2836
- t = Ft(t, "__props", r, `this.${r}`);
2842
+ t = Ut(t, "__props", r, `this.${r}`);
2837
2843
  for (const r of u.props)
2838
2844
  t = R(t, r, `this.${r}`);
2839
2845
  for (const [r, n] of Object.entries(u.reverseApiMap))
@@ -2854,7 +2860,7 @@ function $t(e, u) {
2854
2860
  function Q(e) {
2855
2861
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2856
2862
  }
2857
- function Ft(e, u, t, a) {
2863
+ function Ut(e, u, t, a) {
2858
2864
  const r = new RegExp(
2859
2865
  `\\b${Q(u)}\\.${Q(t)}\\b`,
2860
2866
  "g"
@@ -2884,11 +2890,11 @@ function se(e) {
2884
2890
  }
2885
2891
  return { simple: u, member: t };
2886
2892
  }
2887
- function Ut(e) {
2893
+ function Gt(e) {
2888
2894
  for (const u of e)
2889
2895
  if (xe.includes(u.from)) return u.from;
2890
2896
  }
2891
- function Gt(e) {
2897
+ function Ht(e) {
2892
2898
  const u = {}, t = (a) => {
2893
2899
  for (const [r, n] of Object.entries(a)) {
2894
2900
  if (!n.composable || !n.replace || !n.replace.includes("."))
@@ -2919,16 +2925,16 @@ function Fu(e, u) {
2919
2925
  reverseApiMap: u.globalApiVars,
2920
2926
  reverseMemberApiMap: u.reverseMemberApiMap || se().member
2921
2927
  };
2922
- let a = $t(e, t);
2928
+ let a = Ft(e, t);
2923
2929
  a = a.replace(/_ctx\./g, "this."), a = a.replace(/this\.this\./g, "this.");
2924
2930
  for (const [r, n] of Object.entries(u.libs || {}))
2925
2931
  a = R(a, r, `this.$libs.${n}.${r}`);
2926
2932
  return a;
2927
2933
  }
2928
- function Ht(e) {
2929
- const u = Ut(e.imports || []), { simple: t, member: a } = se(u);
2934
+ function Wt(e) {
2935
+ const u = Gt(e.imports || []), { simple: t, member: a } = se(u);
2930
2936
  if (e.globalApiDestructured && e.globalApiDestructured.length > 0) {
2931
- const n = Gt(u);
2937
+ const n = Ht(u);
2932
2938
  for (const { callee: s, destructure: i } of e.globalApiDestructured) {
2933
2939
  const o = n[s];
2934
2940
  if (o)
@@ -2959,10 +2965,10 @@ function Ht(e) {
2959
2965
  }
2960
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(
2961
2967
  ", "
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(
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(
2963
2969
  ", "
2964
- ), Jt = "user", M = "User";
2965
- class zt {
2970
+ ), zt = "user", M = "User";
2971
+ class Xt {
2966
2972
  validate(u) {
2967
2973
  const t = {
2968
2974
  valid: !0,
@@ -3025,7 +3031,7 @@ class zt {
3025
3031
  checkVtjIcons(u) {
3026
3032
  const t = this.findVtjIcons(u), a = [];
3027
3033
  for (const r of t)
3028
- Wt.includes(r) || a.push(r);
3034
+ Jt.includes(r) || a.push(r);
3029
3035
  return a;
3030
3036
  }
3031
3037
  hasUnchangedComment(u) {
@@ -3040,7 +3046,7 @@ class zt {
3040
3046
  );
3041
3047
  }
3042
3048
  }
3043
- function Xt(e) {
3049
+ function Zt(e) {
3044
3050
  const u = [];
3045
3051
  let t = e;
3046
3052
  const a = P(e);
@@ -3051,18 +3057,18 @@ function Xt(e) {
3051
3057
  fixedCode: e,
3052
3058
  changes: []
3053
3059
  };
3054
- const r = Zt(a.script), n = a.template;
3060
+ const r = Qt(a.script), n = a.template;
3055
3061
  let s = n;
3056
3062
  const i = [], o = /\{\{([^}]+)\}\}/g;
3057
3063
  let c;
3058
3064
  for (; (c = o.exec(n)) !== null; ) {
3059
- const m = c[0], g = c[1], x = H(g, r);
3065
+ const h = c[0], g = c[1], x = H(g, r);
3060
3066
  if (x !== g) {
3061
3067
  const v = G(n, c.index);
3062
3068
  i.push({
3063
3069
  start: c.index,
3064
- end: c.index + m.length,
3065
- original: m,
3070
+ end: c.index + h.length,
3071
+ original: h,
3066
3072
  replacement: `{{${x}}}`,
3067
3073
  line: v.line,
3068
3074
  column: v.column
@@ -3077,13 +3083,13 @@ function Xt(e) {
3077
3083
  }
3078
3084
  const d = /:(\w+)="([^"]+)"/g;
3079
3085
  for (; (c = d.exec(n)) !== null; ) {
3080
- const m = c[0], g = c[1], x = c[2], v = H(x, r);
3086
+ const h = c[0], g = c[1], x = c[2], v = H(x, r);
3081
3087
  if (v !== x) {
3082
3088
  const I = G(n, c.index);
3083
3089
  i.push({
3084
3090
  start: c.index,
3085
- end: c.index + m.length,
3086
- original: m,
3091
+ end: c.index + h.length,
3092
+ original: h,
3087
3093
  replacement: `:${g}="${v}"`,
3088
3094
  line: I.line,
3089
3095
  column: I.column
@@ -3098,13 +3104,13 @@ function Xt(e) {
3098
3104
  }
3099
3105
  const l = /v-(if|else-if|show)="([^"]+)"/g;
3100
3106
  for (; (c = l.exec(n)) !== null; ) {
3101
- const m = c[0], g = c[1], x = c[2], v = H(x, r);
3107
+ const h = c[0], g = c[1], x = c[2], v = H(x, r);
3102
3108
  if (v !== x) {
3103
3109
  const I = G(n, c.index);
3104
3110
  i.push({
3105
3111
  start: c.index,
3106
- end: c.index + m.length,
3107
- original: m,
3112
+ end: c.index + h.length,
3113
+ original: h,
3108
3114
  replacement: `v-${g}="${v}"`,
3109
3115
  line: I.line,
3110
3116
  column: I.column
@@ -3119,7 +3125,7 @@ function Xt(e) {
3119
3125
  }
3120
3126
  const p = /v-for="([^"]+)"/g;
3121
3127
  for (; (c = p.exec(n)) !== null; ) {
3122
- const m = c[0], x = c[1].match(/^(.+)\s+in\s+(.+)$/);
3128
+ const h = c[0], x = c[1].match(/^(.+)\s+in\s+(.+)$/);
3123
3129
  if (x) {
3124
3130
  const [, v, I] = x, D = H(
3125
3131
  I,
@@ -3129,8 +3135,8 @@ function Xt(e) {
3129
3135
  const $ = G(n, c.index), lu = `v-for="${v} in ${D}"`;
3130
3136
  i.push({
3131
3137
  start: c.index,
3132
- end: c.index + m.length,
3133
- original: m,
3138
+ end: c.index + h.length,
3139
+ original: h,
3134
3140
  replacement: lu,
3135
3141
  line: $.line,
3136
3142
  column: $.column
@@ -3146,13 +3152,13 @@ function Xt(e) {
3146
3152
  }
3147
3153
  const b = /v-model="([^"]+)"/g;
3148
3154
  for (; (c = b.exec(n)) !== null; ) {
3149
- const m = c[0], g = c[1], x = H(g, r);
3155
+ const h = c[0], g = c[1], x = H(g, r);
3150
3156
  if (x !== g) {
3151
3157
  const v = G(n, c.index);
3152
3158
  i.push({
3153
3159
  start: c.index,
3154
- end: c.index + m.length,
3155
- original: m,
3160
+ end: c.index + h.length,
3161
+ original: h,
3156
3162
  replacement: `v-model="${x}"`,
3157
3163
  line: v.line,
3158
3164
  column: v.column
@@ -3165,15 +3171,15 @@ function Xt(e) {
3165
3171
  });
3166
3172
  }
3167
3173
  }
3168
- const h = /v-bind="([^"]+)"/g;
3169
- for (; (c = h.exec(n)) !== null; ) {
3170
- const m = c[0], g = c[1], x = H(g, r);
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);
3171
3177
  if (x !== g) {
3172
3178
  const v = G(n, c.index);
3173
3179
  i.push({
3174
3180
  start: c.index,
3175
- end: c.index + m.length,
3176
- original: m,
3181
+ end: c.index + h.length,
3182
+ original: h,
3177
3183
  replacement: `v-bind="${x}"`,
3178
3184
  line: v.line,
3179
3185
  column: v.column
@@ -3188,13 +3194,13 @@ function Xt(e) {
3188
3194
  }
3189
3195
  const S = /v-(text|html)="([^"]+)"/g;
3190
3196
  for (; (c = S.exec(n)) !== null; ) {
3191
- const m = c[0], g = c[1], x = c[2], v = H(x, r);
3197
+ const h = c[0], g = c[1], x = c[2], v = H(x, r);
3192
3198
  if (v !== x) {
3193
3199
  const I = G(n, c.index);
3194
3200
  i.push({
3195
3201
  start: c.index,
3196
- end: c.index + m.length,
3197
- original: m,
3202
+ end: c.index + h.length,
3203
+ original: h,
3198
3204
  replacement: `v-${g}="${v}"`,
3199
3205
  line: I.line,
3200
3206
  column: I.column
@@ -3209,13 +3215,13 @@ function Xt(e) {
3209
3215
  }
3210
3216
  const w = /(@|v-on:)(\w+)="([^"]+)"/g;
3211
3217
  for (; (c = w.exec(n)) !== null; ) {
3212
- const m = c[0], g = c[1], x = c[2], v = c[3], I = Qt(v, r);
3218
+ const h = c[0], g = c[1], x = c[2], v = c[3], I = Kt(v, r);
3213
3219
  if (I !== v) {
3214
3220
  const D = G(n, c.index);
3215
3221
  i.push({
3216
3222
  start: c.index,
3217
- end: c.index + m.length,
3218
- original: m,
3223
+ end: c.index + h.length,
3224
+ original: h,
3219
3225
  replacement: `${g}${x}="${I}"`,
3220
3226
  line: D.line,
3221
3227
  column: D.column
@@ -3228,11 +3234,11 @@ function Xt(e) {
3228
3234
  });
3229
3235
  }
3230
3236
  }
3231
- if (i.sort((m, g) => g.start - m.start), i.forEach((m) => {
3232
- s = s.substring(0, m.start) + m.replacement + s.substring(m.end);
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);
3233
3239
  }), i.length > 0) {
3234
- const m = e.indexOf("<template>"), g = e.lastIndexOf("</template>") + 11;
3235
- t = e.substring(0, m) + `<template>
3240
+ const h = e.indexOf("<template>"), g = e.lastIndexOf("</template>") + 11;
3241
+ t = e.substring(0, h) + `<template>
3236
3242
  ` + s + `
3237
3243
  </template>` + e.substring(g);
3238
3244
  }
@@ -3243,7 +3249,7 @@ function Xt(e) {
3243
3249
  changes: u
3244
3250
  };
3245
3251
  }
3246
- function Zt(e) {
3252
+ function Qt(e) {
3247
3253
  const u = /* @__PURE__ */ new Set();
3248
3254
  try {
3249
3255
  const t = _(e);
@@ -3269,7 +3275,7 @@ function H(e, u) {
3269
3275
  r.test(t) && !t.includes(`state.${a}`) && (t = t.replace(r, `state.${a}`));
3270
3276
  }), t;
3271
3277
  }
3272
- function Qt(e, u) {
3278
+ function Kt(e, u) {
3273
3279
  let t = e.trim();
3274
3280
  return u.forEach((a) => {
3275
3281
  const r = new RegExp(
@@ -3290,15 +3296,15 @@ function G(e, u) {
3290
3296
  column: t[t.length - 1].length
3291
3297
  };
3292
3298
  }
3293
- class Kt {
3299
+ class Yt {
3294
3300
  fixBasedOnValidation(u, t) {
3295
3301
  let a = u;
3296
- return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Xt(a).fixedCode;
3302
+ return t.illegalVantIcons.length && (a = this.fixVantIcons(a)), t.illegalVtjIcons.length && (a = this.fixVtjIcons(a, t.illegalVtjIcons)), Zt(a).fixedCode;
3297
3303
  }
3298
3304
  fixVantIcons(u) {
3299
3305
  const t = P(u), a = t.template.replace(
3300
3306
  /<(?:VanIcon|van-icon)\s+[^>]*name="([^"]+)"[^>]*>/g,
3301
- (r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, Jt)
3307
+ (r, n) => r.includes(":name=") || r.includes("v-bind:name=") || ie.includes(n) ? r : r.replace(n, zt)
3302
3308
  );
3303
3309
  return this.reconstructSFC(t, a, t.script);
3304
3310
  }
@@ -3391,51 +3397,51 @@ ${a}
3391
3397
  }), r;
3392
3398
  }
3393
3399
  }
3394
- async function b0(e) {
3400
+ async function p0(e) {
3395
3401
  const { id: u, name: t, source: a, project: r } = e, n = ke(a, t);
3396
3402
  if (n)
3397
3403
  return Promise.reject(n);
3398
- const { dependencies: s = [], platform: i = "web" } = r || {}, o = new zt(), c = new Kt(), d = o.validate(a);
3404
+ const { dependencies: s = [], platform: i = "web" } = r || {}, o = new Xt(), c = new Yt(), d = o.validate(a);
3399
3405
  let l = [];
3400
3406
  if (!d.valid)
3401
3407
  return l = d.errors, Promise.reject(l);
3402
3408
  const p = c.fixBasedOnValidation(a, d), b = P(p);
3403
3409
  b.script = Ae(b.script);
3404
3410
  const {
3405
- styles: h,
3411
+ styles: m,
3406
3412
  css: S,
3407
3413
  errors: w
3408
- } = Ot(b.styles.join(`
3414
+ } = Bt(b.styles.join(`
3409
3415
  `));
3410
- return l.push(...w), l.length ? Promise.reject(l) : b.isScriptSetup ? u0(b, {
3416
+ return l.push(...w), l.length ? Promise.reject(l) : b.isScriptSetup ? e0(b, {
3411
3417
  id: u,
3412
3418
  name: t,
3413
3419
  project: r,
3414
3420
  platform: i,
3415
3421
  dependencies: s,
3416
- styles: h,
3422
+ styles: m,
3417
3423
  css: S
3418
- }) : Yt(b, {
3424
+ }) : u0(b, {
3419
3425
  id: u,
3420
3426
  name: t,
3421
3427
  project: r,
3422
3428
  platform: i,
3423
3429
  dependencies: s,
3424
- styles: h,
3430
+ styles: m,
3425
3431
  css: S
3426
3432
  });
3427
3433
  }
3428
- async function Yt(e, u) {
3434
+ async function u0(e, u) {
3429
3435
  const { id: t, name: a, project: r, platform: n, dependencies: s, styles: i, css: o } = u, {
3430
3436
  state: c,
3431
3437
  watch: d,
3432
3438
  lifeCycles: l,
3433
3439
  computed: p,
3434
3440
  methods: b,
3435
- props: h,
3441
+ props: m,
3436
3442
  emits: S,
3437
3443
  expose: w,
3438
- inject: m,
3444
+ inject: h,
3439
3445
  handlers: g,
3440
3446
  imports: x,
3441
3447
  dataSources: v,
@@ -3449,8 +3455,8 @@ async function Yt(e, u) {
3449
3455
  }), yu = {
3450
3456
  id: t,
3451
3457
  name: a,
3452
- inject: m,
3453
- props: h,
3458
+ inject: h,
3459
+ props: m,
3454
3460
  state: c,
3455
3461
  watch: d,
3456
3462
  lifeCycles: l,
@@ -3462,7 +3468,7 @@ async function Yt(e, u) {
3462
3468
  expose: w,
3463
3469
  nodes: D,
3464
3470
  css: o
3465
- }, le = Object.keys(p || {}), fe = (h || []).map(
3471
+ }, le = Object.keys(p || {}), fe = (m || []).map(
3466
3472
  (F) => typeof F == "string" ? F : F.name
3467
3473
  ), be = [
3468
3474
  "$el",
@@ -3494,8 +3500,8 @@ async function Yt(e, u) {
3494
3500
  async (F) => {
3495
3501
  await oe(F, async (K) => {
3496
3502
  if (du(K)) {
3497
- const he = await ru(K.value);
3498
- K.value = Iu(he, F.id, Su);
3503
+ const me = await ru(K.value);
3504
+ K.value = Iu(me, F.id, Su);
3499
3505
  }
3500
3506
  });
3501
3507
  },
@@ -3505,8 +3511,8 @@ async function Yt(e, u) {
3505
3511
  }
3506
3512
  ), new Hu(yu).toDsl();
3507
3513
  }
3508
- async function u0(e, u) {
3509
- const { id: t, name: a, project: r, platform: n, styles: s, css: i, dependencies: o } = u, c = Nt(e.script, r), { nodes: d, slots: l, context: p } = re(t, a, e.template, {
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, {
3510
3516
  platform: n,
3511
3517
  handlers: c.handlers,
3512
3518
  styles: s,
@@ -3534,7 +3540,7 @@ async function u0(e, u) {
3534
3540
  expose: c.expose,
3535
3541
  nodes: d,
3536
3542
  css: i
3537
- }, { libs: h } = de(c.imports, o), S = Ht(c), w = {
3543
+ }, { libs: m } = de(c.imports, o), S = Wt(c), w = {
3538
3544
  refs: Array.from(S.refs),
3539
3545
  reactives: Array.from(S.reactives),
3540
3546
  hasState: S.hasState,
@@ -3546,7 +3552,7 @@ async function u0(e, u) {
3546
3552
  dataSources: Array.from(S.dataSources),
3547
3553
  globalApiVars: S.reverseApiMap,
3548
3554
  reverseMemberApiMap: S.reverseMemberApiMap,
3549
- libs: h
3555
+ libs: m
3550
3556
  };
3551
3557
  return await ce(
3552
3558
  b,
@@ -3571,18 +3577,18 @@ async function u0(e, u) {
3571
3577
  ), new Hu(b).toDsl();
3572
3578
  }
3573
3579
  async function ce(e, u, t) {
3574
- const a = async (m, g) => {
3575
- if (await u(m, g), Array.isArray(m?.children))
3576
- for (const x of m?.children || [])
3577
- await a(x, m);
3578
- }, r = async (m) => {
3579
- if (!m || typeof m != "object") return;
3580
- if (Array.isArray(m)) {
3581
- for (let x of m)
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)
3582
3588
  await r(x);
3583
3589
  return;
3584
3590
  }
3585
- const g = Object.values(m);
3591
+ const g = Object.values(h);
3586
3592
  for (const x of g)
3587
3593
  du(x) ? await t(x) : await r(x);
3588
3594
  }, {
@@ -3595,7 +3601,7 @@ async function ce(e, u, t) {
3595
3601
  lifeCycles: l,
3596
3602
  inject: p,
3597
3603
  setup: b,
3598
- provide: h,
3604
+ provide: m,
3599
3605
  refs: S,
3600
3606
  reactives: w
3601
3607
  } = e;
@@ -3609,12 +3615,12 @@ async function ce(e, u, t) {
3609
3615
  lifeCycles: l,
3610
3616
  inject: p,
3611
3617
  setup: b,
3612
- provide: h,
3618
+ provide: m,
3613
3619
  refs: S,
3614
3620
  reactives: w
3615
3621
  }), Array.isArray(e.nodes))
3616
- for (const m of e.nodes)
3617
- await a(m);
3622
+ for (const h of e.nodes)
3623
+ await a(h);
3618
3624
  }
3619
3625
  async function oe(e, u) {
3620
3626
  const t = async (a) => {
@@ -3654,12 +3660,12 @@ function de(e = [], u = []) {
3654
3660
  };
3655
3661
  }
3656
3662
  export {
3657
- Kt as AutoFixer,
3658
- zt as ComponentValidator,
3659
- l0 as VTJ_PARSER_VERSION,
3663
+ Yt as AutoFixer,
3664
+ Xt as ComponentValidator,
3665
+ f0 as VTJ_PARSER_VERSION,
3660
3666
  qu as htmlToNodes,
3661
- f0 as parseUniApp,
3662
- b0 as parseVue,
3667
+ b0 as parseUniApp,
3668
+ p0 as parseVue,
3663
3669
  Iu as patchCode,
3664
3670
  R as replacer
3665
3671
  };