@fangzhongya/vue-archive 0.0.10 → 0.0.12
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
CHANGED
package/dist/node/index.d.cts
CHANGED
package/dist/node/index.d.ts
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../config.cjs"),H=require("@fangzhongya/utils/html/getVueText"),h=require("./common.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const O=require("@fangzhongya/utils/name/humpToLine"),b=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const j=require("@fangzhongya/utils/basic/string/firstLower"),G=require("@fangzhongya/utils/basic/array/duplicateRemoval"),V=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const d=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const B=require("./index.cjs"),p={},g={},
|
|
2
|
-
`)}async function ce(e,t){let n=e;if(e&&(t.comprops||t.curprops)){let s=(await P(t.key,e,t.suffix,t.dir,t.url,t.comprops||"")).filter(r=>h.isComprops(r.key,t.comprops||"")||h.isCurprops(r.key,t.curprops||""));n=await W(s)+n}return n}function E(e){return e&&typeof e=="object"?e.default||"":(e||"")+""}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("../config.cjs"),H=require("@fangzhongya/utils/html/getVueText"),h=require("./common.cjs");require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const O=require("@fangzhongya/utils/name/humpToLine"),b=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const j=require("@fangzhongya/utils/basic/string/firstLower"),G=require("@fangzhongya/utils/basic/array/duplicateRemoval"),V=require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");const d=require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const B=require("./index.cjs"),p={},g={},A=[],k={},M={},T={};function F(){return N.getConfig("example")}function $(e,t,n){const s=Object.assign({exampless:[],examplessRaw:[]},t,n),a=[],r=s.examples;r&&Object.keys(r).forEach(i=>{a.push(i),M[i]=r[i]});const o=s.examplesRaw,l=[];s.urls&&s.urls.length>0?(s.exampless=s.urls,s.urls.forEach(i=>{l.push(i),o&&(T[i]=S(o,i))})):(s.exampless=a,o&&Object.keys(o).forEach(i=>{l.push(i),o&&(T[i]=S(o,i))})),s.examples=void 0,s.examplessRaw=l,s.examplesRaw=void 0,k[e]=s}function S(e,t){return typeof e=="function"?e:e&&(e[t]||e)}const y={};function D(e){const t=N.getConfig("resolve");if(y[e])return y[e];for(let n of t)if(e.startsWith(n.find+"/")){const a=n.replacement.replaceAll("\\","/")+e.replace(n.find+"/","/");return y[e]=a,a}}async function J(e,t){let n="";if(t=="vue"?n=H.getVueTexts(e).script:(t=="js"||t=="ts"||t=="")&&(n=e),n){const s=await B.getTextImport(n),a=[];return s&&s.length>0&&s.forEach(r=>{if(r)if(r.startsWith("./")||r.startsWith("../"))a.push(r);else{const o=D(r);o&&a.push(o)}}),a}}function Q(e){return new Promise(t=>{e?e.raw?t(e.raw):e.getRaw?e.getRaw(e).then(n=>{const s=E(n);e.raw=s,e.getRaw=null,t(s)}):t(""):t("")})}function K(e,t){e=(e||"")+"";let n="";switch(e){case"1":n=t.tdir+"/";break;case"2":n=t.adir+"/";break;case"3":n=t.tdir+"/"+t.adir+"/";break}return n}function X(e,t,n){e=(e||"")+"",n=(n||"")+"";let s=O.humpToLine(t.name),a=[];const r=Object.values(t.aliass||{});if(e==="1")t.alias&&a.push(t.alias+"-"+s);else if(e==="2")r&&r.length>0&&r.forEach(l=>{a.push(l+"-"+s)});else if(e==="3"){let l="";t.alias&&(l=t.alias+"-"),r?.forEach(i=>{a.push(l+i+"-"+s)})}else e==="4"?t.aliasNames?.forEach(l=>{a.push(O.humpToLine(l))}):e=="9"&&(a.push(s),t.aliasNames?.forEach(l=>{a.push(O.humpToLine(l))}));a.length==0&&a.push(s);let o=[];return n==="1"?a.forEach(l=>{let i=b.lineToLargeHump(l);o.push(i,j.firstLower(i))}):n==="2"?a.forEach(l=>{let i=b.lineToLargeHump(l);o.push(l,i,j.firstLower(i))}):o=[...a],o=[...new Set(o)],o}function Y(e,t,n,s){const a=[];return n.examplessRaw.forEach(r=>{for(let o=0;o<t.length;o++){const l=t[o];if(r==e+l+"/"+n.md+".md"){a.push({topurl:e,comkey:s.key,suffix:d.getSuffix(r),name:s.name,value:l,key:r,raw:"",getRaw:h.getRawValue(T,r)});break}}}),a}function q(e){w();const t=p[e];if(t.tests)return t.tests;{const n=k[t.dir],s=n.dir+K(n.level||0,t),a=X(n.aliaslevel||0,t,n.componentName||0);t.mds=Y(s,a,n,t);const r={};return n.exampless.forEach(o=>{for(let l=0;l<a.length;l++){const i=a[l];if(o.startsWith(s+i+"/")){const c=new RegExp("^\\"+s+i+"/(.*)/index\\."+h.defaultExtensions.join("|")+"$");let u="",f=o.match(c);f&&f.length>1&&(u=f[1]),r[o]={topurl:s,name:i,value:u,suffix:d.getSuffix(o),comname:t.name,comkey:t.key,key:o,dir:t.dir,url:o,component:M[o],raw:"",getRaw:h.getRawValue(T,o)};break}}}),t.tests=r,r}}function Z(e){if(e){const t=q(e);return Object.values(t)}else return[]}function _(e,t,n){w();const s=q(n),a=[];if(t){let r=s[t];if(r)return a.push(r),a}return Object.values(s).forEach(r=>{r.name+"/"+r.value==e&&a.push(r)}),a}function v(e){return q(e),p[e].mds}async function P(e,t,n,s,a,r){let o=await J(t,n)||[],l=a.split("/");return o.map(i=>{if(i.startsWith("./")){let c=l.slice(0,l.length-1).join("/"),u=i.substring(2);const f=c.replace(/^\./,"");let m=e.indexOf(f)+f.length;return{key:e.substring(0,m)+"/"+u,name:i,comprops:r||"",value:u,suffix:d.getSuffix(i),head:c,dir:s,url:c+"/"+u}}else if(i.startsWith("../")){let c=i.split("/"),u=0;for(let C=0;C<c.length;C++)if(c[C]!=".."){u=C;break}let f=c.slice(u,c.length),m=l.slice(0,l.length-u-1).join("/"),x=f.join("/");const L=m.replace(/^\./,"");let I=e.indexOf(L)+L.length;return{key:e.substring(0,I)+"/"+x,name:x,comprops:r||"",value:x,suffix:d.getSuffix(i),head:m,dir:s,url:m+"/"+x}}else{const c=s.replace(/^\./,"");let u=i.indexOf(c)+c.length,f=i.substring(u),m=s.substring(0,s.length-1);return{key:i,name:f,comprops:r||"",value:f,suffix:d.getSuffix(i),head:m,dir:s,url:m+"/"+f}}})}function z(e){return new Promise(t=>{if(e&&e.length>0){let n=e.map(s=>({raw:"",name:s.name,value:s.value,suffix:d.getSuffix(s.key),key:s.key,getRaw:h.getRawValue(T,s.key)}));V.asyncMergeArray(n,(s,a,r,o)=>{r.raw?s():r.getRaw?r.getRaw(r).then(l=>{const i=E(l);r.raw=i,r.getRaw=null,s()}):s()}).then(()=>{t(n)})}else t([])})}function ee(){const e=F();N.getConfig("components")?.forEach(n=>{ne(n);let s=n.dir||"";$(s,e,n.example)})}const R="default";function te(e){let t=O.humpToLine(e.name),n=[...e.aliasNames];n.push(t),n.forEach(s=>{A.push({name:s,value:e.key})})}function se(e,t){const n={};t?.forEach(s=>{p[s.key]=s,te(s);const a=Object.values(s.aliass||{});a&&a.length?a.forEach(r=>{n[r]=n[r]||[],n[r].push(s.key)}):(n[R]=n[R]||[],n[R].push(s.key))})}function ne(e){let t,n;const s=e.resolver;s&&Object.keys(s).forEach(r=>{typeof e[r]>"u"&&(e[r]=s[r])}),t=e.alias||R;let a=e?.urls||Object.keys(e.componentsRaw);n=h.getComponentsArr(a,e,e.componentsRaw,e.components,e),n&&n?.props&&n.props.forEach(r=>{g[r.url]=r}),se(t,n.components)}function re(e){return w(),p[e]}function w(){return Object.keys(p).length==0&&ee(),Object.values(p)}function ae(){return w(),g}function ie(e,t,n){w();const s=[];if(n){let r=p[n];if(r&&r.key)return[r]}let a=O.humpToLine(e);return A.forEach(r=>{t?r.name.includes(a)&&s.push(p[r.value]):r.name==a&&s.push(p[r.value])}),G.duplicateRemoval(s,"key")}async function oe(e,t){let n=e;if(e){let s=(await P(t.key,e,t.suffix,t.dir,t.url,t.comprops)).filter(a=>h.isComprops(a.key,t.comprops||""));n=await W(s)+n}return n}function le(e){const t=e.url,n=e.key;return g[t]||g[t+".js"]||g[t+".ts"]||g[n]||g[n+".js"]||g[n+".ts"]}function U(e){return new Promise(t=>{if(e&&e.length>0){let n=e.map(s=>le(s)).filter(s=>!!s);V.asyncMergeArray(n,(s,a,r,o)=>{r.raw?s():r.getRaw?r.getRaw(r).then(async l=>{const i=E(l);let c=await oe(i,e[o]);r.raw=c,r.getRaw=null,s()}):s()}).then(()=>{t(n)})}else t([])})}async function W(e){return((await U(e))?.map(s=>s.raw)||[]).join(`
|
|
2
|
+
`)}async function ce(e,t){let n=e;if(e&&(t.comprops||t.curprops)){let s=(await P(t.key,e,t.suffix,t.dir,t.url,t.comprops||"")).filter(r=>h.isComprops(r.key,t.comprops||"")||h.isCurprops(r.key,t.curprops||""));n=await W(s)+n}return n}function E(e){return e&&typeof e=="object"?e.default||"":(e||"")+""}function ue(e){return new Promise(t=>{if(e){w();const n=p[e];n?n.raw?t(n.raw):n.getRaw?n.getRaw(n).then(s=>{const a=E(s);ce(a,n).then(r=>{n.raw=r,n.getRaw=null,t(r)})}):t(""):t("")}else t("")})}exports.defaultName=R;exports.getCompoName=ie;exports.getCompoNameKey=re;exports.getCompoNameObj=w;exports.getComponentPropsObjs=ae;exports.getGetRawValue=E;exports.getKeyMds=v;exports.getLevelUrl=K;exports.getLocalTextArr=z;exports.getLocalTextComponents=ue;exports.getLocalTextTests=Q;exports.getPropsRaws=U;exports.getTestImportUrl=P;exports.getTestName=Z;exports.getTestNameObj=_;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getConfig as
|
|
1
|
+
import { getConfig as N } from "../config.js";
|
|
2
2
|
import { getVueTexts as B } from "@fangzhongya/utils/html/getVueText";
|
|
3
|
-
import { getRawValue as
|
|
3
|
+
import { getRawValue as y, isComprops as W, isCurprops as F, defaultExtensions as G, getComponentsArr as H } from "./common.js";
|
|
4
4
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
5
5
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
|
6
6
|
import { humpToLine as d } from "@fangzhongya/utils/name/humpToLine";
|
|
7
|
-
import { lineToLargeHump as
|
|
7
|
+
import { lineToLargeHump as b } from "@fangzhongya/utils/name/lineToLargeHump";
|
|
8
8
|
import "@fangzhongya/utils/basic/string/appearNum";
|
|
9
|
-
import { firstLower as
|
|
9
|
+
import { firstLower as k } from "@fangzhongya/utils/basic/string/firstLower";
|
|
10
10
|
import { duplicateRemoval as $ } from "@fangzhongya/utils/basic/array/duplicateRemoval";
|
|
11
11
|
import { asyncMergeArray as A } from "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
12
12
|
import "@fangzhongya/utils/basic/string/firstUpper";
|
|
@@ -15,7 +15,7 @@ import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
|
15
15
|
import { getTextImport as q } from "./index.js";
|
|
16
16
|
const m = {}, h = {}, V = [], I = {}, K = {}, O = {};
|
|
17
17
|
function D() {
|
|
18
|
-
return
|
|
18
|
+
return N("example");
|
|
19
19
|
}
|
|
20
20
|
function J(e, t, n) {
|
|
21
21
|
const s = Object.assign(
|
|
@@ -41,7 +41,7 @@ function j(e, t) {
|
|
|
41
41
|
}
|
|
42
42
|
const P = {};
|
|
43
43
|
function Q(e) {
|
|
44
|
-
const t =
|
|
44
|
+
const t = N("resolve");
|
|
45
45
|
if (P[e])
|
|
46
46
|
return P[e];
|
|
47
47
|
for (let n of t)
|
|
@@ -112,11 +112,11 @@ function Z(e, t, n) {
|
|
|
112
112
|
a.length == 0 && a.push(s);
|
|
113
113
|
let o = [];
|
|
114
114
|
return n === "1" ? a.forEach((l) => {
|
|
115
|
-
let i =
|
|
116
|
-
o.push(i,
|
|
115
|
+
let i = b(l);
|
|
116
|
+
o.push(i, k(i));
|
|
117
117
|
}) : n === "2" ? a.forEach((l) => {
|
|
118
|
-
let i =
|
|
119
|
-
o.push(l, i,
|
|
118
|
+
let i = b(l);
|
|
119
|
+
o.push(l, i, k(i));
|
|
120
120
|
}) : o = [...a], o = [...new Set(o)], o;
|
|
121
121
|
}
|
|
122
122
|
function _(e, t, n, s) {
|
|
@@ -133,14 +133,14 @@ function _(e, t, n, s) {
|
|
|
133
133
|
value: l,
|
|
134
134
|
key: r,
|
|
135
135
|
raw: "",
|
|
136
|
-
getRaw:
|
|
136
|
+
getRaw: y(O, r)
|
|
137
137
|
});
|
|
138
138
|
break;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
}), a;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function L(e) {
|
|
144
144
|
x();
|
|
145
145
|
const t = m[e];
|
|
146
146
|
if (t.tests)
|
|
@@ -169,9 +169,11 @@ function k(e) {
|
|
|
169
169
|
comname: t.name,
|
|
170
170
|
comkey: t.key,
|
|
171
171
|
key: o,
|
|
172
|
+
dir: t.dir,
|
|
173
|
+
url: o,
|
|
172
174
|
component: K[o],
|
|
173
175
|
raw: "",
|
|
174
|
-
getRaw:
|
|
176
|
+
getRaw: y(O, o)
|
|
175
177
|
};
|
|
176
178
|
break;
|
|
177
179
|
}
|
|
@@ -179,16 +181,16 @@ function k(e) {
|
|
|
179
181
|
}), t.tests = r, r;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
function
|
|
184
|
+
function Ne(e) {
|
|
183
185
|
if (e) {
|
|
184
|
-
const t =
|
|
186
|
+
const t = L(e);
|
|
185
187
|
return Object.values(t);
|
|
186
188
|
} else
|
|
187
189
|
return [];
|
|
188
190
|
}
|
|
189
|
-
function
|
|
191
|
+
function ye(e, t, n) {
|
|
190
192
|
x();
|
|
191
|
-
const s =
|
|
193
|
+
const s = L(n), a = [];
|
|
192
194
|
if (t) {
|
|
193
195
|
let r = s[t];
|
|
194
196
|
if (r)
|
|
@@ -198,8 +200,8 @@ function Ne(e, t, n) {
|
|
|
198
200
|
r.name + "/" + r.value == e && a.push(r);
|
|
199
201
|
}), a;
|
|
200
202
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
203
|
+
function Le(e) {
|
|
204
|
+
return L(e), m[e].mds;
|
|
203
205
|
}
|
|
204
206
|
async function U(e, t, n, s, a, r) {
|
|
205
207
|
let o = await X(t, n) || [], l = a.split("/");
|
|
@@ -254,7 +256,7 @@ async function U(e, t, n, s, a, r) {
|
|
|
254
256
|
}
|
|
255
257
|
});
|
|
256
258
|
}
|
|
257
|
-
function
|
|
259
|
+
function be(e) {
|
|
258
260
|
return new Promise((t) => {
|
|
259
261
|
if (e && e.length > 0) {
|
|
260
262
|
let n = e.map((s) => ({
|
|
@@ -263,7 +265,7 @@ function Le(e) {
|
|
|
263
265
|
value: s.value,
|
|
264
266
|
suffix: w(s.key),
|
|
265
267
|
key: s.key,
|
|
266
|
-
getRaw:
|
|
268
|
+
getRaw: y(O, s.key)
|
|
267
269
|
}));
|
|
268
270
|
A(n, (s, a, r, o) => {
|
|
269
271
|
r.raw ? s() : r.getRaw ? r.getRaw(r).then((l) => {
|
|
@@ -279,7 +281,7 @@ function Le(e) {
|
|
|
279
281
|
}
|
|
280
282
|
function z() {
|
|
281
283
|
const e = D();
|
|
282
|
-
|
|
284
|
+
N("components")?.forEach((n) => {
|
|
283
285
|
te(n);
|
|
284
286
|
let s = n.dir || "";
|
|
285
287
|
J(s, e, n.example);
|
|
@@ -316,7 +318,7 @@ function te(e) {
|
|
|
316
318
|
h[r.url] = r;
|
|
317
319
|
}), ee(t, n.components);
|
|
318
320
|
}
|
|
319
|
-
function
|
|
321
|
+
function ke(e) {
|
|
320
322
|
return x(), m[e];
|
|
321
323
|
}
|
|
322
324
|
function x() {
|
|
@@ -414,17 +416,17 @@ function Ae(e) {
|
|
|
414
416
|
export {
|
|
415
417
|
E as defaultName,
|
|
416
418
|
We as getCompoName,
|
|
417
|
-
|
|
419
|
+
ke as getCompoNameKey,
|
|
418
420
|
x as getCompoNameObj,
|
|
419
421
|
je as getComponentPropsObjs,
|
|
420
422
|
T as getGetRawValue,
|
|
421
|
-
|
|
423
|
+
Le as getKeyMds,
|
|
422
424
|
Y as getLevelUrl,
|
|
423
|
-
|
|
425
|
+
be as getLocalTextArr,
|
|
424
426
|
Ae as getLocalTextComponents,
|
|
425
427
|
Pe as getLocalTextTests,
|
|
426
428
|
re as getPropsRaws,
|
|
427
429
|
U as getTestImportUrl,
|
|
428
|
-
|
|
429
|
-
|
|
430
|
+
Ne as getTestName,
|
|
431
|
+
ye as getTestNameObj
|
|
430
432
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fangzhongya/vue-archive",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description ": "vue 组件注释生成文档",
|
|
7
7
|
"author": "fangzhongya ",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dist"
|
|
58
58
|
],
|
|
59
59
|
"exports": {
|
|
60
|
-
"./css": "./dist/
|
|
60
|
+
"./css": "./dist/index.css",
|
|
61
61
|
"./node": {
|
|
62
62
|
"types": "./dist/node/index.d.ts",
|
|
63
63
|
"require": "./dist/node/index.cjs",
|