@vtj/coder 0.17.7 → 0.18.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.cjs +83 -35
- package/dist/index.mjs +1210 -408
- package/package.json +7 -5
- package/types/collecter.d.ts +3 -0
- package/types/index.d.ts +1 -0
- package/types/parser/composition/composables.d.ts +18 -0
- package/types/parser/composition/computed.d.ts +8 -0
- package/types/parser/composition/globalApi.d.ts +49 -0
- package/types/parser/composition/imports.d.ts +31 -0
- package/types/parser/composition/index.d.ts +63 -0
- package/types/parser/composition/inject.d.ts +8 -0
- package/types/parser/composition/lifeCycles.d.ts +23 -0
- package/types/parser/composition/methods.d.ts +18 -0
- package/types/parser/composition/provide.d.ts +9 -0
- package/types/parser/composition/reactives.d.ts +11 -0
- package/types/parser/composition/refs.d.ts +8 -0
- package/types/parser/composition/setupStatements.d.ts +24 -0
- package/types/parser/composition/symbolTable.d.ts +32 -0
- package/types/parser/composition/template.d.ts +17 -0
- package/types/parser/composition/transformer.d.ts +38 -0
- package/types/parser/composition/watch.d.ts +9 -0
- package/types/parser/functions.d.ts +2 -2
- package/types/parser/imports.d.ts +1 -1
- package/types/templates.d.ts +1 -0
- package/types/version.d.ts +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { mitt as
|
|
2
|
-
import { format as
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
1
|
+
import { mitt as ye, base64 as Se, dedupArray as B, toArray as je, kebabCase as F, camelCase as A, isPlainObject as ke, isString as we, template as W, cloneDeep as Ie } from "@vtj/base";
|
|
2
|
+
import { format as H } from "prettier/standalone";
|
|
3
|
+
import * as Oe from "prettier/plugins/html";
|
|
4
|
+
import * as Q from "prettier/plugins/babel";
|
|
5
|
+
import * as X from "prettier/plugins/postcss";
|
|
6
|
+
import * as Y 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.
|
|
11
|
+
* @version 0.18.0
|
|
12
12
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
13
13
|
*/
|
|
14
|
-
const
|
|
14
|
+
const Bt = "0.18.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
|
+
* @version 0.18.0
|
|
20
20
|
* @license <a href="https://vtj.pro/license.html">MIT License</a>
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
22
|
+
const Ce = [
|
|
23
23
|
"slot",
|
|
24
24
|
"template",
|
|
25
25
|
"component",
|
|
@@ -32,8 +32,8 @@ const ie = [
|
|
|
32
32
|
"span",
|
|
33
33
|
"a"
|
|
34
34
|
];
|
|
35
|
-
|
|
36
|
-
const
|
|
35
|
+
ye();
|
|
36
|
+
const V = {
|
|
37
37
|
arrowParens: "always",
|
|
38
38
|
bracketSpacing: !0,
|
|
39
39
|
bracketSameLine: !0,
|
|
@@ -51,100 +51,101 @@ const T = {
|
|
|
51
51
|
tabWidth: 2,
|
|
52
52
|
trailingComma: "none",
|
|
53
53
|
useTabs: !1,
|
|
54
|
-
vueIndentScriptAndStyle: !0
|
|
54
|
+
vueIndentScriptAndStyle: !0,
|
|
55
|
+
removeBlankLines: !0
|
|
55
56
|
};
|
|
56
|
-
async function
|
|
57
|
-
return e ?
|
|
57
|
+
async function K(s, e) {
|
|
58
|
+
return e ? s : await H(s, {
|
|
58
59
|
parser: "vue",
|
|
59
|
-
...
|
|
60
|
-
plugins: [
|
|
60
|
+
...V,
|
|
61
|
+
plugins: [Oe, Q, Y, X]
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
|
-
async function
|
|
64
|
-
if (e) return
|
|
64
|
+
async function xe(s, e) {
|
|
65
|
+
if (e) return s;
|
|
65
66
|
try {
|
|
66
|
-
return (await
|
|
67
|
+
return (await H(s, {
|
|
67
68
|
parser: "babel-ts",
|
|
68
|
-
...
|
|
69
|
-
plugins: [
|
|
69
|
+
...V,
|
|
70
|
+
plugins: [Q, Y]
|
|
70
71
|
})).replace(/;\n$/gi, "");
|
|
71
|
-
} catch (
|
|
72
|
-
return console.warn(
|
|
72
|
+
} catch (t) {
|
|
73
|
+
return console.warn(t), s;
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
async function
|
|
76
|
-
return e ?
|
|
76
|
+
async function G(s, e) {
|
|
77
|
+
return e ? s : H(s, {
|
|
77
78
|
parser: "scss",
|
|
78
|
-
...
|
|
79
|
-
plugins: [
|
|
79
|
+
...V,
|
|
80
|
+
plugins: [X]
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
-
return
|
|
83
|
+
function T(s) {
|
|
84
|
+
return s && s.type === "JSExpression";
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
-
return typeof
|
|
86
|
+
function R(s) {
|
|
87
|
+
return typeof s == "object" && s && s.type === "JSFunction";
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
-
return
|
|
89
|
+
function S(s) {
|
|
90
|
+
return T(s) || R(s);
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
-
return
|
|
92
|
+
function ee(s) {
|
|
93
|
+
return s.replace(new RegExp("this.", "g"), "");
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
return
|
|
95
|
+
function J(s) {
|
|
96
|
+
return s.replace(/this\.context\??\./g, "");
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
let r =
|
|
99
|
-
return
|
|
98
|
+
function _(s, e = !0, t = !0, n = [], o = !0) {
|
|
99
|
+
let r = s;
|
|
100
|
+
return S(s) ? (r = s.value.trim().replace(/;$/, ""), o && (r = r.replace(/\"/g, "'"))) : r = e ? JSON.stringify(r) : s, r = M(r, n), t ? ee(J(r)) : J(r);
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
-
let
|
|
103
|
-
for (const
|
|
104
|
-
|
|
105
|
-
new RegExp(`this.${
|
|
106
|
-
`this.${
|
|
102
|
+
function M(s = "", e = []) {
|
|
103
|
+
let t = s;
|
|
104
|
+
for (const n of e)
|
|
105
|
+
t = t.replace(
|
|
106
|
+
new RegExp(`this.${n}.value`, "g"),
|
|
107
|
+
`this.${n}`
|
|
107
108
|
);
|
|
108
|
-
return
|
|
109
|
+
return t;
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
-
let e =
|
|
111
|
+
function te(s) {
|
|
112
|
+
let e = s.trim().replace(/;$/, "");
|
|
112
113
|
if (e = /^\((\(|async|function)/.test(e) ? e.substring(1, e.length - 1) : e, e.startsWith("{")) return e;
|
|
113
114
|
if (e.startsWith("async function"))
|
|
114
115
|
e = e.replace(/^async function/, "async");
|
|
115
116
|
else if (e.startsWith("function"))
|
|
116
117
|
e = e.replace(/^function/, "");
|
|
117
118
|
else {
|
|
118
|
-
const
|
|
119
|
+
const o = /^(async\s)?\([\w]*\)\s+\=\>\s([\w\W]+)/, r = e.match(o);
|
|
119
120
|
r && r[2] && (r[2].startsWith("{") || (e = e.replace(r[2], `{ return ${r[2]} }`))), e = e.replace("=>", "");
|
|
120
121
|
}
|
|
121
122
|
return e;
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
-
return Object.entries(
|
|
124
|
+
function Ae(s = {}) {
|
|
125
|
+
return Object.entries(s).map(([e, t]) => `"${e}": ${_(t)}`);
|
|
125
126
|
}
|
|
126
|
-
function
|
|
127
|
-
const
|
|
128
|
-
return e ?
|
|
127
|
+
function se(s = {}, e = !1) {
|
|
128
|
+
const t = Object.keys(s);
|
|
129
|
+
return e ? t.map((n) => "." + n) : t;
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
+
function Pe(s) {
|
|
131
132
|
let e = "";
|
|
132
|
-
for (var
|
|
133
|
-
if (
|
|
134
|
-
var
|
|
135
|
-
e +=
|
|
133
|
+
for (var t in s)
|
|
134
|
+
if (s.hasOwnProperty(t)) {
|
|
135
|
+
var n = s[t];
|
|
136
|
+
e += t + ": " + n + ";";
|
|
136
137
|
}
|
|
137
138
|
return e;
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
-
return
|
|
140
|
+
function Ee(s = [], e = []) {
|
|
141
|
+
return s.filter((t) => !e.includes(t));
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
return
|
|
143
|
+
function z(s) {
|
|
144
|
+
return Se(JSON.stringify(s));
|
|
144
145
|
}
|
|
145
|
-
class
|
|
146
|
-
constructor(e,
|
|
147
|
-
this.dsl = e, this.dependencies =
|
|
146
|
+
class Ne {
|
|
147
|
+
constructor(e, t) {
|
|
148
|
+
this.dsl = e, this.dependencies = t, this.collectEasycom(), this.libraryRegex = this.collectLibrary(), this.walk(e), this.walkNodes(e), this.members = this.getLibraryMember();
|
|
148
149
|
}
|
|
149
150
|
/**
|
|
150
151
|
* { 'element-plus': ['ElButton', 'ElInput' ...] }
|
|
@@ -155,7 +156,13 @@ class ue {
|
|
|
155
156
|
members = [];
|
|
156
157
|
urlSchemas = {};
|
|
157
158
|
blockPlugins = {};
|
|
159
|
+
/** 配置了 easycom 的依赖包名集合,出码时不需要 import */
|
|
160
|
+
easycomPackages = /* @__PURE__ */ new Set();
|
|
158
161
|
libraryRegex = [];
|
|
162
|
+
collectEasycom() {
|
|
163
|
+
for (const e of this.dependencies)
|
|
164
|
+
e.easycom?.key && e.easycom?.value && e.package && this.easycomPackages.add(e.package);
|
|
165
|
+
}
|
|
159
166
|
collectLibrary() {
|
|
160
167
|
return this.dependencies.filter((e) => !!e.library).map((e) => new RegExp(`(this.\\$libs.${e.library}.([\\w]+))`, "g"));
|
|
161
168
|
}
|
|
@@ -165,18 +172,18 @@ class ue {
|
|
|
165
172
|
* @returns ex: { name: 'ElButton', path: 'this.$libs.ElementPlus.', library: 'ElementPlus' }
|
|
166
173
|
*/
|
|
167
174
|
collectImport(e) {
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
172
|
-
const
|
|
175
|
+
const t = e.split(".");
|
|
176
|
+
if (t.length === 4) {
|
|
177
|
+
const n = t.pop(), o = t.join(".") + ".", r = t.pop();
|
|
178
|
+
if (n && r) {
|
|
179
|
+
const c = this.dependencies.find(
|
|
173
180
|
(a) => a.library === r
|
|
174
181
|
)?.package;
|
|
175
|
-
|
|
182
|
+
c && !this.easycomPackages.has(c) && (this.imports[c] || (this.imports[c] = /* @__PURE__ */ new Set())).add(n);
|
|
176
183
|
}
|
|
177
184
|
return {
|
|
178
|
-
name:
|
|
179
|
-
path:
|
|
185
|
+
name: n,
|
|
186
|
+
path: o,
|
|
180
187
|
library: r
|
|
181
188
|
};
|
|
182
189
|
}
|
|
@@ -184,58 +191,58 @@ class ue {
|
|
|
184
191
|
}
|
|
185
192
|
// 代码中包含依赖库的引用,需要从代码中移除
|
|
186
193
|
replaceLibraryPath(e) {
|
|
187
|
-
const { libraryRegex:
|
|
188
|
-
let
|
|
189
|
-
for (const
|
|
190
|
-
const r = e.value?.match(
|
|
191
|
-
for (const
|
|
192
|
-
const a = this.collectImport(
|
|
194
|
+
const { libraryRegex: t } = this;
|
|
195
|
+
let n = e.value;
|
|
196
|
+
for (const o of t) {
|
|
197
|
+
const r = e.value?.match(o) || [];
|
|
198
|
+
for (const c of r) {
|
|
199
|
+
const a = this.collectImport(c);
|
|
193
200
|
if (a) {
|
|
194
|
-
const
|
|
195
|
-
|
|
201
|
+
const l = a.path.replace(/\$/g, "\\$");
|
|
202
|
+
n = n.replace(new RegExp(l, "g"), "");
|
|
196
203
|
}
|
|
197
204
|
}
|
|
198
205
|
}
|
|
199
|
-
return
|
|
206
|
+
return n;
|
|
200
207
|
}
|
|
201
208
|
walk(e) {
|
|
202
|
-
const
|
|
203
|
-
if (!
|
|
204
|
-
if (Array.isArray(
|
|
205
|
-
for (let r of
|
|
206
|
-
|
|
209
|
+
const t = (n) => {
|
|
210
|
+
if (!n || typeof n != "object") return;
|
|
211
|
+
if (Array.isArray(n)) {
|
|
212
|
+
for (let r of n)
|
|
213
|
+
t(r);
|
|
207
214
|
return;
|
|
208
215
|
}
|
|
209
|
-
const
|
|
210
|
-
for (const r of
|
|
211
|
-
|
|
216
|
+
const o = Object.values(n);
|
|
217
|
+
for (const r of o)
|
|
218
|
+
S(r) ? r.value = this.replaceLibraryPath(r) : t(r);
|
|
212
219
|
};
|
|
213
|
-
|
|
220
|
+
t(e);
|
|
214
221
|
}
|
|
215
222
|
getLibraryMember(e = []) {
|
|
216
|
-
let
|
|
217
|
-
const
|
|
218
|
-
delete
|
|
219
|
-
for (const
|
|
220
|
-
|
|
221
|
-
return
|
|
223
|
+
let t = [...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
|
+
t = t.concat(Array.from(o));
|
|
228
|
+
return B(t);
|
|
222
229
|
}
|
|
223
|
-
collectContext(e,
|
|
224
|
-
const
|
|
225
|
-
let r = new Set(Array.from(
|
|
226
|
-
if (i) {
|
|
227
|
-
const { item: a = "item", index: h = "index" } = i.iterator || {};
|
|
228
|
-
r = /* @__PURE__ */ new Set([a, h, ...Array.from(r)]);
|
|
229
|
-
}
|
|
230
|
-
const o = e.slot;
|
|
230
|
+
collectContext(e, t) {
|
|
231
|
+
const n = new Set(t?.id ? this.context[t.id] : []), o = (e.directives || []).find((a) => a.name === "vFor");
|
|
232
|
+
let r = new Set(Array.from(n));
|
|
231
233
|
if (o) {
|
|
232
|
-
const a =
|
|
233
|
-
r = /* @__PURE__ */ new Set([
|
|
234
|
+
const { item: a = "item", index: l = "index" } = o.iterator || {};
|
|
235
|
+
r = /* @__PURE__ */ new Set([a, l, ...Array.from(r)]);
|
|
236
|
+
}
|
|
237
|
+
const c = e.slot;
|
|
238
|
+
if (c) {
|
|
239
|
+
const a = typeof c == "string" ? [] : c.params || [], l = a.length ? a : [`scope_${t?.id}`];
|
|
240
|
+
r = /* @__PURE__ */ new Set([...l, ...Array.from(r)]);
|
|
234
241
|
}
|
|
235
242
|
this.context[e.id] = r;
|
|
236
243
|
}
|
|
237
244
|
collectStyle(e) {
|
|
238
|
-
e.id && e.props?.style && Object.keys(e.props.style).length && !
|
|
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);
|
|
239
246
|
}
|
|
240
247
|
collectUrlSchema(e) {
|
|
241
248
|
typeof e.from == "object" && e.from.type === "UrlSchema" && (this.urlSchemas[e.name] = e.from);
|
|
@@ -244,76 +251,76 @@ class ue {
|
|
|
244
251
|
typeof e.from == "object" && e.from.type === "Plugin" && (this.blockPlugins[e.name] = e.from);
|
|
245
252
|
}
|
|
246
253
|
walkNodes(e) {
|
|
247
|
-
const
|
|
248
|
-
this.collectContext(
|
|
254
|
+
const t = (n, o) => {
|
|
255
|
+
this.collectContext(n, o), this.collectStyle(n), this.collectUrlSchema(n), this.collectBlockPlugin(n), Array.isArray(n.children) && n.children.forEach((r) => t(r, n));
|
|
249
256
|
};
|
|
250
|
-
Array.isArray(e.nodes) && e.nodes.forEach((
|
|
257
|
+
Array.isArray(e.nodes) && e.nodes.forEach((n) => t(n));
|
|
251
258
|
}
|
|
252
259
|
}
|
|
253
|
-
function
|
|
254
|
-
return Object.entries(
|
|
255
|
-
const
|
|
256
|
-
return `${e}:${
|
|
260
|
+
function Be(s = {}) {
|
|
261
|
+
return Object.entries(s).map(([e, t]) => {
|
|
262
|
+
const n = _(t, !1, !0, [], !1);
|
|
263
|
+
return `${e}:${n}`;
|
|
257
264
|
});
|
|
258
265
|
}
|
|
259
|
-
function
|
|
260
|
-
return
|
|
266
|
+
function Te(s = []) {
|
|
267
|
+
return s.map((e) => `${e.name}: {
|
|
261
268
|
from: '${e.from || e.name}',
|
|
262
|
-
default: ${
|
|
269
|
+
default: ${_(e.default, !0, !1, [], !1)}
|
|
263
270
|
}`);
|
|
264
271
|
}
|
|
265
|
-
function
|
|
266
|
-
const e = (
|
|
267
|
-
return
|
|
268
|
-
type:${e(
|
|
269
|
-
required: ${
|
|
270
|
-
default: ${
|
|
272
|
+
function ne(s = []) {
|
|
273
|
+
const e = (t) => t ? `[${je(t).map((r) => r.replace(/\'|\"/gi, "")).join(",")}]` : void 0;
|
|
274
|
+
return s.map((t) => typeof t == "string" ? `${t}: {}` : (S(t.default) && !t.default.value && (t.default.value = "undefined"), `${t.name}: {
|
|
275
|
+
type:${e(t.type)},
|
|
276
|
+
required: ${_(!!t.required, !0, !1, [], !1)},
|
|
277
|
+
default: ${t.default ? _(t.default, !0, !1, [], !1) : "undefined"}
|
|
271
278
|
}`));
|
|
272
279
|
}
|
|
273
|
-
function
|
|
274
|
-
return
|
|
280
|
+
function re(s = []) {
|
|
281
|
+
return s.map((e) => `'${typeof e == "string" ? e : e.name}'`);
|
|
275
282
|
}
|
|
276
|
-
function
|
|
277
|
-
return Object.entries(
|
|
278
|
-
let
|
|
279
|
-
|
|
283
|
+
function U(s = {}, e = []) {
|
|
284
|
+
return Object.entries(s).map(([t, n]) => {
|
|
285
|
+
let o = te(
|
|
286
|
+
_(n, !1, !1, [], !1)
|
|
280
287
|
);
|
|
281
|
-
return
|
|
282
|
-
}).filter((
|
|
288
|
+
return o = M(o, e)?.trim(), o.startsWith("async") ? `async ${t}${o.replace(/^async/, "")}` : o.startsWith("(") || o.startsWith("{") ? `${t}${o}` : null;
|
|
289
|
+
}).filter((t) => !!t);
|
|
283
290
|
}
|
|
284
|
-
function
|
|
285
|
-
const
|
|
286
|
-
(r,
|
|
291
|
+
function Me(s = [], e = []) {
|
|
292
|
+
const t = s.reduce(
|
|
293
|
+
(r, c) => (c.id && R(c.source) && (r[`watcher_${c.id}`] = c.source), r),
|
|
287
294
|
{}
|
|
288
|
-
),
|
|
295
|
+
), n = U(t, e), o = s.map((r) => r.handler && r.handler.value ? `watcher_${r.id}: {
|
|
289
296
|
deep: ${r.deep},
|
|
290
297
|
immediate:${r.immediate},
|
|
291
|
-
handler${
|
|
298
|
+
handler${te(r.handler.value)}
|
|
292
299
|
}` : null).filter((r) => !!r);
|
|
293
300
|
return {
|
|
294
|
-
computed:
|
|
295
|
-
watches:
|
|
301
|
+
computed: n,
|
|
302
|
+
watches: o
|
|
296
303
|
};
|
|
297
304
|
}
|
|
298
|
-
function
|
|
299
|
-
return Object.values(
|
|
305
|
+
function Re(s = {}) {
|
|
306
|
+
return Object.values(s).map((e) => {
|
|
300
307
|
if (e.type === "mock") {
|
|
301
|
-
const
|
|
308
|
+
const t = R(e.mockTemplate) && e.mockTemplate.value || "(params) => ({})";
|
|
302
309
|
return `async ${e.name}(...args) {
|
|
303
|
-
// DataSource: ${
|
|
304
|
-
const mock = this.provider.createMock(${
|
|
310
|
+
// DataSource: ${z(e)}
|
|
311
|
+
const mock = this.provider.createMock(${t});
|
|
305
312
|
return await mock.apply(this, args);
|
|
306
313
|
}`;
|
|
307
314
|
} else {
|
|
308
|
-
const
|
|
315
|
+
const t = R(e.transform) && e.transform.value || "(res) => res";
|
|
309
316
|
return `async ${e.name}(...args) {
|
|
310
|
-
// DataSource: ${
|
|
311
|
-
return await this.provider.apis['${e.ref}'].apply(this, args).then(${
|
|
317
|
+
// DataSource: ${z(e)}
|
|
318
|
+
return await this.provider.apis['${e.ref}'].apply(this, args).then(${t});
|
|
312
319
|
}`;
|
|
313
320
|
}
|
|
314
321
|
});
|
|
315
322
|
}
|
|
316
|
-
const
|
|
323
|
+
const De = [
|
|
317
324
|
"img",
|
|
318
325
|
"input",
|
|
319
326
|
"br",
|
|
@@ -328,7 +335,7 @@ const ye = [
|
|
|
328
335
|
"source",
|
|
329
336
|
"track",
|
|
330
337
|
"wbr"
|
|
331
|
-
],
|
|
338
|
+
], Z = [
|
|
332
339
|
"vIf",
|
|
333
340
|
"vElseIf",
|
|
334
341
|
"vElse",
|
|
@@ -338,341 +345,1096 @@ const ye = [
|
|
|
338
345
|
"vBind",
|
|
339
346
|
"vHtml"
|
|
340
347
|
];
|
|
341
|
-
function
|
|
348
|
+
function q(s, e, t = [], n = {}, o) {
|
|
342
349
|
const r = [];
|
|
343
|
-
let
|
|
344
|
-
const
|
|
350
|
+
let c = {}, a = [];
|
|
351
|
+
const l = [];
|
|
345
352
|
let p = [];
|
|
346
|
-
return
|
|
347
|
-
const
|
|
348
|
-
for (const
|
|
349
|
-
let { id:
|
|
350
|
-
if (
|
|
353
|
+
return Le(s).forEach((i) => {
|
|
354
|
+
const u = [];
|
|
355
|
+
for (const v of i.children) {
|
|
356
|
+
let { id: b, name: k, invisible: g, from: m } = v;
|
|
357
|
+
if (g)
|
|
351
358
|
continue;
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
const { props:
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
s,
|
|
360
|
-
n
|
|
361
|
-
), k = Ce(
|
|
362
|
-
f.directives,
|
|
363
|
-
n,
|
|
364
|
-
h
|
|
365
|
-
).join(" "), S = f.children ? Ee(
|
|
366
|
-
f.children,
|
|
359
|
+
const h = Fe(k, e, m);
|
|
360
|
+
h && a.push(h), oe(m) && p.push({ id: m.id, name: k });
|
|
361
|
+
const { props: y, events: $ } = qe(
|
|
362
|
+
v,
|
|
363
|
+
b,
|
|
364
|
+
v.props,
|
|
365
|
+
v.events,
|
|
367
366
|
n,
|
|
367
|
+
t
|
|
368
|
+
), w = Ge(
|
|
369
|
+
v.directives,
|
|
370
|
+
t,
|
|
371
|
+
l
|
|
372
|
+
).join(" "), I = v.children ? Ze(
|
|
373
|
+
v.children,
|
|
374
|
+
t,
|
|
368
375
|
e,
|
|
369
|
-
|
|
370
|
-
|
|
376
|
+
n,
|
|
377
|
+
v
|
|
371
378
|
) : "";
|
|
372
|
-
let
|
|
373
|
-
typeof
|
|
374
|
-
`), Object.assign(
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
) ?
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
` +
|
|
379
|
+
let C = "";
|
|
380
|
+
typeof I == "string" ? C = I : (C = (I?.nodes || []).join(`
|
|
381
|
+
`), Object.assign(c, I?.methods || {}), a = a.concat(I?.components || []), p = p.concat(I?.importBlocks || []));
|
|
382
|
+
const N = ["@dcloudio/uni-h5", "@dcloudio/uni-ui"].includes(
|
|
383
|
+
m || e.get(k)?.package
|
|
384
|
+
) ? F(k) : ce(m) || ae(m) ? "component" : k;
|
|
385
|
+
u.push(
|
|
386
|
+
De.includes(N) ? `<${N} ${w} ${y} ${$} />` : `<${N} ${w} ${y} ${$}>${C ? `
|
|
387
|
+
` + C.trim() : ""}</${N}>`
|
|
381
388
|
);
|
|
382
389
|
}
|
|
383
|
-
const
|
|
384
|
-
`),
|
|
385
|
-
r.push(
|
|
390
|
+
const f = Qe(i.slot, u.join(`
|
|
391
|
+
`), o?.id);
|
|
392
|
+
r.push(f);
|
|
386
393
|
}), {
|
|
387
394
|
nodes: r,
|
|
388
|
-
methods:
|
|
389
|
-
directives:
|
|
390
|
-
components:
|
|
391
|
-
importBlocks:
|
|
395
|
+
methods: c,
|
|
396
|
+
directives: Ue(l),
|
|
397
|
+
components: B(a),
|
|
398
|
+
importBlocks: B(p, "id")
|
|
392
399
|
};
|
|
393
400
|
}
|
|
394
|
-
function
|
|
395
|
-
return
|
|
401
|
+
function Ue(s) {
|
|
402
|
+
return B(s).map((e) => `${e.startsWith("v") ? e.substring(1) : e}:${e}`);
|
|
396
403
|
}
|
|
397
|
-
function
|
|
404
|
+
function Le(s = []) {
|
|
398
405
|
const e = /* @__PURE__ */ new Map();
|
|
399
|
-
for (const
|
|
400
|
-
const
|
|
401
|
-
|
|
406
|
+
for (const t of s) {
|
|
407
|
+
const n = typeof t.slot == "string" ? t.slot : t.slot?.name, o = e.get(n);
|
|
408
|
+
o ? o.children.push(t) : e.set(n, { slot: t.slot, children: [t] });
|
|
402
409
|
}
|
|
403
410
|
return e;
|
|
404
411
|
}
|
|
405
|
-
function
|
|
406
|
-
if (
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
const
|
|
410
|
-
return `${
|
|
412
|
+
function Fe(s, e, t) {
|
|
413
|
+
if (Ce.includes(s)) return null;
|
|
414
|
+
const n = e.get(s);
|
|
415
|
+
if (n && n.alias) {
|
|
416
|
+
const o = n.parent ? `${n.parent}.${n.alias}` : n.alias;
|
|
417
|
+
return `${s}: ${o}`;
|
|
411
418
|
}
|
|
412
|
-
return
|
|
419
|
+
return oe(t) || n ? s : null;
|
|
413
420
|
}
|
|
414
|
-
function
|
|
415
|
-
return !!
|
|
421
|
+
function oe(s) {
|
|
422
|
+
return !!s && typeof s == "object" && s.type === "Schema";
|
|
416
423
|
}
|
|
417
|
-
function
|
|
418
|
-
return typeof
|
|
424
|
+
function ce(s) {
|
|
425
|
+
return typeof s == "object" && s.type === "UrlSchema";
|
|
419
426
|
}
|
|
420
|
-
function
|
|
421
|
-
return typeof
|
|
427
|
+
function ae(s) {
|
|
428
|
+
return typeof s == "object" && s.type === "Plugin";
|
|
422
429
|
}
|
|
423
|
-
function
|
|
424
|
-
return
|
|
430
|
+
function Je(s, e, t = []) {
|
|
431
|
+
return s === "style" ? S(e) ? `:style="${_({
|
|
425
432
|
...e,
|
|
426
|
-
value:
|
|
427
|
-
})}"` : "" :
|
|
433
|
+
value: M(e.value, t)
|
|
434
|
+
})}"` : "" : s === "__class" && S(e) ? `:class="${_({
|
|
428
435
|
...e,
|
|
429
|
-
value:
|
|
430
|
-
})}"` : typeof e == "string" ? `${
|
|
436
|
+
value: M(e.value, t)
|
|
437
|
+
})}"` : typeof e == "string" ? `${s}="${e}"` : S(e) ? `:${s}="${_({
|
|
431
438
|
...e,
|
|
432
|
-
value:
|
|
433
|
-
})}"` :
|
|
439
|
+
value: M(e.value, t)
|
|
440
|
+
})}"` : ke(e) ? `:${s}='{${Ae(
|
|
434
441
|
e
|
|
435
|
-
).join(", ")}}'` : `:${
|
|
442
|
+
).join(", ")}}'` : `:${s}='${JSON.stringify(e)}'`;
|
|
436
443
|
}
|
|
437
|
-
function
|
|
444
|
+
function We(s, e = {}, t = []) {
|
|
438
445
|
if (!!Object.keys(e.style || {}).length) {
|
|
439
|
-
const r = `${
|
|
440
|
-
e.class ? typeof e.class == "string" ? e.class = [e.class, r].join(" ") : (e.__class = e.class, e.class = r) : e.class = r,
|
|
446
|
+
const r = `${s.name}_${s.id}`;
|
|
447
|
+
e.class ? typeof e.class == "string" ? e.class = [e.class, r].join(" ") : (e.__class = e.class, e.class = r) : e.class = r, S(e.style) || delete e.style;
|
|
441
448
|
}
|
|
442
|
-
const
|
|
443
|
-
return (
|
|
449
|
+
const o = s.from;
|
|
450
|
+
return (ce(o) || ae(o)) && (e.is = {
|
|
444
451
|
type: "JSExpression",
|
|
445
|
-
value:
|
|
446
|
-
}), Object.entries(e).map(([r,
|
|
452
|
+
value: s.name
|
|
453
|
+
}), Object.entries(e).map(([r, c]) => Je(r, c, t));
|
|
447
454
|
}
|
|
448
|
-
function
|
|
449
|
-
const
|
|
450
|
-
return `@${
|
|
455
|
+
function He(s, e, t) {
|
|
456
|
+
const n = se(e.modifiers, !0);
|
|
457
|
+
return `@${s}${n.join("")}="${t}"`;
|
|
451
458
|
}
|
|
452
|
-
function
|
|
453
|
-
const
|
|
459
|
+
function Ve(s, e = {}, t = {}) {
|
|
460
|
+
const n = {};
|
|
454
461
|
return {
|
|
455
|
-
binders: Object.entries(e).map(([r,
|
|
456
|
-
const a =
|
|
462
|
+
binders: Object.entries(e).map(([r, c]) => {
|
|
463
|
+
const a = ee(J(c.handler.value)).replace(
|
|
457
464
|
/\"/g,
|
|
458
465
|
"'"
|
|
459
466
|
);
|
|
460
|
-
return
|
|
467
|
+
return He(r, c, a);
|
|
461
468
|
}),
|
|
462
|
-
handlers:
|
|
469
|
+
handlers: n
|
|
463
470
|
};
|
|
464
471
|
}
|
|
465
|
-
function
|
|
466
|
-
const { binders:
|
|
472
|
+
function qe(s, e, t = {}, n = {}, o = {}, r) {
|
|
473
|
+
const { binders: c, handlers: a } = Ve(e, n, o);
|
|
467
474
|
return {
|
|
468
|
-
props:
|
|
475
|
+
props: We(s, t, r).join(" "),
|
|
469
476
|
handlers: a,
|
|
470
|
-
binders:
|
|
471
|
-
events:
|
|
477
|
+
binders: c,
|
|
478
|
+
events: c.join(" ")
|
|
472
479
|
};
|
|
473
480
|
}
|
|
474
|
-
function
|
|
475
|
-
const
|
|
476
|
-
vIf:
|
|
481
|
+
function Ge(s = [], e = [], t = []) {
|
|
482
|
+
const n = [], {
|
|
483
|
+
vIf: o,
|
|
477
484
|
vElse: r,
|
|
478
|
-
vElseIf:
|
|
485
|
+
vElseIf: c,
|
|
479
486
|
vShow: a,
|
|
480
|
-
vModels:
|
|
487
|
+
vModels: l,
|
|
481
488
|
vFor: p,
|
|
482
|
-
vBind:
|
|
483
|
-
vHtml:
|
|
484
|
-
customDirectives:
|
|
485
|
-
} =
|
|
486
|
-
if (
|
|
487
|
-
`v-else-if="${
|
|
488
|
-
), r &&
|
|
489
|
-
`v-show="${
|
|
490
|
-
),
|
|
491
|
-
`v-bind="${
|
|
492
|
-
),
|
|
493
|
-
const
|
|
494
|
-
|
|
495
|
-
`v-model${
|
|
489
|
+
vBind: d,
|
|
490
|
+
vHtml: i,
|
|
491
|
+
customDirectives: u
|
|
492
|
+
} = ze(s);
|
|
493
|
+
if (o && n.push(`v-if="${_(o.value, !0, !0, e)}"`), c && n.push(
|
|
494
|
+
`v-else-if="${_(c.value, !0, !0, e)}"`
|
|
495
|
+
), r && n.push("v-else"), a && n.push(
|
|
496
|
+
`v-show="${_(a.value, !0, !0, e)}"`
|
|
497
|
+
), d && n.push(
|
|
498
|
+
`v-bind="${_(d.value, !0, !0, e)}"`
|
|
499
|
+
), l.forEach((f) => {
|
|
500
|
+
const v = se(f.modifiers, !0), b = f.arg ? T(f.arg) ? `:[${_(f.arg, !0, !0, e)}]` : `:${f.arg}` : "";
|
|
501
|
+
n.push(
|
|
502
|
+
`v-model${b}${v}="${_(f.value, !0, !0, e)}"`
|
|
496
503
|
);
|
|
497
504
|
}), p) {
|
|
498
|
-
const { item:
|
|
499
|
-
|
|
500
|
-
`v-for="(${
|
|
505
|
+
const { item: f, index: v } = { item: "item", index: "index", ...p.iterator };
|
|
506
|
+
n.push(
|
|
507
|
+
`v-for="(${f}, ${v}) in ${_(p.value, !0, !0, e)}"`
|
|
501
508
|
);
|
|
502
509
|
}
|
|
503
|
-
return
|
|
504
|
-
`v-html="${
|
|
505
|
-
),
|
|
506
|
-
if (!
|
|
507
|
-
let
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
511
|
-
const
|
|
512
|
-
|
|
510
|
+
return i && n.push(
|
|
511
|
+
`v-html="${_(i.value, !0, !0, e)}"`
|
|
512
|
+
), u && u.length && u.forEach((f) => {
|
|
513
|
+
if (!f.name) return;
|
|
514
|
+
let v = "", b = "";
|
|
515
|
+
T(f.name) ? (b = _(f.name, !0, !0, e), t.push(b)) : b = f.name;
|
|
516
|
+
const k = b?.startsWith("v") ? F(b) : F("v-" + b);
|
|
517
|
+
if (v += k, f.arg && (T(f.arg) ? v += `:[${_(f.name, !0, !0, e)}]` : v += `:${f.arg}`), f.modifiers) {
|
|
518
|
+
const g = Object.keys(f.modifiers);
|
|
519
|
+
g.length && (v += g.map((m) => "." + m));
|
|
513
520
|
}
|
|
514
|
-
|
|
515
|
-
`${
|
|
516
|
-
) :
|
|
517
|
-
}),
|
|
518
|
-
}
|
|
519
|
-
function
|
|
520
|
-
const e =
|
|
521
|
-
(
|
|
522
|
-
),
|
|
523
|
-
(
|
|
524
|
-
),
|
|
525
|
-
(
|
|
526
|
-
), i = e.find(
|
|
527
|
-
(c) => b(c.name) === "vElseIf"
|
|
528
|
-
), r = e.find(
|
|
529
|
-
(c) => b(c.name) === "vElse"
|
|
521
|
+
f.value ? n.push(
|
|
522
|
+
`${v}="${_(f.value, !0, !0, e)}"`
|
|
523
|
+
) : n.push(v);
|
|
524
|
+
}), n;
|
|
525
|
+
}
|
|
526
|
+
function ze(s = []) {
|
|
527
|
+
const e = s.filter(
|
|
528
|
+
(i) => Z.includes(i.name)
|
|
529
|
+
), t = s.filter(
|
|
530
|
+
(i) => !Z.includes(i.name)
|
|
531
|
+
), n = e.find(
|
|
532
|
+
(i) => A(i.name) === "vIf"
|
|
530
533
|
), o = e.find(
|
|
531
|
-
(
|
|
534
|
+
(i) => A(i.name) === "vElseIf"
|
|
535
|
+
), r = e.find(
|
|
536
|
+
(i) => A(i.name) === "vElse"
|
|
537
|
+
), c = e.find(
|
|
538
|
+
(i) => A(i.name) === "vFor"
|
|
532
539
|
), a = e.find(
|
|
533
|
-
(
|
|
534
|
-
),
|
|
535
|
-
(
|
|
540
|
+
(i) => A(i.name) === "vShow"
|
|
541
|
+
), l = e.find(
|
|
542
|
+
(i) => A(i.name) === "vBind"
|
|
536
543
|
), p = e.find(
|
|
537
|
-
(
|
|
538
|
-
),
|
|
539
|
-
(
|
|
544
|
+
(i) => A(i.name) === "vHtml"
|
|
545
|
+
), d = e.filter(
|
|
546
|
+
(i) => A(i.name) === "vModel"
|
|
540
547
|
);
|
|
541
548
|
return {
|
|
542
|
-
vIf:
|
|
543
|
-
vElseIf:
|
|
549
|
+
vIf: n,
|
|
550
|
+
vElseIf: o,
|
|
544
551
|
vElse: r,
|
|
545
|
-
vFor:
|
|
552
|
+
vFor: c,
|
|
546
553
|
vShow: a,
|
|
547
|
-
vModels:
|
|
548
|
-
vBind:
|
|
554
|
+
vModels: d,
|
|
555
|
+
vBind: l,
|
|
549
556
|
vHtml: p,
|
|
550
|
-
customDirectives:
|
|
557
|
+
customDirectives: t
|
|
551
558
|
};
|
|
552
559
|
}
|
|
553
|
-
function
|
|
554
|
-
return typeof
|
|
560
|
+
function Ze(s, e, t, n, o) {
|
|
561
|
+
return typeof s == "string" ? s : T(s) ? `{{ ${_(s, !1, !0, e)} }}` : Array.isArray(s) ? q(s, t, e, n, o) : "";
|
|
555
562
|
}
|
|
556
|
-
function
|
|
557
|
-
if (!
|
|
558
|
-
const
|
|
559
|
-
return `<template ${`#${
|
|
563
|
+
function Qe(s, e, t) {
|
|
564
|
+
if (!s) return e;
|
|
565
|
+
const n = typeof s == "string" ? { name: s, params: [], scope: "" } : { params: [], scope: "", ...s };
|
|
566
|
+
return `<template ${`#${n.name}="${n.scope ? n.scope : n.params?.length > 0 ? `{${n.params?.join(",")}}` : `scope_${t}`}"`}>
|
|
560
567
|
${e}
|
|
561
568
|
</template>`;
|
|
562
569
|
}
|
|
563
|
-
function
|
|
564
|
-
const
|
|
570
|
+
function Xe(s, e = [], t = [], n = {}, o = "web", r = /* @__PURE__ */ new Set()) {
|
|
571
|
+
const c = [
|
|
565
572
|
"@dcloudio/uni-h5",
|
|
566
573
|
"uni-h5",
|
|
567
574
|
"@dcloudio/uni-ui",
|
|
568
575
|
"uni-ui"
|
|
569
|
-
],
|
|
576
|
+
], a = {
|
|
570
577
|
vue: ["defineComponent", "reactive"]
|
|
571
|
-
},
|
|
572
|
-
for (const
|
|
573
|
-
const
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
|
|
578
|
+
}, l = [];
|
|
579
|
+
for (const d of e) {
|
|
580
|
+
const i = s.get(d.split(":")[0]);
|
|
581
|
+
if (i && i.package) {
|
|
582
|
+
if (r.has(i.package)) continue;
|
|
583
|
+
const u = a[i.package] ?? (a[i.package] = []), f = i.parent || (i.alias || "").split(".")[0] || i.name;
|
|
584
|
+
u.push(f), o === "uniapp" && c.includes(i.package) && l.push(f);
|
|
577
585
|
}
|
|
578
586
|
}
|
|
579
|
-
for (const [
|
|
580
|
-
(
|
|
587
|
+
for (const [d, i] of Object.entries(n))
|
|
588
|
+
(a[d] ?? (a[d] = [])).push(...Array.from(i)), o === "uniapp" && c.includes(d) && l.push(...Array.from(i));
|
|
581
589
|
return {
|
|
582
|
-
imports: Object.entries(
|
|
590
|
+
imports: Object.entries(a).filter(([d, i]) => o === "uniapp" ? !c.includes(d) && !!i.length : !!i.length).map(([d, i]) => `import { ${B(i).join(
|
|
583
591
|
","
|
|
584
|
-
)}} from '${
|
|
585
|
-
uniComponents:
|
|
592
|
+
)}} from '${d}';`).concat(t),
|
|
593
|
+
uniComponents: l
|
|
586
594
|
};
|
|
587
595
|
}
|
|
588
|
-
function
|
|
596
|
+
function ie(s = {}) {
|
|
589
597
|
const e = [];
|
|
590
|
-
for (const [
|
|
598
|
+
for (const [t, n] of Object.entries(s))
|
|
591
599
|
e.push(`
|
|
592
|
-
${
|
|
593
|
-
${
|
|
600
|
+
${t} {
|
|
601
|
+
${Pe(n)}
|
|
594
602
|
}
|
|
595
603
|
`);
|
|
596
604
|
return e.join(`
|
|
597
605
|
`);
|
|
598
606
|
}
|
|
599
|
-
function
|
|
607
|
+
function le(s = {}) {
|
|
600
608
|
const e = [];
|
|
601
|
-
return Object.entries(
|
|
609
|
+
return Object.entries(s).forEach(([t, n]) => {
|
|
602
610
|
e.push(
|
|
603
|
-
`const ${
|
|
611
|
+
`const ${t} = provider.defineUrlSchemaComponent('${n.url}');`
|
|
604
612
|
);
|
|
605
613
|
}), e;
|
|
606
614
|
}
|
|
607
|
-
function
|
|
615
|
+
function ue(s = {}) {
|
|
608
616
|
const e = [];
|
|
609
|
-
return Object.entries(
|
|
617
|
+
return Object.entries(s).forEach(([t, n]) => {
|
|
610
618
|
e.push(
|
|
611
|
-
`const ${
|
|
619
|
+
`const ${t} = provider.definePluginComponent(${JSON.stringify(n)});`
|
|
612
620
|
);
|
|
613
621
|
}), e;
|
|
614
622
|
}
|
|
615
|
-
function
|
|
616
|
-
const { dsl:
|
|
617
|
-
|
|
623
|
+
function Ye(s, e, t = "web") {
|
|
624
|
+
const { dsl: n } = s, o = Object.keys(n.computed || {}), r = U(n.lifeCycles, o), c = U(n.computed, o), a = Me(n.watch, o), l = Re(n.dataSources), { methods: p, nodes: d, components: i, importBlocks: u, directives: f } = q(
|
|
625
|
+
n.nodes || [],
|
|
618
626
|
e,
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
),
|
|
627
|
+
o,
|
|
628
|
+
s.context
|
|
629
|
+
), v = [...c, ...a.computed], b = U(
|
|
622
630
|
{
|
|
623
631
|
...p,
|
|
624
|
-
...
|
|
632
|
+
...n.methods || {}
|
|
625
633
|
},
|
|
626
|
-
|
|
627
|
-
),
|
|
628
|
-
let { imports:
|
|
634
|
+
o
|
|
635
|
+
), k = u.map((w) => `import ${w.name} from './${w.id}.vue';`);
|
|
636
|
+
let { imports: g, uniComponents: m } = Xe(
|
|
629
637
|
e,
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
638
|
+
i,
|
|
639
|
+
k,
|
|
640
|
+
s.imports,
|
|
641
|
+
t,
|
|
642
|
+
s.easycomPackages
|
|
634
643
|
);
|
|
635
|
-
const
|
|
636
|
-
...
|
|
637
|
-
...
|
|
638
|
-
}),
|
|
644
|
+
const h = Object.keys({
|
|
645
|
+
...s.urlSchemas,
|
|
646
|
+
...s.blockPlugins
|
|
647
|
+
}), y = le(s.urlSchemas), $ = ue(s.blockPlugins);
|
|
639
648
|
return {
|
|
640
|
-
id:
|
|
641
|
-
version:
|
|
642
|
-
name:
|
|
643
|
-
state:
|
|
644
|
-
inject:
|
|
645
|
-
props:
|
|
646
|
-
emits:
|
|
647
|
-
expose:
|
|
649
|
+
id: n.id,
|
|
650
|
+
version: n.__VERSION__,
|
|
651
|
+
name: n.name,
|
|
652
|
+
state: Be(n.state).join(","),
|
|
653
|
+
inject: Te(n.inject).join(","),
|
|
654
|
+
props: ne(n.props).join(","),
|
|
655
|
+
emits: re(n.emits).join(","),
|
|
656
|
+
expose: n.expose && n.expose.length ? JSON.stringify(n.expose || []) : "",
|
|
648
657
|
watch: a.watches.join(","),
|
|
649
658
|
lifeCycles: r.join(","),
|
|
650
|
-
computed:
|
|
651
|
-
methods: [...
|
|
659
|
+
computed: v.join(","),
|
|
660
|
+
methods: [...l, ...b].join(","),
|
|
652
661
|
imports: `
|
|
653
|
-
` +
|
|
662
|
+
` + g.join(`
|
|
654
663
|
`),
|
|
655
|
-
components:
|
|
656
|
-
directives:
|
|
657
|
-
returns:
|
|
658
|
-
template:
|
|
664
|
+
components: Ee(i, m).join(","),
|
|
665
|
+
directives: f.join(","),
|
|
666
|
+
returns: s.members.join(","),
|
|
667
|
+
template: d.join(`
|
|
659
668
|
`),
|
|
660
|
-
css:
|
|
661
|
-
style:
|
|
662
|
-
urlSchemas:
|
|
669
|
+
css: n.css || "",
|
|
670
|
+
style: ie(s.style),
|
|
671
|
+
urlSchemas: y.join(`
|
|
663
672
|
`),
|
|
664
|
-
blockPlugins:
|
|
673
|
+
blockPlugins: $.join(`
|
|
665
674
|
`),
|
|
666
|
-
asyncComponents:
|
|
667
|
-
uniComponents:
|
|
668
|
-
renderer:
|
|
675
|
+
asyncComponents: h.join(","),
|
|
676
|
+
uniComponents: m,
|
|
677
|
+
renderer: t === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer"
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
const E = {
|
|
681
|
+
state: {
|
|
682
|
+
composable: null,
|
|
683
|
+
from: "self",
|
|
684
|
+
declare: null,
|
|
685
|
+
replace: "__state"
|
|
686
|
+
},
|
|
687
|
+
$uni: {
|
|
688
|
+
composable: null,
|
|
689
|
+
from: "self",
|
|
690
|
+
declare: null,
|
|
691
|
+
replace: "uni"
|
|
692
|
+
},
|
|
693
|
+
$getApp: {
|
|
694
|
+
composable: null,
|
|
695
|
+
from: "self",
|
|
696
|
+
declare: null,
|
|
697
|
+
replace: "getApp"
|
|
698
|
+
},
|
|
699
|
+
// ---- Vue 原生 ----
|
|
700
|
+
$emit: {
|
|
701
|
+
composable: null,
|
|
702
|
+
from: "vue",
|
|
703
|
+
declare: null,
|
|
704
|
+
replace: "__emit"
|
|
705
|
+
},
|
|
706
|
+
$props: {
|
|
707
|
+
composable: null,
|
|
708
|
+
from: "vue",
|
|
709
|
+
declare: null,
|
|
710
|
+
replace: "__props"
|
|
711
|
+
},
|
|
712
|
+
$attrs: {
|
|
713
|
+
composable: "useAttrs",
|
|
714
|
+
from: "vue",
|
|
715
|
+
declare: "const __attrs = useAttrs();",
|
|
716
|
+
replace: "__attrs"
|
|
717
|
+
},
|
|
718
|
+
$slots: {
|
|
719
|
+
composable: "useSlots",
|
|
720
|
+
from: "vue",
|
|
721
|
+
declare: "const __slots = useSlots();",
|
|
722
|
+
replace: "__slots"
|
|
723
|
+
},
|
|
724
|
+
$nextTick: {
|
|
725
|
+
composable: "nextTick",
|
|
726
|
+
from: "vue",
|
|
727
|
+
declare: null,
|
|
728
|
+
replace: "nextTick"
|
|
729
|
+
},
|
|
730
|
+
$watch: {
|
|
731
|
+
composable: "watch",
|
|
732
|
+
from: "vue",
|
|
733
|
+
declare: null,
|
|
734
|
+
replace: "watch"
|
|
735
|
+
},
|
|
736
|
+
$refs: {
|
|
737
|
+
composable: "getCurrentInstance",
|
|
738
|
+
from: "vue",
|
|
739
|
+
declare: "const __instance = getCurrentInstance();",
|
|
740
|
+
replace: "__instance.proxy.$refs"
|
|
741
|
+
},
|
|
742
|
+
$el: {
|
|
743
|
+
composable: "getCurrentInstance",
|
|
744
|
+
from: "vue",
|
|
745
|
+
declare: "const __instance = getCurrentInstance();",
|
|
746
|
+
replace: "__instance.proxy.$el"
|
|
747
|
+
},
|
|
748
|
+
$root: {
|
|
749
|
+
composable: "getCurrentInstance",
|
|
750
|
+
from: "vue",
|
|
751
|
+
declare: "const __instance = getCurrentInstance();",
|
|
752
|
+
replace: "__instance.proxy.$root"
|
|
753
|
+
},
|
|
754
|
+
$parent: {
|
|
755
|
+
composable: "getCurrentInstance",
|
|
756
|
+
from: "vue",
|
|
757
|
+
declare: "const __instance = getCurrentInstance();",
|
|
758
|
+
replace: "__instance.proxy.$parent"
|
|
759
|
+
},
|
|
760
|
+
$options: {
|
|
761
|
+
composable: "getCurrentInstance",
|
|
762
|
+
from: "vue",
|
|
763
|
+
declare: "const __instance = getCurrentInstance();",
|
|
764
|
+
replace: "__instance.proxy.$options"
|
|
765
|
+
},
|
|
766
|
+
$forceUpdate: {
|
|
767
|
+
composable: "getCurrentInstance",
|
|
768
|
+
from: "vue",
|
|
769
|
+
declare: "const __instance = getCurrentInstance();",
|
|
770
|
+
replace: "__instance.proxy.$forceUpdate"
|
|
771
|
+
},
|
|
772
|
+
// ---- vue-router ----
|
|
773
|
+
$router: {
|
|
774
|
+
composable: "useRouter",
|
|
775
|
+
from: "vue-router",
|
|
776
|
+
declare: "const __router = useRouter();",
|
|
777
|
+
replace: "__router"
|
|
778
|
+
},
|
|
779
|
+
$route: {
|
|
780
|
+
composable: "useRoute",
|
|
781
|
+
from: "vue-router",
|
|
782
|
+
declare: "const __route = useRoute();",
|
|
783
|
+
replace: "__route"
|
|
784
|
+
},
|
|
785
|
+
// ---- vue-i18n ----
|
|
786
|
+
$i18n: {
|
|
787
|
+
composable: "useI18n",
|
|
788
|
+
from: "vue-i18n",
|
|
789
|
+
declare: "const __i18n = useI18n();",
|
|
790
|
+
replace: "__i18n"
|
|
791
|
+
},
|
|
792
|
+
$t: {
|
|
793
|
+
composable: "useI18n",
|
|
794
|
+
from: "vue-i18n",
|
|
795
|
+
declare: "const __i18n = useI18n();",
|
|
796
|
+
replace: "__i18n.t"
|
|
797
|
+
},
|
|
798
|
+
$n: {
|
|
799
|
+
composable: "useI18n",
|
|
800
|
+
from: "vue-i18n",
|
|
801
|
+
declare: "const __i18n = useI18n();",
|
|
802
|
+
replace: "__i18n.n"
|
|
803
|
+
},
|
|
804
|
+
$d: {
|
|
805
|
+
composable: "useI18n",
|
|
806
|
+
from: "vue-i18n",
|
|
807
|
+
declare: "const __i18n = useI18n();",
|
|
808
|
+
replace: "__i18n.d"
|
|
809
|
+
},
|
|
810
|
+
$rt: {
|
|
811
|
+
composable: "useI18n",
|
|
812
|
+
from: "vue-i18n",
|
|
813
|
+
declare: "const __i18n = useI18n();",
|
|
814
|
+
replace: "__i18n.rt"
|
|
815
|
+
},
|
|
816
|
+
$te: {
|
|
817
|
+
composable: "useI18n",
|
|
818
|
+
from: "vue-i18n",
|
|
819
|
+
declare: "const __i18n = useI18n();",
|
|
820
|
+
replace: "__i18n.te"
|
|
821
|
+
},
|
|
822
|
+
$tm: {
|
|
823
|
+
composable: "useI18n",
|
|
824
|
+
from: "vue-i18n",
|
|
825
|
+
declare: "const __i18n = useI18n();",
|
|
826
|
+
replace: "__i18n.tm"
|
|
827
|
+
},
|
|
828
|
+
// ---- @vtj/renderer ----
|
|
829
|
+
// 注:from 使用特殊标记 '__renderer__',运行时会与 useProvider 合并到同一条 import 语句
|
|
830
|
+
$provider: {
|
|
831
|
+
composable: "useStore",
|
|
832
|
+
from: "__renderer__",
|
|
833
|
+
declare: null,
|
|
834
|
+
replace: "__provider"
|
|
835
|
+
},
|
|
836
|
+
$store: {
|
|
837
|
+
composable: "useStore",
|
|
838
|
+
from: "__renderer__",
|
|
839
|
+
declare: "const __store = useStore();",
|
|
840
|
+
replace: "__store"
|
|
841
|
+
},
|
|
842
|
+
$pinia: {
|
|
843
|
+
composable: "usePinia",
|
|
844
|
+
from: "__renderer__",
|
|
845
|
+
declare: "const __pinia = usePinia();",
|
|
846
|
+
replace: "__pinia"
|
|
847
|
+
},
|
|
848
|
+
$request: {
|
|
849
|
+
composable: "useRequest",
|
|
850
|
+
from: "__renderer__",
|
|
851
|
+
declare: "const __request = useRequest();",
|
|
852
|
+
replace: "__request"
|
|
853
|
+
},
|
|
854
|
+
$libs: {
|
|
855
|
+
composable: "useLibs",
|
|
856
|
+
from: "__renderer__",
|
|
857
|
+
declare: "const __libs = useLibs();",
|
|
858
|
+
replace: "__libs"
|
|
859
|
+
},
|
|
860
|
+
$access: {
|
|
861
|
+
composable: "useAccess",
|
|
862
|
+
from: "__renderer__",
|
|
863
|
+
declare: "const __access = useAccess();",
|
|
864
|
+
replace: "__access"
|
|
865
|
+
},
|
|
866
|
+
$apis: {
|
|
867
|
+
composable: "useApis",
|
|
868
|
+
from: "__renderer__",
|
|
869
|
+
declare: "const __apis = useApis();",
|
|
870
|
+
replace: "__apis"
|
|
871
|
+
}
|
|
872
|
+
}, pe = {
|
|
873
|
+
"element-plus": {
|
|
874
|
+
$loading: {
|
|
875
|
+
composable: "ElLoading",
|
|
876
|
+
from: "element-plus",
|
|
877
|
+
declare: null,
|
|
878
|
+
replace: "ElLoading.service"
|
|
879
|
+
},
|
|
880
|
+
$message: {
|
|
881
|
+
composable: "ElMessage",
|
|
882
|
+
from: "element-plus",
|
|
883
|
+
declare: null,
|
|
884
|
+
replace: "ElMessage"
|
|
885
|
+
},
|
|
886
|
+
$notify: {
|
|
887
|
+
composable: "ElNotification",
|
|
888
|
+
from: "element-plus",
|
|
889
|
+
declare: null,
|
|
890
|
+
replace: "ElNotification"
|
|
891
|
+
},
|
|
892
|
+
$messageBox: {
|
|
893
|
+
composable: "ElMessageBox",
|
|
894
|
+
from: "element-plus",
|
|
895
|
+
declare: null,
|
|
896
|
+
replace: "ElMessageBox"
|
|
897
|
+
},
|
|
898
|
+
$msgbox: {
|
|
899
|
+
composable: "ElMessageBox",
|
|
900
|
+
from: "element-plus",
|
|
901
|
+
declare: null,
|
|
902
|
+
replace: "ElMessageBox"
|
|
903
|
+
},
|
|
904
|
+
$confirm: {
|
|
905
|
+
composable: "ElMessageBox",
|
|
906
|
+
from: "element-plus",
|
|
907
|
+
declare: null,
|
|
908
|
+
replace: "ElMessageBox.confirm"
|
|
909
|
+
},
|
|
910
|
+
$prompt: {
|
|
911
|
+
composable: "ElMessageBox",
|
|
912
|
+
from: "element-plus",
|
|
913
|
+
declare: null,
|
|
914
|
+
replace: "ElMessageBox.prompt"
|
|
915
|
+
}
|
|
916
|
+
},
|
|
917
|
+
"ant-design-vue": {
|
|
918
|
+
$confirm: {
|
|
919
|
+
composable: "Modal",
|
|
920
|
+
from: "ant-design-vue",
|
|
921
|
+
declare: null,
|
|
922
|
+
replace: "Modal.confirm"
|
|
923
|
+
},
|
|
924
|
+
$message: {
|
|
925
|
+
composable: "message",
|
|
926
|
+
from: "ant-design-vue",
|
|
927
|
+
declare: null,
|
|
928
|
+
replace: "message"
|
|
929
|
+
},
|
|
930
|
+
$notification: {
|
|
931
|
+
composable: "notification",
|
|
932
|
+
from: "ant-design-vue",
|
|
933
|
+
declare: null,
|
|
934
|
+
replace: "notification"
|
|
935
|
+
},
|
|
936
|
+
$info: {
|
|
937
|
+
composable: "message",
|
|
938
|
+
from: "ant-design-vue",
|
|
939
|
+
declare: null,
|
|
940
|
+
replace: "message.info"
|
|
941
|
+
},
|
|
942
|
+
$success: {
|
|
943
|
+
composable: "message",
|
|
944
|
+
from: "ant-design-vue",
|
|
945
|
+
declare: null,
|
|
946
|
+
replace: "message.success"
|
|
947
|
+
},
|
|
948
|
+
$warning: {
|
|
949
|
+
composable: "message",
|
|
950
|
+
from: "ant-design-vue",
|
|
951
|
+
declare: null,
|
|
952
|
+
replace: "message.warning"
|
|
953
|
+
},
|
|
954
|
+
$error: {
|
|
955
|
+
composable: "message",
|
|
956
|
+
from: "ant-design-vue",
|
|
957
|
+
declare: null,
|
|
958
|
+
replace: "message.error"
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}, Ke = Object.keys(pe);
|
|
962
|
+
function et(s) {
|
|
963
|
+
for (const [, e] of s)
|
|
964
|
+
if (Ke.includes(e.package))
|
|
965
|
+
return e.package;
|
|
966
|
+
return null;
|
|
967
|
+
}
|
|
968
|
+
function tt(s) {
|
|
969
|
+
const e = s ? pe[s] ?? {} : {};
|
|
970
|
+
return { ...E, ...e };
|
|
971
|
+
}
|
|
972
|
+
function st(s, e = E) {
|
|
973
|
+
const t = /* @__PURE__ */ new Set(), n = /this\.\$(\w+)\b/g, o = (r) => {
|
|
974
|
+
if (r && typeof r == "object") {
|
|
975
|
+
if (Array.isArray(r)) {
|
|
976
|
+
for (const c of r) o(c);
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
if (S(r) && r.value) {
|
|
980
|
+
let c;
|
|
981
|
+
for (n.lastIndex = 0; (c = n.exec(r.value)) !== null; ) {
|
|
982
|
+
const a = "$" + c[1];
|
|
983
|
+
a in e && t.add(a);
|
|
984
|
+
}
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
for (const c of Object.values(r))
|
|
988
|
+
o(c);
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
return o(s.refs), o(s.reactives), o(s.state), o(s.computed), o(s.methods), o(s.watch), o(s.lifeCycles), o(s.inject), o(s.composables), o(s.provide), o(s.dataSources), o(s.setup), o(s.nodes), t;
|
|
992
|
+
}
|
|
993
|
+
function nt(s, e = E) {
|
|
994
|
+
const t = [];
|
|
995
|
+
for (const n of s) {
|
|
996
|
+
const o = e[n];
|
|
997
|
+
o && o.declare && !t.includes(o.declare) && t.push(o.declare);
|
|
998
|
+
}
|
|
999
|
+
return t;
|
|
1000
|
+
}
|
|
1001
|
+
function rt(s, e = E) {
|
|
1002
|
+
const t = {};
|
|
1003
|
+
for (const n of s) {
|
|
1004
|
+
const o = e[n];
|
|
1005
|
+
if (o && o.composable) {
|
|
1006
|
+
const r = t[o.from] ?? (t[o.from] = []);
|
|
1007
|
+
r.includes(o.composable) || r.push(o.composable);
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
return t;
|
|
1011
|
+
}
|
|
1012
|
+
function ot(s, e = E) {
|
|
1013
|
+
const t = new Set(Object.keys(s.refs ?? {})), n = new Set(Object.keys(s.reactives ?? {})), r = Object.keys(s.state ?? {}).length > 0;
|
|
1014
|
+
r && n.add("__state");
|
|
1015
|
+
const c = new Set(Object.keys(s.computed ?? {})), a = new Set(Object.keys(s.methods ?? {})), l = /* @__PURE__ */ new Set();
|
|
1016
|
+
for (const u of s.props ?? [])
|
|
1017
|
+
we(u) ? l.add(u) : l.add(u.name);
|
|
1018
|
+
const p = /* @__PURE__ */ new Set();
|
|
1019
|
+
for (const u of s.composables ?? [])
|
|
1020
|
+
if (u.destructure && u.destructure.length > 0)
|
|
1021
|
+
for (const f of u.destructure) p.add(f);
|
|
1022
|
+
else u.name && p.add(u.name);
|
|
1023
|
+
const d = /* @__PURE__ */ new Set();
|
|
1024
|
+
for (const u of s.inject ?? [])
|
|
1025
|
+
u.name && d.add(u.name);
|
|
1026
|
+
const i = /* @__PURE__ */ new Set();
|
|
1027
|
+
for (const [, u] of Object.entries(s.dataSources ?? {}))
|
|
1028
|
+
u.name && i.add(u.name);
|
|
1029
|
+
return {
|
|
1030
|
+
refs: t,
|
|
1031
|
+
reactives: n,
|
|
1032
|
+
computed: c,
|
|
1033
|
+
methods: a,
|
|
1034
|
+
props: l,
|
|
1035
|
+
composables: p,
|
|
1036
|
+
injects: d,
|
|
1037
|
+
dataSources: i,
|
|
1038
|
+
hasState: r,
|
|
1039
|
+
effectiveApiMap: e
|
|
669
1040
|
};
|
|
670
1041
|
}
|
|
671
|
-
|
|
1042
|
+
function j(s, e, t = "script") {
|
|
1043
|
+
if (!s) return s;
|
|
1044
|
+
let n = s;
|
|
1045
|
+
for (const [o, r] of Object.entries(e.effectiveApiMap)) {
|
|
1046
|
+
const c = o.replace(/\$/g, "\\$"), a = new RegExp(`this\\.${c}\\b`, "g");
|
|
1047
|
+
n = n.replace(a, r.replace);
|
|
1048
|
+
}
|
|
1049
|
+
return n = n.replace(
|
|
1050
|
+
/this\.([A-Za-z_$][\w$]*)\.value\b/g,
|
|
1051
|
+
(o, r) => e.refs.has(r) || e.computed.has(r) ? t === "script" ? `${r}.value` : r : o
|
|
1052
|
+
), n = n.replace(/this\.([A-Za-z_$][\w$]*)/g, (o, r) => e.refs.has(r) || e.computed.has(r) ? t === "script" ? `${r}.value` : r : r === "state" ? "__state" : e.reactives.has(r) || e.methods.has(r) || e.composables.has(r) || e.injects.has(r) || e.dataSources.has(r) ? r : e.props.has(r) ? t === "script" ? `__props.${r}` : r : o), n;
|
|
1053
|
+
}
|
|
1054
|
+
function P(s) {
|
|
1055
|
+
let e = s.trim().replace(/;$/, "");
|
|
1056
|
+
return /^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim()), e;
|
|
1057
|
+
}
|
|
1058
|
+
function ct(s = {}, e) {
|
|
1059
|
+
return Object.entries(s).map(([t, n]) => {
|
|
1060
|
+
let o;
|
|
1061
|
+
return S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n), `const ${t} = ref(${o});`;
|
|
1062
|
+
});
|
|
1063
|
+
}
|
|
1064
|
+
function at(s = {}, e) {
|
|
1065
|
+
return Object.entries(s).map(([t, n]) => {
|
|
1066
|
+
let o;
|
|
1067
|
+
return S(n) ? o = j(n.value || "{}", e, "script") : o = JSON.stringify(n ?? {}), `const ${t} = reactive(${o});`;
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
function it(s = {}, e) {
|
|
1071
|
+
const t = Object.entries(s);
|
|
1072
|
+
return t.length === 0 ? "" : `const __state = reactive({ ${t.map(([o, r]) => {
|
|
1073
|
+
let c;
|
|
1074
|
+
return S(r) ? c = j(r.value || "undefined", e, "script") : c = JSON.stringify(r), `${o}: ${c}`;
|
|
1075
|
+
}).join(", ")} });`;
|
|
1076
|
+
}
|
|
1077
|
+
function lt(s = [], e) {
|
|
1078
|
+
const t = [], n = {}, o = /* @__PURE__ */ new Set();
|
|
1079
|
+
for (const r of s) {
|
|
1080
|
+
if (!r || !r.composable) continue;
|
|
1081
|
+
let c = "";
|
|
1082
|
+
if (S(r.composable) ? c = r.composable.value || "" : typeof r.composable == "string" && (c = r.composable), !c || c === "useProvider") continue;
|
|
1083
|
+
if (r.name) {
|
|
1084
|
+
if (o.has(r.name)) continue;
|
|
1085
|
+
o.add(r.name);
|
|
1086
|
+
}
|
|
1087
|
+
const l = (r.args ?? []).map((p) => S(p) ? j(p.value || "", e, "script") : JSON.stringify(p)).join(", ");
|
|
1088
|
+
r.destructure && r.destructure.length > 0 ? t.push(
|
|
1089
|
+
`const { ${r.destructure.join(", ")} } = ${c}(${l});`
|
|
1090
|
+
) : r.name ? t.push(`const ${r.name} = ${c}(${l});`) : t.push(`${c}(${l});`);
|
|
1091
|
+
}
|
|
1092
|
+
return { statements: t, imports: n };
|
|
1093
|
+
}
|
|
1094
|
+
function ut(s = [], e) {
|
|
1095
|
+
return s.map((t) => {
|
|
1096
|
+
const n = S(t.from) ? j(
|
|
1097
|
+
t.from.value || `'${t.name}'`,
|
|
1098
|
+
e,
|
|
1099
|
+
"script"
|
|
1100
|
+
) : `'${t.from || t.name}'`;
|
|
1101
|
+
let o = "undefined";
|
|
1102
|
+
return t.default !== void 0 && t.default !== null && (S(t.default) ? o = j(
|
|
1103
|
+
t.default.value || "undefined",
|
|
1104
|
+
e,
|
|
1105
|
+
"script"
|
|
1106
|
+
) : o = JSON.stringify(t.default)), `const ${t.name} = inject(${n}, ${o});`;
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
function pt(s = {}, e) {
|
|
1110
|
+
return Object.entries(s).map(([t, n]) => {
|
|
1111
|
+
if (!n || !n.value) return null;
|
|
1112
|
+
const o = j(n.value, e, "script"), r = P(o);
|
|
1113
|
+
return `const ${t} = computed(${r});`;
|
|
1114
|
+
}).filter((t) => !!t);
|
|
1115
|
+
}
|
|
1116
|
+
function ft(s = {}, e) {
|
|
1117
|
+
return Object.entries(s).map(([t, n]) => {
|
|
1118
|
+
if (!n || !n.value) return null;
|
|
1119
|
+
const o = j(n.value, e, "script"), r = P(o);
|
|
1120
|
+
return `const ${t} = ${r};`;
|
|
1121
|
+
}).filter((t) => !!t);
|
|
1122
|
+
}
|
|
1123
|
+
function mt(s = {}, e) {
|
|
1124
|
+
return Object.values(s).map((t) => {
|
|
1125
|
+
if (!t || !t.name) return null;
|
|
1126
|
+
if (t.type === "mock") {
|
|
1127
|
+
const n = t.mockTemplate && t.mockTemplate.value ? t.mockTemplate.value : "(params) => ({})", o = e ? j(n, e, "script") : n;
|
|
1128
|
+
return `const ${t.name} = async (...args) => {
|
|
1129
|
+
const mock = __provider.createMock(${o});
|
|
1130
|
+
return await mock.apply(null, args);
|
|
1131
|
+
};`;
|
|
1132
|
+
} else {
|
|
1133
|
+
const n = t.transform && t.transform.value ? t.transform.value : "(res) => res", o = e ? j(n, e, "script") : n;
|
|
1134
|
+
return `const ${t.name} = async (...args) => {
|
|
1135
|
+
return await __provider.apis['${t.ref}'].apply(null, args).then(${o});
|
|
1136
|
+
};`;
|
|
1137
|
+
}
|
|
1138
|
+
}).filter((t) => !!t);
|
|
1139
|
+
}
|
|
1140
|
+
function dt(s = [], e) {
|
|
1141
|
+
return s.map((t) => {
|
|
1142
|
+
if (!t || !t.handler || !t.handler.value) return null;
|
|
1143
|
+
const n = t.source && t.source.value ? j(t.source.value, e, "script") : "() => null", o = P(n), r = j(
|
|
1144
|
+
t.handler.value,
|
|
1145
|
+
e,
|
|
1146
|
+
"script"
|
|
1147
|
+
), c = P(r), a = [];
|
|
1148
|
+
t.deep && a.push("deep: true"), t.immediate && a.push("immediate: true"), t.flush && a.push(`flush: '${t.flush}'`);
|
|
1149
|
+
const l = a.length > 0 ? `, { ${a.join(", ")} }` : "";
|
|
1150
|
+
return `watch(${o}, ${c}${l});`;
|
|
1151
|
+
}).filter((t) => !!t);
|
|
1152
|
+
}
|
|
1153
|
+
function ht(s = {}, e) {
|
|
1154
|
+
return Object.entries(s).map(([t, n]) => {
|
|
1155
|
+
let o;
|
|
1156
|
+
if (R(n)) {
|
|
1157
|
+
const r = j(
|
|
1158
|
+
n.value || "",
|
|
1159
|
+
e,
|
|
1160
|
+
"script"
|
|
1161
|
+
);
|
|
1162
|
+
o = P(r);
|
|
1163
|
+
} else S(n) ? o = j(n.value || "undefined", e, "script") : o = JSON.stringify(n);
|
|
1164
|
+
return `provide('${t}', ${o});`;
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
function fe(s) {
|
|
1168
|
+
let e = s.trim().replace(/;$/, "");
|
|
1169
|
+
/^\((\(|async|function)/.test(e) && (e = e.substring(1, e.length - 1).trim());
|
|
1170
|
+
const t = e.match(/^(?:async\s+)?\([^)]*\)\s*=>\s*([\s\S]+)$/);
|
|
1171
|
+
if (t) {
|
|
1172
|
+
let o = t[1].trim();
|
|
1173
|
+
return o.startsWith("{") && o.endsWith("}") ? o = o.slice(1, -1).trim() : o = o.replace(/;$/, "") + ";", o;
|
|
1174
|
+
}
|
|
1175
|
+
const n = e.match(
|
|
1176
|
+
/^(?:async\s+)?function\s*\w*\s*\([^)]*\)\s*\{([\s\S]*)\}$/
|
|
1177
|
+
);
|
|
1178
|
+
return n ? n[1].trim() : e;
|
|
1179
|
+
}
|
|
1180
|
+
function gt(s, e) {
|
|
1181
|
+
if (!s || !s.value) return "";
|
|
1182
|
+
const t = j(s.value, e, "script");
|
|
1183
|
+
return fe(t);
|
|
1184
|
+
}
|
|
1185
|
+
function vt(s = {}, e) {
|
|
1186
|
+
const t = [];
|
|
1187
|
+
for (const n of ["beforeCreate", "created"]) {
|
|
1188
|
+
const o = s[n];
|
|
1189
|
+
if (o && o.value) {
|
|
1190
|
+
const r = j(o.value, e, "script"), c = fe(r);
|
|
1191
|
+
c && t.push(`// ${n}
|
|
1192
|
+
${c}`);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
return t.join(`
|
|
1196
|
+
`);
|
|
1197
|
+
}
|
|
1198
|
+
const $t = {
|
|
1199
|
+
beforeMount: "onBeforeMount",
|
|
1200
|
+
mounted: "onMounted",
|
|
1201
|
+
beforeUpdate: "onBeforeUpdate",
|
|
1202
|
+
updated: "onUpdated",
|
|
1203
|
+
beforeUnmount: "onBeforeUnmount",
|
|
1204
|
+
unmounted: "onUnmounted",
|
|
1205
|
+
errorCaptured: "onErrorCaptured",
|
|
1206
|
+
renderTracked: "onRenderTracked",
|
|
1207
|
+
renderTriggered: "onRenderTriggered",
|
|
1208
|
+
activated: "onActivated",
|
|
1209
|
+
deactivated: "onDeactivated"
|
|
1210
|
+
}, bt = /* @__PURE__ */ new Set([
|
|
1211
|
+
"onBeforeMount",
|
|
1212
|
+
"onMounted",
|
|
1213
|
+
"onBeforeUpdate",
|
|
1214
|
+
"onUpdated",
|
|
1215
|
+
"onBeforeUnmount",
|
|
1216
|
+
"onUnmounted",
|
|
1217
|
+
"onErrorCaptured",
|
|
1218
|
+
"onRenderTracked",
|
|
1219
|
+
"onRenderTriggered",
|
|
1220
|
+
"onActivated",
|
|
1221
|
+
"onDeactivated"
|
|
1222
|
+
]), _t = /* @__PURE__ */ new Set([
|
|
1223
|
+
"onLoad",
|
|
1224
|
+
"onShow",
|
|
1225
|
+
"onReady",
|
|
1226
|
+
"onHide",
|
|
1227
|
+
"onUnload",
|
|
1228
|
+
"onResize",
|
|
1229
|
+
"onPullDownRefresh",
|
|
1230
|
+
"onReachBottom",
|
|
1231
|
+
"onTabItemTap",
|
|
1232
|
+
"onShareAppMessage",
|
|
1233
|
+
"onPageScroll",
|
|
1234
|
+
"onNavigationBarButtonTap",
|
|
1235
|
+
"onBackPress",
|
|
1236
|
+
"onNavigationBarSearchInputChanged",
|
|
1237
|
+
"onNavigationBarSearchInputConfirmed",
|
|
1238
|
+
"onNavigationBarSearchInputClicked",
|
|
1239
|
+
"onShareTimeline",
|
|
1240
|
+
"onAddToFavorites"
|
|
1241
|
+
]);
|
|
1242
|
+
function yt(s = {}, e) {
|
|
1243
|
+
const t = [], n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
|
|
1244
|
+
for (const [r, c] of Object.entries(s)) {
|
|
1245
|
+
if (!c || !c.value || r === "created" || r === "beforeCreate") continue;
|
|
1246
|
+
const a = $t[r] || r;
|
|
1247
|
+
if (bt.has(a)) {
|
|
1248
|
+
const l = j(c.value, e, "script"), p = P(l);
|
|
1249
|
+
t.push(`${a}(${p});`), n.add(a);
|
|
1250
|
+
} else if (_t.has(a)) {
|
|
1251
|
+
const l = j(c.value, e, "script"), p = P(l);
|
|
1252
|
+
t.push(`${a}(${p});`), o.add(a);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
return { statements: t, usedHooks: n, usedUniHooks: o };
|
|
1256
|
+
}
|
|
1257
|
+
function St(s) {
|
|
1258
|
+
const {
|
|
1259
|
+
componentMap: e,
|
|
1260
|
+
components: t,
|
|
1261
|
+
importBlocks: n,
|
|
1262
|
+
collectImports: o,
|
|
1263
|
+
platform: r,
|
|
1264
|
+
vueImports: c,
|
|
1265
|
+
composableImports: a,
|
|
1266
|
+
globalApiImports: l,
|
|
1267
|
+
uniHookImports: p,
|
|
1268
|
+
easycomPackages: d
|
|
1269
|
+
} = s, i = [
|
|
1270
|
+
"@dcloudio/uni-h5",
|
|
1271
|
+
"uni-h5",
|
|
1272
|
+
"@dcloudio/uni-ui",
|
|
1273
|
+
"uni-ui"
|
|
1274
|
+
], u = {
|
|
1275
|
+
vue: [...c]
|
|
1276
|
+
}, f = [], v = [], b = {};
|
|
1277
|
+
for (const g of t) {
|
|
1278
|
+
const m = g.split(":")[0], h = e.get(m);
|
|
1279
|
+
if (!h || !h.package || h.parent || d.has(h.package)) continue;
|
|
1280
|
+
const y = u[h.package] ?? (u[h.package] = []), $ = (h.alias || "").split(".")[0] || h.name, w = m, I = $ !== w ? `${$} as ${w}` : $;
|
|
1281
|
+
y.push(I), b[$] = w, r === "uniapp" && i.includes(h.package) && f.push($);
|
|
1282
|
+
}
|
|
1283
|
+
for (const g of t) {
|
|
1284
|
+
const m = g.split(":")[0], h = e.get(m);
|
|
1285
|
+
if (!h || !h.package || !h.parent || d.has(h.package)) continue;
|
|
1286
|
+
const y = h.parent, $ = b[y] ?? y, w = h.alias || "";
|
|
1287
|
+
v.push(
|
|
1288
|
+
`const ${m} = ${$}.${w};`
|
|
1289
|
+
), b[y] || ((u[h.package] ?? (u[h.package] = [])).push(y), b[y] = y);
|
|
1290
|
+
}
|
|
1291
|
+
for (const [g, m] of Object.entries(o))
|
|
1292
|
+
(u[g] ?? (u[g] = [])).push(...Array.from(m)), r === "uniapp" && i.includes(g) && f.push(...Array.from(m));
|
|
1293
|
+
for (const [g, m] of Object.entries(a))
|
|
1294
|
+
(u[g] ?? (u[g] = [])).push(...m);
|
|
1295
|
+
for (const [g, m] of Object.entries(l))
|
|
1296
|
+
(u[g] ?? (u[g] = [])).push(...m);
|
|
1297
|
+
return r === "uniapp" && p.length > 0 && (u["@dcloudio/uni-app"] ?? (u["@dcloudio/uni-app"] = [])).push(...p), { imports: Object.entries(u).filter(([g, m]) => r === "uniapp" ? !i.includes(g) && !!m.length : !!m.length).map(([g, m]) => `import { ${B(m).join(
|
|
1298
|
+
","
|
|
1299
|
+
)}} from '${g}';`).concat(n), uniComponents: f, componentDeclarations: v };
|
|
1300
|
+
}
|
|
1301
|
+
function jt(s, e = E, t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set()) {
|
|
1302
|
+
const o = Object.entries(e), r = (c) => {
|
|
1303
|
+
if (c == null || typeof c != "object") return c;
|
|
1304
|
+
if (Array.isArray(c))
|
|
1305
|
+
return c.map(r);
|
|
1306
|
+
if (S(c) && typeof c.value == "string") {
|
|
1307
|
+
let l = c.value;
|
|
1308
|
+
for (const [p, d] of o) {
|
|
1309
|
+
const i = p.replace(/\$/g, "\\$"), u = new RegExp(`this\\.${i}\\b`, "g");
|
|
1310
|
+
l = l.replace(u, d.replace);
|
|
1311
|
+
}
|
|
1312
|
+
return l = l.replace(/this\.([A-Za-z_$][\w$]*)\.value\b/g, (p, d) => t.has(d) || n.has(d) ? d : p), { ...c, value: l };
|
|
1313
|
+
}
|
|
1314
|
+
const a = {};
|
|
1315
|
+
for (const [l, p] of Object.entries(c))
|
|
1316
|
+
a[l] = r(p);
|
|
1317
|
+
return a;
|
|
1318
|
+
};
|
|
1319
|
+
return s.map(r);
|
|
1320
|
+
}
|
|
1321
|
+
function kt(s, e, t = [], n = {}, o, r = E, c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set()) {
|
|
1322
|
+
const l = jt(
|
|
1323
|
+
s,
|
|
1324
|
+
r,
|
|
1325
|
+
c,
|
|
1326
|
+
a
|
|
1327
|
+
);
|
|
1328
|
+
return q(
|
|
1329
|
+
l,
|
|
1330
|
+
e,
|
|
1331
|
+
t,
|
|
1332
|
+
n,
|
|
1333
|
+
o
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
function wt(s, e, t = "web") {
|
|
1337
|
+
const { dsl: n } = s, o = et(e), r = tt(o), c = ot(n, r), a = st(n, r), l = nt(a, r), p = rt(a, r), d = p.__renderer__ || [];
|
|
1338
|
+
delete p.__renderer__;
|
|
1339
|
+
const i = kt(
|
|
1340
|
+
n.nodes || [],
|
|
1341
|
+
e,
|
|
1342
|
+
Object.keys(n.computed || {}),
|
|
1343
|
+
s.context,
|
|
1344
|
+
void 0,
|
|
1345
|
+
r,
|
|
1346
|
+
c.refs,
|
|
1347
|
+
c.computed
|
|
1348
|
+
), u = i.importBlocks.map(
|
|
1349
|
+
(O) => `import ${O.name} from './${O.id}.vue';`
|
|
1350
|
+
), f = ct(n.refs || {}, c), v = at(n.reactives || {}, c), b = it(n.state || {}, c), k = pt(n.computed || {}, c), g = {
|
|
1351
|
+
...i.methods || {},
|
|
1352
|
+
...n.methods || {}
|
|
1353
|
+
}, m = ft(g, c), h = mt(n.dataSources || {}, c), y = dt(n.watch || [], c), $ = ut(n.inject || [], c), w = ht(n.provide || {}, c), I = lt(
|
|
1354
|
+
n.composables || [],
|
|
1355
|
+
c
|
|
1356
|
+
), C = /* @__PURE__ */ new Set();
|
|
1357
|
+
for (const O of n.composables || [])
|
|
1358
|
+
if (O.destructure && O.destructure.length > 0)
|
|
1359
|
+
for (const D of O.destructure) C.add(D);
|
|
1360
|
+
else O.name && C.add(O.name);
|
|
1361
|
+
const N = l.filter((O) => {
|
|
1362
|
+
const D = O.match(/^const\s+(\w+)\s*=/);
|
|
1363
|
+
return !(D && C.has(D[1]));
|
|
1364
|
+
}), L = yt(n.lifeCycles || {}, c), me = vt(
|
|
1365
|
+
n.lifeCycles || {},
|
|
1366
|
+
c
|
|
1367
|
+
), de = gt(n.setup, c), x = /* @__PURE__ */ new Set();
|
|
1368
|
+
f.length > 0 && x.add("ref"), (v.length > 0 || b) && x.add("reactive"), k.length > 0 && x.add("computed"), y.length > 0 && x.add("watch"), $.length > 0 && x.add("inject"), w.length > 0 && x.add("provide");
|
|
1369
|
+
for (const O of L.usedHooks) x.add(O);
|
|
1370
|
+
const he = t === "uniapp" ? Array.from(L.usedUniHooks) : [], { imports: ge, uniComponents: ve, componentDeclarations: $e } = St({
|
|
1371
|
+
componentMap: e,
|
|
1372
|
+
components: i.components,
|
|
1373
|
+
importBlocks: u,
|
|
1374
|
+
collectImports: s.imports,
|
|
1375
|
+
platform: t,
|
|
1376
|
+
vueImports: Array.from(x),
|
|
1377
|
+
composableImports: I.imports,
|
|
1378
|
+
globalApiImports: p,
|
|
1379
|
+
uniHookImports: he,
|
|
1380
|
+
easycomPackages: s.easycomPackages
|
|
1381
|
+
}), be = le(s.urlSchemas), _e = ue(s.blockPlugins);
|
|
1382
|
+
return {
|
|
1383
|
+
id: n.id,
|
|
1384
|
+
version: n.__VERSION__,
|
|
1385
|
+
name: n.name,
|
|
1386
|
+
imports: `
|
|
1387
|
+
` + ge.join(`
|
|
1388
|
+
`),
|
|
1389
|
+
props: ne(n.props).join(","),
|
|
1390
|
+
emits: re(n.emits).join(","),
|
|
1391
|
+
needsProps: a.has("$props"),
|
|
1392
|
+
needsEmit: a.has("$emit"),
|
|
1393
|
+
expose: n.expose && n.expose.length ? `{ ${n.expose.join(", ")} }` : "",
|
|
1394
|
+
globalApiDeclares: N.join(`
|
|
1395
|
+
`),
|
|
1396
|
+
injects: $.join(`
|
|
1397
|
+
`),
|
|
1398
|
+
composables: I.statements.join(`
|
|
1399
|
+
`),
|
|
1400
|
+
state: b,
|
|
1401
|
+
refs: f.join(`
|
|
1402
|
+
`),
|
|
1403
|
+
reactives: v.join(`
|
|
1404
|
+
`),
|
|
1405
|
+
computed: k.join(`
|
|
1406
|
+
`),
|
|
1407
|
+
methods: m.join(`
|
|
1408
|
+
`),
|
|
1409
|
+
dataSources: h.join(`
|
|
1410
|
+
`),
|
|
1411
|
+
watch: y.join(`
|
|
1412
|
+
`),
|
|
1413
|
+
provide: w.join(`
|
|
1414
|
+
`),
|
|
1415
|
+
createdStatements: me,
|
|
1416
|
+
setupStatements: de,
|
|
1417
|
+
lifeCycles: L.statements.join(`
|
|
1418
|
+
`),
|
|
1419
|
+
template: i.nodes.join(`
|
|
1420
|
+
`),
|
|
1421
|
+
css: n.css || "",
|
|
1422
|
+
style: ie(s.style),
|
|
1423
|
+
urlSchemas: be.join(`
|
|
1424
|
+
`),
|
|
1425
|
+
blockPlugins: _e.join(`
|
|
1426
|
+
`),
|
|
1427
|
+
uniComponents: ve,
|
|
1428
|
+
renderer: t === "uniapp" ? "@vtj/uni-app" : "@vtj/renderer",
|
|
1429
|
+
rendererImports: ["useProvider", ...d].join(", "),
|
|
1430
|
+
componentDeclarations: $e.join(`
|
|
1431
|
+
`)
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
const It = `
|
|
672
1435
|
// @ts-nocheck
|
|
673
|
-
|
|
674
|
-
<%= imports %>
|
|
675
1436
|
import { useProvider } from '<%= renderer %>';
|
|
1437
|
+
<%= imports %>
|
|
676
1438
|
export default defineComponent({
|
|
677
1439
|
name: '<%= name %>',
|
|
678
1440
|
<% if(inject) { %> inject: { <%= inject %>}, <% } %>
|
|
@@ -701,53 +1463,88 @@ export default defineComponent({
|
|
|
701
1463
|
<% if(methods) { %> methods: { <%= methods %> }, <% } %>
|
|
702
1464
|
<% if(watch) { %> watch: { <%= watch %> }, <% } %> <%= lifeCycles %>
|
|
703
1465
|
});
|
|
704
|
-
|
|
1466
|
+
`, Ot = `
|
|
705
1467
|
<template>
|
|
706
1468
|
<%= template %>
|
|
707
1469
|
</template>
|
|
708
|
-
<script lang="<%= scriptLang %>"
|
|
1470
|
+
<script lang="<%= scriptLang %>"<% if(scriptSetup) { %> setup<% } %>>
|
|
709
1471
|
<%= script %>
|
|
710
1472
|
<\/script>
|
|
711
1473
|
<style lang="<%= styleLang %>" scoped>
|
|
712
1474
|
<%= css %>
|
|
713
1475
|
<%= style %>
|
|
714
1476
|
</style>
|
|
715
|
-
`,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
1477
|
+
`, Ct = `// @ts-nocheck
|
|
1478
|
+
import { <%= rendererImports %> } from '<%= renderer %>';<%= imports %>
|
|
1479
|
+
<% if(componentDeclarations) { %><%= componentDeclarations %><% } %>
|
|
1480
|
+
<% if(props) { %>const __props = defineProps({ <%= props %> });<% } else if(needsProps) { %>const __props = defineProps();<% } %>
|
|
1481
|
+
<% if(emits) { %>const __emit = defineEmits([<%= emits %>]);<% } else if(needsEmit) { %>const __emit = defineEmits();<% } %>
|
|
1482
|
+
const __provider = useProvider({ id: '<%= id %>', version: '<%= version %>' });
|
|
1483
|
+
<%= urlSchemas %>
|
|
1484
|
+
<%= blockPlugins %>
|
|
1485
|
+
<%= globalApiDeclares %>
|
|
1486
|
+
<%= injects %>
|
|
1487
|
+
<%= composables %>
|
|
1488
|
+
<%= createdStatements %>
|
|
1489
|
+
<%= state %>
|
|
1490
|
+
<%= refs %>
|
|
1491
|
+
<%= reactives %>
|
|
1492
|
+
<%= computed %>
|
|
1493
|
+
<%= methods %>
|
|
1494
|
+
<%= setupStatements %>
|
|
1495
|
+
<%= dataSources %>
|
|
1496
|
+
<%= watch %>
|
|
1497
|
+
<%= provide %>
|
|
1498
|
+
<%= lifeCycles %>
|
|
1499
|
+
<% if(expose) { %>defineExpose(<%= expose %>);<% } %>
|
|
1500
|
+
`, xt = W(It), At = W(Ct), Pt = W(Ot);
|
|
1501
|
+
async function Tt(s, e = /* @__PURE__ */ new Map(), t = [], n = "web", o) {
|
|
1502
|
+
const r = s, c = typeof r.dsl == "object" && arguments.length === 1 ? r : {
|
|
1503
|
+
dsl: s,
|
|
719
1504
|
componentMap: e,
|
|
720
|
-
dependencies:
|
|
721
|
-
platform:
|
|
722
|
-
formatterDisabled:
|
|
1505
|
+
dependencies: t,
|
|
1506
|
+
platform: n,
|
|
1507
|
+
formatterDisabled: o
|
|
723
1508
|
}, {
|
|
724
1509
|
dsl: a,
|
|
725
|
-
componentMap:
|
|
1510
|
+
componentMap: l = /* @__PURE__ */ new Map(),
|
|
726
1511
|
dependencies: p = [],
|
|
727
|
-
platform:
|
|
728
|
-
formatterDisabled:
|
|
729
|
-
ts:
|
|
730
|
-
scss:
|
|
731
|
-
} =
|
|
732
|
-
|
|
1512
|
+
platform: d = "web",
|
|
1513
|
+
formatterDisabled: i = !1,
|
|
1514
|
+
ts: u = !0,
|
|
1515
|
+
scss: f = !1
|
|
1516
|
+
} = c, v = new Ne(Ie(a), p), b = a.apiMode === "composition";
|
|
1517
|
+
let k, g, m, h;
|
|
1518
|
+
if (b) {
|
|
1519
|
+
const $ = wt(v, l, d);
|
|
1520
|
+
h = At($), k = $.template || `
|
|
733
1521
|
<!--组件模版内容-->
|
|
734
|
-
`,
|
|
735
|
-
|
|
1522
|
+
`, g = $.css, m = $.style;
|
|
1523
|
+
} else {
|
|
1524
|
+
const $ = Ye(v, l, d);
|
|
1525
|
+
h = xt($), k = $.template || `
|
|
1526
|
+
<!--组件模版内容-->
|
|
1527
|
+
`, g = $.css, m = $.style;
|
|
1528
|
+
}
|
|
1529
|
+
const y = Pt({
|
|
1530
|
+
template: k,
|
|
1531
|
+
css: await G(g, i) || `
|
|
736
1532
|
/* 组件样式内容 */
|
|
737
1533
|
`,
|
|
738
|
-
script: await
|
|
739
|
-
style: await
|
|
740
|
-
scriptLang:
|
|
741
|
-
styleLang:
|
|
1534
|
+
script: await xe(h, i),
|
|
1535
|
+
style: await G(m, i),
|
|
1536
|
+
scriptLang: u ? "ts" : "js",
|
|
1537
|
+
styleLang: f ? "scss" : "css",
|
|
1538
|
+
scriptSetup: b
|
|
742
1539
|
});
|
|
743
|
-
return await
|
|
1540
|
+
return await K(y, i).catch(($) => ($.content = y, Promise.reject($)));
|
|
744
1541
|
}
|
|
745
|
-
async function
|
|
1542
|
+
async function Mt(s) {
|
|
746
1543
|
const e = `
|
|
747
1544
|
<template>
|
|
748
1545
|
<div>
|
|
749
1546
|
<h3>源码模式页面</h3>
|
|
750
|
-
<div>文件路径:/.vtj/vue/${
|
|
1547
|
+
<div>文件路径:/.vtj/vue/${s.id}.vue</div>
|
|
751
1548
|
</div>
|
|
752
1549
|
</template>
|
|
753
1550
|
<script lang="ts" setup>
|
|
@@ -755,13 +1552,18 @@ async function Me(t) {
|
|
|
755
1552
|
<style scoped lang="scss">
|
|
756
1553
|
</style>
|
|
757
1554
|
`;
|
|
758
|
-
return await
|
|
1555
|
+
return await K(e);
|
|
759
1556
|
}
|
|
760
1557
|
export {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
1558
|
+
E as GLOBAL_API_MAP,
|
|
1559
|
+
pe as UI_GLOBAL_API_MAPS,
|
|
1560
|
+
Ke as UI_PACKAGES,
|
|
1561
|
+
Bt as VTJ_CODER_VERSION,
|
|
1562
|
+
tt as buildEffectiveApiMap,
|
|
1563
|
+
Mt as createEmptyPage,
|
|
1564
|
+
G as cssFormatter,
|
|
1565
|
+
et as detectUIPackage,
|
|
1566
|
+
Tt as generator,
|
|
1567
|
+
xe as tsFormatter,
|
|
1568
|
+
K as vueFormatter
|
|
767
1569
|
};
|