@vtj/coder 0.18.0 → 0.18.1

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
@@ -8,15 +8,15 @@ import * as Y from "prettier/plugins/estree";
8
8
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
9
9
  * @name @vtj/coder
10
10
  * @author CHC chenhuachun1549@dingtalk.com
11
- * @version 0.18.0
11
+ * @version 0.18.1
12
12
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
13
  */
14
- const Bt = "0.18.0";
14
+ const Tt = "0.18.1";
15
15
  /**!
16
16
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
17
17
  * @name @vtj/core
18
18
  * @author CHC chenhuachun1549@dingtalk.com
19
- * @version 0.18.0
19
+ * @version 0.18.1
20
20
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
21
21
  */
22
22
  const Ce = [
@@ -54,62 +54,62 @@ const V = {
54
54
  vueIndentScriptAndStyle: !0,
55
55
  removeBlankLines: !0
56
56
  };
57
- async function K(s, e) {
58
- return e ? s : await H(s, {
57
+ async function K(t, e) {
58
+ return e ? t : await H(t, {
59
59
  parser: "vue",
60
60
  ...V,
61
61
  plugins: [Oe, Q, Y, X]
62
62
  });
63
63
  }
64
- async function xe(s, e) {
65
- if (e) return s;
64
+ async function xe(t, e) {
65
+ if (e) return t;
66
66
  try {
67
- return (await H(s, {
67
+ return (await H(t, {
68
68
  parser: "babel-ts",
69
69
  ...V,
70
70
  plugins: [Q, Y]
71
71
  })).replace(/;\n$/gi, "");
72
- } catch (t) {
73
- return console.warn(t), s;
72
+ } catch (s) {
73
+ return console.warn(s), t;
74
74
  }
75
75
  }
76
- async function G(s, e) {
77
- return e ? s : H(s, {
76
+ async function G(t, e) {
77
+ return e ? t : H(t, {
78
78
  parser: "scss",
79
79
  ...V,
80
80
  plugins: [X]
81
81
  });
82
82
  }
83
- function T(s) {
84
- return s && s.type === "JSExpression";
83
+ function T(t) {
84
+ return t && t.type === "JSExpression";
85
85
  }
86
- function R(s) {
87
- return typeof s == "object" && s && s.type === "JSFunction";
86
+ function R(t) {
87
+ return typeof t == "object" && t && t.type === "JSFunction";
88
88
  }
89
- function S(s) {
90
- return T(s) || R(s);
89
+ function S(t) {
90
+ return T(t) || R(t);
91
91
  }
92
- function ee(s) {
93
- return s.replace(new RegExp("this.", "g"), "");
92
+ function ee(t) {
93
+ return t.replace(new RegExp("this.", "g"), "");
94
94
  }
95
- function J(s) {
96
- return s.replace(/this\.context\??\./g, "");
95
+ function J(t) {
96
+ return t.replace(/this\.context\??\./g, "");
97
97
  }
98
- function _(s, e = !0, t = !0, n = [], o = !0) {
99
- let r = s;
100
- return S(s) ? (r = s.value.trim().replace(/;$/, ""), o && (r = r.replace(/\"/g, "'"))) : r = e ? JSON.stringify(r) : s, r = M(r, n), t ? ee(J(r)) : J(r);
98
+ function _(t, e = !0, s = !0, n = [], o = !0) {
99
+ let r = t;
100
+ return S(t) ? (r = t.value.trim().replace(/;$/, ""), o && (r = r.replace(/\"/g, "'"))) : r = e ? JSON.stringify(r) : t, r = M(r, n), s ? ee(J(r)) : J(r);
101
101
  }
102
- function M(s = "", e = []) {
103
- let t = s;
102
+ function M(t = "", e = []) {
103
+ let s = t;
104
104
  for (const n of e)
105
- t = t.replace(
105
+ s = s.replace(
106
106
  new RegExp(`this.${n}.value`, "g"),
107
107
  `this.${n}`
108
108
  );
109
- return t;
109
+ return s;
110
110
  }
111
- function te(s) {
112
- let e = s.trim().replace(/;$/, "");
111
+ function te(t) {
112
+ let e = t.trim().replace(/;$/, "");
113
113
  if (e = /^\((\(|async|function)/.test(e) ? e.substring(1, e.length - 1) : e, e.startsWith("{")) return e;
114
114
  if (e.startsWith("async function"))
115
115
  e = e.replace(/^async function/, "async");
@@ -121,31 +121,31 @@ function te(s) {
121
121
  }
122
122
  return e;
123
123
  }
124
- function Ae(s = {}) {
125
- return Object.entries(s).map(([e, t]) => `"${e}": ${_(t)}`);
124
+ function Ae(t = {}) {
125
+ return Object.entries(t).map(([e, s]) => `"${e}": ${_(s)}`);
126
126
  }
127
- function se(s = {}, e = !1) {
128
- const t = Object.keys(s);
129
- return e ? t.map((n) => "." + n) : t;
127
+ function se(t = {}, e = !1) {
128
+ const s = Object.keys(t);
129
+ return e ? s.map((n) => "." + n) : s;
130
130
  }
131
- function Pe(s) {
131
+ function Pe(t) {
132
132
  let e = "";
133
- for (var t in s)
134
- if (s.hasOwnProperty(t)) {
135
- var n = s[t];
136
- e += t + ": " + n + ";";
133
+ for (var s in t)
134
+ if (t.hasOwnProperty(s)) {
135
+ var n = t[s];
136
+ e += s + ": " + n + ";";
137
137
  }
138
138
  return e;
139
139
  }
140
- function Ee(s = [], e = []) {
141
- return s.filter((t) => !e.includes(t));
140
+ function Ee(t = [], e = []) {
141
+ return t.filter((s) => !e.includes(s));
142
142
  }
143
- function z(s) {
144
- return Se(JSON.stringify(s));
143
+ function z(t) {
144
+ return Se(JSON.stringify(t));
145
145
  }
146
146
  class Ne {
147
- constructor(e, t) {
148
- this.dsl = e, this.dependencies = t, this.collectEasycom(), this.libraryRegex = this.collectLibrary(), this.walk(e), this.walkNodes(e), this.members = this.getLibraryMember();
147
+ constructor(e, s) {
148
+ this.dsl = e, this.dependencies = s, this.collectEasycom(), this.libraryRegex = this.collectLibrary(), this.walk(e), this.walkNodes(e), this.members = this.getLibraryMember();
149
149
  }
150
150
  /**
151
151
  * { 'element-plus': ['ElButton', 'ElInput' ...] }
@@ -172,9 +172,9 @@ class Ne {
172
172
  * @returns ex: { name: 'ElButton', path: 'this.$libs.ElementPlus.', library: 'ElementPlus' }
173
173
  */
174
174
  collectImport(e) {
175
- const t = e.split(".");
176
- if (t.length === 4) {
177
- const n = t.pop(), o = t.join(".") + ".", r = t.pop();
175
+ const s = e.split(".");
176
+ if (s.length === 4) {
177
+ const n = s.pop(), o = s.join(".") + ".", r = s.pop();
178
178
  if (n && r) {
179
179
  const c = this.dependencies.find(
180
180
  (a) => a.library === r
@@ -191,9 +191,9 @@ class Ne {
191
191
  }
192
192
  // 代码中包含依赖库的引用,需要从代码中移除
193
193
  replaceLibraryPath(e) {
194
- const { libraryRegex: t } = this;
194
+ const { libraryRegex: s } = this;
195
195
  let n = e.value;
196
- for (const o of t) {
196
+ for (const o of s) {
197
197
  const r = e.value?.match(o) || [];
198
198
  for (const c of r) {
199
199
  const a = this.collectImport(c);
@@ -206,29 +206,29 @@ class Ne {
206
206
  return n;
207
207
  }
208
208
  walk(e) {
209
- const t = (n) => {
209
+ const s = (n) => {
210
210
  if (!n || typeof n != "object") return;
211
211
  if (Array.isArray(n)) {
212
212
  for (let r of n)
213
- t(r);
213
+ s(r);
214
214
  return;
215
215
  }
216
216
  const o = Object.values(n);
217
217
  for (const r of o)
218
- S(r) ? r.value = this.replaceLibraryPath(r) : t(r);
218
+ S(r) ? r.value = this.replaceLibraryPath(r) : s(r);
219
219
  };
220
- t(e);
220
+ s(e);
221
221
  }
222
222
  getLibraryMember(e = []) {
223
- let t = [...e];
223
+ let s = [...e];
224
224
  const n = { ...this.imports };
225
225
  delete n["uni-h5"], delete n["@dcloudio/uni-h5"], delete n["uni-ui"], delete n["@dcloudio/uni-ui"];
226
226
  for (const o of Object.values(n))
227
- t = t.concat(Array.from(o));
228
- return B(t);
227
+ s = s.concat(Array.from(o));
228
+ return B(s);
229
229
  }
230
- collectContext(e, t) {
231
- const n = new Set(t?.id ? this.context[t.id] : []), o = (e.directives || []).find((a) => a.name === "vFor");
230
+ collectContext(e, s) {
231
+ const n = new Set(s?.id ? this.context[s.id] : []), o = (e.directives || []).find((a) => a.name === "vFor");
232
232
  let r = new Set(Array.from(n));
233
233
  if (o) {
234
234
  const { item: a = "item", index: l = "index" } = o.iterator || {};
@@ -236,7 +236,7 @@ class Ne {
236
236
  }
237
237
  const c = e.slot;
238
238
  if (c) {
239
- const a = typeof c == "string" ? [] : c.params || [], l = a.length ? a : [`scope_${t?.id}`];
239
+ const a = typeof c == "string" ? [] : c.params || [], l = a.length ? a : [`scope_${s?.id}`];
240
240
  r = /* @__PURE__ */ new Set([...l, ...Array.from(r)]);
241
241
  }
242
242
  this.context[e.id] = r;
@@ -251,48 +251,48 @@ class Ne {
251
251
  typeof e.from == "object" && e.from.type === "Plugin" && (this.blockPlugins[e.name] = e.from);
252
252
  }
253
253
  walkNodes(e) {
254
- const t = (n, o) => {
255
- this.collectContext(n, o), this.collectStyle(n), this.collectUrlSchema(n), this.collectBlockPlugin(n), Array.isArray(n.children) && n.children.forEach((r) => t(r, n));
254
+ const s = (n, o) => {
255
+ this.collectContext(n, o), this.collectStyle(n), this.collectUrlSchema(n), this.collectBlockPlugin(n), Array.isArray(n.children) && n.children.forEach((r) => s(r, n));
256
256
  };
257
- Array.isArray(e.nodes) && e.nodes.forEach((n) => t(n));
257
+ Array.isArray(e.nodes) && e.nodes.forEach((n) => s(n));
258
258
  }
259
259
  }
260
- function Be(s = {}) {
261
- return Object.entries(s).map(([e, t]) => {
262
- const n = _(t, !1, !0, [], !1);
260
+ function Be(t = {}) {
261
+ return Object.entries(t).map(([e, s]) => {
262
+ const n = _(s, !1, !0, [], !1);
263
263
  return `${e}:${n}`;
264
264
  });
265
265
  }
266
- function Te(s = []) {
267
- return s.map((e) => `${e.name}: {
266
+ function Te(t = []) {
267
+ return t.map((e) => `${e.name}: {
268
268
  from: '${e.from || e.name}',
269
269
  default: ${_(e.default, !0, !1, [], !1)}
270
270
  }`);
271
271
  }
272
- function ne(s = []) {
273
- const e = (t) => t ? `[${je(t).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
274
- return s.map((t) => typeof t == "string" ? `${t}: {}` : (S(t.default) && !t.default.value && (t.default.value = "undefined"), `${t.name}: {
275
- type:${e(t.type)},
276
- required: ${_(!!t.required, !0, !1, [], !1)},
277
- default: ${t.default ? _(t.default, !0, !1, [], !1) : "undefined"}
272
+ function ne(t = []) {
273
+ const e = (s) => s ? `[${je(s).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
274
+ return t.map((s) => typeof s == "string" ? `${s}: {}` : (S(s.default) && !s.default.value && (s.default.value = "undefined"), `${s.name}: {
275
+ type:${e(s.type)},
276
+ required: ${_(!!s.required, !0, !1, [], !1)},
277
+ default: ${s.default ? _(s.default, !0, !1, [], !1) : "undefined"}
278
278
  }`));
279
279
  }
280
- function re(s = []) {
281
- return s.map((e) => `'${typeof e == "string" ? e : e.name}'`);
280
+ function re(t = []) {
281
+ return t.map((e) => `'${typeof e == "string" ? e : e.name}'`);
282
282
  }
283
- function U(s = {}, e = []) {
284
- return Object.entries(s).map(([t, n]) => {
283
+ function U(t = {}, e = []) {
284
+ return Object.entries(t).map(([s, n]) => {
285
285
  let o = te(
286
286
  _(n, !1, !1, [], !1)
287
287
  );
288
- return o = M(o, e)?.trim(), o.startsWith("async") ? `async ${t}${o.replace(/^async/, "")}` : o.startsWith("(") || o.startsWith("{") ? `${t}${o}` : null;
289
- }).filter((t) => !!t);
288
+ return o = M(o, e)?.trim(), o.startsWith("async") ? `async ${s}${o.replace(/^async/, "")}` : o.startsWith("(") || o.startsWith("{") ? `${s}${o}` : null;
289
+ }).filter((s) => !!s);
290
290
  }
291
- function Me(s = [], e = []) {
292
- const t = s.reduce(
291
+ function Me(t = [], e = []) {
292
+ const s = t.reduce(
293
293
  (r, c) => (c.id && R(c.source) && (r[`watcher_${c.id}`] = c.source), r),
294
294
  {}
295
- ), n = U(t, e), o = s.map((r) => r.handler && r.handler.value ? `watcher_${r.id}: {
295
+ ), n = U(s, e), o = t.map((r) => r.handler && r.handler.value ? `watcher_${r.id}: {
296
296
  deep: ${r.deep},
297
297
  immediate:${r.immediate},
298
298
  handler${te(r.handler.value)}
@@ -302,20 +302,20 @@ function Me(s = [], e = []) {
302
302
  watches: o
303
303
  };
304
304
  }
305
- function Re(s = {}) {
306
- return Object.values(s).map((e) => {
305
+ function Re(t = {}) {
306
+ return Object.values(t).map((e) => {
307
307
  if (e.type === "mock") {
308
- const t = R(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
308
+ const s = R(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
309
309
  return `async ${e.name}(...args) {
310
310
  // DataSource: ${z(e)}
311
- const mock = this.provider.createMock(${t});
311
+ const mock = this.provider.createMock(${s});
312
312
  return await mock.apply(this, args);
313
313
  }`;
314
314
  } else {
315
- const t = R(e.transform) && e.transform.value || "(res) => res";
315
+ const s = R(e.transform) && e.transform.value || "(res) => res";
316
316
  return `async ${e.name}(...args) {
317
317
  // DataSource: ${z(e)}
318
- return await this.provider.apis['${e.ref}'].apply(this, args).then(${t});
318
+ return await this.provider.apis['${e.ref}'].apply(this, args).then(${s});
319
319
  }`;
320
320
  }
321
321
  });
@@ -345,12 +345,12 @@ const De = [
345
345
  "vBind",
346
346
  "vHtml"
347
347
  ];
348
- function q(s, e, t = [], n = {}, o) {
348
+ function q(t, e, s = [], n = {}, o) {
349
349
  const r = [];
350
350
  let c = {}, a = [];
351
351
  const l = [];
352
352
  let p = [];
353
- return Le(s).forEach((i) => {
353
+ return Le(t).forEach((i) => {
354
354
  const u = [];
355
355
  for (const v of i.children) {
356
356
  let { id: b, name: k, invisible: g, from: m } = v;
@@ -364,14 +364,14 @@ function q(s, e, t = [], n = {}, o) {
364
364
  v.props,
365
365
  v.events,
366
366
  n,
367
- t
367
+ s
368
368
  ), w = Ge(
369
369
  v.directives,
370
- t,
370
+ s,
371
371
  l
372
- ).join(" "), I = v.children ? Ze(
372
+ ).join(" "), I = v.children ? Qe(
373
373
  v.children,
374
- t,
374
+ s,
375
375
  e,
376
376
  n,
377
377
  v
@@ -387,7 +387,7 @@ function q(s, e, t = [], n = {}, o) {
387
387
  ` + C.trim() : ""}</${N}>`
388
388
  );
389
389
  }
390
- const f = Qe(i.slot, u.join(`
390
+ const f = Xe(i.slot, u.join(`
391
391
  `), o?.id);
392
392
  r.push(f);
393
393
  }), {
@@ -398,65 +398,65 @@ function q(s, e, t = [], n = {}, o) {
398
398
  importBlocks: B(p, "id")
399
399
  };
400
400
  }
401
- function Ue(s) {
402
- return B(s).map((e) => `${e.startsWith("v") ? e.substring(1) : e}:${e}`);
401
+ function Ue(t) {
402
+ return B(t).map((e) => `${e.startsWith("v") ? e.substring(1) : e}:${e}`);
403
403
  }
404
- function Le(s = []) {
404
+ function Le(t = []) {
405
405
  const e = /* @__PURE__ */ new Map();
406
- for (const t of s) {
407
- const n = typeof t.slot == "string" ? t.slot : t.slot?.name, o = e.get(n);
408
- o ? o.children.push(t) : e.set(n, { slot: t.slot, children: [t] });
406
+ for (const s of t) {
407
+ const n = typeof s.slot == "string" ? s.slot : s.slot?.name, o = e.get(n);
408
+ o ? o.children.push(s) : e.set(n, { slot: s.slot, children: [s] });
409
409
  }
410
410
  return e;
411
411
  }
412
- function Fe(s, e, t) {
413
- if (Ce.includes(s)) return null;
414
- const n = e.get(s);
412
+ function Fe(t, e, s) {
413
+ if (Ce.includes(t)) return null;
414
+ const n = e.get(t);
415
415
  if (n && n.alias) {
416
416
  const o = n.parent ? `${n.parent}.${n.alias}` : n.alias;
417
- return `${s}: ${o}`;
417
+ return `${t}: ${o}`;
418
418
  }
419
- return oe(t) || n ? s : null;
419
+ return oe(s) || n ? t : null;
420
420
  }
421
- function oe(s) {
422
- return !!s && typeof s == "object" && s.type === "Schema";
421
+ function oe(t) {
422
+ return !!t && typeof t == "object" && t.type === "Schema";
423
423
  }
424
- function ce(s) {
425
- return typeof s == "object" && s.type === "UrlSchema";
424
+ function ce(t) {
425
+ return typeof t == "object" && t.type === "UrlSchema";
426
426
  }
427
- function ae(s) {
428
- return typeof s == "object" && s.type === "Plugin";
427
+ function ae(t) {
428
+ return typeof t == "object" && t.type === "Plugin";
429
429
  }
430
- function Je(s, e, t = []) {
431
- return s === "style" ? S(e) ? `:style="${_({
430
+ function Je(t, e, s = []) {
431
+ return t === "style" ? S(e) ? `:style="${_({
432
432
  ...e,
433
- value: M(e.value, t)
434
- })}"` : "" : s === "__class" && S(e) ? `:class="${_({
433
+ value: M(e.value, s)
434
+ })}"` : "" : t === "__class" && S(e) ? `:class="${_({
435
435
  ...e,
436
- value: M(e.value, t)
437
- })}"` : typeof e == "string" ? `${s}="${e}"` : S(e) ? `:${s}="${_({
436
+ value: M(e.value, s)
437
+ })}"` : typeof e == "string" ? `${t}="${e}"` : S(e) ? `:${t}="${_({
438
438
  ...e,
439
- value: M(e.value, t)
440
- })}"` : ke(e) ? `:${s}='{${Ae(
439
+ value: M(e.value, s)
440
+ })}"` : ke(e) ? `:${t}='{${Ae(
441
441
  e
442
- ).join(", ")}}'` : `:${s}='${JSON.stringify(e)}'`;
442
+ ).join(", ")}}'` : `:${t}='${JSON.stringify(e)}'`;
443
443
  }
444
- function We(s, e = {}, t = []) {
444
+ function We(t, e = {}, s = []) {
445
445
  if (!!Object.keys(e.style || {}).length) {
446
- const r = `${s.name}_${s.id}`;
446
+ const r = `${t.name}_${t.id}`;
447
447
  e.class ? typeof e.class == "string" ? e.class = [e.class, r].join(" ") : (e.__class = e.class, e.class = r) : e.class = r, S(e.style) || delete e.style;
448
448
  }
449
- const o = s.from;
449
+ const o = t.from;
450
450
  return (ce(o) || ae(o)) && (e.is = {
451
451
  type: "JSExpression",
452
- value: s.name
453
- }), Object.entries(e).map(([r, c]) => Je(r, c, t));
452
+ value: t.name
453
+ }), Object.entries(e).map(([r, c]) => Je(r, c, s));
454
454
  }
455
- function He(s, e, t) {
455
+ function He(t, e, s) {
456
456
  const n = se(e.modifiers, !0);
457
- return `@${s}${n.join("")}="${t}"`;
457
+ return `@${t}${n.join("")}="${s}"`;
458
458
  }
459
- function Ve(s, e = {}, t = {}) {
459
+ function Ve(t, e = {}, s = {}) {
460
460
  const n = {};
461
461
  return {
462
462
  binders: Object.entries(e).map(([r, c]) => {
@@ -469,16 +469,16 @@ function Ve(s, e = {}, t = {}) {
469
469
  handlers: n
470
470
  };
471
471
  }
472
- function qe(s, e, t = {}, n = {}, o = {}, r) {
472
+ function qe(t, e, s = {}, n = {}, o = {}, r) {
473
473
  const { binders: c, handlers: a } = Ve(e, n, o);
474
474
  return {
475
- props: We(s, t, r).join(" "),
475
+ props: We(t, s, r).join(" "),
476
476
  handlers: a,
477
477
  binders: c,
478
478
  events: c.join(" ")
479
479
  };
480
480
  }
481
- function Ge(s = [], e = [], t = []) {
481
+ function Ge(t = [], e = [], s = []) {
482
482
  const n = [], {
483
483
  vIf: o,
484
484
  vElse: r,
@@ -489,7 +489,7 @@ function Ge(s = [], e = [], t = []) {
489
489
  vBind: d,
490
490
  vHtml: i,
491
491
  customDirectives: u
492
- } = ze(s);
492
+ } = ze(t);
493
493
  if (o && n.push(`v-if="${_(o.value, !0, !0, e)}"`), c && n.push(
494
494
  `v-else-if="${_(c.value, !0, !0, e)}"`
495
495
  ), r && n.push("v-else"), a && n.push(
@@ -512,7 +512,7 @@ function Ge(s = [], e = [], t = []) {
512
512
  ), u && u.length && u.forEach((f) => {
513
513
  if (!f.name) return;
514
514
  let v = "", b = "";
515
- T(f.name) ? (b = _(f.name, !0, !0, e), t.push(b)) : b = f.name;
515
+ T(f.name) ? (b = _(f.name, !0, !0, e), s.push(b)) : b = f.name;
516
516
  const k = b?.startsWith("v") ? F(b) : F("v-" + b);
517
517
  if (v += k, f.arg && (T(f.arg) ? v += `:[${_(f.name, !0, !0, e)}]` : v += `:${f.arg}`), f.modifiers) {
518
518
  const g = Object.keys(f.modifiers);
@@ -523,10 +523,10 @@ function Ge(s = [], e = [], t = []) {
523
523
  ) : n.push(v);
524
524
  }), n;
525
525
  }
526
- function ze(s = []) {
527
- const e = s.filter(
526
+ function ze(t = []) {
527
+ const e = t.filter(
528
528
  (i) => Z.includes(i.name)
529
- ), t = s.filter(
529
+ ), s = t.filter(
530
530
  (i) => !Z.includes(i.name)
531
531
  ), n = e.find(
532
532
  (i) => A(i.name) === "vIf"
@@ -554,20 +554,23 @@ function ze(s = []) {
554
554
  vModels: d,
555
555
  vBind: l,
556
556
  vHtml: p,
557
- customDirectives: t
557
+ customDirectives: s
558
558
  };
559
559
  }
560
- function Ze(s, e, t, n, o) {
561
- return typeof s == "string" ? s : T(s) ? `{{ ${_(s, !1, !0, e)} }}` : Array.isArray(s) ? q(s, t, e, n, o) : "";
560
+ function Ze(t) {
561
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
562
562
  }
563
- function Qe(s, e, t) {
564
- if (!s) return e;
565
- const n = typeof s == "string" ? { name: s, params: [], scope: "" } : { params: [], scope: "", ...s };
566
- return `<template ${`#${n.name}="${n.scope ? n.scope : n.params?.length > 0 ? `{${n.params?.join(",")}}` : `scope_${t}`}"`}>
563
+ function Qe(t, e, s, n, o) {
564
+ return typeof t == "string" ? Ze(t) : T(t) ? `{{ ${_(t, !1, !0, e)} }}` : Array.isArray(t) ? q(t, s, e, n, o) : "";
565
+ }
566
+ function Xe(t, e, s) {
567
+ if (!t) return e;
568
+ const n = typeof t == "string" ? { name: t, params: [], scope: "" } : { params: [], scope: "", ...t };
569
+ return `<template ${`#${n.name}="${n.scope ? n.scope : n.params?.length > 0 ? `{${n.params?.join(",")}}` : `scope_${s}`}"`}>
567
570
  ${e}
568
571
  </template>`;
569
572
  }
570
- function Xe(s, e = [], t = [], n = {}, o = "web", r = /* @__PURE__ */ new Set()) {
573
+ function Ye(t, e = [], s = [], n = {}, o = "web", r = /* @__PURE__ */ new Set()) {
571
574
  const c = [
572
575
  "@dcloudio/uni-h5",
573
576
  "uni-h5",
@@ -577,7 +580,7 @@ function Xe(s, e = [], t = [], n = {}, o = "web", r = /* @__PURE__ */ new Set())
577
580
  vue: ["defineComponent", "reactive"]
578
581
  }, l = [];
579
582
  for (const d of e) {
580
- const i = s.get(d.split(":")[0]);
583
+ const i = t.get(d.split(":")[0]);
581
584
  if (i && i.package) {
582
585
  if (r.has(i.package)) continue;
583
586
  const u = a[i.package] ?? (a[i.package] = []), f = i.parent || (i.alias || "").split(".")[0] || i.name;
@@ -589,43 +592,43 @@ function Xe(s, e = [], t = [], n = {}, o = "web", r = /* @__PURE__ */ new Set())
589
592
  return {
590
593
  imports: Object.entries(a).filter(([d, i]) => o === "uniapp" ? !c.includes(d) && !!i.length : !!i.length).map(([d, i]) => `import { ${B(i).join(
591
594
  ","
592
- )}} from '${d}';`).concat(t),
595
+ )}} from '${d}';`).concat(s),
593
596
  uniComponents: l
594
597
  };
595
598
  }
596
- function ie(s = {}) {
599
+ function ie(t = {}) {
597
600
  const e = [];
598
- for (const [t, n] of Object.entries(s))
601
+ for (const [s, n] of Object.entries(t))
599
602
  e.push(`
600
- ${t} {
603
+ ${s} {
601
604
  ${Pe(n)}
602
605
  }
603
606
  `);
604
607
  return e.join(`
605
608
  `);
606
609
  }
607
- function le(s = {}) {
610
+ function le(t = {}) {
608
611
  const e = [];
609
- return Object.entries(s).forEach(([t, n]) => {
612
+ return Object.entries(t).forEach(([s, n]) => {
610
613
  e.push(
611
- `const ${t} = provider.defineUrlSchemaComponent('${n.url}');`
614
+ `const ${s} = provider.defineUrlSchemaComponent('${n.url}');`
612
615
  );
613
616
  }), e;
614
617
  }
615
- function ue(s = {}) {
618
+ function ue(t = {}) {
616
619
  const e = [];
617
- return Object.entries(s).forEach(([t, n]) => {
620
+ return Object.entries(t).forEach(([s, n]) => {
618
621
  e.push(
619
- `const ${t} = provider.definePluginComponent(${JSON.stringify(n)});`
622
+ `const ${s} = provider.definePluginComponent(${JSON.stringify(n)});`
620
623
  );
621
624
  }), e;
622
625
  }
623
- function Ye(s, e, t = "web") {
624
- const { dsl: n } = s, o = Object.keys(n.computed || {}), r = U(n.lifeCycles, o), c = U(n.computed, o), a = Me(n.watch, o), l = Re(n.dataSources), { methods: p, nodes: d, components: i, importBlocks: u, directives: f } = q(
626
+ function Ke(t, e, s = "web") {
627
+ const { dsl: n } = t, o = Object.keys(n.computed || {}), r = U(n.lifeCycles, o), c = U(n.computed, o), a = Me(n.watch, o), l = Re(n.dataSources), { methods: p, nodes: d, components: i, importBlocks: u, directives: f } = q(
625
628
  n.nodes || [],
626
629
  e,
627
630
  o,
628
- s.context
631
+ t.context
629
632
  ), v = [...c, ...a.computed], b = U(
630
633
  {
631
634
  ...p,
@@ -633,18 +636,18 @@ function Ye(s, e, t = "web") {
633
636
  },
634
637
  o
635
638
  ), k = u.map((w) => `import ${w.name} from './${w.id}.vue';`);
636
- let { imports: g, uniComponents: m } = Xe(
639
+ let { imports: g, uniComponents: m } = Ye(
637
640
  e,
638
641
  i,
639
642
  k,
640
- s.imports,
641
- t,
642
- s.easycomPackages
643
+ t.imports,
644
+ s,
645
+ t.easycomPackages
643
646
  );
644
647
  const h = Object.keys({
645
- ...s.urlSchemas,
646
- ...s.blockPlugins
647
- }), y = le(s.urlSchemas), $ = ue(s.blockPlugins);
648
+ ...t.urlSchemas,
649
+ ...t.blockPlugins
650
+ }), y = le(t.urlSchemas), $ = ue(t.blockPlugins);
648
651
  return {
649
652
  id: n.id,
650
653
  version: n.__VERSION__,
@@ -663,18 +666,18 @@ function Ye(s, e, t = "web") {
663
666
  `),
664
667
  components: Ee(i, m).join(","),
665
668
  directives: f.join(","),
666
- returns: s.members.join(","),
669
+ returns: t.members.join(","),
667
670
  template: d.join(`
668
671
  `),
669
672
  css: n.css || "",
670
- style: ie(s.style),
673
+ style: ie(t.style),
671
674
  urlSchemas: y.join(`
672
675
  `),
673
676
  blockPlugins: $.join(`
674
677
  `),
675
678
  asyncComponents: h.join(","),
676
679
  uniComponents: m,
677
- renderer: t === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer"
680
+ renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer"
678
681
  };
679
682
  }
680
683
  const E = {
@@ -958,19 +961,19 @@ const E = {
958
961
  replace: "message.error"
959
962
  }
960
963
  }
961
- }, Ke = Object.keys(pe);
962
- function et(s) {
963
- for (const [, e] of s)
964
- if (Ke.includes(e.package))
964
+ }, et = Object.keys(pe);
965
+ function tt(t) {
966
+ for (const [, e] of t)
967
+ if (et.includes(e.package))
965
968
  return e.package;
966
969
  return null;
967
970
  }
968
- function tt(s) {
969
- const e = s ? pe[s] ?? {} : {};
971
+ function st(t) {
972
+ const e = t ? pe[t] ?? {} : {};
970
973
  return { ...E, ...e };
971
974
  }
972
- function st(s, e = E) {
973
- const t = /* @__PURE__ */ new Set(), n = /this\.\$(\w+)\b/g, o = (r) => {
975
+ function nt(t, e = E) {
976
+ const s = /* @__PURE__ */ new Set(), n = /this\.\$(\w+)\b/g, o = (r) => {
974
977
  if (r && typeof r == "object") {
975
978
  if (Array.isArray(r)) {
976
979
  for (const c of r) o(c);
@@ -980,7 +983,7 @@ function st(s, e = E) {
980
983
  let c;
981
984
  for (n.lastIndex = 0; (c = n.exec(r.value)) !== null; ) {
982
985
  const a = "$" + c[1];
983
- a in e && t.add(a);
986
+ a in e && s.add(a);
984
987
  }
985
988
  return;
986
989
  }
@@ -988,46 +991,46 @@ function st(s, e = E) {
988
991
  o(c);
989
992
  }
990
993
  };
991
- return o(s.refs), o(s.reactives), o(s.state), o(s.computed), o(s.methods), o(s.watch), o(s.lifeCycles), o(s.inject), o(s.composables), o(s.provide), o(s.dataSources), o(s.setup), o(s.nodes), t;
994
+ return o(t.refs), o(t.reactives), o(t.state), o(t.computed), o(t.methods), o(t.watch), o(t.lifeCycles), o(t.inject), o(t.composables), o(t.provide), o(t.dataSources), o(t.setup), o(t.nodes), s;
992
995
  }
993
- function nt(s, e = E) {
994
- const t = [];
995
- for (const n of s) {
996
+ function rt(t, e = E) {
997
+ const s = [];
998
+ for (const n of t) {
996
999
  const o = e[n];
997
- o && o.declare && !t.includes(o.declare) && t.push(o.declare);
1000
+ o && o.declare && !s.includes(o.declare) && s.push(o.declare);
998
1001
  }
999
- return t;
1002
+ return s;
1000
1003
  }
1001
- function rt(s, e = E) {
1002
- const t = {};
1003
- for (const n of s) {
1004
+ function ot(t, e = E) {
1005
+ const s = {};
1006
+ for (const n of t) {
1004
1007
  const o = e[n];
1005
1008
  if (o && o.composable) {
1006
- const r = t[o.from] ?? (t[o.from] = []);
1009
+ const r = s[o.from] ?? (s[o.from] = []);
1007
1010
  r.includes(o.composable) || r.push(o.composable);
1008
1011
  }
1009
1012
  }
1010
- return t;
1013
+ return s;
1011
1014
  }
1012
- function ot(s, e = E) {
1013
- const t = new Set(Object.keys(s.refs ?? {})), n = new Set(Object.keys(s.reactives ?? {})), r = Object.keys(s.state ?? {}).length > 0;
1015
+ function ct(t, e = E) {
1016
+ const s = new Set(Object.keys(t.refs ?? {})), n = new Set(Object.keys(t.reactives ?? {})), r = Object.keys(t.state ?? {}).length > 0;
1014
1017
  r && n.add("__state");
1015
- const c = new Set(Object.keys(s.computed ?? {})), a = new Set(Object.keys(s.methods ?? {})), l = /* @__PURE__ */ new Set();
1016
- for (const u of s.props ?? [])
1018
+ const c = new Set(Object.keys(t.computed ?? {})), a = new Set(Object.keys(t.methods ?? {})), l = /* @__PURE__ */ new Set();
1019
+ for (const u of t.props ?? [])
1017
1020
  we(u) ? l.add(u) : l.add(u.name);
1018
1021
  const p = /* @__PURE__ */ new Set();
1019
- for (const u of s.composables ?? [])
1022
+ for (const u of t.composables ?? [])
1020
1023
  if (u.destructure && u.destructure.length > 0)
1021
1024
  for (const f of u.destructure) p.add(f);
1022
1025
  else u.name && p.add(u.name);
1023
1026
  const d = /* @__PURE__ */ new Set();
1024
- for (const u of s.inject ?? [])
1027
+ for (const u of t.inject ?? [])
1025
1028
  u.name && d.add(u.name);
1026
1029
  const i = /* @__PURE__ */ new Set();
1027
- for (const [, u] of Object.entries(s.dataSources ?? {}))
1030
+ for (const [, u] of Object.entries(t.dataSources ?? {}))
1028
1031
  u.name && i.add(u.name);
1029
1032
  return {
1030
- refs: t,
1033
+ refs: s,
1031
1034
  reactives: n,
1032
1035
  computed: c,
1033
1036
  methods: a,
@@ -1039,44 +1042,44 @@ function ot(s, e = E) {
1039
1042
  effectiveApiMap: e
1040
1043
  };
1041
1044
  }
1042
- function j(s, e, t = "script") {
1043
- if (!s) return s;
1044
- let n = s;
1045
+ function j(t, e, s = "script") {
1046
+ if (!t) return t;
1047
+ let n = t;
1045
1048
  for (const [o, r] of Object.entries(e.effectiveApiMap)) {
1046
1049
  const c = o.replace(/\$/g, "\\$"), a = new RegExp(`this\\.${c}\\b`, "g");
1047
1050
  n = n.replace(a, r.replace);
1048
1051
  }
1049
1052
  return n = n.replace(
1050
1053
  /this\.([A-Za-z_$][\w$]*)\.value\b/g,
1051
- (o, r) => e.refs.has(r) || e.computed.has(r) ? t === "script" ? `${r}.value` : r : o
1052
- ), n = n.replace(/this\.([A-Za-z_$][\w$]*)/g, (o, r) => e.refs.has(r) || e.computed.has(r) ? t === "script" ? `${r}.value` : r : r === "state" ? "__state" : e.reactives.has(r) || e.methods.has(r) || e.composables.has(r) || e.injects.has(r) || e.dataSources.has(r) ? r : e.props.has(r) ? t === "script" ? `__props.${r}` : r : o), n;
1054
+ (o, r) => e.refs.has(r) || e.computed.has(r) ? s === "script" ? `${r}.value` : r : o
1055
+ ), n = n.replace(/this\.([A-Za-z_$][\w$]*)/g, (o, r) => e.refs.has(r) || e.computed.has(r) ? s === "script" ? `${r}.value` : r : r === "state" ? "__state" : e.reactives.has(r) || e.methods.has(r) || e.composables.has(r) || e.injects.has(r) || e.dataSources.has(r) ? r : e.props.has(r) ? s === "script" ? `__props.${r}` : r : o), n;
1053
1056
  }
1054
- function P(s) {
1055
- let e = s.trim().replace(/;$/, "");
1057
+ function P(t) {
1058
+ let e = t.trim().replace(/;$/, "");
1056
1059
  return /^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim()), e;
1057
1060
  }
1058
- function ct(s = {}, e) {
1059
- return Object.entries(s).map(([t, n]) => {
1061
+ function at(t = {}, e) {
1062
+ return Object.entries(t).map(([s, n]) => {
1060
1063
  let o;
1061
- return S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n), `const ${t} = ref(${o});`;
1064
+ return S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n), `const ${s} = ref(${o});`;
1062
1065
  });
1063
1066
  }
1064
- function at(s = {}, e) {
1065
- return Object.entries(s).map(([t, n]) => {
1067
+ function it(t = {}, e) {
1068
+ return Object.entries(t).map(([s, n]) => {
1066
1069
  let o;
1067
- return S(n) ? o = j(n.value || "{}", e, "script") : o = JSON.stringify(n ?? {}), `const ${t} = reactive(${o});`;
1070
+ return S(n) ? o = j(n.value || "{}", e, "script") : o = JSON.stringify(n ?? {}), `const ${s} = reactive(${o});`;
1068
1071
  });
1069
1072
  }
1070
- function it(s = {}, e) {
1071
- const t = Object.entries(s);
1072
- return t.length === 0 ? "" : `const __state = reactive({ ${t.map(([o, r]) => {
1073
+ function lt(t = {}, e) {
1074
+ const s = Object.entries(t);
1075
+ return s.length === 0 ? "" : `const __state = reactive({ ${s.map(([o, r]) => {
1073
1076
  let c;
1074
1077
  return S(r) ? c = j(r.value || "undefined", e, "script") : c = JSON.stringify(r), `${o}: ${c}`;
1075
1078
  }).join(", ")} });`;
1076
1079
  }
1077
- function lt(s = [], e) {
1078
- const t = [], n = {}, o = /* @__PURE__ */ new Set();
1079
- for (const r of s) {
1080
+ function ut(t = [], e) {
1081
+ const s = [], n = {}, o = /* @__PURE__ */ new Set();
1082
+ for (const r of t) {
1080
1083
  if (!r || !r.composable) continue;
1081
1084
  let c = "";
1082
1085
  if (S(r.composable) ? c = r.composable.value || "" : typeof r.composable == "string" && (c = r.composable), !c || c === "useProvider") continue;
@@ -1085,73 +1088,73 @@ function lt(s = [], e) {
1085
1088
  o.add(r.name);
1086
1089
  }
1087
1090
  const l = (r.args ?? []).map((p) => S(p) ? j(p.value || "", e, "script") : JSON.stringify(p)).join(", ");
1088
- r.destructure && r.destructure.length > 0 ? t.push(
1091
+ r.destructure && r.destructure.length > 0 ? s.push(
1089
1092
  `const { ${r.destructure.join(", ")} } = ${c}(${l});`
1090
- ) : r.name ? t.push(`const ${r.name} = ${c}(${l});`) : t.push(`${c}(${l});`);
1093
+ ) : r.name ? s.push(`const ${r.name} = ${c}(${l});`) : s.push(`${c}(${l});`);
1091
1094
  }
1092
- return { statements: t, imports: n };
1095
+ return { statements: s, imports: n };
1093
1096
  }
1094
- function ut(s = [], e) {
1095
- return s.map((t) => {
1096
- const n = S(t.from) ? j(
1097
- t.from.value || `'${t.name}'`,
1097
+ function pt(t = [], e) {
1098
+ return t.map((s) => {
1099
+ const n = S(s.from) ? j(
1100
+ s.from.value || `'${s.name}'`,
1098
1101
  e,
1099
1102
  "script"
1100
- ) : `'${t.from || t.name}'`;
1103
+ ) : `'${s.from || s.name}'`;
1101
1104
  let o = "undefined";
1102
- return t.default !== void 0 && t.default !== null && (S(t.default) ? o = j(
1103
- t.default.value || "undefined",
1105
+ return s.default !== void 0 && s.default !== null && (S(s.default) ? o = j(
1106
+ s.default.value || "undefined",
1104
1107
  e,
1105
1108
  "script"
1106
- ) : o = JSON.stringify(t.default)), `const ${t.name} = inject(${n}, ${o});`;
1109
+ ) : o = JSON.stringify(s.default)), `const ${s.name} = inject(${n}, ${o});`;
1107
1110
  });
1108
1111
  }
1109
- function pt(s = {}, e) {
1110
- return Object.entries(s).map(([t, n]) => {
1112
+ function ft(t = {}, e) {
1113
+ return Object.entries(t).map(([s, n]) => {
1111
1114
  if (!n || !n.value) return null;
1112
1115
  const o = j(n.value, e, "script"), r = P(o);
1113
- return `const ${t} = computed(${r});`;
1114
- }).filter((t) => !!t);
1116
+ return `const ${s} = computed(${r});`;
1117
+ }).filter((s) => !!s);
1115
1118
  }
1116
- function ft(s = {}, e) {
1117
- return Object.entries(s).map(([t, n]) => {
1119
+ function mt(t = {}, e) {
1120
+ return Object.entries(t).map(([s, n]) => {
1118
1121
  if (!n || !n.value) return null;
1119
1122
  const o = j(n.value, e, "script"), r = P(o);
1120
- return `const ${t} = ${r};`;
1121
- }).filter((t) => !!t);
1122
- }
1123
- function mt(s = {}, e) {
1124
- return Object.values(s).map((t) => {
1125
- if (!t || !t.name) return null;
1126
- if (t.type === "mock") {
1127
- const n = t.mockTemplate && t.mockTemplate.value ? t.mockTemplate.value : "(params) => ({})", o = e ? j(n, e, "script") : n;
1128
- return `const ${t.name} = async (...args) => {
1123
+ return `const ${s} = ${r};`;
1124
+ }).filter((s) => !!s);
1125
+ }
1126
+ function dt(t = {}, e) {
1127
+ return Object.values(t).map((s) => {
1128
+ if (!s || !s.name) return null;
1129
+ if (s.type === "mock") {
1130
+ const n = s.mockTemplate && s.mockTemplate.value ? s.mockTemplate.value : "(params) => ({})", o = e ? j(n, e, "script") : n;
1131
+ return `const ${s.name} = async (...args) => {
1129
1132
  const mock = __provider.createMock(${o});
1130
1133
  return await mock.apply(null, args);
1131
1134
  };`;
1132
1135
  } else {
1133
- const n = t.transform && t.transform.value ? t.transform.value : "(res) => res", o = e ? j(n, e, "script") : n;
1134
- return `const ${t.name} = async (...args) => {
1135
- return await __provider.apis['${t.ref}'].apply(null, args).then(${o});
1136
+ const n = s.transform && s.transform.value ? s.transform.value : "(res) => res", o = e ? j(n, e, "script") : n;
1137
+ return `const ${s.name} = async (...args) => {
1138
+ return await __provider.apis['${s.ref}'].apply(null, args).then(${o});
1136
1139
  };`;
1137
1140
  }
1138
- }).filter((t) => !!t);
1141
+ }).filter((s) => !!s);
1139
1142
  }
1140
- function dt(s = [], e) {
1141
- return s.map((t) => {
1142
- if (!t || !t.handler || !t.handler.value) return null;
1143
- const n = t.source && t.source.value ? j(t.source.value, e, "script") : "() => null", o = P(n), r = j(
1144
- t.handler.value,
1143
+ function ht(t = [], e) {
1144
+ return t.map((s) => {
1145
+ if (!s || !s.handler || !s.handler.value) return null;
1146
+ const n = s.source && s.source.value ? j(s.source.value, e, "script") : "() => null", o = P(n), r = j(
1147
+ s.handler.value,
1145
1148
  e,
1146
1149
  "script"
1147
1150
  ), c = P(r), a = [];
1148
- t.deep && a.push("deep: true"), t.immediate && a.push("immediate: true"), t.flush && a.push(`flush: '${t.flush}'`);
1151
+ s.deep && a.push("deep: true"), s.immediate && a.push("immediate: true"), s.flush && a.push(`flush: '${s.flush}'`);
1149
1152
  const l = a.length > 0 ? `, { ${a.join(", ")} }` : "";
1150
1153
  return `watch(${o}, ${c}${l});`;
1151
- }).filter((t) => !!t);
1154
+ }).filter((s) => !!s);
1152
1155
  }
1153
- function ht(s = {}, e) {
1154
- return Object.entries(s).map(([t, n]) => {
1156
+ function gt(t = {}, e) {
1157
+ return Object.entries(t).map(([s, n]) => {
1155
1158
  let o;
1156
1159
  if (R(n)) {
1157
1160
  const r = j(
@@ -1161,15 +1164,15 @@ function ht(s = {}, e) {
1161
1164
  );
1162
1165
  o = P(r);
1163
1166
  } else S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n);
1164
- return `provide('${t}', ${o});`;
1167
+ return `provide('${s}', ${o});`;
1165
1168
  });
1166
1169
  }
1167
- function fe(s) {
1168
- let e = s.trim().replace(/;$/, "");
1170
+ function fe(t) {
1171
+ let e = t.trim().replace(/;$/, "");
1169
1172
  /^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim());
1170
- const t = e.match(/^(?:async\s+)?\([^)]*\)\s*=>\s*([\s\S]+)$/);
1171
- if (t) {
1172
- let o = t[1].trim();
1173
+ const s = e.match(/^(?:async\s+)?\([^)]*\)\s*=>\s*([\s\S]+)$/);
1174
+ if (s) {
1175
+ let o = s[1].trim();
1173
1176
  return o.startsWith("{") && o.endsWith("}") ? o = o.slice(1, -1).trim() : o = o.replace(/;$/, "") + ";", o;
1174
1177
  }
1175
1178
  const n = e.match(
@@ -1177,25 +1180,25 @@ function fe(s) {
1177
1180
  );
1178
1181
  return n ? n[1].trim() : e;
1179
1182
  }
1180
- function gt(s, e) {
1181
- if (!s || !s.value) return "";
1182
- const t = j(s.value, e, "script");
1183
- return fe(t);
1183
+ function vt(t, e) {
1184
+ if (!t || !t.value) return "";
1185
+ const s = j(t.value, e, "script");
1186
+ return fe(s);
1184
1187
  }
1185
- function vt(s = {}, e) {
1186
- const t = [];
1188
+ function $t(t = {}, e) {
1189
+ const s = [];
1187
1190
  for (const n of ["beforeCreate", "created"]) {
1188
- const o = s[n];
1191
+ const o = t[n];
1189
1192
  if (o && o.value) {
1190
1193
  const r = j(o.value, e, "script"), c = fe(r);
1191
- c && t.push(`// ${n}
1194
+ c && s.push(`// ${n}
1192
1195
  ${c}`);
1193
1196
  }
1194
1197
  }
1195
- return t.join(`
1198
+ return s.join(`
1196
1199
  `);
1197
1200
  }
1198
- const $t = {
1201
+ const bt = {
1199
1202
  beforeMount: "onBeforeMount",
1200
1203
  mounted: "onMounted",
1201
1204
  beforeUpdate: "onBeforeUpdate",
@@ -1207,7 +1210,7 @@ const $t = {
1207
1210
  renderTriggered: "onRenderTriggered",
1208
1211
  activated: "onActivated",
1209
1212
  deactivated: "onDeactivated"
1210
- }, bt = /* @__PURE__ */ new Set([
1213
+ }, _t = /* @__PURE__ */ new Set([
1211
1214
  "onBeforeMount",
1212
1215
  "onMounted",
1213
1216
  "onBeforeUpdate",
@@ -1219,7 +1222,7 @@ const $t = {
1219
1222
  "onRenderTriggered",
1220
1223
  "onActivated",
1221
1224
  "onDeactivated"
1222
- ]), _t = /* @__PURE__ */ new Set([
1225
+ ]), yt = /* @__PURE__ */ new Set([
1223
1226
  "onLoad",
1224
1227
  "onShow",
1225
1228
  "onReady",
@@ -1239,25 +1242,25 @@ const $t = {
1239
1242
  "onShareTimeline",
1240
1243
  "onAddToFavorites"
1241
1244
  ]);
1242
- function yt(s = {}, e) {
1243
- const t = [], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1244
- for (const [r, c] of Object.entries(s)) {
1245
+ function St(t = {}, e) {
1246
+ const s = [], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1247
+ for (const [r, c] of Object.entries(t)) {
1245
1248
  if (!c || !c.value || r === "created" || r === "beforeCreate") continue;
1246
- const a = $t[r] || r;
1247
- if (bt.has(a)) {
1249
+ const a = bt[r] || r;
1250
+ if (_t.has(a)) {
1248
1251
  const l = j(c.value, e, "script"), p = P(l);
1249
- t.push(`${a}(${p});`), n.add(a);
1250
- } else if (_t.has(a)) {
1252
+ s.push(`${a}(${p});`), n.add(a);
1253
+ } else if (yt.has(a)) {
1251
1254
  const l = j(c.value, e, "script"), p = P(l);
1252
- t.push(`${a}(${p});`), o.add(a);
1255
+ s.push(`${a}(${p});`), o.add(a);
1253
1256
  }
1254
1257
  }
1255
- return { statements: t, usedHooks: n, usedUniHooks: o };
1258
+ return { statements: s, usedHooks: n, usedUniHooks: o };
1256
1259
  }
1257
- function St(s) {
1260
+ function jt(t) {
1258
1261
  const {
1259
1262
  componentMap: e,
1260
- components: t,
1263
+ components: s,
1261
1264
  importBlocks: n,
1262
1265
  collectImports: o,
1263
1266
  platform: r,
@@ -1266,7 +1269,7 @@ function St(s) {
1266
1269
  globalApiImports: l,
1267
1270
  uniHookImports: p,
1268
1271
  easycomPackages: d
1269
- } = s, i = [
1272
+ } = t, i = [
1270
1273
  "@dcloudio/uni-h5",
1271
1274
  "uni-h5",
1272
1275
  "@dcloudio/uni-ui",
@@ -1274,13 +1277,13 @@ function St(s) {
1274
1277
  ], u = {
1275
1278
  vue: [...c]
1276
1279
  }, f = [], v = [], b = {};
1277
- for (const g of t) {
1280
+ for (const g of s) {
1278
1281
  const m = g.split(":")[0], h = e.get(m);
1279
1282
  if (!h || !h.package || h.parent || d.has(h.package)) continue;
1280
1283
  const y = u[h.package] ?? (u[h.package] = []), $ = (h.alias || "").split(".")[0] || h.name, w = m, I = $ !== w ? `${$} as ${w}` : $;
1281
1284
  y.push(I), b[$] = w, r === "uniapp" && i.includes(h.package) && f.push($);
1282
1285
  }
1283
- for (const g of t) {
1286
+ for (const g of s) {
1284
1287
  const m = g.split(":")[0], h = e.get(m);
1285
1288
  if (!h || !h.package || !h.parent || d.has(h.package)) continue;
1286
1289
  const y = h.parent, $ = b[y] ?? y, w = h.alias || "";
@@ -1298,7 +1301,7 @@ function St(s) {
1298
1301
  ","
1299
1302
  )}} from '${g}';`).concat(n), uniComponents: f, componentDeclarations: v };
1300
1303
  }
1301
- function jt(s, e = E, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
1304
+ function kt(t, e = E, s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
1302
1305
  const o = Object.entries(e), r = (c) => {
1303
1306
  if (c == null || typeof c != "object") return c;
1304
1307
  if (Array.isArray(c))
@@ -1309,18 +1312,18 @@ function jt(s, e = E, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set
1309
1312
  const i = p.replace(/\$/g, "\\$"), u = new RegExp(`this\\.${i}\\b`, "g");
1310
1313
  l = l.replace(u, d.replace);
1311
1314
  }
1312
- return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (p, d) => t.has(d) || n.has(d) ? d : p), { ...c, value: l };
1315
+ return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (p, d) => s.has(d) || n.has(d) ? d : p), { ...c, value: l };
1313
1316
  }
1314
1317
  const a = {};
1315
1318
  for (const [l, p] of Object.entries(c))
1316
1319
  a[l] = r(p);
1317
1320
  return a;
1318
1321
  };
1319
- return s.map(r);
1322
+ return t.map(r);
1320
1323
  }
1321
- function kt(s, e, t = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
1322
- const l = jt(
1323
- s,
1324
+ function wt(t, e, s = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
1325
+ const l = kt(
1326
+ t,
1324
1327
  r,
1325
1328
  c,
1326
1329
  a
@@ -1328,29 +1331,29 @@ function kt(s, e, t = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /
1328
1331
  return q(
1329
1332
  l,
1330
1333
  e,
1331
- t,
1334
+ s,
1332
1335
  n,
1333
1336
  o
1334
1337
  );
1335
1338
  }
1336
- function wt(s, e, t = "web") {
1337
- const { dsl: n } = s, o = et(e), r = tt(o), c = ot(n, r), a = st(n, r), l = nt(a, r), p = rt(a, r), d = p.__renderer__ || [];
1339
+ function It(t, e, s = "web") {
1340
+ const { dsl: n } = t, o = tt(e), r = st(o), c = ct(n, r), a = nt(n, r), l = rt(a, r), p = ot(a, r), d = p.__renderer__ || [];
1338
1341
  delete p.__renderer__;
1339
- const i = kt(
1342
+ const i = wt(
1340
1343
  n.nodes || [],
1341
1344
  e,
1342
1345
  Object.keys(n.computed || {}),
1343
- s.context,
1346
+ t.context,
1344
1347
  void 0,
1345
1348
  r,
1346
1349
  c.refs,
1347
1350
  c.computed
1348
1351
  ), u = i.importBlocks.map(
1349
1352
  (O) => `import ${O.name} from './${O.id}.vue';`
1350
- ), f = ct(n.refs || {}, c), v = at(n.reactives || {}, c), b = it(n.state || {}, c), k = pt(n.computed || {}, c), g = {
1353
+ ), f = at(n.refs || {}, c), v = it(n.reactives || {}, c), b = lt(n.state || {}, c), k = ft(n.computed || {}, c), g = {
1351
1354
  ...i.methods || {},
1352
1355
  ...n.methods || {}
1353
- }, m = ft(g, c), h = mt(n.dataSources || {}, c), y = dt(n.watch || [], c), $ = ut(n.inject || [], c), w = ht(n.provide || {}, c), I = lt(
1356
+ }, m = mt(g, c), h = dt(n.dataSources || {}, c), y = ht(n.watch || [], c), $ = pt(n.inject || [], c), w = gt(n.provide || {}, c), I = ut(
1354
1357
  n.composables || [],
1355
1358
  c
1356
1359
  ), C = /* @__PURE__ */ new Set();
@@ -1361,24 +1364,24 @@ function wt(s, e, t = "web") {
1361
1364
  const N = l.filter((O) => {
1362
1365
  const D = O.match(/^const\s+(\w+)\s*=/);
1363
1366
  return !(D && C.has(D[1]));
1364
- }), L = yt(n.lifeCycles || {}, c), me = vt(
1367
+ }), L = St(n.lifeCycles || {}, c), me = $t(
1365
1368
  n.lifeCycles || {},
1366
1369
  c
1367
- ), de = gt(n.setup, c), x = /* @__PURE__ */ new Set();
1370
+ ), de = vt(n.setup, c), x = /* @__PURE__ */ new Set();
1368
1371
  f.length > 0 && x.add("ref"), (v.length > 0 || b) && x.add("reactive"), k.length > 0 && x.add("computed"), y.length > 0 && x.add("watch"), $.length > 0 && x.add("inject"), w.length > 0 && x.add("provide");
1369
1372
  for (const O of L.usedHooks) x.add(O);
1370
- const he = t === "uniapp" ? Array.from(L.usedUniHooks) : [], { imports: ge, uniComponents: ve, componentDeclarations: $e } = St({
1373
+ const he = s === "uniapp" ? Array.from(L.usedUniHooks) : [], { imports: ge, uniComponents: ve, componentDeclarations: $e } = jt({
1371
1374
  componentMap: e,
1372
1375
  components: i.components,
1373
1376
  importBlocks: u,
1374
- collectImports: s.imports,
1375
- platform: t,
1377
+ collectImports: t.imports,
1378
+ platform: s,
1376
1379
  vueImports: Array.from(x),
1377
1380
  composableImports: I.imports,
1378
1381
  globalApiImports: p,
1379
1382
  uniHookImports: he,
1380
- easycomPackages: s.easycomPackages
1381
- }), be = le(s.urlSchemas), _e = ue(s.blockPlugins);
1383
+ easycomPackages: t.easycomPackages
1384
+ }), be = le(t.urlSchemas), _e = ue(t.blockPlugins);
1382
1385
  return {
1383
1386
  id: n.id,
1384
1387
  version: n.__VERSION__,
@@ -1419,19 +1422,19 @@ function wt(s, e, t = "web") {
1419
1422
  template: i.nodes.join(`
1420
1423
  `),
1421
1424
  css: n.css || "",
1422
- style: ie(s.style),
1425
+ style: ie(t.style),
1423
1426
  urlSchemas: be.join(`
1424
1427
  `),
1425
1428
  blockPlugins: _e.join(`
1426
1429
  `),
1427
1430
  uniComponents: ve,
1428
- renderer: t === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer",
1431
+ renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer",
1429
1432
  rendererImports: ["useProvider", ...d].join(", "),
1430
1433
  componentDeclarations: $e.join(`
1431
1434
  `)
1432
1435
  };
1433
1436
  }
1434
- const It = `
1437
+ const Ot = `
1435
1438
  // @ts-nocheck
1436
1439
  import { useProvider } from '<%= renderer %>';
1437
1440
  <%= imports %>
@@ -1463,7 +1466,7 @@ export default defineComponent({
1463
1466
  <% if(methods) { %> methods: { <%= methods %> }, <% } %>
1464
1467
  <% if(watch) { %> watch: { <%= watch %> }, <% } %> <%= lifeCycles %>
1465
1468
  });
1466
- `, Ot = `
1469
+ `, Ct = `
1467
1470
  <template>
1468
1471
  <%= template %>
1469
1472
  </template>
@@ -1474,7 +1477,7 @@ export default defineComponent({
1474
1477
  <%= css %>
1475
1478
  <%= style %>
1476
1479
  </style>
1477
- `, Ct = `// @ts-nocheck
1480
+ `, xt = `// @ts-nocheck
1478
1481
  import { <%= rendererImports %> } from '<%= renderer %>';<%= imports %>
1479
1482
  <% if(componentDeclarations) { %><%= componentDeclarations %><% } %>
1480
1483
  <% if(props) { %>const __props = defineProps({ <%= props %> });<% } else if(needsProps) { %>const __props = defineProps();<% } %>
@@ -1497,12 +1500,12 @@ const __provider = useProvider({ id: '<%= id %>', version: '<%= version %>' });
1497
1500
  <%= provide %>
1498
1501
  <%= lifeCycles %>
1499
1502
  <% if(expose) { %>defineExpose(<%= expose %>);<% } %>
1500
- `, xt = W(It), At = W(Ct), Pt = W(Ot);
1501
- async function Tt(s, e = /* @__PURE__ */ new Map(), t = [], n = "web", o) {
1502
- const r = s, c = typeof r.dsl == "object" && arguments.length === 1 ? r : {
1503
- dsl: s,
1503
+ `, At = W(Ot), Pt = W(xt), Et = W(Ct);
1504
+ async function Mt(t, e = /* @__PURE__ */ new Map(), s = [], n = "web", o) {
1505
+ const r = t, c = typeof r.dsl == "object" && arguments.length === 1 ? r : {
1506
+ dsl: t,
1504
1507
  componentMap: e,
1505
- dependencies: t,
1508
+ dependencies: s,
1506
1509
  platform: n,
1507
1510
  formatterDisabled: o
1508
1511
  }, {
@@ -1516,17 +1519,17 @@ async function Tt(s, e = /* @__PURE__ */ new Map(), t = [], n = "web", o) {
1516
1519
  } = c, v = new Ne(Ie(a), p), b = a.apiMode === "composition";
1517
1520
  let k, g, m, h;
1518
1521
  if (b) {
1519
- const $ = wt(v, l, d);
1520
- h = At($), k = $.template || `
1522
+ const $ = It(v, l, d);
1523
+ h = Pt($), k = $.template || `
1521
1524
  <!--组件模版内容-->
1522
1525
  `, g = $.css, m = $.style;
1523
1526
  } else {
1524
- const $ = Ye(v, l, d);
1525
- h = xt($), k = $.template || `
1527
+ const $ = Ke(v, l, d);
1528
+ h = At($), k = $.template || `
1526
1529
  <!--组件模版内容-->
1527
1530
  `, g = $.css, m = $.style;
1528
1531
  }
1529
- const y = Pt({
1532
+ const y = Et({
1530
1533
  template: k,
1531
1534
  css: await G(g, i) || `
1532
1535
  /* 组件样式内容 */
@@ -1539,12 +1542,12 @@ async function Tt(s, e = /* @__PURE__ */ new Map(), t = [], n = "web", o) {
1539
1542
  });
1540
1543
  return await K(y, i).catch(($) => ($.content = y, Promise.reject($)));
1541
1544
  }
1542
- async function Mt(s) {
1545
+ async function Rt(t) {
1543
1546
  const e = `
1544
1547
  <template>
1545
1548
  <div>
1546
1549
  <h3>源码模式页面</h3>
1547
- <div>文件路径:/.vtj/vue/${s.id}.vue</div>
1550
+ <div>文件路径:/.vtj/vue/${t.id}.vue</div>
1548
1551
  </div>
1549
1552
  </template>
1550
1553
  <script lang="ts" setup>
@@ -1557,13 +1560,13 @@ async function Mt(s) {
1557
1560
  export {
1558
1561
  E as GLOBAL_API_MAP,
1559
1562
  pe as UI_GLOBAL_API_MAPS,
1560
- Ke as UI_PACKAGES,
1561
- Bt as VTJ_CODER_VERSION,
1562
- tt as buildEffectiveApiMap,
1563
- Mt as createEmptyPage,
1563
+ et as UI_PACKAGES,
1564
+ Tt as VTJ_CODER_VERSION,
1565
+ st as buildEffectiveApiMap,
1566
+ Rt as createEmptyPage,
1564
1567
  G as cssFormatter,
1565
- et as detectUIPackage,
1566
- Tt as generator,
1568
+ tt as detectUIPackage,
1569
+ Mt as generator,
1567
1570
  xe as tsFormatter,
1568
1571
  K as vueFormatter
1569
1572
  };