@fangzhongya/vue-archive 0.0.34 → 0.0.35
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/node/index.cjs +52 -17
- package/dist/node/index.js +52 -17
- package/dist/packages/components/compo/index.cjs +1 -1
- package/dist/packages/components/compo/index.js +2 -1
- package/dist/packages/components/use/code.cjs +9 -7
- package/dist/packages/components/use/code.js +85 -73
- package/dist/packages/utils/common.d.ts +1 -0
- package/dist/packages/utils/glob.cjs +2 -2
- package/dist/packages/utils/glob.d.ts +1 -1
- package/dist/packages/utils/glob.js +226 -221
- package/dist/packages/utils/props.cjs +1 -1
- package/dist/packages/utils/props.js +6 -0
- package/package.json +1 -1
|
@@ -1,102 +1,105 @@
|
|
|
1
1
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
2
2
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
3
|
-
import { humpToLine as
|
|
3
|
+
import { humpToLine as A } from "@fangzhongya/utils/name/humpToLine";
|
|
4
4
|
import "@fangzhongya/utils/name/lineToLargeHump";
|
|
5
5
|
import "@fangzhongya/utils/basic/string/appearNum";
|
|
6
|
-
import { firstLower as
|
|
6
|
+
import { firstLower as H } from "@fangzhongya/utils/basic/string/firstLower";
|
|
7
7
|
import "@fangzhongya/utils/basic/array/duplicateRemoval";
|
|
8
8
|
import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
9
|
-
import { firstUpper as
|
|
9
|
+
import { firstUpper as T } from "@fangzhongya/utils/basic/string/firstUpper";
|
|
10
10
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
11
11
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
12
|
-
import { parseParamString as
|
|
13
|
-
import { getPropsValue as
|
|
14
|
-
import { getFunctionFormat as
|
|
15
|
-
const
|
|
12
|
+
import { parseParamString as j, getTypeValue as O, setDataType as U, vueFormat as V, prettierFormat as Z, getFunBody as x } from "./util.js";
|
|
13
|
+
import { getPropsValue as q, getEmitsValue as G, getExposeValue as I, getSlotValue as K } from "../../utils/props.js";
|
|
14
|
+
import { getFunctionFormat as M } from "@fangzhongya/utils/basic/string/toFunction";
|
|
15
|
+
const Q = ["class"];
|
|
16
16
|
function S(s, e) {
|
|
17
17
|
return s.filter((t) => t.name == e)[0];
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return s.map((e) => (e.prop || "...arr") + ":" +
|
|
19
|
+
function z(s) {
|
|
20
|
+
return s.map((e) => (e.prop || "...arr") + ":" + U(e.dataType)).join(",");
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function mt(s, e, t, r, l, $) {
|
|
23
23
|
const p = [], n = [];
|
|
24
|
-
let
|
|
25
|
-
const
|
|
24
|
+
let y = !0;
|
|
25
|
+
const P = q(e.propss || []), B = G(e.emitss || []), C = I(e.exposes || []), J = K(e.slots || []);
|
|
26
26
|
Object.keys(t).forEach((o) => {
|
|
27
|
-
let
|
|
28
|
-
if (/^on[A-Z]/.test(o) && typeof
|
|
27
|
+
let a = t[o];
|
|
28
|
+
if (/^on[A-Z]/.test(o) && typeof a == "function") {
|
|
29
29
|
let i = o.substring(2);
|
|
30
30
|
const c = o.split(":");
|
|
31
|
-
let
|
|
32
|
-
if (c.length > 1 ? (
|
|
33
|
-
let
|
|
34
|
-
|
|
31
|
+
let m;
|
|
32
|
+
if (c.length > 1 ? (m = c[0] + c.slice(1).map((u) => T(u)).join(""), i = H(i)) : (m = c[0], i = A(i)), c.includes("-")) {
|
|
33
|
+
let u = m.split("-");
|
|
34
|
+
u = u.map((h, E) => E != 0 ? T(h) : h), m = u.join("");
|
|
35
35
|
}
|
|
36
|
-
p.push(" @" + i + '="' +
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const h = f.name || "arr";
|
|
42
|
-
n.push(" console.log('" + f.label + "', " + h + ")");
|
|
36
|
+
p.push(" @" + i + '="' + m + '"');
|
|
37
|
+
const f = S(B, i) || {}, d = f.selectable || "", b = j(d), g = z(b);
|
|
38
|
+
n.push(`// ${f.description} ${f.name}: (${f.selectable})`), n.push("function " + m + "(" + g + ") {"), b.forEach((u) => {
|
|
39
|
+
const h = u.name || "arr";
|
|
40
|
+
n.push(" console.log('" + u.label + "', " + h + ")");
|
|
43
41
|
}), n.push("}");
|
|
44
42
|
} else {
|
|
45
43
|
let i = o;
|
|
46
|
-
|
|
47
|
-
const c = S(
|
|
44
|
+
Q.includes(o) && (i = o + "1"), p.push(" :" + o + '="' + i + '"');
|
|
45
|
+
const c = S(P, o) || {}, m = Y(c);
|
|
48
46
|
if (n.push(
|
|
49
47
|
`// ${c.description} ${c.name}: {${c.type}} (${c.selectable})`
|
|
50
|
-
), typeof
|
|
48
|
+
), typeof a == "function")
|
|
51
49
|
n.push(
|
|
52
|
-
"const " + o + " = " +
|
|
50
|
+
"const " + o + " = " + D(a, o, l)
|
|
53
51
|
);
|
|
54
|
-
else if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"const " + i + " =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
else if (y && (y = !1, n.unshift("import { ref } from 'vue';")), typeof a > "u")
|
|
53
|
+
if (m.type == "function") {
|
|
54
|
+
const f = W(c);
|
|
55
|
+
n.push("const " + i + " = " + f + ";");
|
|
56
|
+
} else {
|
|
57
|
+
const f = O(m.dataType);
|
|
58
|
+
n.push(
|
|
59
|
+
"const " + i + " = ref(" + (f === "undefined" ? "" : f) + ");"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
let f = w(a, o, l);
|
|
64
|
+
n.push("const " + i + " = ref(" + f + ");");
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
});
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
+
const F = Object.values($ || {});
|
|
69
|
+
F.length > 0 && (y && (y = !1, n.unshift("import { ref } from 'vue';")), p.unshift(' ref="refDom"'), n.push("const refDom = ref()"), F.forEach((o) => {
|
|
70
|
+
const a = S(C, o.name) || {};
|
|
68
71
|
n.push(
|
|
69
|
-
`// ${
|
|
72
|
+
`// ${a.description} ${a.name}:(${a.selectable}) ${a.type}`
|
|
70
73
|
);
|
|
71
|
-
const i = o.name + "Value", c =
|
|
72
|
-
c.forEach((d,
|
|
74
|
+
const i = o.name + "Value", c = j(a?.selectable || ""), m = [], f = o.params || [];
|
|
75
|
+
c.forEach((d, b) => {
|
|
73
76
|
const g = d.name;
|
|
74
77
|
if (g) {
|
|
75
|
-
const
|
|
78
|
+
const u = g + o.name, h = f[b];
|
|
76
79
|
if (n.push(`// ${d.label}`), typeof h == "function")
|
|
77
80
|
n.push(
|
|
78
|
-
"const " +
|
|
81
|
+
"const " + u + " = " + D(h, g, o.text)
|
|
79
82
|
);
|
|
80
83
|
else if (typeof h > "u")
|
|
81
84
|
n.push(
|
|
82
|
-
"const " +
|
|
85
|
+
"const " + u + " = " + O(d.dataType) + ";"
|
|
83
86
|
);
|
|
84
87
|
else {
|
|
85
|
-
let
|
|
86
|
-
n.push("const " +
|
|
88
|
+
let E = w(h, g, o.text);
|
|
89
|
+
n.push("const " + u + " = " + E + ";");
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
m.push(u);
|
|
89
92
|
}
|
|
90
93
|
}), o.type === "function" ? n.push(
|
|
91
|
-
`const ${i} = refDom.value?.${o.name}(${
|
|
92
|
-
) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${
|
|
94
|
+
`const ${i} = refDom.value?.${o.name}(${m.join(", ")})`
|
|
95
|
+
) : n.push(`const ${i} = refDom.value?.${o.name}`), n.push(`console.log('"${a.type}"', ${i})`);
|
|
93
96
|
})), p.length > 0 && p.unshift("");
|
|
94
|
-
const
|
|
97
|
+
const N = R(r, J);
|
|
95
98
|
return `<!--${s}-->
|
|
96
99
|
<template>
|
|
97
100
|
<div>
|
|
98
101
|
<${s}${p.join(`
|
|
99
|
-
`)}>${
|
|
102
|
+
`)}>${N.join(`
|
|
100
103
|
`)}
|
|
101
104
|
</${s}>
|
|
102
105
|
</div>
|
|
@@ -110,44 +113,53 @@ ${n.join(`
|
|
|
110
113
|
function R(s = {}, e) {
|
|
111
114
|
const t = [];
|
|
112
115
|
return Object.keys(s).forEach((r) => {
|
|
113
|
-
const
|
|
116
|
+
const l = S(e, r) || {}, $ = s[r];
|
|
114
117
|
if ($) {
|
|
115
|
-
const p = ` <!-- ${
|
|
118
|
+
const p = ` <!-- ${l.description} ${l.name}:(${l.selectable}) -->
|
|
116
119
|
<template #${r}="scope">
|
|
117
|
-
${
|
|
120
|
+
${V($, " ")}
|
|
118
121
|
</template>`;
|
|
119
122
|
t.push(p);
|
|
120
123
|
}
|
|
121
124
|
}), t && t.length > 0 && t.unshift(""), t;
|
|
122
125
|
}
|
|
123
|
-
function
|
|
126
|
+
function D(s, e, t) {
|
|
124
127
|
const r = t ? t[e] : "";
|
|
125
|
-
return r ||
|
|
128
|
+
return r || L(s.toString());
|
|
126
129
|
}
|
|
127
|
-
function
|
|
128
|
-
const e =
|
|
130
|
+
function L(s) {
|
|
131
|
+
const e = M(Z(s));
|
|
129
132
|
if (e) {
|
|
130
133
|
let t = `{
|
|
131
|
-
${
|
|
134
|
+
${V(x(e.body), " ")}
|
|
132
135
|
}`;
|
|
133
136
|
return `function (${e.param}) ${t}`;
|
|
134
137
|
} else
|
|
135
138
|
return "undefined";
|
|
136
139
|
}
|
|
137
140
|
function W(s) {
|
|
141
|
+
const e = j(s.selectable), t = z(e);
|
|
142
|
+
let r = "";
|
|
143
|
+
s.return && (r = "return ");
|
|
144
|
+
let l = `{
|
|
145
|
+
${V(x(r), " ")}
|
|
146
|
+
}`;
|
|
147
|
+
return `function (${t}) ${l}`;
|
|
148
|
+
}
|
|
149
|
+
function X(s) {
|
|
138
150
|
const e = s.trim();
|
|
139
|
-
return /^\(/.test(e) ?
|
|
151
|
+
return /^\(/.test(e) ? L(e) : JSON.stringify(s);
|
|
140
152
|
}
|
|
141
|
-
function
|
|
153
|
+
function w(s, e, t) {
|
|
142
154
|
const r = t ? t[e] : "";
|
|
143
|
-
return r || (typeof s == "string" ?
|
|
155
|
+
return r || (typeof s == "string" ? X(s + "") : JSON.stringify(s));
|
|
144
156
|
}
|
|
145
|
-
function
|
|
146
|
-
let e =
|
|
157
|
+
function Y(s) {
|
|
158
|
+
let e = _(s?.type), t = "any";
|
|
147
159
|
e.length == 1 && (t = e[0].split("<")[0]);
|
|
148
160
|
const r = t;
|
|
149
|
-
let
|
|
150
|
-
return
|
|
161
|
+
let l = (s?.selectable || "").trim(), $ = [];
|
|
162
|
+
return l && t != "boolean" && (l.includes("|") ? l.split("|").forEach((p) => {
|
|
151
163
|
if (p) {
|
|
152
164
|
let n = p.split(":");
|
|
153
165
|
$.push({
|
|
@@ -155,21 +167,21 @@ function X(s) {
|
|
|
155
167
|
prop: n[0].trim()
|
|
156
168
|
});
|
|
157
169
|
}
|
|
158
|
-
}), t == "function" ? t = "function" : t == "array" ? t = "choice" : t = "select"), {
|
|
170
|
+
}) : $ = j(l), t == "function" ? t = "function" : t == "array" ? t = "choice" : t = "select"), {
|
|
159
171
|
arr: $,
|
|
160
172
|
zdtype: r,
|
|
161
173
|
type: t,
|
|
162
174
|
dataType: e
|
|
163
175
|
};
|
|
164
176
|
}
|
|
165
|
-
function
|
|
177
|
+
function _(s) {
|
|
166
178
|
let e = [];
|
|
167
179
|
return (s || "").trim().toLowerCase().split(",").forEach((r) => {
|
|
168
180
|
r = r.trim(), r && e.push(r);
|
|
169
181
|
}), [...new Set(e)].sort();
|
|
170
182
|
}
|
|
171
183
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
184
|
+
mt as getHmtl,
|
|
185
|
+
Y as getSpecType,
|
|
186
|
+
w as setValStringify
|
|
175
187
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)}async function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../config.cjs"),G=require("@fangzhongya/utils/html/getVueText"),c=require("./common.cjs"),B=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const E=require("@fangzhongya/utils/name/humpToLine"),A=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const W=require("@fangzhongya/utils/basic/string/firstLower"),F=require("@fangzhongya/utils/basic/array/duplicateRemoval"),M=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const h=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const D=require("./index.cjs"),w={},d={},v=[],I={},j={},g={};function J(){return b.getConfig("example")}function Q(t,e,n,r){const a=B.mergeObject(e,n||{},3,!0);a.exampless=a.exampless||[],a.examplessRaw=a.examplessRaw||[];const s=[],i=a.examples;i&&Object.keys(i).forEach(o=>{s.push(o),j[o]=i[o]});const u=a.examplesRaw,l=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(o=>{l.push(o),u&&(g[o]=N(u,o))})):(a.exampless=s,u&&Object.keys(u).forEach(o=>{l.push(o),g[o]=N(u,o)})),a.examples=void 0,e.tests&&r){const o=e.testsNanme||"/tests/";typeof o=="string"?Object.keys(r).forEach(f=>{f.includes(o)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))}):Object.keys(r).forEach(f=>{o.test(f)&&(a.exampless.push(f),l.push(f),g[f]=N(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(l)],a.examplesRaw=void 0,I[t]=a}function N(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function X(t){const e=b.getConfig("resolve");if(q[t])return q[t];for(let n of e)if(t.startsWith(n.find+"/")){const a=n.replacement.replaceAll("\\","/")+t.replace(n.find+"/","/");return q[t]=a,a}}async function Y(t,e){let n="";if(e=="vue"?n=G.getVueTexts(t).script:(e=="js"||e=="ts"||e=="")&&(n=t),n){const r=await D.getTextImport(n),a=[];return r&&r.length>0&&r.forEach(s=>{if(s)if(s.startsWith("./")||s.startsWith("../"))a.push(s);else{const i=X(s);i&&a.push(i)}}),a}}function Z(t){return new Promise(e=>{t?t.raw?e(t.raw):t.getRaw?t.getRaw(t).then(n=>{const r=C(n);t.raw=r,t.getRaw=null,e(r)}):e(""):e("")})}function K(t,e){t=(t||"")+"";let n="";switch(t){case"1":n=e.tdir+"/";break;case"2":n=e.adir+"/";break;case"3":n=e.tdir+"/"+e.adir+"/";break}return n}function _(t,e,n){t=(t||"")+"",n=(n||"")+"";let r=E.humpToLine(e.name),a=[];const s=Object.values(e.aliass||{});if(t==="1")e.alias&&a.push(e.alias+"-"+r);else if(t==="2")s&&s.length>0&&s.forEach(u=>{a.push(u+"-"+r)});else if(t==="3"){let u="";e.alias&&(u=e.alias+"-"),s?.forEach(l=>{a.push(u+l+"-"+r)})}else t==="4"?e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}):t=="9"&&(a.push(r),e.aliasNames?.forEach(u=>{a.push(E.humpToLine(u))}));a.length==0&&a.push(r);let i=[];return n==="1"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(l,W.firstLower(l))}):n==="2"?a.forEach(u=>{let l=A.lineToLargeHump(u);i.push(u,l,W.firstLower(l))}):i=[...a],i=[...new Set(i)],i}function y(t,e,n,r){const a=[];return n.examplessRaw.forEach(s=>{for(let i=0;i<e.length;i++){const u=e[i];if(s==t+u+n.md+".md"){a.push({topurl:t,comkey:r.key,suffix:h.getSuffix(s),name:r.name,value:u,key:s,raw:"",getRaw:c.getRawValue(g,s)});break}}}),a}function P(t){R();const e=w[t];if(e.tests&&Object.keys(e.tests).length>0)return e.tests;{const n=I[e.dir],r=n.dir+K(n.level||0,e),a=_(n.aliaslevel||0,e,n.componentName||0);e.mds=y(r,a,n,e);const s={};return n.exampless.forEach(i=>{for(let u=0;u<a.length;u++){const l=a[u];if(i.startsWith(r+l+"/")){const o=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),f=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let p=i.match(o)||i.match(f);if(p&&p.length>0){let m="";p&&p.length>1&&(m=p[1]),s[i]={topurl:r,name:l,value:m,suffix:h.getSuffix(i),comname:e.name,comkey:e.key,key:i,dir:e.dir,url:i,component:j[i],raw:"",getRaw:c.getRawValue(g,i)};break}}}}),n.tests&&z(s,e,n),e.tests=s,s}}function z(t,e,n){const r=e.url.substring(0,e.url.lastIndexOf("/"+e.value+"/"))+"/"+e.value,a=n.testsNanme||"/tests/";typeof a=="string"?n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(s.startsWith(r+a)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}}):n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:c.getRawValue(g,s)});else if(a.test(s)){const i=new RegExp("/([^/]+)/index\\."+c.defaultExtensions.join("|")+"$"),u=new RegExp("/([^/]+)\\."+c.defaultExtensions.join("|")+"$");let l=s.match(i)||s.match(u);if(l&&l.length>0){let o="";l&&l.length>1&&(o=l[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:c.getRawValue(g,s)}}}}})}function k(t){if(t){const e=P(t);return Object.values(e)}else return[]}function ee(t,e,n){R();const r=P(n),a=[];if(e){let s=r[e];if(s)return a.push(s),a}return Object.values(r).forEach(s=>{s.name+"/"+s.value==t&&a.push(s)}),a}function te(t){return P(t),w[t].mds}async function V(t,e,n,r,a,s,i){let u=await Y(e,n)||[],l=a.split("/");return u.map(o=>{if(o.startsWith("./")){let f=l.slice(0,l.length-1).join("/"),p=o.substring(2);const m=f.replace(/^\.\/|((\.\.\/)+)/,"/");let x=t.indexOf(m)+m.length;return{key:t.substring(0,x)+"/"+p,name:o,comprops:s||"",curprops:i||"",value:p,suffix:h.getSuffix(o),head:f,dir:r,url:f+"/"+p}}else if(o.startsWith("../")){let f=o.split("/"),p=0;for(let L=0;L<f.length;L++)if(f[L]!=".."){p=L;break}let m=f.slice(p,f.length),x=l.slice(0,l.length-p-1).join("/"),O=m.join("/");const S=x.replace(/^\.\/|((\.\.\/)+)/,"/");let H=t.indexOf(S)+S.length;return{key:t.substring(0,H)+"/"+O,name:O,comprops:s||"",curprops:i||"",value:O,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+O}}else{const f=r.replace(/^\.\/|((\.\.\/)+)/,"/");let p=o.indexOf(f)+f.length,m=o.substring(p),x=r.substring(0,r.length-1);return{key:o,name:m,comprops:s||"",curprops:i||"",value:m,suffix:h.getSuffix(o),head:x,dir:r,url:x+"/"+m}}})}function se(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>({raw:"",name:r.name,value:r.value,suffix:h.getSuffix(r.key),key:r.key,getRaw:c.getRawValue(g,r.key)}));M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(u=>{const l=C(u);s.raw=l,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}function ne(){const t=J();b.getConfig("components")?.forEach(n=>{const r=ie(n);let a=n.dir||"";Q(a,t,n.example,r)})}const T="default";function re(t){let e=E.humpToLine(t.name),n=[...t.aliasNames];n.push(e),n.forEach(r=>{v.push({name:r,value:t.key})})}function ae(t,e){const n={};e?.forEach(r=>{w[r.key]=r,re(r);const a=Object.values(r.aliass||{});a&&a.length?a.forEach(s=>{n[s]=n[s]||[],n[s].push(r.key)}):(n[T]=n[T]||[],n[T].push(r.key))})}function ie(t){let e,n;const r=t.resolver;r&&Object.keys(r).forEach(s=>{typeof t[s]>"u"&&(t[s]=r[s])}),e=t.alias||T;let a=t?.urls||Object.keys(t.componentsRaw);return n=c.getComponentsArr(a,t,t.componentsRaw,t.components,t),n&&n?.props&&n.props.forEach(s=>{d[s.url]=s}),ae(e,n.components),t.componentsRaw}function le(t){return R(),w[t]}function R(){return Object.keys(w).length==0&&ne(),Object.values(w)}function oe(){return R(),d}function ue(t,e,n){R();const r=[];if(n){let s=w[n];if(s&&s.key)return[s]}let a=E.humpToLine(t);return v.forEach(s=>{e?s.name.includes(a)&&r.push(w[s.value]):s.name==a&&r.push(w[s.value])}),F.duplicateRemoval(r,"key")}async function fe(t,e){let n=t;if(t){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops,e.curprops)).filter(a=>c.isComprops(a.key,e.comprops||"")||c.isCurprops(a.key,e.curprops||""));n=await $(r)+n}return n}function ce(t){const e=t.url,n=t.key;return d[e]||d[e+".js"]||d[e+".ts"]||d[n]||d[n+".js"]||d[n+".ts"]}function U(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>ce(r)).filter(r=>!!r);M.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(async u=>{const l=C(u);let o=await fe(l,t[i]);s.raw=o,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}async function $(t){return((await U(t))?.map(r=>r.raw)||[]).join(`
|
|
2
|
+
`)}async function pe(t,e){let n=t;if(t&&(e.comprops||e.curprops)){let r=(await V(e.key,t,e.suffix,e.dir,e.url,e.comprops||"",e.curprops)).filter(s=>c.isComprops(s.key,e.comprops||"")||c.isCurprops(s.key,e.curprops||""));n=await $(r)+n}return n}function C(t){return t&&typeof t=="object"?t.default||"":(t||"")+""}function me(t){return new Promise(e=>{if(t){R();const n=w[t];n?n.raw?e(n.raw):n.getRaw?n.getRaw(n).then(r=>{const a=C(r);pe(a,n).then(s=>{n.raw=s,n.getRaw=null,e(s)})}):e(""):e("")}else e("")})}exports.defaultName=T;exports.getCompoName=ue;exports.getCompoNameKey=le;exports.getCompoNameObj=R;exports.getComponentPropsObjs=oe;exports.getGetRawValue=C;exports.getKeyMds=te;exports.getLevelUrl=K;exports.getLocalTextArr=se;exports.getLocalTextComponents=me;exports.getLocalTextTests=Z;exports.getPropsRaws=U;exports.getTestImportUrl=V;exports.getTestName=k;exports.getTestNameObj=ee;
|
|
@@ -21,7 +21,7 @@ export declare function getKeyMds(key: string): MdObj[] | undefined;
|
|
|
21
21
|
* @param {*} arr
|
|
22
22
|
* @returns
|
|
23
23
|
*/
|
|
24
|
-
export declare function getTestImportUrl(key: string, text: string, type: string, dir: string, url: string, comprops?: string): Promise<Array<PropObj>>;
|
|
24
|
+
export declare function getTestImportUrl(key: string, text: string, type: string, dir: string, url: string, comprops?: string, curprops?: string): Promise<Array<PropObj>>;
|
|
25
25
|
export declare function getLocalTextArr(arr: Array<PropObj>): Promise<TextObj[]>;
|
|
26
26
|
export declare const defaultName = "default";
|
|
27
27
|
export declare function getCompoNameKey(key: string): ComponentsObj;
|