@vtj/coder 0.18.15 → 0.18.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +40 -40
- package/dist/index.mjs +241 -231
- package/package.json +2 -2
- package/types/parser/composition/template.d.ts +1 -1
- package/types/parser/template.d.ts +1 -1
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { mitt as ye, base64 as Se, dedupArray as
|
|
2
|
-
import { format as
|
|
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";
|
|
2
|
+
import { format as V } from "prettier/standalone";
|
|
3
3
|
import * as Oe from "prettier/plugins/html";
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
4
|
+
import * as X from "prettier/plugins/babel";
|
|
5
|
+
import * as Y from "prettier/plugins/postcss";
|
|
6
|
+
import * as K 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.18.
|
|
11
|
+
* @version 0.18.16
|
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
13
13
|
*/
|
|
14
|
-
const Tt = "0.18.
|
|
14
|
+
const Tt = "0.18.16";
|
|
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.
|
|
19
|
+
* @version 0.18.16
|
|
20
20
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
21
21
|
*/
|
|
22
22
|
const Ce = [
|
|
@@ -33,7 +33,7 @@ const Ce = [
|
|
|
33
33
|
"a"
|
|
34
34
|
];
|
|
35
35
|
ye();
|
|
36
|
-
const
|
|
36
|
+
const q = {
|
|
37
37
|
arrowParens: "always",
|
|
38
38
|
bracketSpacing: !0,
|
|
39
39
|
bracketSameLine: !0,
|
|
@@ -54,52 +54,52 @@ const V = {
|
|
|
54
54
|
vueIndentScriptAndStyle: !0,
|
|
55
55
|
removeBlankLines: !0
|
|
56
56
|
};
|
|
57
|
-
async function
|
|
58
|
-
return e ? t : await
|
|
57
|
+
async function ee(t, e) {
|
|
58
|
+
return e ? t : await V(t, {
|
|
59
59
|
parser: "vue",
|
|
60
|
-
...
|
|
61
|
-
plugins: [Oe,
|
|
60
|
+
...q,
|
|
61
|
+
plugins: [Oe, X, K, Y]
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
async function xe(t, e) {
|
|
65
65
|
if (e) return t;
|
|
66
66
|
try {
|
|
67
|
-
return (await
|
|
67
|
+
return (await V(t, {
|
|
68
68
|
parser: "babel-ts",
|
|
69
|
-
...
|
|
70
|
-
plugins: [
|
|
69
|
+
...q,
|
|
70
|
+
plugins: [X, K]
|
|
71
71
|
})).replace(/;\n$/gi, "");
|
|
72
72
|
} catch (s) {
|
|
73
73
|
return console.warn(s), t;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
async function
|
|
77
|
-
return e ? t :
|
|
76
|
+
async function z(t, e) {
|
|
77
|
+
return e ? t : V(t, {
|
|
78
78
|
parser: "scss",
|
|
79
|
-
...
|
|
80
|
-
plugins: [
|
|
79
|
+
...q,
|
|
80
|
+
plugins: [Y]
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function R(t) {
|
|
84
84
|
return t && t.type === "JSExpression";
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function U(t) {
|
|
87
87
|
return typeof t == "object" && t && t.type === "JSFunction";
|
|
88
88
|
}
|
|
89
89
|
function S(t) {
|
|
90
|
-
return
|
|
90
|
+
return R(t) || U(t);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function te(t) {
|
|
93
93
|
return t.replace(new RegExp("this.", "g"), "");
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function W(t) {
|
|
96
96
|
return t.replace(/this\.context\??\./g, "");
|
|
97
97
|
}
|
|
98
98
|
function _(t, e = !0, s = !0, n = [], o = !0) {
|
|
99
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 =
|
|
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);
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function D(t = "", e = []) {
|
|
103
103
|
let s = t;
|
|
104
104
|
for (const n of e)
|
|
105
105
|
s = s.replace(
|
|
@@ -108,7 +108,7 @@ function M(t = "", e = []) {
|
|
|
108
108
|
);
|
|
109
109
|
return s;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function se(t) {
|
|
112
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"))
|
|
@@ -124,7 +124,7 @@ function te(t) {
|
|
|
124
124
|
function Ae(t = {}) {
|
|
125
125
|
return Object.entries(t).map(([e, s]) => `"${e}": ${_(s)}`);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function ne(t = {}, e = !1) {
|
|
128
128
|
const s = Object.keys(t);
|
|
129
129
|
return e ? s.map((n) => "." + n) : s;
|
|
130
130
|
}
|
|
@@ -140,7 +140,7 @@ function Pe(t) {
|
|
|
140
140
|
function Ee(t = [], e = []) {
|
|
141
141
|
return t.filter((s) => !e.includes(s));
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function Z(t) {
|
|
144
144
|
return Se(JSON.stringify(t));
|
|
145
145
|
}
|
|
146
146
|
class Ne {
|
|
@@ -225,7 +225,7 @@ class Ne {
|
|
|
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
227
|
s = s.concat(Array.from(o));
|
|
228
|
-
return
|
|
228
|
+
return M(s);
|
|
229
229
|
}
|
|
230
230
|
collectContext(e, s) {
|
|
231
231
|
const n = new Set(s?.id ? this.context[s.id] : []), o = (e.directives || []).find((a) => a.name === "vFor");
|
|
@@ -269,7 +269,7 @@ function Te(t = []) {
|
|
|
269
269
|
default: ${_(e.default, !0, !1, [], !1)}
|
|
270
270
|
}`);
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function re(t = []) {
|
|
273
273
|
const e = (s) => s ? `[${je(s).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
|
|
274
274
|
return t.map((s) => typeof s == "string" ? `${s}: {}` : (S(s.default) && !s.default.value && (s.default.value = "undefined"), `${s.name}: {
|
|
275
275
|
type:${e(s.type)},
|
|
@@ -277,25 +277,25 @@ function ne(t = []) {
|
|
|
277
277
|
default: ${s.default ? _(s.default, !0, !1, [], !1) : "undefined"}
|
|
278
278
|
}`));
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function oe(t = []) {
|
|
281
281
|
return t.map((e) => `'${typeof e == "string" ? e : e.name}'`);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function F(t = {}, e = []) {
|
|
284
284
|
return Object.entries(t).map(([s, n]) => {
|
|
285
|
-
let o =
|
|
285
|
+
let o = se(
|
|
286
286
|
_(n, !1, !1, [], !1)
|
|
287
287
|
);
|
|
288
|
-
return o =
|
|
288
|
+
return o = D(o, e)?.trim(), o.startsWith("async") ? `async ${s}${o.replace(/^async/, "")}` : o.startsWith("(") || o.startsWith("{") ? `${s}${o}` : null;
|
|
289
289
|
}).filter((s) => !!s);
|
|
290
290
|
}
|
|
291
291
|
function Me(t = [], e = []) {
|
|
292
292
|
const s = t.reduce(
|
|
293
|
-
(r, c) => (c.id &&
|
|
293
|
+
(r, c) => (c.id && U(c.source) && (r[`watcher_${c.id}`] = c.source), r),
|
|
294
294
|
{}
|
|
295
|
-
), n =
|
|
295
|
+
), n = F(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
|
-
handler${
|
|
298
|
+
handler${se(r.handler.value)}
|
|
299
299
|
}` : null).filter((r) => !!r);
|
|
300
300
|
return {
|
|
301
301
|
computed: n,
|
|
@@ -305,16 +305,16 @@ function Me(t = [], e = []) {
|
|
|
305
305
|
function Re(t = {}) {
|
|
306
306
|
return Object.values(t).map((e) => {
|
|
307
307
|
if (e.type === "mock") {
|
|
308
|
-
const s =
|
|
308
|
+
const s = U(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
|
|
309
309
|
return `async ${e.name}(...args) {
|
|
310
|
-
// DataSource: ${
|
|
310
|
+
// DataSource: ${Z(e)}
|
|
311
311
|
const mock = this.provider.createMock(${s});
|
|
312
312
|
return await mock.apply(this, args);
|
|
313
313
|
}`;
|
|
314
314
|
} else {
|
|
315
|
-
const s =
|
|
315
|
+
const s = U(e.transform) && e.transform.value || "(res) => res";
|
|
316
316
|
return `async ${e.name}(...args) {
|
|
317
|
-
// DataSource: ${
|
|
317
|
+
// DataSource: ${Z(e)}
|
|
318
318
|
return await this.provider.apis['${e.ref}'].apply(this, args).then(${s});
|
|
319
319
|
}`;
|
|
320
320
|
}
|
|
@@ -335,7 +335,7 @@ const De = [
|
|
|
335
335
|
"source",
|
|
336
336
|
"track",
|
|
337
337
|
"wbr"
|
|
338
|
-
],
|
|
338
|
+
], Q = [
|
|
339
339
|
"vIf",
|
|
340
340
|
"vElseIf",
|
|
341
341
|
"vElse",
|
|
@@ -345,61 +345,60 @@ const De = [
|
|
|
345
345
|
"vBind",
|
|
346
346
|
"vHtml"
|
|
347
347
|
];
|
|
348
|
-
function
|
|
349
|
-
const
|
|
350
|
-
let
|
|
351
|
-
const
|
|
352
|
-
let
|
|
353
|
-
return Le(t).forEach((
|
|
354
|
-
const
|
|
355
|
-
for (const
|
|
356
|
-
let { id:
|
|
357
|
-
if (
|
|
348
|
+
function G(t, e, s = [], n = {}, o, r = /* @__PURE__ */ new Set()) {
|
|
349
|
+
const c = [];
|
|
350
|
+
let a = {}, l = [];
|
|
351
|
+
const p = [];
|
|
352
|
+
let m = [];
|
|
353
|
+
return Le(t).forEach((u) => {
|
|
354
|
+
const f = [];
|
|
355
|
+
for (const g of u.children) {
|
|
356
|
+
let { id: w, name: d, invisible: v, from: h } = g;
|
|
357
|
+
if (v)
|
|
358
358
|
continue;
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
const { props:
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
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(
|
|
362
|
+
g,
|
|
363
|
+
w,
|
|
364
|
+
g.props,
|
|
365
|
+
g.events,
|
|
366
366
|
n,
|
|
367
367
|
s
|
|
368
|
-
),
|
|
369
|
-
|
|
368
|
+
), C = Ge(
|
|
369
|
+
g.directives,
|
|
370
370
|
s,
|
|
371
|
-
|
|
372
|
-
).join(" "),
|
|
373
|
-
|
|
371
|
+
p
|
|
372
|
+
).join(" "), O = g.children ? Qe(
|
|
373
|
+
g.children,
|
|
374
374
|
s,
|
|
375
375
|
e,
|
|
376
376
|
n,
|
|
377
|
-
|
|
377
|
+
g,
|
|
378
|
+
r
|
|
378
379
|
) : "";
|
|
379
|
-
let
|
|
380
|
-
typeof
|
|
381
|
-
`), Object.assign(
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
De.includes(N) ? `<${N} ${w} ${y} ${$} />` : `<${N} ${w} ${y} ${$}>${C ? `
|
|
387
|
-
` + C.trim() : ""}</${N}>`
|
|
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;
|
|
384
|
+
f.push(
|
|
385
|
+
De.includes(T) ? `<${T} ${C} ${$} ${k} />` : `<${T} ${C} ${$} ${k}>${N ? `
|
|
386
|
+
` + N.trim() : ""}</${T}>`
|
|
388
387
|
);
|
|
389
388
|
}
|
|
390
|
-
const
|
|
389
|
+
const b = Xe(u.slot, f.join(`
|
|
391
390
|
`), o?.id);
|
|
392
|
-
|
|
391
|
+
c.push(b);
|
|
393
392
|
}), {
|
|
394
|
-
nodes:
|
|
395
|
-
methods:
|
|
396
|
-
directives: Ue(
|
|
397
|
-
components:
|
|
398
|
-
importBlocks:
|
|
393
|
+
nodes: c,
|
|
394
|
+
methods: a,
|
|
395
|
+
directives: Ue(p),
|
|
396
|
+
components: M(l),
|
|
397
|
+
importBlocks: M(m, "id")
|
|
399
398
|
};
|
|
400
399
|
}
|
|
401
400
|
function Ue(t) {
|
|
402
|
-
return
|
|
401
|
+
return M(t).map((e) => `${e.startsWith("v") ? e.substring(1) : e}:${e}`);
|
|
403
402
|
}
|
|
404
403
|
function Le(t = []) {
|
|
405
404
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -416,27 +415,27 @@ function Fe(t, e, s) {
|
|
|
416
415
|
const o = n.parent ? `${n.parent}.${n.alias}` : n.alias;
|
|
417
416
|
return `${t}: ${o}`;
|
|
418
417
|
}
|
|
419
|
-
return
|
|
418
|
+
return ce(s) || n ? t : null;
|
|
420
419
|
}
|
|
421
|
-
function
|
|
420
|
+
function ce(t) {
|
|
422
421
|
return !!t && typeof t == "object" && t.type === "Schema";
|
|
423
422
|
}
|
|
424
|
-
function
|
|
423
|
+
function ae(t) {
|
|
425
424
|
return typeof t == "object" && t.type === "UrlSchema";
|
|
426
425
|
}
|
|
427
|
-
function
|
|
426
|
+
function ie(t) {
|
|
428
427
|
return typeof t == "object" && t.type === "Plugin";
|
|
429
428
|
}
|
|
430
429
|
function Je(t, e, s = []) {
|
|
431
430
|
return t === "style" ? S(e) ? `:style="${_({
|
|
432
431
|
...e,
|
|
433
|
-
value:
|
|
432
|
+
value: D(e.value, s)
|
|
434
433
|
})}"` : "" : t === "__class" && S(e) ? `:class="${_({
|
|
435
434
|
...e,
|
|
436
|
-
value:
|
|
435
|
+
value: D(e.value, s)
|
|
437
436
|
})}"` : typeof e == "string" ? `${t}="${e}"` : S(e) ? `:${t}="${_({
|
|
438
437
|
...e,
|
|
439
|
-
value:
|
|
438
|
+
value: D(e.value, s)
|
|
440
439
|
})}"` : ke(e) ? `:${t}='{${Ae(
|
|
441
440
|
e
|
|
442
441
|
).join(", ")}}'` : `:${t}='${JSON.stringify(e)}'`;
|
|
@@ -447,20 +446,20 @@ function We(t, e = {}, s = []) {
|
|
|
447
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;
|
|
448
447
|
}
|
|
449
448
|
const o = t.from;
|
|
450
|
-
return (
|
|
449
|
+
return (ae(o) || ie(o)) && (e.is = {
|
|
451
450
|
type: "JSExpression",
|
|
452
451
|
value: t.name
|
|
453
452
|
}), Object.entries(e).map(([r, c]) => Je(r, c, s));
|
|
454
453
|
}
|
|
455
454
|
function He(t, e, s) {
|
|
456
|
-
const n =
|
|
455
|
+
const n = ne(e.modifiers, !0);
|
|
457
456
|
return `@${t}${n.join("")}="${s}"`;
|
|
458
457
|
}
|
|
459
458
|
function Ve(t, e = {}, s = {}) {
|
|
460
459
|
const n = {};
|
|
461
460
|
return {
|
|
462
461
|
binders: Object.entries(e).map(([r, c]) => {
|
|
463
|
-
const a =
|
|
462
|
+
const a = te(W(c.handler.value)).replace(
|
|
464
463
|
/\"/g,
|
|
465
464
|
"'"
|
|
466
465
|
);
|
|
@@ -486,7 +485,7 @@ function Ge(t = [], e = [], s = []) {
|
|
|
486
485
|
vShow: a,
|
|
487
486
|
vModels: l,
|
|
488
487
|
vFor: p,
|
|
489
|
-
vBind:
|
|
488
|
+
vBind: m,
|
|
490
489
|
vHtml: i,
|
|
491
490
|
customDirectives: u
|
|
492
491
|
} = ze(t);
|
|
@@ -494,40 +493,40 @@ function Ge(t = [], e = [], s = []) {
|
|
|
494
493
|
`v-else-if="${_(c.value, !0, !0, e)}"`
|
|
495
494
|
), r && n.push("v-else"), a && n.push(
|
|
496
495
|
`v-show="${_(a.value, !0, !0, e)}"`
|
|
497
|
-
),
|
|
498
|
-
`v-bind="${_(
|
|
496
|
+
), m && n.push(
|
|
497
|
+
`v-bind="${_(m.value, !0, !0, e)}"`
|
|
499
498
|
), l.forEach((f) => {
|
|
500
|
-
const
|
|
499
|
+
const b = ne(f.modifiers, !0), g = f.arg ? R(f.arg) ? `:[${_(f.arg, !0, !0, e)}]` : `:${f.arg}` : "";
|
|
501
500
|
n.push(
|
|
502
|
-
`v-model${
|
|
501
|
+
`v-model${g}${b}="${_(f.value, !0, !0, e)}"`
|
|
503
502
|
);
|
|
504
503
|
}), p) {
|
|
505
|
-
const { item: f, index:
|
|
504
|
+
const { item: f, index: b } = { item: "item", index: "index", ...p.iterator };
|
|
506
505
|
n.push(
|
|
507
|
-
`v-for="(${f}, ${
|
|
506
|
+
`v-for="(${f}, ${b}) in ${_(p.value, !0, !0, e)}"`
|
|
508
507
|
);
|
|
509
508
|
}
|
|
510
509
|
return i && n.push(
|
|
511
510
|
`v-html="${_(i.value, !0, !0, e)}"`
|
|
512
511
|
), u && u.length && u.forEach((f) => {
|
|
513
512
|
if (!f.name) return;
|
|
514
|
-
let
|
|
515
|
-
|
|
516
|
-
const
|
|
517
|
-
if (
|
|
518
|
-
const
|
|
519
|
-
|
|
513
|
+
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));
|
|
520
519
|
}
|
|
521
520
|
f.value ? n.push(
|
|
522
|
-
`${
|
|
523
|
-
) : n.push(
|
|
521
|
+
`${b}="${_(f.value, !0, !0, e)}"`
|
|
522
|
+
) : n.push(b);
|
|
524
523
|
}), n;
|
|
525
524
|
}
|
|
526
525
|
function ze(t = []) {
|
|
527
526
|
const e = t.filter(
|
|
528
|
-
(i) =>
|
|
527
|
+
(i) => Q.includes(i.name)
|
|
529
528
|
), s = t.filter(
|
|
530
|
-
(i) => !
|
|
529
|
+
(i) => !Q.includes(i.name)
|
|
531
530
|
), n = e.find(
|
|
532
531
|
(i) => A(i.name) === "vIf"
|
|
533
532
|
), o = e.find(
|
|
@@ -542,7 +541,7 @@ function ze(t = []) {
|
|
|
542
541
|
(i) => A(i.name) === "vBind"
|
|
543
542
|
), p = e.find(
|
|
544
543
|
(i) => A(i.name) === "vHtml"
|
|
545
|
-
),
|
|
544
|
+
), m = e.filter(
|
|
546
545
|
(i) => A(i.name) === "vModel"
|
|
547
546
|
);
|
|
548
547
|
return {
|
|
@@ -551,7 +550,7 @@ function ze(t = []) {
|
|
|
551
550
|
vElse: r,
|
|
552
551
|
vFor: c,
|
|
553
552
|
vShow: a,
|
|
554
|
-
vModels:
|
|
553
|
+
vModels: m,
|
|
555
554
|
vBind: l,
|
|
556
555
|
vHtml: p,
|
|
557
556
|
customDirectives: s
|
|
@@ -560,8 +559,15 @@ function ze(t = []) {
|
|
|
560
559
|
function Ze(t) {
|
|
561
560
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
562
561
|
}
|
|
563
|
-
function Qe(t, e, s, n, o) {
|
|
564
|
-
return typeof t == "string" ? Ze(t) :
|
|
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(
|
|
564
|
+
t,
|
|
565
|
+
s,
|
|
566
|
+
e,
|
|
567
|
+
n,
|
|
568
|
+
o,
|
|
569
|
+
r
|
|
570
|
+
) : "";
|
|
565
571
|
}
|
|
566
572
|
function Xe(t, e, s) {
|
|
567
573
|
if (!t) return e;
|
|
@@ -579,24 +585,24 @@ function Ye(t, e = [], s = [], n = {}, o = "web", r = /* @__PURE__ */ new Set())
|
|
|
579
585
|
], a = {
|
|
580
586
|
vue: ["defineComponent", "reactive"]
|
|
581
587
|
}, l = [];
|
|
582
|
-
for (const
|
|
583
|
-
const i = t.get(
|
|
588
|
+
for (const m of e) {
|
|
589
|
+
const i = t.get(m.split(":")[0]);
|
|
584
590
|
if (i && i.package) {
|
|
585
591
|
if (r.has(i.package)) continue;
|
|
586
592
|
const u = a[i.package] ?? (a[i.package] = []), f = i.parent || (i.alias || "").split(".")[0] || i.name;
|
|
587
593
|
u.push(f), o === "uniapp" && c.includes(i.package) && l.push(f);
|
|
588
594
|
}
|
|
589
595
|
}
|
|
590
|
-
for (const [
|
|
591
|
-
(a[
|
|
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));
|
|
592
598
|
return {
|
|
593
|
-
imports: Object.entries(a).filter(([
|
|
599
|
+
imports: Object.entries(a).filter(([m, i]) => o === "uniapp" ? !c.includes(m) && !!i.length : !!i.length).map(([m, i]) => `import { ${M(i).join(
|
|
594
600
|
","
|
|
595
|
-
)}} from '${
|
|
601
|
+
)}} from '${m}';`).concat(s),
|
|
596
602
|
uniComponents: l
|
|
597
603
|
};
|
|
598
604
|
}
|
|
599
|
-
function
|
|
605
|
+
function le(t = {}) {
|
|
600
606
|
const e = [];
|
|
601
607
|
for (const [s, n] of Object.entries(t))
|
|
602
608
|
e.push(`
|
|
@@ -607,7 +613,7 @@ function ie(t = {}) {
|
|
|
607
613
|
return e.join(`
|
|
608
614
|
`);
|
|
609
615
|
}
|
|
610
|
-
function
|
|
616
|
+
function ue(t = {}) {
|
|
611
617
|
const e = [];
|
|
612
618
|
return Object.entries(t).forEach(([s, n]) => {
|
|
613
619
|
e.push(
|
|
@@ -615,7 +621,7 @@ function le(t = {}) {
|
|
|
615
621
|
);
|
|
616
622
|
}), e;
|
|
617
623
|
}
|
|
618
|
-
function
|
|
624
|
+
function pe(t = {}) {
|
|
619
625
|
const e = [];
|
|
620
626
|
return Object.entries(t).forEach(([s, n]) => {
|
|
621
627
|
e.push(
|
|
@@ -624,22 +630,24 @@ function ue(t = {}) {
|
|
|
624
630
|
}), e;
|
|
625
631
|
}
|
|
626
632
|
function Ke(t, e, s = "web") {
|
|
627
|
-
const { dsl: n } = t, o = Object.keys(n.computed || {}), r =
|
|
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(
|
|
628
634
|
n.nodes || [],
|
|
629
635
|
e,
|
|
630
636
|
o,
|
|
631
|
-
t.context
|
|
632
|
-
|
|
637
|
+
t.context,
|
|
638
|
+
void 0,
|
|
639
|
+
t.easycomPackages
|
|
640
|
+
), b = [...c, ...a.computed], g = F(
|
|
633
641
|
{
|
|
634
642
|
...p,
|
|
635
643
|
...n.methods || {}
|
|
636
644
|
},
|
|
637
645
|
o
|
|
638
|
-
),
|
|
639
|
-
let { imports:
|
|
646
|
+
), w = u.map((k) => `import ${k.name} from './${k.id}.vue';`);
|
|
647
|
+
let { imports: d, uniComponents: v } = Ye(
|
|
640
648
|
e,
|
|
641
649
|
i,
|
|
642
|
-
|
|
650
|
+
w,
|
|
643
651
|
t.imports,
|
|
644
652
|
s,
|
|
645
653
|
t.easycomPackages
|
|
@@ -647,36 +655,36 @@ function Ke(t, e, s = "web") {
|
|
|
647
655
|
const h = Object.keys({
|
|
648
656
|
...t.urlSchemas,
|
|
649
657
|
...t.blockPlugins
|
|
650
|
-
}), y =
|
|
658
|
+
}), y = ue(t.urlSchemas), $ = pe(t.blockPlugins);
|
|
651
659
|
return {
|
|
652
660
|
id: n.id,
|
|
653
661
|
version: n.__VERSION__,
|
|
654
662
|
name: n.name,
|
|
655
663
|
state: Be(n.state).join(","),
|
|
656
664
|
inject: Te(n.inject).join(","),
|
|
657
|
-
props:
|
|
658
|
-
emits:
|
|
665
|
+
props: re(n.props).join(","),
|
|
666
|
+
emits: oe(n.emits).join(","),
|
|
659
667
|
expose: n.expose && n.expose.length ? JSON.stringify(n.expose || []) : "",
|
|
660
668
|
watch: a.watches.join(","),
|
|
661
669
|
lifeCycles: r.join(","),
|
|
662
|
-
computed:
|
|
663
|
-
methods: [...l, ...
|
|
670
|
+
computed: b.join(","),
|
|
671
|
+
methods: [...l, ...g].join(","),
|
|
664
672
|
imports: `
|
|
665
|
-
` +
|
|
673
|
+
` + d.join(`
|
|
666
674
|
`),
|
|
667
|
-
components: Ee(i,
|
|
675
|
+
components: Ee(i, v).join(","),
|
|
668
676
|
directives: f.join(","),
|
|
669
677
|
returns: t.members.join(","),
|
|
670
|
-
template:
|
|
678
|
+
template: m.join(`
|
|
671
679
|
`),
|
|
672
680
|
css: n.css || "",
|
|
673
|
-
style:
|
|
681
|
+
style: le(t.style),
|
|
674
682
|
urlSchemas: y.join(`
|
|
675
683
|
`),
|
|
676
684
|
blockPlugins: $.join(`
|
|
677
685
|
`),
|
|
678
686
|
asyncComponents: h.join(","),
|
|
679
|
-
uniComponents:
|
|
687
|
+
uniComponents: v,
|
|
680
688
|
renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer"
|
|
681
689
|
};
|
|
682
690
|
}
|
|
@@ -872,7 +880,7 @@ const E = {
|
|
|
872
880
|
declare: "const __apis = useApis();",
|
|
873
881
|
replace: "__apis"
|
|
874
882
|
}
|
|
875
|
-
},
|
|
883
|
+
}, fe = {
|
|
876
884
|
"element-plus": {
|
|
877
885
|
$loading: {
|
|
878
886
|
composable: "ElLoading",
|
|
@@ -961,7 +969,7 @@ const E = {
|
|
|
961
969
|
replace: "message.error"
|
|
962
970
|
}
|
|
963
971
|
}
|
|
964
|
-
}, et = Object.keys(
|
|
972
|
+
}, et = Object.keys(fe);
|
|
965
973
|
function tt(t) {
|
|
966
974
|
for (const [, e] of t)
|
|
967
975
|
if (et.includes(e.package))
|
|
@@ -969,7 +977,7 @@ function tt(t) {
|
|
|
969
977
|
return null;
|
|
970
978
|
}
|
|
971
979
|
function st(t) {
|
|
972
|
-
const e = t ?
|
|
980
|
+
const e = t ? fe[t] ?? {} : {};
|
|
973
981
|
return { ...E, ...e };
|
|
974
982
|
}
|
|
975
983
|
function nt(t, e = E) {
|
|
@@ -1023,9 +1031,9 @@ function ct(t, e = E) {
|
|
|
1023
1031
|
if (u.destructure && u.destructure.length > 0)
|
|
1024
1032
|
for (const f of u.destructure) p.add(f);
|
|
1025
1033
|
else u.name && p.add(u.name);
|
|
1026
|
-
const
|
|
1034
|
+
const m = /* @__PURE__ */ new Set();
|
|
1027
1035
|
for (const u of t.inject ?? [])
|
|
1028
|
-
u.name &&
|
|
1036
|
+
u.name && m.add(u.name);
|
|
1029
1037
|
const i = /* @__PURE__ */ new Set();
|
|
1030
1038
|
for (const [, u] of Object.entries(t.dataSources ?? {}))
|
|
1031
1039
|
u.name && i.add(u.name);
|
|
@@ -1036,7 +1044,7 @@ function ct(t, e = E) {
|
|
|
1036
1044
|
methods: a,
|
|
1037
1045
|
props: l,
|
|
1038
1046
|
composables: p,
|
|
1039
|
-
injects:
|
|
1047
|
+
injects: m,
|
|
1040
1048
|
dataSources: i,
|
|
1041
1049
|
hasState: r,
|
|
1042
1050
|
effectiveApiMap: e
|
|
@@ -1156,7 +1164,7 @@ function ht(t = [], e) {
|
|
|
1156
1164
|
function gt(t = {}, e) {
|
|
1157
1165
|
return Object.entries(t).map(([s, n]) => {
|
|
1158
1166
|
let o;
|
|
1159
|
-
if (
|
|
1167
|
+
if (U(n)) {
|
|
1160
1168
|
const r = j(
|
|
1161
1169
|
n.value || "",
|
|
1162
1170
|
e,
|
|
@@ -1167,7 +1175,7 @@ function gt(t = {}, e) {
|
|
|
1167
1175
|
return `provide('${s}', ${o});`;
|
|
1168
1176
|
});
|
|
1169
1177
|
}
|
|
1170
|
-
function
|
|
1178
|
+
function me(t) {
|
|
1171
1179
|
let e = t.trim().replace(/;$/, "");
|
|
1172
1180
|
/^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim());
|
|
1173
1181
|
const s = e.match(/^(?:async\s+)?\([^)]*\)\s*=>\s*([\s\S]+)$/);
|
|
@@ -1183,14 +1191,14 @@ function fe(t) {
|
|
|
1183
1191
|
function vt(t, e) {
|
|
1184
1192
|
if (!t || !t.value) return "";
|
|
1185
1193
|
const s = j(t.value, e, "script");
|
|
1186
|
-
return
|
|
1194
|
+
return me(s);
|
|
1187
1195
|
}
|
|
1188
1196
|
function $t(t = {}, e) {
|
|
1189
1197
|
const s = [];
|
|
1190
1198
|
for (const n of ["beforeCreate", "created"]) {
|
|
1191
1199
|
const o = t[n];
|
|
1192
1200
|
if (o && o.value) {
|
|
1193
|
-
const r = j(o.value, e, "script"), c =
|
|
1201
|
+
const r = j(o.value, e, "script"), c = me(r);
|
|
1194
1202
|
c && s.push(`// ${n}
|
|
1195
1203
|
${c}`);
|
|
1196
1204
|
}
|
|
@@ -1268,7 +1276,7 @@ function jt(t) {
|
|
|
1268
1276
|
composableImports: a,
|
|
1269
1277
|
globalApiImports: l,
|
|
1270
1278
|
uniHookImports: p,
|
|
1271
|
-
easycomPackages:
|
|
1279
|
+
easycomPackages: m
|
|
1272
1280
|
} = t, i = [
|
|
1273
1281
|
"@dcloudio/uni-h5",
|
|
1274
1282
|
"uni-h5",
|
|
@@ -1276,30 +1284,30 @@ function jt(t) {
|
|
|
1276
1284
|
"uni-ui"
|
|
1277
1285
|
], u = {
|
|
1278
1286
|
vue: [...c]
|
|
1279
|
-
}, f = [],
|
|
1280
|
-
for (const
|
|
1281
|
-
const
|
|
1282
|
-
if (!h || !h.package || h.parent ||
|
|
1283
|
-
const y = u[h.package] ?? (u[h.package] = []), $ = (h.alias || "").split(".")[0] || h.name,
|
|
1284
|
-
y.push(
|
|
1287
|
+
}, 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($);
|
|
1285
1293
|
}
|
|
1286
|
-
for (const
|
|
1287
|
-
const
|
|
1288
|
-
if (!h || !h.package || !h.parent ||
|
|
1289
|
-
const y = h.parent, $ =
|
|
1290
|
-
|
|
1291
|
-
`const ${
|
|
1292
|
-
),
|
|
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 || "";
|
|
1298
|
+
b.push(
|
|
1299
|
+
`const ${v} = ${$}.${k};`
|
|
1300
|
+
), g[y] || ((u[h.package] ?? (u[h.package] = [])).push(y), g[y] = y);
|
|
1293
1301
|
}
|
|
1294
|
-
for (const [
|
|
1295
|
-
(u[
|
|
1296
|
-
for (const [
|
|
1297
|
-
(u[
|
|
1298
|
-
for (const [
|
|
1299
|
-
(u[
|
|
1300
|
-
return r === "uniapp" && p.length > 0 && (u["@dcloudio/uni-app"] ?? (u["@dcloudio/uni-app"] = [])).push(...p), { imports: Object.entries(u).filter(([
|
|
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(
|
|
1301
1309
|
","
|
|
1302
|
-
)}} from '${
|
|
1310
|
+
)}} from '${d}';`).concat(n), uniComponents: f, componentDeclarations: b };
|
|
1303
1311
|
}
|
|
1304
1312
|
function kt(t, e = E, s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
|
|
1305
1313
|
const o = Object.entries(e), r = (c) => {
|
|
@@ -1308,11 +1316,11 @@ function kt(t, e = E, s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set
|
|
|
1308
1316
|
return c.map(r);
|
|
1309
1317
|
if (S(c) && typeof c.value == "string") {
|
|
1310
1318
|
let l = c.value;
|
|
1311
|
-
for (const [p,
|
|
1319
|
+
for (const [p, m] of o) {
|
|
1312
1320
|
const i = p.replace(/\$/g, "\\$"), u = new RegExp(`this\\.${i}\\b`, "g");
|
|
1313
|
-
l = l.replace(u,
|
|
1321
|
+
l = l.replace(u, m.replace);
|
|
1314
1322
|
}
|
|
1315
|
-
return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (p,
|
|
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 };
|
|
1316
1324
|
}
|
|
1317
1325
|
const a = {};
|
|
1318
1326
|
for (const [l, p] of Object.entries(c))
|
|
@@ -1321,23 +1329,24 @@ function kt(t, e = E, s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set
|
|
|
1321
1329
|
};
|
|
1322
1330
|
return t.map(r);
|
|
1323
1331
|
}
|
|
1324
|
-
function wt(t, e, s = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
|
|
1325
|
-
const
|
|
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(
|
|
1326
1334
|
t,
|
|
1327
1335
|
r,
|
|
1328
1336
|
c,
|
|
1329
1337
|
a
|
|
1330
1338
|
);
|
|
1331
|
-
return
|
|
1332
|
-
|
|
1339
|
+
return G(
|
|
1340
|
+
p,
|
|
1333
1341
|
e,
|
|
1334
1342
|
s,
|
|
1335
1343
|
n,
|
|
1336
|
-
o
|
|
1344
|
+
o,
|
|
1345
|
+
l
|
|
1337
1346
|
);
|
|
1338
1347
|
}
|
|
1339
1348
|
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),
|
|
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__ || [];
|
|
1341
1350
|
delete p.__renderer__;
|
|
1342
1351
|
const i = wt(
|
|
1343
1352
|
n.nodes || [],
|
|
@@ -1347,41 +1356,42 @@ function It(t, e, s = "web") {
|
|
|
1347
1356
|
void 0,
|
|
1348
1357
|
r,
|
|
1349
1358
|
c.refs,
|
|
1350
|
-
c.computed
|
|
1359
|
+
c.computed,
|
|
1360
|
+
t.easycomPackages
|
|
1351
1361
|
), u = i.importBlocks.map(
|
|
1352
|
-
(
|
|
1353
|
-
), f = at(n.refs || {}, c),
|
|
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 = {
|
|
1354
1364
|
...i.methods || {},
|
|
1355
1365
|
...n.methods || {}
|
|
1356
|
-
},
|
|
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(
|
|
1357
1367
|
n.composables || [],
|
|
1358
1368
|
c
|
|
1359
|
-
),
|
|
1360
|
-
for (const
|
|
1361
|
-
if (
|
|
1362
|
-
for (const
|
|
1363
|
-
else
|
|
1364
|
-
const N = l.filter((
|
|
1365
|
-
const
|
|
1366
|
-
return !(
|
|
1367
|
-
}),
|
|
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(
|
|
1368
1378
|
n.lifeCycles || {},
|
|
1369
1379
|
c
|
|
1370
1380
|
), de = vt(n.setup, c), x = /* @__PURE__ */ new Set();
|
|
1371
|
-
f.length > 0 && x.add("ref"), (
|
|
1372
|
-
for (const
|
|
1373
|
-
const he = s === "uniapp" ? Array.from(
|
|
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({
|
|
1374
1384
|
componentMap: e,
|
|
1375
1385
|
components: i.components,
|
|
1376
1386
|
importBlocks: u,
|
|
1377
1387
|
collectImports: t.imports,
|
|
1378
1388
|
platform: s,
|
|
1379
1389
|
vueImports: Array.from(x),
|
|
1380
|
-
composableImports:
|
|
1390
|
+
composableImports: C.imports,
|
|
1381
1391
|
globalApiImports: p,
|
|
1382
1392
|
uniHookImports: he,
|
|
1383
1393
|
easycomPackages: t.easycomPackages
|
|
1384
|
-
}), be =
|
|
1394
|
+
}), be = ue(t.urlSchemas), _e = pe(t.blockPlugins);
|
|
1385
1395
|
return {
|
|
1386
1396
|
id: n.id,
|
|
1387
1397
|
version: n.__VERSION__,
|
|
@@ -1389,8 +1399,8 @@ function It(t, e, s = "web") {
|
|
|
1389
1399
|
imports: `
|
|
1390
1400
|
` + ge.join(`
|
|
1391
1401
|
`),
|
|
1392
|
-
props:
|
|
1393
|
-
emits:
|
|
1402
|
+
props: re(n.props).join(","),
|
|
1403
|
+
emits: oe(n.emits).join(","),
|
|
1394
1404
|
needsProps: a.has("$props"),
|
|
1395
1405
|
needsEmit: a.has("$emit"),
|
|
1396
1406
|
expose: n.expose && n.expose.length ? `{ ${n.expose.join(", ")} }` : "",
|
|
@@ -1398,38 +1408,38 @@ function It(t, e, s = "web") {
|
|
|
1398
1408
|
`),
|
|
1399
1409
|
injects: $.join(`
|
|
1400
1410
|
`),
|
|
1401
|
-
composables:
|
|
1411
|
+
composables: C.statements.join(`
|
|
1402
1412
|
`),
|
|
1403
|
-
state:
|
|
1413
|
+
state: g,
|
|
1404
1414
|
refs: f.join(`
|
|
1405
1415
|
`),
|
|
1406
|
-
reactives:
|
|
1416
|
+
reactives: b.join(`
|
|
1407
1417
|
`),
|
|
1408
|
-
computed:
|
|
1418
|
+
computed: w.join(`
|
|
1409
1419
|
`),
|
|
1410
|
-
methods:
|
|
1420
|
+
methods: v.join(`
|
|
1411
1421
|
`),
|
|
1412
1422
|
dataSources: h.join(`
|
|
1413
1423
|
`),
|
|
1414
1424
|
watch: y.join(`
|
|
1415
1425
|
`),
|
|
1416
|
-
provide:
|
|
1426
|
+
provide: k.join(`
|
|
1417
1427
|
`),
|
|
1418
|
-
createdStatements:
|
|
1428
|
+
createdStatements: T,
|
|
1419
1429
|
setupStatements: de,
|
|
1420
|
-
lifeCycles:
|
|
1430
|
+
lifeCycles: B.statements.join(`
|
|
1421
1431
|
`),
|
|
1422
1432
|
template: i.nodes.join(`
|
|
1423
1433
|
`),
|
|
1424
1434
|
css: n.css || "",
|
|
1425
|
-
style:
|
|
1435
|
+
style: le(t.style),
|
|
1426
1436
|
urlSchemas: be.join(`
|
|
1427
1437
|
`),
|
|
1428
1438
|
blockPlugins: _e.join(`
|
|
1429
1439
|
`),
|
|
1430
1440
|
uniComponents: ve,
|
|
1431
1441
|
renderer: s === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer",
|
|
1432
|
-
rendererImports: ["useProvider", ...
|
|
1442
|
+
rendererImports: ["useProvider", ...m].join(", "),
|
|
1433
1443
|
componentDeclarations: $e.join(`
|
|
1434
1444
|
`)
|
|
1435
1445
|
};
|
|
@@ -1500,7 +1510,7 @@ const __provider = useProvider({ id: '<%= id %>', version: '<%= version %>' });
|
|
|
1500
1510
|
<%= provide %>
|
|
1501
1511
|
<%= lifeCycles %>
|
|
1502
1512
|
<% if(expose) { %>defineExpose(<%= expose %>);<% } %>
|
|
1503
|
-
`, At =
|
|
1513
|
+
`, At = H(Ot), Pt = H(xt), Et = H(Ct);
|
|
1504
1514
|
async function Mt(t, e = /* @__PURE__ */ new Map(), s = [], n = "web", o) {
|
|
1505
1515
|
const r = t, c = typeof r.dsl == "object" && arguments.length === 1 ? r : {
|
|
1506
1516
|
dsl: t,
|
|
@@ -1512,35 +1522,35 @@ async function Mt(t, e = /* @__PURE__ */ new Map(), s = [], n = "web", o) {
|
|
|
1512
1522
|
dsl: a,
|
|
1513
1523
|
componentMap: l = /* @__PURE__ */ new Map(),
|
|
1514
1524
|
dependencies: p = [],
|
|
1515
|
-
platform:
|
|
1525
|
+
platform: m = "web",
|
|
1516
1526
|
formatterDisabled: i = !1,
|
|
1517
1527
|
ts: u = !0,
|
|
1518
1528
|
scss: f = !1
|
|
1519
|
-
} = c,
|
|
1520
|
-
let
|
|
1521
|
-
if (
|
|
1522
|
-
const $ = It(
|
|
1523
|
-
h = Pt($),
|
|
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 || `
|
|
1524
1534
|
<!--组件模版内容-->
|
|
1525
|
-
`,
|
|
1535
|
+
`, d = $.css, v = $.style;
|
|
1526
1536
|
} else {
|
|
1527
|
-
const $ = Ke(
|
|
1528
|
-
h = At($),
|
|
1537
|
+
const $ = Ke(b, l, m);
|
|
1538
|
+
h = At($), w = $.template || `
|
|
1529
1539
|
<!--组件模版内容-->
|
|
1530
|
-
`,
|
|
1540
|
+
`, d = $.css, v = $.style;
|
|
1531
1541
|
}
|
|
1532
1542
|
const y = Et({
|
|
1533
|
-
template:
|
|
1534
|
-
css: await
|
|
1543
|
+
template: w,
|
|
1544
|
+
css: await z(d, i) || `
|
|
1535
1545
|
/* 组件样式内容 */
|
|
1536
1546
|
`,
|
|
1537
1547
|
script: await xe(h, i),
|
|
1538
|
-
style: await
|
|
1548
|
+
style: await z(v, i),
|
|
1539
1549
|
scriptLang: u ? "ts" : "js",
|
|
1540
1550
|
styleLang: f ? "scss" : "css",
|
|
1541
|
-
scriptSetup:
|
|
1551
|
+
scriptSetup: g
|
|
1542
1552
|
});
|
|
1543
|
-
return await
|
|
1553
|
+
return await ee(y, i).catch(($) => ($.content = y, Promise.reject($)));
|
|
1544
1554
|
}
|
|
1545
1555
|
async function Rt(t) {
|
|
1546
1556
|
const e = `
|
|
@@ -1555,18 +1565,18 @@ async function Rt(t) {
|
|
|
1555
1565
|
<style scoped lang="scss">
|
|
1556
1566
|
</style>
|
|
1557
1567
|
`;
|
|
1558
|
-
return await
|
|
1568
|
+
return await ee(e);
|
|
1559
1569
|
}
|
|
1560
1570
|
export {
|
|
1561
1571
|
E as GLOBAL_API_MAP,
|
|
1562
|
-
|
|
1572
|
+
fe as UI_GLOBAL_API_MAPS,
|
|
1563
1573
|
et as UI_PACKAGES,
|
|
1564
1574
|
Tt as VTJ_CODER_VERSION,
|
|
1565
1575
|
st as buildEffectiveApiMap,
|
|
1566
1576
|
Rt as createEmptyPage,
|
|
1567
|
-
|
|
1577
|
+
z as cssFormatter,
|
|
1568
1578
|
tt as detectUIPackage,
|
|
1569
1579
|
Mt as generator,
|
|
1570
1580
|
xe as tsFormatter,
|
|
1571
|
-
|
|
1581
|
+
ee as vueFormatter
|
|
1572
1582
|
};
|