@vtj/coder 0.19.22 → 0.19.23-alpha.0

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,25 +1,25 @@
1
- import { mitt as ye, base64 as Se, dedupArray as M, toArray as je, kebabCase as J, camelCase as A, isPlainObject as ke, isString as we, template as H, cloneDeep as Ie } from "@vtj/base";
1
+ import { mitt as Ie, base64 as Oe, dedupArray as M, toArray as Ce, kebabCase as J, camelCase as E, isPlainObject as xe, isString as Ae, template as q, cloneDeep as Pe } from "@vtj/base";
2
2
  import { format as V } from "prettier/standalone";
3
- import * as Oe from "prettier/plugins/html";
4
- import * as X from "prettier/plugins/babel";
5
- import * as Y from "prettier/plugins/postcss";
6
- import * as K from "prettier/plugins/estree";
3
+ import * as Ee from "prettier/plugins/html";
4
+ import * as Y from "prettier/plugins/babel";
5
+ import * as K from "prettier/plugins/postcss";
6
+ import * as ee from "prettier/plugins/estree";
7
7
  /**!
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.19.22
11
+ * @version 0.19.23-alpha.0
12
12
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
13
13
  */
14
- const Tt = "0.19.22";
14
+ const Jt = "0.19.23-alpha.0";
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.19.22
19
+ * @version 0.19.23-alpha.0
20
20
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
21
21
  */
22
- const Ce = [
22
+ const Be = [
23
23
  "slot",
24
24
  "template",
25
25
  "component",
@@ -32,8 +32,45 @@ const Ce = [
32
32
  "span",
33
33
  "a"
34
34
  ];
35
- ye();
36
- const q = {
35
+ Ie();
36
+ function Ne(t) {
37
+ return (t || "").trim().replace(/\\/g, "/").replace(/^\/+|\/+$/g, "").replace(/\.vue$/i, "");
38
+ }
39
+ function te(t) {
40
+ return Ne(t.filePath) || t.id;
41
+ }
42
+ function W(t, e = "web") {
43
+ const s = te(t);
44
+ return t.type === "block" ? `src/components/${s}.vue` : e === "uniapp" ? `src/pages/${s}.vue` : `src/views/${s}.vue`;
45
+ }
46
+ function se(t) {
47
+ return `@/components/${te(t)}.vue`;
48
+ }
49
+ function ne(t = []) {
50
+ const e = [];
51
+ for (const s of t)
52
+ s.dir || e.push(s), s.children?.length && e.push(...ne(s.children));
53
+ return e;
54
+ }
55
+ function Me(t) {
56
+ const e = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
57
+ for (const r of t.blocks || []) {
58
+ const c = W(r, t.platform).toLowerCase();
59
+ e.set(r.id, r), o.set(c, r.id), s.set(se(r).toLowerCase(), r.id);
60
+ }
61
+ for (const r of ne(t.pages))
62
+ e.set(r.id, r), n.set(
63
+ W(r, t.platform).toLowerCase(),
64
+ r.id
65
+ );
66
+ return {
67
+ byId: e,
68
+ blockIdByImportPath: s,
69
+ blockIdBySourcePath: o,
70
+ pageIdBySourcePath: n
71
+ };
72
+ }
73
+ const G = {
37
74
  arrowParens: "always",
38
75
  bracketSpacing: !0,
39
76
  bracketSameLine: !0,
@@ -54,61 +91,61 @@ const q = {
54
91
  vueIndentScriptAndStyle: !0,
55
92
  removeBlankLines: !0
56
93
  };
57
- async function ee(t, e) {
94
+ async function re(t, e) {
58
95
  return e ? t : await V(t, {
59
96
  parser: "vue",
60
- ...q,
61
- plugins: [Oe, X, K, Y]
97
+ ...G,
98
+ plugins: [Ee, Y, ee, K]
62
99
  });
63
100
  }
64
- async function xe(t, e) {
101
+ async function Te(t, e) {
65
102
  if (e) return t;
66
103
  try {
67
104
  return (await V(t, {
68
105
  parser: "babel-ts",
69
- ...q,
70
- plugins: [X, K]
106
+ ...G,
107
+ plugins: [Y, ee]
71
108
  })).replace(/;\n$/gi, "");
72
109
  } catch (s) {
73
110
  return console.warn(s), t;
74
111
  }
75
112
  }
76
- async function z(t, e) {
113
+ async function Z(t, e) {
77
114
  return e ? t : V(t, {
78
115
  parser: "scss",
79
- ...q,
80
- plugins: [Y]
116
+ ...G,
117
+ plugins: [K]
81
118
  });
82
119
  }
83
- function R(t) {
120
+ function T(t) {
84
121
  return t && t.type === "JSExpression";
85
122
  }
86
- function U(t) {
123
+ function L(t) {
87
124
  return typeof t == "object" && t && t.type === "JSFunction";
88
125
  }
89
- function S(t) {
90
- return R(t) || U(t);
126
+ function j(t) {
127
+ return T(t) || L(t);
91
128
  }
92
- function te(t) {
129
+ function oe(t) {
93
130
  return t.replace(new RegExp("this.", "g"), "");
94
131
  }
95
- function W(t) {
132
+ function H(t) {
96
133
  return t.replace(/this\.context\??\./g, "");
97
134
  }
98
- function _(t, e = !0, s = !0, n = [], o = !0) {
135
+ function _(t, e = !0, s = !0, o = [], n = !0) {
99
136
  let r = t;
100
- return S(t) ? (r = t.value.trim().replace(/;$/, ""), o && (r = r.replace(/\"/g, "'"))) : r = e ? JSON.stringify(r) : t, r = D(r, n), s ? te(W(r)) : W(r);
137
+ return j(t) ? (r = t.value.trim().replace(/;$/, ""), n && (r = r.replace(/\"/g, "'"))) : r = e ? JSON.stringify(r) : t, r = R(r, o), s ? oe(H(r)) : H(r);
101
138
  }
102
- function D(t = "", e = []) {
139
+ function R(t = "", e = []) {
103
140
  let s = t;
104
- for (const n of e)
141
+ for (const o of e)
105
142
  s = s.replace(
106
- new RegExp(`this.${n}.value`, "g"),
107
- `this.${n}`
143
+ new RegExp(`this.${o}.value`, "g"),
144
+ `this.${o}`
108
145
  );
109
146
  return s;
110
147
  }
111
- function se(t) {
148
+ function ce(t) {
112
149
  let e = t.trim().replace(/;$/, "");
113
150
  if (e = /^\((\(|async|function)/.test(e) ? e.substring(1, e.length - 1) : e, e.startsWith("{")) return e;
114
151
  if (e.startsWith("async function"))
@@ -116,34 +153,34 @@ function se(t) {
116
153
  else if (e.startsWith("function"))
117
154
  e = e.replace(/^function/, "");
118
155
  else {
119
- const o = /^(async\s)?\([\w]*\)\s+\=\>\s([\w\W]+)/, r = e.match(o);
156
+ const n = /^(async\s)?\([\w]*\)\s+\=\>\s([\w\W]+)/, r = e.match(n);
120
157
  r && r[2] && (r[2].startsWith("{") || (e = e.replace(r[2], `{ return ${r[2]} }`))), e = e.replace("=>", "");
121
158
  }
122
159
  return e;
123
160
  }
124
- function Ae(t = {}) {
161
+ function Re(t = {}) {
125
162
  return Object.entries(t).map(([e, s]) => `"${e}": ${_(s)}`);
126
163
  }
127
- function ne(t = {}, e = !1) {
164
+ function ae(t = {}, e = !1) {
128
165
  const s = Object.keys(t);
129
- return e ? s.map((n) => "." + n) : s;
166
+ return e ? s.map((o) => "." + o) : s;
130
167
  }
131
- function Pe(t) {
168
+ function Le(t) {
132
169
  let e = "";
133
170
  for (var s in t)
134
171
  if (t.hasOwnProperty(s)) {
135
- var n = t[s];
136
- e += s + ": " + n + ";";
172
+ var o = t[s];
173
+ e += s + ": " + o + ";";
137
174
  }
138
175
  return e;
139
176
  }
140
- function Ee(t = [], e = []) {
177
+ function De(t = [], e = []) {
141
178
  return t.filter((s) => !e.includes(s));
142
179
  }
143
- function Z(t) {
144
- return Se(JSON.stringify(t));
180
+ function Q(t) {
181
+ return Oe(JSON.stringify(t));
145
182
  }
146
- class Ne {
183
+ class Ue {
147
184
  constructor(e, s) {
148
185
  this.dsl = e, this.dependencies = s, this.collectEasycom(), this.libraryRegex = this.collectLibrary(), this.walk(e), this.walkNodes(e), this.members = this.getLibraryMember();
149
186
  }
@@ -174,16 +211,16 @@ class Ne {
174
211
  collectImport(e) {
175
212
  const s = e.split(".");
176
213
  if (s.length === 4) {
177
- const n = s.pop(), o = s.join(".") + ".", r = s.pop();
178
- if (n && r) {
214
+ const o = s.pop(), n = s.join(".") + ".", r = s.pop();
215
+ if (o && r) {
179
216
  const c = this.dependencies.find(
180
217
  (a) => a.library === r
181
218
  )?.package;
182
- c && !this.easycomPackages.has(c) && (this.imports[c] || (this.imports[c] = /* @__PURE__ */ new Set())).add(n);
219
+ c && !this.easycomPackages.has(c) && (this.imports[c] || (this.imports[c] = /* @__PURE__ */ new Set())).add(o);
183
220
  }
184
221
  return {
185
- name: n,
186
- path: o,
222
+ name: o,
223
+ path: n,
187
224
  library: r
188
225
  };
189
226
  }
@@ -192,46 +229,46 @@ class Ne {
192
229
  // 代码中包含依赖库的引用,需要从代码中移除
193
230
  replaceLibraryPath(e) {
194
231
  const { libraryRegex: s } = this;
195
- let n = e.value;
196
- for (const o of s) {
197
- const r = e.value?.match(o) || [];
232
+ let o = e.value;
233
+ for (const n of s) {
234
+ const r = e.value?.match(n) || [];
198
235
  for (const c of r) {
199
236
  const a = this.collectImport(c);
200
237
  if (a) {
201
238
  const l = a.path.replace(/\$/g, "\\$");
202
- n = n.replace(new RegExp(l, "g"), "");
239
+ o = o.replace(new RegExp(l, "g"), "");
203
240
  }
204
241
  }
205
242
  }
206
- return n;
243
+ return o;
207
244
  }
208
245
  walk(e) {
209
- const s = (n) => {
210
- if (!n || typeof n != "object") return;
211
- if (Array.isArray(n)) {
212
- for (let r of n)
246
+ const s = (o) => {
247
+ if (!o || typeof o != "object") return;
248
+ if (Array.isArray(o)) {
249
+ for (let r of o)
213
250
  s(r);
214
251
  return;
215
252
  }
216
- const o = Object.values(n);
217
- for (const r of o)
218
- S(r) ? r.value = this.replaceLibraryPath(r) : s(r);
253
+ const n = Object.values(o);
254
+ for (const r of n)
255
+ j(r) ? r.value = this.replaceLibraryPath(r) : s(r);
219
256
  };
220
257
  s(e);
221
258
  }
222
259
  getLibraryMember(e = []) {
223
260
  let s = [...e];
224
- const n = { ...this.imports };
225
- delete n["uni-h5"], delete n["@dcloudio/uni-h5"], delete n["uni-ui"], delete n["@dcloudio/uni-ui"];
226
- for (const o of Object.values(n))
227
- s = s.concat(Array.from(o));
261
+ const o = { ...this.imports };
262
+ delete o["uni-h5"], delete o["@dcloudio/uni-h5"], delete o["uni-ui"], delete o["@dcloudio/uni-ui"];
263
+ for (const n of Object.values(o))
264
+ s = s.concat(Array.from(n));
228
265
  return M(s);
229
266
  }
230
267
  collectContext(e, s) {
231
- const n = new Set(s?.id ? this.context[s.id] : []), o = (e.directives || []).find((a) => a.name === "vFor");
232
- let r = new Set(Array.from(n));
233
- if (o) {
234
- const { item: a = "item", index: l = "index" } = o.iterator || {};
268
+ const o = new Set(s?.id ? this.context[s.id] : []), n = (e.directives || []).find((a) => a.name === "vFor");
269
+ let r = new Set(Array.from(o));
270
+ if (n) {
271
+ const { item: a = "item", index: l = "index" } = n.iterator || {};
235
272
  r = /* @__PURE__ */ new Set([a, l, ...Array.from(r)]);
236
273
  }
237
274
  const c = e.slot;
@@ -242,7 +279,7 @@ class Ne {
242
279
  this.context[e.id] = r;
243
280
  }
244
281
  collectStyle(e) {
245
- e.id && e.props?.style && Object.keys(e.props.style).length && !S(e.props.style) && (this.style[`.${e.name}_${e.id}`] = e.props.style);
282
+ e.id && e.props?.style && Object.keys(e.props.style).length && !j(e.props.style) && (this.style[`.${e.name}_${e.id}`] = e.props.style);
246
283
  }
247
284
  collectUrlSchema(e) {
248
285
  typeof e.from == "object" && e.from.type === "UrlSchema" && (this.urlSchemas[e.name] = e.from);
@@ -251,76 +288,76 @@ class Ne {
251
288
  typeof e.from == "object" && e.from.type === "Plugin" && (this.blockPlugins[e.name] = e.from);
252
289
  }
253
290
  walkNodes(e) {
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));
291
+ const s = (o, n) => {
292
+ this.collectContext(o, n), this.collectStyle(o), this.collectUrlSchema(o), this.collectBlockPlugin(o), Array.isArray(o.children) && o.children.forEach((r) => s(r, o));
256
293
  };
257
- Array.isArray(e.nodes) && e.nodes.forEach((n) => s(n));
294
+ Array.isArray(e.nodes) && e.nodes.forEach((o) => s(o));
258
295
  }
259
296
  }
260
- function Be(t = {}) {
297
+ function Fe(t = {}) {
261
298
  return Object.entries(t).map(([e, s]) => {
262
- const n = _(s, !1, !0, [], !1);
263
- return `${e}:${n}`;
299
+ const o = _(s, !1, !0, [], !1);
300
+ return `${e}:${o}`;
264
301
  });
265
302
  }
266
- function Te(t = []) {
303
+ function Je(t = []) {
267
304
  return t.map((e) => `${e.name}: {
268
305
  from: '${e.from || e.name}',
269
306
  default: ${_(e.default, !0, !1, [], !1)}
270
307
  }`);
271
308
  }
272
- function re(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}: {
309
+ function ie(t = []) {
310
+ const e = (s) => s ? `[${Ce(s).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
311
+ return t.map((s) => typeof s == "string" ? `${s}: {}` : (j(s.default) && !s.default.value && (s.default.value = "undefined"), `${s.name}: {
275
312
  type:${e(s.type)},
276
313
  required: ${_(!!s.required, !0, !1, [], !1)},
277
314
  default: ${s.default ? _(s.default, !0, !1, [], !1) : "undefined"}
278
315
  }`));
279
316
  }
280
- function oe(t = []) {
317
+ function le(t = []) {
281
318
  return t.map((e) => `'${typeof e == "string" ? e : e.name}'`);
282
319
  }
283
320
  function F(t = {}, e = []) {
284
- return Object.entries(t).map(([s, n]) => {
285
- let o = se(
286
- _(n, !1, !1, [], !1)
321
+ return Object.entries(t).map(([s, o]) => {
322
+ let n = ce(
323
+ _(o, !1, !1, [], !1)
287
324
  );
288
- return o = D(o, e)?.trim(), o.startsWith("async") ? `async ${s}${o.replace(/^async/, "")}` : o.startsWith("(") || o.startsWith("{") ? `${s}${o}` : null;
325
+ return n = R(n, e)?.trim(), n.startsWith("async") ? `async ${s}${n.replace(/^async/, "")}` : n.startsWith("(") || n.startsWith("{") ? `${s}${n}` : null;
289
326
  }).filter((s) => !!s);
290
327
  }
291
- function Me(t = [], e = []) {
328
+ function We(t = [], e = []) {
292
329
  const s = t.reduce(
293
- (r, c) => (c.id && U(c.source) && (r[`watcher_${c.id}`] = c.source), r),
330
+ (r, c) => (c.id && L(c.source) && (r[`watcher_${c.id}`] = c.source), r),
294
331
  {}
295
- ), n = F(s, e), o = t.map((r) => r.handler && r.handler.value ? `watcher_${r.id}: {
332
+ ), o = F(s, e), n = t.map((r) => r.handler && r.handler.value ? `watcher_${r.id}: {
296
333
  deep: ${r.deep},
297
334
  immediate:${r.immediate},
298
- handler${se(r.handler.value)}
335
+ handler${ce(r.handler.value)}
299
336
  }` : null).filter((r) => !!r);
300
337
  return {
301
- computed: n,
302
- watches: o
338
+ computed: o,
339
+ watches: n
303
340
  };
304
341
  }
305
- function Re(t = {}) {
342
+ function He(t = {}) {
306
343
  return Object.values(t).map((e) => {
307
344
  if (e.type === "mock") {
308
- const s = U(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
345
+ const s = L(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
309
346
  return `async ${e.name}(...args) {
310
- // DataSource: ${Z(e)}
347
+ // DataSource: ${Q(e)}
311
348
  const mock = this.provider.createMock(${s});
312
349
  return await mock.apply(this, args);
313
350
  }`;
314
351
  } else {
315
- const s = U(e.transform) && e.transform.value || "(res) => res";
352
+ const s = L(e.transform) && e.transform.value || "(res) => res";
316
353
  return `async ${e.name}(...args) {
317
- // DataSource: ${Z(e)}
354
+ // DataSource: ${Q(e)}
318
355
  return await this.provider.apis['${e.ref}'].apply(this, args).then(${s});
319
356
  }`;
320
357
  }
321
358
  });
322
359
  }
323
- const De = [
360
+ const qe = [
324
361
  "img",
325
362
  "input",
326
363
  "br",
@@ -335,7 +372,7 @@ const De = [
335
372
  "source",
336
373
  "track",
337
374
  "wbr"
338
- ], Q = [
375
+ ], X = [
339
376
  "vIf",
340
377
  "vElseIf",
341
378
  "vElse",
@@ -345,238 +382,238 @@ const De = [
345
382
  "vBind",
346
383
  "vHtml"
347
384
  ];
348
- function G(t, e, s = [], n = {}, o, r = /* @__PURE__ */ new Set()) {
385
+ function z(t, e, s = [], o = {}, n, r = /* @__PURE__ */ new Set()) {
349
386
  const c = [];
350
387
  let a = {}, l = [];
351
- const p = [];
352
- let m = [];
353
- return Le(t).forEach((u) => {
388
+ const m = [];
389
+ let p = [];
390
+ return Ge(t).forEach((u) => {
354
391
  const f = [];
355
392
  for (const g of u.children) {
356
- let { id: w, name: d, invisible: v, from: h } = g;
357
- if (v)
393
+ let { id: C, name: h, invisible: $, from: d } = g;
394
+ if ($)
358
395
  continue;
359
- const y = Fe(d, e, h);
360
- y && l.push(y), ce(h) && m.push({ id: h.id, name: d });
361
- const { props: $, events: k } = qe(
396
+ const y = ze(h, e, d);
397
+ y && l.push(y), ue(d) && p.push({ id: d.id, name: h });
398
+ const { props: S, events: w } = Ke(
362
399
  g,
363
- w,
400
+ C,
364
401
  g.props,
365
402
  g.events,
366
- n,
403
+ o,
367
404
  s
368
- ), C = Ge(
405
+ ), I = et(
369
406
  g.directives,
370
407
  s,
371
- p
372
- ).join(" "), O = g.children ? Qe(
408
+ m
409
+ ).join(" "), v = g.children ? nt(
373
410
  g.children,
374
411
  s,
375
412
  e,
376
- n,
413
+ o,
377
414
  g,
378
415
  r
379
416
  ) : "";
380
- let N = "";
381
- typeof O == "string" ? N = O : (N = (O?.nodes || []).join(`
382
- `), Object.assign(a, O?.methods || {}), l = l.concat(O?.components || []), m = m.concat(O?.importBlocks || []));
383
- const B = h || e.get(d)?.package, T = r.has(B) ? J(d) : ["@dcloudio/uni-h5", "@dcloudio/uni-ui"].includes(B) ? J(d) : ae(h) || ie(h) ? "component" : d;
417
+ let x = "";
418
+ typeof v == "string" ? x = v : (x = (v?.nodes || []).join(`
419
+ `), Object.assign(a, v?.methods || {}), l = l.concat(v?.components || []), p = p.concat(v?.importBlocks || []));
420
+ const D = d || e.get(h)?.package, A = r.has(D) ? J(h) : ["@dcloudio/uni-h5", "@dcloudio/uni-ui"].includes(D) ? J(h) : pe(d) || fe(d) ? "component" : h;
384
421
  f.push(
385
- De.includes(T) ? `<${T} ${C} ${$} ${k} />` : `<${T} ${C} ${$} ${k}>${N ? `
386
- ` + N.trim() : ""}</${T}>`
422
+ qe.includes(A) ? `<${A} ${I} ${S} ${w} />` : `<${A} ${I} ${S} ${w}>${x ? `
423
+ ` + x.trim() : ""}</${A}>`
387
424
  );
388
425
  }
389
- const b = Xe(u.slot, f.join(`
390
- `), o?.id);
426
+ const b = rt(u.slot, f.join(`
427
+ `), n?.id);
391
428
  c.push(b);
392
429
  }), {
393
430
  nodes: c,
394
431
  methods: a,
395
- directives: Ue(p),
432
+ directives: Ve(m),
396
433
  components: M(l),
397
- importBlocks: M(m, "id")
434
+ importBlocks: M(p, "id")
398
435
  };
399
436
  }
400
- function Ue(t) {
437
+ function Ve(t) {
401
438
  return M(t).map((e) => `${e.startsWith("v") ? e.substring(1) : e}:${e}`);
402
439
  }
403
- function Le(t = []) {
440
+ function Ge(t = []) {
404
441
  const e = /* @__PURE__ */ new Map();
405
442
  for (const s of t) {
406
- const n = typeof s.slot == "string" ? s.slot : s.slot?.name, o = e.get(n);
407
- o ? o.children.push(s) : e.set(n, { slot: s.slot, children: [s] });
443
+ const o = typeof s.slot == "string" ? s.slot : s.slot?.name, n = e.get(o);
444
+ n ? n.children.push(s) : e.set(o, { slot: s.slot, children: [s] });
408
445
  }
409
446
  return e;
410
447
  }
411
- function Fe(t, e, s) {
412
- if (Ce.includes(t)) return null;
413
- const n = e.get(t);
414
- if (n && n.alias) {
415
- const o = n.parent ? `${n.parent}.${n.alias}` : n.alias;
416
- return `${t}: ${o}`;
448
+ function ze(t, e, s) {
449
+ if (Be.includes(t)) return null;
450
+ const o = e.get(t);
451
+ if (o && o.alias) {
452
+ const n = o.parent ? `${o.parent}.${o.alias}` : o.alias;
453
+ return `${t}: ${n}`;
417
454
  }
418
- return ce(s) || n ? t : null;
455
+ return ue(s) || o ? t : null;
419
456
  }
420
- function ce(t) {
457
+ function ue(t) {
421
458
  return !!t && typeof t == "object" && t.type === "Schema";
422
459
  }
423
- function ae(t) {
460
+ function pe(t) {
424
461
  return typeof t == "object" && t.type === "UrlSchema";
425
462
  }
426
- function ie(t) {
463
+ function fe(t) {
427
464
  return typeof t == "object" && t.type === "Plugin";
428
465
  }
429
- function Je(t, e, s = []) {
430
- return t === "style" ? S(e) ? `:style="${_({
466
+ function Ze(t, e, s = []) {
467
+ return t === "style" ? j(e) ? `:style="${_({
431
468
  ...e,
432
- value: D(e.value, s)
433
- })}"` : "" : t === "__class" && S(e) ? `:class="${_({
469
+ value: R(e.value, s)
470
+ })}"` : "" : t === "__class" && j(e) ? `:class="${_({
434
471
  ...e,
435
- value: D(e.value, s)
436
- })}"` : typeof e == "string" ? `${t}="${e}"` : S(e) ? `:${t}="${_({
472
+ value: R(e.value, s)
473
+ })}"` : typeof e == "string" ? `${t}="${e}"` : j(e) ? `:${t}="${_({
437
474
  ...e,
438
- value: D(e.value, s)
439
- })}"` : ke(e) ? `:${t}='{${Ae(
475
+ value: R(e.value, s)
476
+ })}"` : xe(e) ? `:${t}='{${Re(
440
477
  e
441
478
  ).join(", ")}}'` : `:${t}='${JSON.stringify(e)}'`;
442
479
  }
443
- function We(t, e = {}, s = []) {
480
+ function Qe(t, e = {}, s = []) {
444
481
  if (!!Object.keys(e.style || {}).length) {
445
482
  const r = `${t.name}_${t.id}`;
446
- 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;
483
+ e.class ? typeof e.class == "string" ? e.class = [e.class, r].join(" ") : (e.__class = e.class, e.class = r) : e.class = r, j(e.style) || delete e.style;
447
484
  }
448
- const o = t.from;
449
- return (ae(o) || ie(o)) && (e.is = {
485
+ const n = t.from;
486
+ return (pe(n) || fe(n)) && (e.is = {
450
487
  type: "JSExpression",
451
488
  value: t.name
452
- }), Object.entries(e).map(([r, c]) => Je(r, c, s));
489
+ }), Object.entries(e).map(([r, c]) => Ze(r, c, s));
453
490
  }
454
- function He(t, e, s) {
455
- const n = ne(e.modifiers, !0);
456
- return `@${t}${n.join("")}="${s}"`;
491
+ function Xe(t, e, s) {
492
+ const o = ae(e.modifiers, !0);
493
+ return `@${t}${o.join("")}="${s}"`;
457
494
  }
458
- function Ve(t, e = {}, s = {}) {
459
- const n = {};
495
+ function Ye(t, e = {}, s = {}) {
496
+ const o = {};
460
497
  return {
461
498
  binders: Object.entries(e).map(([r, c]) => {
462
- const a = te(W(c.handler.value)).replace(
499
+ const a = oe(H(c.handler.value)).replace(
463
500
  /\"/g,
464
501
  "'"
465
502
  );
466
- return He(r, c, a);
503
+ return Xe(r, c, a);
467
504
  }),
468
- handlers: n
505
+ handlers: o
469
506
  };
470
507
  }
471
- function qe(t, e, s = {}, n = {}, o = {}, r) {
472
- const { binders: c, handlers: a } = Ve(e, n, o);
508
+ function Ke(t, e, s = {}, o = {}, n = {}, r) {
509
+ const { binders: c, handlers: a } = Ye(e, o, n);
473
510
  return {
474
- props: We(t, s, r).join(" "),
511
+ props: Qe(t, s, r).join(" "),
475
512
  handlers: a,
476
513
  binders: c,
477
514
  events: c.join(" ")
478
515
  };
479
516
  }
480
- function Ge(t = [], e = [], s = []) {
481
- const n = [], {
482
- vIf: o,
517
+ function et(t = [], e = [], s = []) {
518
+ const o = [], {
519
+ vIf: n,
483
520
  vElse: r,
484
521
  vElseIf: c,
485
522
  vShow: a,
486
523
  vModels: l,
487
- vFor: p,
488
- vBind: m,
524
+ vFor: m,
525
+ vBind: p,
489
526
  vHtml: i,
490
527
  customDirectives: u
491
- } = ze(t);
492
- if (o && n.push(`v-if="${_(o.value, !0, !0, e)}"`), c && n.push(
528
+ } = tt(t);
529
+ if (n && o.push(`v-if="${_(n.value, !0, !0, e)}"`), c && o.push(
493
530
  `v-else-if="${_(c.value, !0, !0, e)}"`
494
- ), r && n.push("v-else"), a && n.push(
531
+ ), r && o.push("v-else"), a && o.push(
495
532
  `v-show="${_(a.value, !0, !0, e)}"`
496
- ), m && n.push(
497
- `v-bind="${_(m.value, !0, !0, e)}"`
533
+ ), p && o.push(
534
+ `v-bind="${_(p.value, !0, !0, e)}"`
498
535
  ), l.forEach((f) => {
499
- const b = ne(f.modifiers, !0), g = f.arg ? R(f.arg) ? `:[${_(f.arg, !0, !0, e)}]` : `:${f.arg}` : "";
500
- n.push(
536
+ const b = ae(f.modifiers, !0), g = f.arg ? T(f.arg) ? `:[${_(f.arg, !0, !0, e)}]` : `:${f.arg}` : "";
537
+ o.push(
501
538
  `v-model${g}${b}="${_(f.value, !0, !0, e)}"`
502
539
  );
503
- }), p) {
504
- const { item: f, index: b } = { item: "item", index: "index", ...p.iterator };
505
- n.push(
506
- `v-for="(${f}, ${b}) in ${_(p.value, !0, !0, e)}"`
540
+ }), m) {
541
+ const { item: f, index: b } = { item: "item", index: "index", ...m.iterator };
542
+ o.push(
543
+ `v-for="(${f}, ${b}) in ${_(m.value, !0, !0, e)}"`
507
544
  );
508
545
  }
509
- return i && n.push(
546
+ return i && o.push(
510
547
  `v-html="${_(i.value, !0, !0, e)}"`
511
548
  ), u && u.length && u.forEach((f) => {
512
549
  if (!f.name) return;
513
550
  let b = "", g = "";
514
- R(f.name) ? (g = _(f.name, !0, !0, e), s.push(g)) : g = f.name;
515
- const w = g?.startsWith("v") ? J(g) : J("v-" + g);
516
- if (b += w, f.arg && (R(f.arg) ? b += `:[${_(f.name, !0, !0, e)}]` : b += `:${f.arg}`), f.modifiers) {
517
- const d = Object.keys(f.modifiers);
518
- d.length && (b += d.map((v) => "." + v));
551
+ T(f.name) ? (g = _(f.name, !0, !0, e), s.push(g)) : g = f.name;
552
+ const C = g?.startsWith("v") ? J(g) : J("v-" + g);
553
+ if (b += C, f.arg && (T(f.arg) ? b += `:[${_(f.name, !0, !0, e)}]` : b += `:${f.arg}`), f.modifiers) {
554
+ const h = Object.keys(f.modifiers);
555
+ h.length && (b += h.map(($) => "." + $));
519
556
  }
520
- f.value ? n.push(
557
+ f.value ? o.push(
521
558
  `${b}="${_(f.value, !0, !0, e)}"`
522
- ) : n.push(b);
523
- }), n;
559
+ ) : o.push(b);
560
+ }), o;
524
561
  }
525
- function ze(t = []) {
562
+ function tt(t = []) {
526
563
  const e = t.filter(
527
- (i) => Q.includes(i.name)
564
+ (i) => X.includes(i.name)
528
565
  ), s = t.filter(
529
- (i) => !Q.includes(i.name)
530
- ), n = e.find(
531
- (i) => A(i.name) === "vIf"
566
+ (i) => !X.includes(i.name)
532
567
  ), o = e.find(
533
- (i) => A(i.name) === "vElseIf"
568
+ (i) => E(i.name) === "vIf"
569
+ ), n = e.find(
570
+ (i) => E(i.name) === "vElseIf"
534
571
  ), r = e.find(
535
- (i) => A(i.name) === "vElse"
572
+ (i) => E(i.name) === "vElse"
536
573
  ), c = e.find(
537
- (i) => A(i.name) === "vFor"
574
+ (i) => E(i.name) === "vFor"
538
575
  ), a = e.find(
539
- (i) => A(i.name) === "vShow"
576
+ (i) => E(i.name) === "vShow"
540
577
  ), l = e.find(
541
- (i) => A(i.name) === "vBind"
542
- ), p = e.find(
543
- (i) => A(i.name) === "vHtml"
544
- ), m = e.filter(
545
- (i) => A(i.name) === "vModel"
578
+ (i) => E(i.name) === "vBind"
579
+ ), m = e.find(
580
+ (i) => E(i.name) === "vHtml"
581
+ ), p = e.filter(
582
+ (i) => E(i.name) === "vModel"
546
583
  );
547
584
  return {
548
- vIf: n,
549
- vElseIf: o,
585
+ vIf: o,
586
+ vElseIf: n,
550
587
  vElse: r,
551
588
  vFor: c,
552
589
  vShow: a,
553
- vModels: m,
590
+ vModels: p,
554
591
  vBind: l,
555
- vHtml: p,
592
+ vHtml: m,
556
593
  customDirectives: s
557
594
  };
558
595
  }
559
- function Ze(t) {
596
+ function st(t) {
560
597
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
561
598
  }
562
- function Qe(t, e, s, n, o, r = /* @__PURE__ */ new Set()) {
563
- return typeof t == "string" ? Ze(t) : R(t) ? `{{ ${_(t, !1, !0, e)} }}` : Array.isArray(t) ? G(
599
+ function nt(t, e, s, o, n, r = /* @__PURE__ */ new Set()) {
600
+ return typeof t == "string" ? st(t) : T(t) ? `{{ ${_(t, !1, !0, e)} }}` : Array.isArray(t) ? z(
564
601
  t,
565
602
  s,
566
603
  e,
567
- n,
568
604
  o,
605
+ n,
569
606
  r
570
607
  ) : "";
571
608
  }
572
- function Xe(t, e, s) {
609
+ function rt(t, e, s) {
573
610
  if (!t) return e;
574
- const n = typeof t == "string" ? { name: t, params: [], scope: "" } : { params: [], scope: "", ...t };
575
- return `<template ${`#${n.name}="${n.scope ? n.scope : n.params?.length > 0 ? `{${n.params?.join(",")}}` : `scope_${s}`}"`}>
611
+ const o = typeof t == "string" ? { name: t, params: [], scope: "" } : { params: [], scope: "", ...t };
612
+ return `<template ${`#${o.name}="${o.scope ? o.scope : o.params?.length > 0 ? `{${o.params?.join(",")}}` : `scope_${s}`}"`}>
576
613
  ${e}
577
614
  </template>`;
578
615
  }
579
- function Ye(t, e = [], s = [], n = {}, o = "web", r = /* @__PURE__ */ new Set()) {
616
+ function ot(t, e = [], s = [], o = {}, n = "web", r = /* @__PURE__ */ new Set()) {
580
617
  const c = [
581
618
  "@dcloudio/uni-h5",
582
619
  "uni-h5",
@@ -585,110 +622,113 @@ function Ye(t, e = [], s = [], n = {}, o = "web", r = /* @__PURE__ */ new Set())
585
622
  ], a = {
586
623
  vue: ["defineComponent", "reactive"]
587
624
  }, l = [];
588
- for (const m of e) {
589
- const i = t.get(m.split(":")[0]);
625
+ for (const p of e) {
626
+ const i = t.get(p.split(":")[0]);
590
627
  if (i && i.package) {
591
628
  if (r.has(i.package)) continue;
592
629
  const u = a[i.package] ?? (a[i.package] = []), f = i.parent || (i.alias || "").split(".")[0] || i.name;
593
- u.push(f), o === "uniapp" && c.includes(i.package) && l.push(f);
630
+ u.push(f), n === "uniapp" && c.includes(i.package) && l.push(f);
594
631
  }
595
632
  }
596
- for (const [m, i] of Object.entries(n))
597
- (a[m] ?? (a[m] = [])).push(...Array.from(i)), o === "uniapp" && c.includes(m) && l.push(...Array.from(i));
633
+ for (const [p, i] of Object.entries(o))
634
+ (a[p] ?? (a[p] = [])).push(...Array.from(i)), n === "uniapp" && c.includes(p) && l.push(...Array.from(i));
598
635
  return {
599
- imports: Object.entries(a).filter(([m, i]) => o === "uniapp" ? !c.includes(m) && !!i.length : !!i.length).map(([m, i]) => `import { ${M(i).join(
636
+ imports: Object.entries(a).filter(([p, i]) => n === "uniapp" ? !c.includes(p) && !!i.length : !!i.length).map(([p, i]) => `import { ${M(i).join(
600
637
  ","
601
- )}} from '${m}';`).concat(s),
638
+ )}} from '${p}';`).concat(s),
602
639
  uniComponents: l
603
640
  };
604
641
  }
605
- function le(t = {}) {
642
+ function me(t = {}) {
606
643
  const e = [];
607
- for (const [s, n] of Object.entries(t))
644
+ for (const [s, o] of Object.entries(t))
608
645
  e.push(`
609
646
  ${s} {
610
- ${Pe(n)}
647
+ ${Le(o)}
611
648
  }
612
649
  `);
613
650
  return e.join(`
614
651
  `);
615
652
  }
616
- function ue(t = {}) {
653
+ function de(t = {}) {
617
654
  const e = [];
618
- return Object.entries(t).forEach(([s, n]) => {
655
+ return Object.entries(t).forEach(([s, o]) => {
619
656
  e.push(
620
- `const ${s} = provider.defineUrlSchemaComponent('${n.url}');`
657
+ `const ${s} = provider.defineUrlSchemaComponent('${o.url}');`
621
658
  );
622
659
  }), e;
623
660
  }
624
- function pe(t = {}) {
661
+ function he(t = {}) {
625
662
  const e = [];
626
- return Object.entries(t).forEach(([s, n]) => {
663
+ return Object.entries(t).forEach(([s, o]) => {
627
664
  e.push(
628
- `const ${s} = provider.definePluginComponent(${JSON.stringify(n)});`
665
+ `const ${s} = provider.definePluginComponent(${JSON.stringify(o)});`
629
666
  );
630
667
  }), e;
631
668
  }
632
- function Ke(t, e, s = "web") {
633
- const { dsl: n } = t, o = Object.keys(n.computed || {}), r = F(n.lifeCycles, o), c = F(n.computed, o), a = Me(n.watch, o), l = Re(n.dataSources), { methods: p, nodes: m, components: i, importBlocks: u, directives: f } = G(
669
+ function ct(t, e, s = "web", o) {
670
+ const { dsl: n } = t, r = Object.keys(n.computed || {}), c = F(n.lifeCycles, r), a = F(n.computed, r), l = We(n.watch, r), m = He(n.dataSources), { methods: p, nodes: i, components: u, importBlocks: f, directives: b } = z(
634
671
  n.nodes || [],
635
672
  e,
636
- o,
673
+ r,
637
674
  t.context,
638
675
  void 0,
639
676
  t.easycomPackages
640
- ), b = [...c, ...a.computed], g = F(
677
+ ), g = [...a, ...l.computed], C = F(
641
678
  {
642
679
  ...p,
643
680
  ...n.methods || {}
644
681
  },
645
- o
646
- ), w = u.map((k) => `import ${k.name} from './${k.id}.vue';`);
647
- let { imports: d, uniComponents: v } = Ye(
682
+ r
683
+ ), h = f.map((I) => {
684
+ const v = o?.(I.id) || `./${I.id}.vue`;
685
+ return `import ${I.name} from '${v}';`;
686
+ });
687
+ let { imports: $, uniComponents: d } = ot(
648
688
  e,
649
- i,
650
- w,
689
+ u,
690
+ h,
651
691
  t.imports,
652
692
  s,
653
693
  t.easycomPackages
654
694
  );
655
- const h = Object.keys({
695
+ const y = Object.keys({
656
696
  ...t.urlSchemas,
657
697
  ...t.blockPlugins
658
- }), y = ue(t.urlSchemas), $ = pe(t.blockPlugins);
698
+ }), S = de(t.urlSchemas), w = he(t.blockPlugins);
659
699
  return {
660
700
  id: n.id,
661
701
  version: n.__VERSION__,
662
702
  name: n.name,
663
- state: Be(n.state).join(","),
664
- inject: Te(n.inject).join(","),
665
- props: re(n.props).join(","),
666
- emits: oe(n.emits).join(","),
703
+ state: Fe(n.state).join(","),
704
+ inject: Je(n.inject).join(","),
705
+ props: ie(n.props).join(","),
706
+ emits: le(n.emits).join(","),
667
707
  expose: n.expose && n.expose.length ? JSON.stringify(n.expose || []) : "",
668
- watch: a.watches.join(","),
669
- lifeCycles: r.join(","),
670
- computed: b.join(","),
671
- methods: [...l, ...g].join(","),
708
+ watch: l.watches.join(","),
709
+ lifeCycles: c.join(","),
710
+ computed: g.join(","),
711
+ methods: [...m, ...C].join(","),
672
712
  imports: `
673
- ` + d.join(`
713
+ ` + $.join(`
674
714
  `),
675
- components: Ee(i, v).join(","),
676
- directives: f.join(","),
715
+ components: De(u, d).join(","),
716
+ directives: b.join(","),
677
717
  returns: t.members.join(","),
678
- template: m.join(`
718
+ template: i.join(`
679
719
  `),
680
720
  css: n.css || "",
681
- style: le(t.style),
682
- urlSchemas: y.join(`
721
+ style: me(t.style),
722
+ urlSchemas: S.join(`
683
723
  `),
684
- blockPlugins: $.join(`
724
+ blockPlugins: w.join(`
685
725
  `),
686
- asyncComponents: h.join(","),
687
- uniComponents: v,
726
+ asyncComponents: y.join(","),
727
+ uniComponents: d,
688
728
  renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer"
689
729
  };
690
730
  }
691
- const E = {
731
+ const N = {
692
732
  state: {
693
733
  composable: null,
694
734
  from: "self",
@@ -880,7 +920,7 @@ const E = {
880
920
  declare: "const __apis = useApis();",
881
921
  replace: "__apis"
882
922
  }
883
- }, fe = {
923
+ }, ge = {
884
924
  "element-plus": {
885
925
  $loading: {
886
926
  composable: "ElLoading",
@@ -969,244 +1009,244 @@ const E = {
969
1009
  replace: "message.error"
970
1010
  }
971
1011
  }
972
- }, et = Object.keys(fe);
973
- function tt(t) {
1012
+ }, at = Object.keys(ge);
1013
+ function it(t) {
974
1014
  for (const [, e] of t)
975
- if (et.includes(e.package))
1015
+ if (at.includes(e.package))
976
1016
  return e.package;
977
1017
  return null;
978
1018
  }
979
- function st(t) {
980
- const e = t ? fe[t] ?? {} : {};
981
- return { ...E, ...e };
1019
+ function lt(t) {
1020
+ const e = t ? ge[t] ?? {} : {};
1021
+ return { ...N, ...e };
982
1022
  }
983
- function nt(t, e = E) {
984
- const s = /* @__PURE__ */ new Set(), n = /this\.\$(\w+)\b/g, o = (r) => {
1023
+ function ut(t, e = N) {
1024
+ const s = /* @__PURE__ */ new Set(), o = /this\.\$(\w+)\b/g, n = (r) => {
985
1025
  if (r && typeof r == "object") {
986
1026
  if (Array.isArray(r)) {
987
- for (const c of r) o(c);
1027
+ for (const c of r) n(c);
988
1028
  return;
989
1029
  }
990
- if (S(r) && r.value) {
1030
+ if (j(r) && r.value) {
991
1031
  let c;
992
- for (n.lastIndex = 0; (c = n.exec(r.value)) !== null; ) {
1032
+ for (o.lastIndex = 0; (c = o.exec(r.value)) !== null; ) {
993
1033
  const a = "$" + c[1];
994
1034
  a in e && s.add(a);
995
1035
  }
996
1036
  return;
997
1037
  }
998
1038
  for (const c of Object.values(r))
999
- o(c);
1039
+ n(c);
1000
1040
  }
1001
1041
  };
1002
- 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;
1042
+ return n(t.refs), n(t.reactives), n(t.state), n(t.computed), n(t.methods), n(t.watch), n(t.lifeCycles), n(t.inject), n(t.composables), n(t.provide), n(t.dataSources), n(t.setup), n(t.nodes), s;
1003
1043
  }
1004
- function rt(t, e = E) {
1044
+ function pt(t, e = N) {
1005
1045
  const s = [];
1006
- for (const n of t) {
1007
- const o = e[n];
1008
- o && o.declare && !s.includes(o.declare) && s.push(o.declare);
1046
+ for (const o of t) {
1047
+ const n = e[o];
1048
+ n && n.declare && !s.includes(n.declare) && s.push(n.declare);
1009
1049
  }
1010
1050
  return s;
1011
1051
  }
1012
- function ot(t, e = E) {
1052
+ function ft(t, e = N) {
1013
1053
  const s = {};
1014
- for (const n of t) {
1015
- const o = e[n];
1016
- if (o && o.composable) {
1017
- const r = s[o.from] ?? (s[o.from] = []);
1018
- r.includes(o.composable) || r.push(o.composable);
1054
+ for (const o of t) {
1055
+ const n = e[o];
1056
+ if (n && n.composable) {
1057
+ const r = s[n.from] ?? (s[n.from] = []);
1058
+ r.includes(n.composable) || r.push(n.composable);
1019
1059
  }
1020
1060
  }
1021
1061
  return s;
1022
1062
  }
1023
- function ct(t, e = E) {
1024
- const s = new Set(Object.keys(t.refs ?? {})), n = new Set(Object.keys(t.reactives ?? {})), r = Object.keys(t.state ?? {}).length > 0;
1025
- r && n.add("__state");
1063
+ function mt(t, e = N) {
1064
+ const s = new Set(Object.keys(t.refs ?? {})), o = new Set(Object.keys(t.reactives ?? {})), r = Object.keys(t.state ?? {}).length > 0;
1065
+ r && o.add("__state");
1026
1066
  const c = new Set(Object.keys(t.computed ?? {})), a = new Set(Object.keys(t.methods ?? {})), l = /* @__PURE__ */ new Set();
1027
1067
  for (const u of t.props ?? [])
1028
- we(u) ? l.add(u) : l.add(u.name);
1029
- const p = /* @__PURE__ */ new Set();
1068
+ Ae(u) ? l.add(u) : l.add(u.name);
1069
+ const m = /* @__PURE__ */ new Set();
1030
1070
  for (const u of t.composables ?? [])
1031
1071
  if (u.destructure && u.destructure.length > 0)
1032
- for (const f of u.destructure) p.add(f);
1033
- else u.name && p.add(u.name);
1034
- const m = /* @__PURE__ */ new Set();
1072
+ for (const f of u.destructure) m.add(f);
1073
+ else u.name && m.add(u.name);
1074
+ const p = /* @__PURE__ */ new Set();
1035
1075
  for (const u of t.inject ?? [])
1036
- u.name && m.add(u.name);
1076
+ u.name && p.add(u.name);
1037
1077
  const i = /* @__PURE__ */ new Set();
1038
1078
  for (const [, u] of Object.entries(t.dataSources ?? {}))
1039
1079
  u.name && i.add(u.name);
1040
1080
  return {
1041
1081
  refs: s,
1042
- reactives: n,
1082
+ reactives: o,
1043
1083
  computed: c,
1044
1084
  methods: a,
1045
1085
  props: l,
1046
- composables: p,
1047
- injects: m,
1086
+ composables: m,
1087
+ injects: p,
1048
1088
  dataSources: i,
1049
1089
  hasState: r,
1050
1090
  effectiveApiMap: e
1051
1091
  };
1052
1092
  }
1053
- function j(t, e, s = "script") {
1093
+ function k(t, e, s = "script") {
1054
1094
  if (!t) return t;
1055
- let n = t;
1056
- for (const [o, r] of Object.entries(e.effectiveApiMap)) {
1057
- const c = o.replace(/\$/g, "\\$"), a = new RegExp(`this\\.${c}\\b`, "g");
1058
- n = n.replace(a, r.replace);
1095
+ let o = t;
1096
+ for (const [n, r] of Object.entries(e.effectiveApiMap)) {
1097
+ const c = n.replace(/\$/g, "\\$"), a = new RegExp(`this\\.${c}\\b`, "g");
1098
+ o = o.replace(a, r.replace);
1059
1099
  }
1060
- return n = n.replace(
1100
+ return o = o.replace(
1061
1101
  /this\.([A-Za-z_$][\w$]*)\.value\b/g,
1062
- (o, r) => e.refs.has(r) || e.computed.has(r) ? s === "script" ? `${r}.value` : r : o
1063
- ), 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;
1102
+ (n, r) => e.refs.has(r) || e.computed.has(r) ? s === "script" ? `${r}.value` : r : n
1103
+ ), o = o.replace(/this\.([A-Za-z_$][\w$]*)/g, (n, 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 : n), o;
1064
1104
  }
1065
- function P(t) {
1105
+ function B(t) {
1066
1106
  let e = t.trim().replace(/;$/, "");
1067
1107
  return /^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim()), e;
1068
1108
  }
1069
- function at(t = {}, e) {
1070
- return Object.entries(t).map(([s, n]) => {
1071
- let o;
1072
- return S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n), `const ${s} = ref(${o});`;
1109
+ function dt(t = {}, e) {
1110
+ return Object.entries(t).map(([s, o]) => {
1111
+ let n;
1112
+ return j(o) ? n = k(o.value || "undefined", e, "script") : n = JSON.stringify(o), `const ${s} = ref(${n});`;
1073
1113
  });
1074
1114
  }
1075
- function it(t = {}, e) {
1076
- return Object.entries(t).map(([s, n]) => {
1077
- let o;
1078
- return S(n) ? o = j(n.value || "{}", e, "script") : o = JSON.stringify(n ?? {}), `const ${s} = reactive(${o});`;
1115
+ function ht(t = {}, e) {
1116
+ return Object.entries(t).map(([s, o]) => {
1117
+ let n;
1118
+ return j(o) ? n = k(o.value || "{}", e, "script") : n = JSON.stringify(o ?? {}), `const ${s} = reactive(${n});`;
1079
1119
  });
1080
1120
  }
1081
- function lt(t = {}, e) {
1121
+ function gt(t = {}, e) {
1082
1122
  const s = Object.entries(t);
1083
- return s.length === 0 ? "" : `const __state = reactive({ ${s.map(([o, r]) => {
1123
+ return s.length === 0 ? "" : `const __state = reactive({ ${s.map(([n, r]) => {
1084
1124
  let c;
1085
- return S(r) ? c = j(r.value || "undefined", e, "script") : c = JSON.stringify(r), `${o}: ${c}`;
1125
+ return j(r) ? c = k(r.value || "undefined", e, "script") : c = JSON.stringify(r), `${n}: ${c}`;
1086
1126
  }).join(", ")} });`;
1087
1127
  }
1088
- function ut(t = [], e) {
1089
- const s = [], n = {}, o = /* @__PURE__ */ new Set();
1128
+ function $t(t = [], e) {
1129
+ const s = [], o = {}, n = /* @__PURE__ */ new Set();
1090
1130
  for (const r of t) {
1091
1131
  if (!r || !r.composable) continue;
1092
1132
  let c = "";
1093
- if (S(r.composable) ? c = r.composable.value || "" : typeof r.composable == "string" && (c = r.composable), !c || c === "useProvider") continue;
1133
+ if (j(r.composable) ? c = r.composable.value || "" : typeof r.composable == "string" && (c = r.composable), !c || c === "useProvider") continue;
1094
1134
  if (r.name) {
1095
- if (o.has(r.name)) continue;
1096
- o.add(r.name);
1135
+ if (n.has(r.name)) continue;
1136
+ n.add(r.name);
1097
1137
  }
1098
- const l = (r.args ?? []).map((p) => S(p) ? j(p.value || "", e, "script") : JSON.stringify(p)).join(", ");
1138
+ const l = (r.args ?? []).map((m) => j(m) ? k(m.value || "", e, "script") : JSON.stringify(m)).join(", ");
1099
1139
  r.destructure && r.destructure.length > 0 ? s.push(
1100
1140
  `const { ${r.destructure.join(", ")} } = ${c}(${l});`
1101
1141
  ) : r.name ? s.push(`const ${r.name} = ${c}(${l});`) : s.push(`${c}(${l});`);
1102
1142
  }
1103
- return { statements: s, imports: n };
1143
+ return { statements: s, imports: o };
1104
1144
  }
1105
- function pt(t = [], e) {
1145
+ function vt(t = [], e) {
1106
1146
  return t.map((s) => {
1107
- const n = S(s.from) ? j(
1147
+ const o = j(s.from) ? k(
1108
1148
  s.from.value || `'${s.name}'`,
1109
1149
  e,
1110
1150
  "script"
1111
1151
  ) : `'${s.from || s.name}'`;
1112
- let o = "undefined";
1113
- return s.default !== void 0 && s.default !== null && (S(s.default) ? o = j(
1152
+ let n = "undefined";
1153
+ return s.default !== void 0 && s.default !== null && (j(s.default) ? n = k(
1114
1154
  s.default.value || "undefined",
1115
1155
  e,
1116
1156
  "script"
1117
- ) : o = JSON.stringify(s.default)), `const ${s.name} = inject(${n}, ${o});`;
1157
+ ) : n = JSON.stringify(s.default)), `const ${s.name} = inject(${o}, ${n});`;
1118
1158
  });
1119
1159
  }
1120
- function ft(t = {}, e) {
1121
- return Object.entries(t).map(([s, n]) => {
1122
- if (!n || !n.value) return null;
1123
- const o = j(n.value, e, "script"), r = P(o);
1160
+ function bt(t = {}, e) {
1161
+ return Object.entries(t).map(([s, o]) => {
1162
+ if (!o || !o.value) return null;
1163
+ const n = k(o.value, e, "script"), r = B(n);
1124
1164
  return `const ${s} = computed(${r});`;
1125
1165
  }).filter((s) => !!s);
1126
1166
  }
1127
- function mt(t = {}, e) {
1128
- return Object.entries(t).map(([s, n]) => {
1129
- if (!n || !n.value) return null;
1130
- const o = j(n.value, e, "script"), r = P(o);
1167
+ function _t(t = {}, e) {
1168
+ return Object.entries(t).map(([s, o]) => {
1169
+ if (!o || !o.value) return null;
1170
+ const n = k(o.value, e, "script"), r = B(n);
1131
1171
  return `const ${s} = ${r};`;
1132
1172
  }).filter((s) => !!s);
1133
1173
  }
1134
- function dt(t = {}, e) {
1174
+ function yt(t = {}, e) {
1135
1175
  return Object.values(t).map((s) => {
1136
1176
  if (!s || !s.name) return null;
1137
1177
  if (s.type === "mock") {
1138
- const n = s.mockTemplate && s.mockTemplate.value ? s.mockTemplate.value : "(params) => ({})", o = e ? j(n, e, "script") : n;
1178
+ const o = s.mockTemplate && s.mockTemplate.value ? s.mockTemplate.value : "(params) => ({})", n = e ? k(o, e, "script") : o;
1139
1179
  return `const ${s.name} = async (...args) => {
1140
- const mock = __provider.createMock(${o});
1180
+ const mock = __provider.createMock(${n});
1141
1181
  return await mock.apply(null, args);
1142
1182
  };`;
1143
1183
  } else {
1144
- const n = s.transform && s.transform.value ? s.transform.value : "(res) => res", o = e ? j(n, e, "script") : n;
1184
+ const o = s.transform && s.transform.value ? s.transform.value : "(res) => res", n = e ? k(o, e, "script") : o;
1145
1185
  return `const ${s.name} = async (...args) => {
1146
- return await __provider.apis['${s.ref}'].apply(null, args).then(${o});
1186
+ return await __provider.apis['${s.ref}'].apply(null, args).then(${n});
1147
1187
  };`;
1148
1188
  }
1149
1189
  }).filter((s) => !!s);
1150
1190
  }
1151
- function ht(t = [], e) {
1191
+ function St(t = [], e) {
1152
1192
  return t.map((s) => {
1153
1193
  if (!s || !s.handler || !s.handler.value) return null;
1154
- const n = s.source && s.source.value ? j(s.source.value, e, "script") : "() => null", o = P(n), r = j(
1194
+ const o = s.source && s.source.value ? k(s.source.value, e, "script") : "() => null", n = B(o), r = k(
1155
1195
  s.handler.value,
1156
1196
  e,
1157
1197
  "script"
1158
- ), c = P(r), a = [];
1198
+ ), c = B(r), a = [];
1159
1199
  s.deep && a.push("deep: true"), s.immediate && a.push("immediate: true"), s.flush && a.push(`flush: '${s.flush}'`);
1160
1200
  const l = a.length > 0 ? `, { ${a.join(", ")} }` : "";
1161
- return `watch(${o}, ${c}${l});`;
1201
+ return `watch(${n}, ${c}${l});`;
1162
1202
  }).filter((s) => !!s);
1163
1203
  }
1164
- function gt(t = {}, e) {
1165
- return Object.entries(t).map(([s, n]) => {
1166
- let o;
1167
- if (U(n)) {
1168
- const r = j(
1169
- n.value || "",
1204
+ function jt(t = {}, e) {
1205
+ return Object.entries(t).map(([s, o]) => {
1206
+ let n;
1207
+ if (L(o)) {
1208
+ const r = k(
1209
+ o.value || "",
1170
1210
  e,
1171
1211
  "script"
1172
1212
  );
1173
- o = P(r);
1174
- } else S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n);
1175
- return `provide('${s}', ${o});`;
1213
+ n = B(r);
1214
+ } else j(o) ? n = k(o.value || "undefined", e, "script") : n = JSON.stringify(o);
1215
+ return `provide('${s}', ${n});`;
1176
1216
  });
1177
1217
  }
1178
- function me(t) {
1218
+ function $e(t) {
1179
1219
  let e = t.trim().replace(/;$/, "");
1180
1220
  /^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim());
1181
1221
  const s = e.match(/^(?:async\s+)?\([^)]*\)\s*=>\s*([\s\S]+)$/);
1182
1222
  if (s) {
1183
- let o = s[1].trim();
1184
- return o.startsWith("{") && o.endsWith("}") ? o = o.slice(1, -1).trim() : o = o.replace(/;$/, "") + ";", o;
1223
+ let n = s[1].trim();
1224
+ return n.startsWith("{") && n.endsWith("}") ? n = n.slice(1, -1).trim() : n = n.replace(/;$/, "") + ";", n;
1185
1225
  }
1186
- const n = e.match(
1226
+ const o = e.match(
1187
1227
  /^(?:async\s+)?function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*)\}$/
1188
1228
  );
1189
- return n ? n[1].trim() : e;
1229
+ return o ? o[1].trim() : e;
1190
1230
  }
1191
- function vt(t, e) {
1231
+ function kt(t, e) {
1192
1232
  if (!t || !t.value) return "";
1193
- const s = j(t.value, e, "script");
1194
- return me(s);
1233
+ const s = k(t.value, e, "script");
1234
+ return $e(s);
1195
1235
  }
1196
- function $t(t = {}, e) {
1236
+ function wt(t = {}, e) {
1197
1237
  const s = [];
1198
- for (const n of ["beforeCreate", "created"]) {
1199
- const o = t[n];
1200
- if (o && o.value) {
1201
- const r = j(o.value, e, "script"), c = me(r);
1202
- c && s.push(`// ${n}
1238
+ for (const o of ["beforeCreate", "created"]) {
1239
+ const n = t[o];
1240
+ if (n && n.value) {
1241
+ const r = k(n.value, e, "script"), c = $e(r);
1242
+ c && s.push(`// ${o}
1203
1243
  ${c}`);
1204
1244
  }
1205
1245
  }
1206
1246
  return s.join(`
1207
1247
  `);
1208
1248
  }
1209
- const bt = {
1249
+ const It = {
1210
1250
  beforeMount: "onBeforeMount",
1211
1251
  mounted: "onMounted",
1212
1252
  beforeUpdate: "onBeforeUpdate",
@@ -1218,7 +1258,7 @@ const bt = {
1218
1258
  renderTriggered: "onRenderTriggered",
1219
1259
  activated: "onActivated",
1220
1260
  deactivated: "onDeactivated"
1221
- }, _t = /* @__PURE__ */ new Set([
1261
+ }, Ot = /* @__PURE__ */ new Set([
1222
1262
  "onBeforeMount",
1223
1263
  "onMounted",
1224
1264
  "onBeforeUpdate",
@@ -1230,7 +1270,7 @@ const bt = {
1230
1270
  "onRenderTriggered",
1231
1271
  "onActivated",
1232
1272
  "onDeactivated"
1233
- ]), yt = /* @__PURE__ */ new Set([
1273
+ ]), Ct = /* @__PURE__ */ new Set([
1234
1274
  "onLoad",
1235
1275
  "onShow",
1236
1276
  "onReady",
@@ -1250,33 +1290,33 @@ const bt = {
1250
1290
  "onShareTimeline",
1251
1291
  "onAddToFavorites"
1252
1292
  ]);
1253
- function St(t = {}, e) {
1254
- const s = [], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
1293
+ function xt(t = {}, e) {
1294
+ const s = [], o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
1255
1295
  for (const [r, c] of Object.entries(t)) {
1256
1296
  if (!c || !c.value || r === "created" || r === "beforeCreate") continue;
1257
- const a = bt[r] || r;
1258
- if (_t.has(a)) {
1259
- const l = j(c.value, e, "script"), p = P(l);
1260
- s.push(`${a}(${p});`), n.add(a);
1261
- } else if (yt.has(a)) {
1262
- const l = j(c.value, e, "script"), p = P(l);
1263
- s.push(`${a}(${p});`), o.add(a);
1297
+ const a = It[r] || r;
1298
+ if (Ot.has(a)) {
1299
+ const l = k(c.value, e, "script"), m = B(l);
1300
+ s.push(`${a}(${m});`), o.add(a);
1301
+ } else if (Ct.has(a)) {
1302
+ const l = k(c.value, e, "script"), m = B(l);
1303
+ s.push(`${a}(${m});`), n.add(a);
1264
1304
  }
1265
1305
  }
1266
- return { statements: s, usedHooks: n, usedUniHooks: o };
1306
+ return { statements: s, usedHooks: o, usedUniHooks: n };
1267
1307
  }
1268
- function jt(t) {
1308
+ function At(t) {
1269
1309
  const {
1270
1310
  componentMap: e,
1271
1311
  components: s,
1272
- importBlocks: n,
1273
- collectImports: o,
1312
+ importBlocks: o,
1313
+ collectImports: n,
1274
1314
  platform: r,
1275
1315
  vueImports: c,
1276
1316
  composableImports: a,
1277
1317
  globalApiImports: l,
1278
- uniHookImports: p,
1279
- easycomPackages: m
1318
+ uniHookImports: m,
1319
+ easycomPackages: p
1280
1320
  } = t, i = [
1281
1321
  "@dcloudio/uni-h5",
1282
1322
  "uni-h5",
@@ -1285,166 +1325,166 @@ function jt(t) {
1285
1325
  ], u = {
1286
1326
  vue: [...c]
1287
1327
  }, f = [], b = [], g = {};
1288
- for (const d of s) {
1289
- const v = d.split(":")[0], h = e.get(v);
1290
- if (!h || !h.package || h.parent || m.has(h.package)) continue;
1291
- const y = u[h.package] ?? (u[h.package] = []), $ = (h.alias || "").split(".")[0] || h.name, k = v, C = $ !== k ? `${$} as ${k}` : $;
1292
- y.push(C), g[$] = k, r === "uniapp" && i.includes(h.package) && f.push($);
1328
+ for (const h of s) {
1329
+ const $ = h.split(":")[0], d = e.get($);
1330
+ if (!d || !d.package || d.parent || p.has(d.package)) continue;
1331
+ const y = u[d.package] ?? (u[d.package] = []), S = (d.alias || "").split(".")[0] || d.name, w = $, I = S !== w ? `${S} as ${w}` : S;
1332
+ y.push(I), g[S] = w, r === "uniapp" && i.includes(d.package) && f.push(S);
1293
1333
  }
1294
- for (const d of s) {
1295
- const v = d.split(":")[0], h = e.get(v);
1296
- if (!h || !h.package || !h.parent || m.has(h.package)) continue;
1297
- const y = h.parent, $ = g[y] ?? y, k = h.alias || "";
1334
+ for (const h of s) {
1335
+ const $ = h.split(":")[0], d = e.get($);
1336
+ if (!d || !d.package || !d.parent || p.has(d.package)) continue;
1337
+ const y = d.parent, S = g[y] ?? y, w = d.alias || "";
1298
1338
  b.push(
1299
- `const ${v} = ${$}.${k};`
1300
- ), g[y] || ((u[h.package] ?? (u[h.package] = [])).push(y), g[y] = y);
1339
+ `const ${$} = ${S}.${w};`
1340
+ ), g[y] || ((u[d.package] ?? (u[d.package] = [])).push(y), g[y] = y);
1301
1341
  }
1302
- for (const [d, v] of Object.entries(o))
1303
- (u[d] ?? (u[d] = [])).push(...Array.from(v)), r === "uniapp" && i.includes(d) && f.push(...Array.from(v));
1304
- for (const [d, v] of Object.entries(a))
1305
- (u[d] ?? (u[d] = [])).push(...v);
1306
- for (const [d, v] of Object.entries(l))
1307
- (u[d] ?? (u[d] = [])).push(...v);
1308
- return r === "uniapp" && p.length > 0 && (u["@dcloudio/uni-app"] ?? (u["@dcloudio/uni-app"] = [])).push(...p), { imports: Object.entries(u).filter(([d, v]) => r === "uniapp" ? !i.includes(d) && !!v.length : !!v.length).map(([d, v]) => `import { ${M(v).join(
1342
+ for (const [h, $] of Object.entries(n))
1343
+ (u[h] ?? (u[h] = [])).push(...Array.from($)), r === "uniapp" && i.includes(h) && f.push(...Array.from($));
1344
+ for (const [h, $] of Object.entries(a))
1345
+ (u[h] ?? (u[h] = [])).push(...$);
1346
+ for (const [h, $] of Object.entries(l))
1347
+ (u[h] ?? (u[h] = [])).push(...$);
1348
+ return r === "uniapp" && m.length > 0 && (u["@dcloudio/uni-app"] ?? (u["@dcloudio/uni-app"] = [])).push(...m), { imports: Object.entries(u).filter(([h, $]) => r === "uniapp" ? !i.includes(h) && !!$.length : !!$.length).map(([h, $]) => `import { ${M($).join(
1309
1349
  ","
1310
- )}} from '${d}';`).concat(n), uniComponents: f, componentDeclarations: b };
1350
+ )}} from '${h}';`).concat(o), uniComponents: f, componentDeclarations: b };
1311
1351
  }
1312
- function kt(t, e = E, s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
1313
- const o = Object.entries(e), r = (c) => {
1352
+ function Pt(t, e = N, s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set()) {
1353
+ const n = Object.entries(e), r = (c) => {
1314
1354
  if (c == null || typeof c != "object") return c;
1315
1355
  if (Array.isArray(c))
1316
1356
  return c.map(r);
1317
- if (S(c) && typeof c.value == "string") {
1357
+ if (j(c) && typeof c.value == "string") {
1318
1358
  let l = c.value;
1319
- for (const [p, m] of o) {
1320
- const i = p.replace(/\$/g, "\\$"), u = new RegExp(`this\\.${i}\\b`, "g");
1321
- l = l.replace(u, m.replace);
1359
+ for (const [m, p] of n) {
1360
+ const i = m.replace(/\$/g, "\\$"), u = new RegExp(`this\\.${i}\\b`, "g");
1361
+ l = l.replace(u, p.replace);
1322
1362
  }
1323
- return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (p, m) => s.has(m) || n.has(m) ? m : p), { ...c, value: l };
1363
+ return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (m, p) => s.has(p) || o.has(p) ? p : m), { ...c, value: l };
1324
1364
  }
1325
1365
  const a = {};
1326
- for (const [l, p] of Object.entries(c))
1327
- a[l] = r(p);
1366
+ for (const [l, m] of Object.entries(c))
1367
+ a[l] = r(m);
1328
1368
  return a;
1329
1369
  };
1330
1370
  return t.map(r);
1331
1371
  }
1332
- function wt(t, e, s = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set()) {
1333
- const p = kt(
1372
+ function Et(t, e, s = [], o = {}, n, r = N, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set()) {
1373
+ const m = Pt(
1334
1374
  t,
1335
1375
  r,
1336
1376
  c,
1337
1377
  a
1338
1378
  );
1339
- return G(
1340
- p,
1379
+ return z(
1380
+ m,
1341
1381
  e,
1342
1382
  s,
1343
- n,
1344
1383
  o,
1384
+ n,
1345
1385
  l
1346
1386
  );
1347
1387
  }
1348
- function It(t, e, s = "web") {
1349
- 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), m = p.__renderer__ || [];
1388
+ function Bt(t, e, s = "web", o) {
1389
+ const { dsl: n } = t, r = it(e), c = lt(r), a = mt(n, c), l = ut(n, c), m = pt(l, c), p = ft(l, c), i = p.__renderer__ || [];
1350
1390
  delete p.__renderer__;
1351
- const i = wt(
1391
+ const u = Et(
1352
1392
  n.nodes || [],
1353
1393
  e,
1354
1394
  Object.keys(n.computed || {}),
1355
1395
  t.context,
1356
1396
  void 0,
1357
- r,
1358
- c.refs,
1359
- c.computed,
1397
+ c,
1398
+ a.refs,
1399
+ a.computed,
1360
1400
  t.easycomPackages
1361
- ), u = i.importBlocks.map(
1362
- (I) => `import ${I.name} from './${I.id}.vue';`
1363
- ), f = at(n.refs || {}, c), b = it(n.reactives || {}, c), g = lt(n.state || {}, c), w = ft(n.computed || {}, c), d = {
1364
- ...i.methods || {},
1401
+ ), f = u.importBlocks.map(
1402
+ (O) => `import ${O.name} from '${o?.(O.id) || `./${O.id}.vue`}';`
1403
+ ), b = dt(n.refs || {}, a), g = ht(n.reactives || {}, a), C = gt(n.state || {}, a), h = bt(n.computed || {}, a), $ = {
1404
+ ...u.methods || {},
1365
1405
  ...n.methods || {}
1366
- }, v = mt(d, c), h = dt(n.dataSources || {}, c), y = ht(n.watch || [], c), $ = pt(n.inject || [], c), k = gt(n.provide || {}, c), C = ut(
1406
+ }, d = _t($, a), y = yt(n.dataSources || {}, a), S = St(n.watch || [], a), w = vt(n.inject || [], a), I = jt(n.provide || {}, a), v = $t(
1367
1407
  n.composables || [],
1368
- c
1369
- ), O = /* @__PURE__ */ new Set();
1370
- for (const I of n.composables || [])
1371
- if (I.destructure && I.destructure.length > 0)
1372
- for (const L of I.destructure) O.add(L);
1373
- else I.name && O.add(I.name);
1374
- const N = l.filter((I) => {
1375
- const L = I.match(/^const\s+(\w+)\s*=/);
1376
- return !(L && O.has(L[1]));
1377
- }), B = St(n.lifeCycles || {}, c), T = $t(
1408
+ a
1409
+ ), x = /* @__PURE__ */ new Set();
1410
+ for (const O of n.composables || [])
1411
+ if (O.destructure && O.destructure.length > 0)
1412
+ for (const U of O.destructure) x.add(U);
1413
+ else O.name && x.add(O.name);
1414
+ const D = m.filter((O) => {
1415
+ const U = O.match(/^const\s+(\w+)\s*=/);
1416
+ return !(U && x.has(U[1]));
1417
+ }), A = xt(n.lifeCycles || {}, a), ve = wt(
1378
1418
  n.lifeCycles || {},
1379
- c
1380
- ), de = vt(n.setup, c), x = /* @__PURE__ */ new Set();
1381
- f.length > 0 && x.add("ref"), (b.length > 0 || g) && x.add("reactive"), w.length > 0 && x.add("computed"), y.length > 0 && x.add("watch"), $.length > 0 && x.add("inject"), k.length > 0 && x.add("provide");
1382
- for (const I of B.usedHooks) x.add(I);
1383
- const he = s === "uniapp" ? Array.from(B.usedUniHooks) : [], { imports: ge, uniComponents: ve, componentDeclarations: $e } = jt({
1419
+ a
1420
+ ), be = kt(n.setup, a), P = /* @__PURE__ */ new Set();
1421
+ b.length > 0 && P.add("ref"), (g.length > 0 || C) && P.add("reactive"), h.length > 0 && P.add("computed"), S.length > 0 && P.add("watch"), w.length > 0 && P.add("inject"), I.length > 0 && P.add("provide");
1422
+ for (const O of A.usedHooks) P.add(O);
1423
+ const _e = s === "uniapp" ? Array.from(A.usedUniHooks) : [], { imports: ye, uniComponents: Se, componentDeclarations: je } = At({
1384
1424
  componentMap: e,
1385
- components: i.components,
1386
- importBlocks: u,
1425
+ components: u.components,
1426
+ importBlocks: f,
1387
1427
  collectImports: t.imports,
1388
1428
  platform: s,
1389
- vueImports: Array.from(x),
1390
- composableImports: C.imports,
1429
+ vueImports: Array.from(P),
1430
+ composableImports: v.imports,
1391
1431
  globalApiImports: p,
1392
- uniHookImports: he,
1432
+ uniHookImports: _e,
1393
1433
  easycomPackages: t.easycomPackages
1394
- }), be = ue(t.urlSchemas), _e = pe(t.blockPlugins);
1434
+ }), ke = de(t.urlSchemas), we = he(t.blockPlugins);
1395
1435
  return {
1396
1436
  id: n.id,
1397
1437
  version: n.__VERSION__,
1398
1438
  name: n.name,
1399
1439
  imports: `
1400
- ` + ge.join(`
1440
+ ` + ye.join(`
1401
1441
  `),
1402
- props: re(n.props).join(","),
1403
- emits: oe(n.emits).join(","),
1404
- needsProps: a.has("$props"),
1405
- needsEmit: a.has("$emit"),
1442
+ props: ie(n.props).join(","),
1443
+ emits: le(n.emits).join(","),
1444
+ needsProps: l.has("$props"),
1445
+ needsEmit: l.has("$emit"),
1406
1446
  expose: n.expose && n.expose.length ? `{ ${n.expose.join(", ")} }` : "",
1407
- globalApiDeclares: N.join(`
1447
+ globalApiDeclares: D.join(`
1408
1448
  `),
1409
- injects: $.join(`
1449
+ injects: w.join(`
1410
1450
  `),
1411
- composables: C.statements.join(`
1451
+ composables: v.statements.join(`
1412
1452
  `),
1413
- state: g,
1414
- refs: f.join(`
1453
+ state: C,
1454
+ refs: b.join(`
1415
1455
  `),
1416
- reactives: b.join(`
1456
+ reactives: g.join(`
1417
1457
  `),
1418
- computed: w.join(`
1458
+ computed: h.join(`
1419
1459
  `),
1420
- methods: v.join(`
1460
+ methods: d.join(`
1421
1461
  `),
1422
- dataSources: h.join(`
1462
+ dataSources: y.join(`
1423
1463
  `),
1424
- watch: y.join(`
1464
+ watch: S.join(`
1425
1465
  `),
1426
- provide: k.join(`
1466
+ provide: I.join(`
1427
1467
  `),
1428
- createdStatements: T,
1429
- setupStatements: de,
1430
- lifeCycles: B.statements.join(`
1468
+ createdStatements: ve,
1469
+ setupStatements: be,
1470
+ lifeCycles: A.statements.join(`
1431
1471
  `),
1432
- template: i.nodes.join(`
1472
+ template: u.nodes.join(`
1433
1473
  `),
1434
1474
  css: n.css || "",
1435
- style: le(t.style),
1436
- urlSchemas: be.join(`
1475
+ style: me(t.style),
1476
+ urlSchemas: ke.join(`
1437
1477
  `),
1438
- blockPlugins: _e.join(`
1478
+ blockPlugins: we.join(`
1439
1479
  `),
1440
- uniComponents: ve,
1480
+ uniComponents: Se,
1441
1481
  renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer",
1442
- rendererImports: ["useProvider", ...m].join(", "),
1443
- componentDeclarations: $e.join(`
1482
+ rendererImports: ["useProvider", ...i].join(", "),
1483
+ componentDeclarations: je.join(`
1444
1484
  `)
1445
1485
  };
1446
1486
  }
1447
- const Ot = `
1487
+ const Nt = `
1448
1488
  // @ts-nocheck
1449
1489
  import { useProvider } from '<%= renderer %>';
1450
1490
  <%= imports %>
@@ -1476,7 +1516,7 @@ export default defineComponent({
1476
1516
  <% if(methods) { %> methods: { <%= methods %> }, <% } %>
1477
1517
  <% if(watch) { %> watch: { <%= watch %> }, <% } %> <%= lifeCycles %>
1478
1518
  });
1479
- `, Ct = `
1519
+ `, Mt = `
1480
1520
  <template>
1481
1521
  <%= template %>
1482
1522
  </template>
@@ -1487,7 +1527,7 @@ export default defineComponent({
1487
1527
  <%= css %>
1488
1528
  <%= style %>
1489
1529
  </style>
1490
- `, xt = `// @ts-nocheck
1530
+ `, Tt = `// @ts-nocheck
1491
1531
  import { <%= rendererImports %> } from '<%= renderer %>';<%= imports %>
1492
1532
  <% if(componentDeclarations) { %><%= componentDeclarations %><% } %>
1493
1533
  <% if(props) { %>const __props = defineProps({ <%= props %> });<% } else if(needsProps) { %>const __props = defineProps();<% } %>
@@ -1510,54 +1550,63 @@ const __provider = useProvider({ id: '<%= id %>', version: '<%= version %>' });
1510
1550
  <%= provide %>
1511
1551
  <%= lifeCycles %>
1512
1552
  <% if(expose) { %>defineExpose(<%= expose %>);<% } %>
1513
- `, At = H(Ot), Pt = H(xt), Et = H(Ct);
1514
- async function Mt(t, e = /* @__PURE__ */ new Map(), s = [], n = "web", o) {
1553
+ `, Rt = q(Nt), Lt = q(Tt), Dt = q(Mt);
1554
+ async function Wt(t, e = /* @__PURE__ */ new Map(), s = [], o = "web", n) {
1515
1555
  const r = t, c = typeof r.dsl == "object" && arguments.length === 1 ? r : {
1516
1556
  dsl: t,
1517
1557
  componentMap: e,
1518
1558
  dependencies: s,
1519
- platform: n,
1520
- formatterDisabled: o
1559
+ platform: o,
1560
+ formatterDisabled: n
1521
1561
  }, {
1522
1562
  dsl: a,
1523
1563
  componentMap: l = /* @__PURE__ */ new Map(),
1524
- dependencies: p = [],
1525
- platform: m = "web",
1564
+ dependencies: m = [],
1565
+ platform: p = "web",
1526
1566
  formatterDisabled: i = !1,
1527
1567
  ts: u = !0,
1528
- scss: f = !1
1529
- } = c, b = new Ne(Ie(a), p), g = a.apiMode === "composition";
1530
- let w, d, v, h;
1531
- if (g) {
1532
- const $ = It(b, l, m);
1533
- h = Pt($), w = $.template || `
1568
+ scss: f = !1,
1569
+ project: b
1570
+ } = c, g = b ? Me(b) : null, C = g ? (v) => {
1571
+ const x = g.byId.get(v);
1572
+ return x?.type === "block" ? se(x) : `./${v}.vue`;
1573
+ } : void 0, h = new Ue(Pe(a), m), $ = a.apiMode === "composition";
1574
+ let d, y, S, w;
1575
+ if ($) {
1576
+ const v = Bt(
1577
+ h,
1578
+ l,
1579
+ p,
1580
+ C
1581
+ );
1582
+ w = Lt(v), d = v.template || `
1534
1583
  <!--组件模版内容-->
1535
- `, d = $.css, v = $.style;
1584
+ `, y = v.css, S = v.style;
1536
1585
  } else {
1537
- const $ = Ke(b, l, m);
1538
- h = At($), w = $.template || `
1586
+ const v = ct(h, l, p, C);
1587
+ w = Rt(v), d = v.template || `
1539
1588
  <!--组件模版内容-->
1540
- `, d = $.css, v = $.style;
1589
+ `, y = v.css, S = v.style;
1541
1590
  }
1542
- const y = Et({
1543
- template: w,
1544
- css: await z(d, i) || `
1591
+ const I = Dt({
1592
+ template: d,
1593
+ css: await Z(y, i) || `
1545
1594
  /* 组件样式内容 */
1546
1595
  `,
1547
- script: await xe(h, i),
1548
- style: await z(v, i),
1596
+ script: await Te(w, i),
1597
+ style: await Z(S, i),
1549
1598
  scriptLang: u ? "ts" : "js",
1550
1599
  styleLang: f ? "scss" : "css",
1551
- scriptSetup: g
1600
+ scriptSetup: $
1552
1601
  });
1553
- return await ee(y, i).catch(($) => ($.content = y, Promise.reject($)));
1602
+ return await re(I, i).catch((v) => (v.content = I, Promise.reject(v)));
1554
1603
  }
1555
- async function Rt(t) {
1556
- const e = `
1604
+ async function Ht(t, e = "web") {
1605
+ const s = `
1557
1606
  <template>
1558
1607
  <div>
1559
1608
  <h3>源码模式页面</h3>
1560
- <div>文件路径:/.vtj/vue/${t.id}.vue</div>
1609
+ <div>文件路径:/${W(t, e)}</div>
1561
1610
  </div>
1562
1611
  </template>
1563
1612
  <script lang="ts" setup>
@@ -1565,18 +1614,18 @@ async function Rt(t) {
1565
1614
  <style scoped lang="scss">
1566
1615
  </style>
1567
1616
  `;
1568
- return await ee(e);
1617
+ return await re(s);
1569
1618
  }
1570
1619
  export {
1571
- E as GLOBAL_API_MAP,
1572
- fe as UI_GLOBAL_API_MAPS,
1573
- et as UI_PACKAGES,
1574
- Tt as VTJ_CODER_VERSION,
1575
- st as buildEffectiveApiMap,
1576
- Rt as createEmptyPage,
1577
- z as cssFormatter,
1578
- tt as detectUIPackage,
1579
- Mt as generator,
1580
- xe as tsFormatter,
1581
- ee as vueFormatter
1620
+ N as GLOBAL_API_MAP,
1621
+ ge as UI_GLOBAL_API_MAPS,
1622
+ at as UI_PACKAGES,
1623
+ Jt as VTJ_CODER_VERSION,
1624
+ lt as buildEffectiveApiMap,
1625
+ Ht as createEmptyPage,
1626
+ Z as cssFormatter,
1627
+ it as detectUIPackage,
1628
+ Wt as generator,
1629
+ Te as tsFormatter,
1630
+ re as vueFormatter
1582
1631
  };