@fangzhongya/vue-archive 0.0.15 → 0.0.17
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 +203 -74
- package/dist/node/index.d.cts +4 -1
- package/dist/node/index.d.ts +4 -1
- package/dist/node/index.js +203 -74
- package/dist/packages/components/code/highlight.vue2.cjs +1 -1
- package/dist/packages/components/code/highlight.vue2.js +1 -1
- package/dist/packages/components/test/index.vue.js +2 -8
- package/dist/packages/config.d.ts +4 -1
- package/dist/packages/index.cjs +1 -1
- package/dist/packages/index.js +8 -8
- package/dist/packages/utils/common.cjs +1 -1
- package/dist/packages/utils/common.js +2 -2
- package/dist/packages/utils/glob.cjs +2 -2
- package/dist/packages/utils/glob.js +387 -307
- package/package.json +11 -11
- /package/dist/node_modules/.pnpm/{@highlightjs_vue-plugin@2.1_b586068ec461434c266304f56a34d01a → @highlightjs_vue-plugin@2.1_f44d533e0c923799b88f34f8325fca35}/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.cjs +0 -0
- /package/dist/node_modules/.pnpm/{@highlightjs_vue-plugin@2.1_b586068ec461434c266304f56a34d01a → @highlightjs_vue-plugin@2.1_f44d533e0c923799b88f34f8325fca35}/node_modules/@highlightjs/vue-plugin/dist/highlightjs-vue.esm.min.js +0 -0
package/dist/node/index.cjs
CHANGED
|
@@ -24,12 +24,12 @@ __export(index_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
27
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
|
|
28
28
|
function isArray(obj) {
|
|
29
29
|
return Object.prototype.toString.call(obj) == "[object Array]";
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
32
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
|
|
33
33
|
function getStartSames(str, val) {
|
|
34
34
|
let s = "";
|
|
35
35
|
const vs = [...val];
|
|
@@ -45,7 +45,7 @@ function getStartSames(str, val) {
|
|
|
45
45
|
return [s, str.substring(index), val.substring(index)];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
48
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
|
|
49
49
|
function getImportUrl(url, imp) {
|
|
50
50
|
const arr = getStartSames(url, imp);
|
|
51
51
|
const ts = arr[0];
|
|
@@ -72,12 +72,12 @@ function getImportUrl(url, imp) {
|
|
|
72
72
|
return ds.join("") + arr[2].replace(/\\/g, "/");
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
75
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
|
|
76
76
|
function firstUpper(str) {
|
|
77
77
|
return str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
80
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
|
|
81
81
|
function lineToLargeHump(name) {
|
|
82
82
|
let arr = name.split("-");
|
|
83
83
|
arr = arr.map((vs) => {
|
|
@@ -86,7 +86,7 @@ function lineToLargeHump(name) {
|
|
|
86
86
|
return arr.join("");
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.
|
|
89
|
+
// node_modules/.pnpm/@fangzhongya+create@0.2.34/node_modules/@fangzhongya/create/dist/chunk-7V2NDMIF.js
|
|
90
90
|
var import_fs = require("fs");
|
|
91
91
|
var import_path = require("path");
|
|
92
92
|
function getUrlCatalogueObj(str) {
|
|
@@ -345,7 +345,7 @@ function writeFileUrl(url, files, callback, isDirs, isFile, issynch) {
|
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.
|
|
348
|
+
// node_modules/.pnpm/@fangzhongya+create@0.2.34/node_modules/@fangzhongya/create/dist/chunk-PXLSY3ZR.js
|
|
349
349
|
var import_path2 = require("path");
|
|
350
350
|
function styleLog(msg = "", obj) {
|
|
351
351
|
const arr = ["\x1B[0m"];
|
|
@@ -767,7 +767,7 @@ var FangCom = class {
|
|
|
767
767
|
}
|
|
768
768
|
};
|
|
769
769
|
|
|
770
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.
|
|
770
|
+
// node_modules/.pnpm/@fangzhongya+create@0.2.34/node_modules/@fangzhongya/create/dist/bins/md.js
|
|
771
771
|
var defaultConfig2 = Object.assign({}, defaultConfig, {
|
|
772
772
|
name: "md"
|
|
773
773
|
});
|
|
@@ -786,7 +786,7 @@ function runDev(config2, configCallback) {
|
|
|
786
786
|
return new FangMd(config2, configCallback);
|
|
787
787
|
}
|
|
788
788
|
|
|
789
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
789
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
|
|
790
790
|
var zObj = {
|
|
791
791
|
"<": "<",
|
|
792
792
|
">": ">",
|
|
@@ -807,7 +807,7 @@ function htmlEscape(str) {
|
|
|
807
807
|
// packages/node/index.ts
|
|
808
808
|
var import_node_path = require("path");
|
|
809
809
|
|
|
810
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
810
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
|
|
811
811
|
function mergeObject(a, b, j = 0, i) {
|
|
812
812
|
if (a instanceof Array) {
|
|
813
813
|
if (j > 0 && i) {
|
|
@@ -850,7 +850,7 @@ function mergeObject(a, b, j = 0, i) {
|
|
|
850
850
|
return a;
|
|
851
851
|
}
|
|
852
852
|
|
|
853
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
853
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
|
|
854
854
|
function humpToLine(name) {
|
|
855
855
|
const reg = /(([A-Z])([^A-Z]*))/g;
|
|
856
856
|
let result;
|
|
@@ -872,7 +872,7 @@ function humpToLine(name) {
|
|
|
872
872
|
}
|
|
873
873
|
}
|
|
874
874
|
|
|
875
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
875
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
|
|
876
876
|
function appearNum(str, t) {
|
|
877
877
|
let reg = t;
|
|
878
878
|
if (typeof t == "string") {
|
|
@@ -883,12 +883,12 @@ function appearNum(str, t) {
|
|
|
883
883
|
return c;
|
|
884
884
|
}
|
|
885
885
|
|
|
886
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
886
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
|
|
887
887
|
function firstLower(str) {
|
|
888
888
|
return str.slice(0, 1).toLowerCase() + str.slice(1);
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
891
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
|
|
892
892
|
function asyncMergeArray(arr, callback) {
|
|
893
893
|
return new Promise((resolve2, reject) => {
|
|
894
894
|
let index = 0;
|
|
@@ -912,7 +912,7 @@ function asyncMergeArray(arr, callback) {
|
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
914
|
|
|
915
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
915
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
|
|
916
916
|
function getSuffix2(url) {
|
|
917
917
|
const reg = /\.([a-z|A-Z]+)$/;
|
|
918
918
|
const regs = reg.exec(url);
|
|
@@ -933,7 +933,7 @@ function getConfig(key) {
|
|
|
933
933
|
return config[key];
|
|
934
934
|
}
|
|
935
935
|
|
|
936
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
936
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
|
|
937
937
|
function getVueText(content) {
|
|
938
938
|
const result = {
|
|
939
939
|
template: "",
|
|
@@ -981,7 +981,7 @@ function getVueTexts(content) {
|
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
// packages/utils/common.ts
|
|
984
|
-
var defaultExtensions = ["vue", "js"];
|
|
984
|
+
var defaultExtensions = ["vue", "js", "ts"];
|
|
985
985
|
function getAliassNames(obj, arr) {
|
|
986
986
|
let vm = humpToLine(obj.name);
|
|
987
987
|
let ass = [];
|
|
@@ -1088,7 +1088,7 @@ function isComprops(url, comprops) {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
function isCurprops(url, comprops) {
|
|
1090
1090
|
if (comprops) {
|
|
1091
|
-
const reg = new RegExp(
|
|
1091
|
+
const reg = new RegExp(comprops + "(\\.(js|ts))?$");
|
|
1092
1092
|
return reg.test(url);
|
|
1093
1093
|
} else {
|
|
1094
1094
|
return false;
|
|
@@ -1519,7 +1519,7 @@ function parse(source, options = {}) {
|
|
|
1519
1519
|
}
|
|
1520
1520
|
var stringify = getStringifier();
|
|
1521
1521
|
|
|
1522
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1522
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
|
|
1523
1523
|
function deComment(code) {
|
|
1524
1524
|
let output = "";
|
|
1525
1525
|
let state = "code";
|
|
@@ -1611,7 +1611,7 @@ function deComment(code) {
|
|
|
1611
1611
|
return output;
|
|
1612
1612
|
}
|
|
1613
1613
|
|
|
1614
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1614
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-I4VBDCIM.js
|
|
1615
1615
|
function getImports(code) {
|
|
1616
1616
|
code = deComment(code);
|
|
1617
1617
|
const imports = /* @__PURE__ */ new Set();
|
|
@@ -1650,15 +1650,10 @@ var examplesRawObj = {};
|
|
|
1650
1650
|
function getTests() {
|
|
1651
1651
|
return getConfig("example");
|
|
1652
1652
|
}
|
|
1653
|
-
function setExampleObj(dir, example, vexample) {
|
|
1654
|
-
const obj =
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
examplessRaw: []
|
|
1658
|
-
},
|
|
1659
|
-
example,
|
|
1660
|
-
vexample
|
|
1661
|
-
);
|
|
1653
|
+
function setExampleObj(dir, example, vexample, comRaw) {
|
|
1654
|
+
const obj = mergeObject(example, vexample || {}, 3, true);
|
|
1655
|
+
obj.exampless = obj.exampless || [];
|
|
1656
|
+
obj.examplessRaw = obj.examplessRaw || [];
|
|
1662
1657
|
const arr = [];
|
|
1663
1658
|
const examples = obj.examples;
|
|
1664
1659
|
if (examples) {
|
|
@@ -1682,14 +1677,33 @@ function setExampleObj(dir, example, vexample) {
|
|
|
1682
1677
|
if (examplesRaw) {
|
|
1683
1678
|
Object.keys(examplesRaw).forEach((key) => {
|
|
1684
1679
|
arrraw.push(key);
|
|
1685
|
-
|
|
1686
|
-
examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
|
|
1687
|
-
}
|
|
1680
|
+
examplesRawObj[key] = getexamplesRawObj(examplesRaw, key);
|
|
1688
1681
|
});
|
|
1689
1682
|
}
|
|
1690
1683
|
}
|
|
1691
1684
|
obj.examples = void 0;
|
|
1692
|
-
|
|
1685
|
+
if (example.tests && comRaw) {
|
|
1686
|
+
const testsNanme = example.testsNanme || "/tests/";
|
|
1687
|
+
if (typeof testsNanme == "string") {
|
|
1688
|
+
Object.keys(comRaw).forEach((key) => {
|
|
1689
|
+
if (key.includes(testsNanme)) {
|
|
1690
|
+
obj.exampless.push(key);
|
|
1691
|
+
arrraw.push(key);
|
|
1692
|
+
examplesRawObj[key] = getexamplesRawObj(comRaw, key);
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
} else {
|
|
1696
|
+
Object.keys(comRaw).forEach((key) => {
|
|
1697
|
+
if (testsNanme.test(key)) {
|
|
1698
|
+
obj.exampless.push(key);
|
|
1699
|
+
arrraw.push(key);
|
|
1700
|
+
examplesRawObj[key] = getexamplesRawObj(comRaw, key);
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
obj.exampless = [...new Set(obj.exampless)];
|
|
1706
|
+
obj.examplessRaw = [...new Set(arrraw)];
|
|
1693
1707
|
obj.examplesRaw = void 0;
|
|
1694
1708
|
exampleObj[dir] = obj;
|
|
1695
1709
|
}
|
|
@@ -1840,7 +1854,7 @@ function getTestMd(topurl, mlurl, exa, com) {
|
|
|
1840
1854
|
exa.examplessRaw.forEach((key) => {
|
|
1841
1855
|
for (let index = 0; index < mlurl.length; index++) {
|
|
1842
1856
|
const comName = mlurl[index];
|
|
1843
|
-
if (key == topurl + comName +
|
|
1857
|
+
if (key == topurl + comName + exa.md + ".md") {
|
|
1844
1858
|
arr.push({
|
|
1845
1859
|
topurl,
|
|
1846
1860
|
comkey: com.key,
|
|
@@ -1860,7 +1874,7 @@ function getTestMd(topurl, mlurl, exa, com) {
|
|
|
1860
1874
|
function getTestObj(key) {
|
|
1861
1875
|
getCompoNameObj();
|
|
1862
1876
|
const com = componentsObj[key];
|
|
1863
|
-
if (com.tests) {
|
|
1877
|
+
if (com.tests && Object.keys(com.tests).length > 0) {
|
|
1864
1878
|
return com.tests;
|
|
1865
1879
|
} else {
|
|
1866
1880
|
const exa = exampleObj[com.dir];
|
|
@@ -1877,35 +1891,140 @@ function getTestObj(key) {
|
|
|
1877
1891
|
const bname = mlurl[index];
|
|
1878
1892
|
if (key2.startsWith(topurl + bname + "/")) {
|
|
1879
1893
|
const reg = new RegExp(
|
|
1880
|
-
"
|
|
1894
|
+
"/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
|
|
1895
|
+
);
|
|
1896
|
+
const reg2 = new RegExp(
|
|
1897
|
+
"/([^/]+)\\." + defaultExtensions.join("|") + "$"
|
|
1881
1898
|
);
|
|
1882
|
-
let
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1899
|
+
let ms = key2.match(reg) || key2.match(reg2);
|
|
1900
|
+
if (ms && ms.length > 0) {
|
|
1901
|
+
let value = "";
|
|
1902
|
+
if (ms && ms.length > 1) {
|
|
1903
|
+
value = ms[1];
|
|
1904
|
+
}
|
|
1905
|
+
arr[key2] = {
|
|
1906
|
+
topurl,
|
|
1907
|
+
name: bname,
|
|
1908
|
+
value,
|
|
1909
|
+
suffix: getSuffix2(key2),
|
|
1910
|
+
comname: com.name,
|
|
1911
|
+
comkey: com.key,
|
|
1912
|
+
key: key2,
|
|
1913
|
+
dir: com.dir,
|
|
1914
|
+
url: key2,
|
|
1915
|
+
component: examplesObj[key2],
|
|
1916
|
+
raw: "",
|
|
1917
|
+
getRaw: getRawValue(examplesRawObj, key2)
|
|
1918
|
+
};
|
|
1919
|
+
break;
|
|
1886
1920
|
}
|
|
1887
|
-
arr[key2] = {
|
|
1888
|
-
topurl,
|
|
1889
|
-
name: bname,
|
|
1890
|
-
value,
|
|
1891
|
-
suffix: getSuffix2(key2),
|
|
1892
|
-
comname: com.name,
|
|
1893
|
-
comkey: com.key,
|
|
1894
|
-
key: key2,
|
|
1895
|
-
dir: com.dir,
|
|
1896
|
-
url: key2,
|
|
1897
|
-
component: examplesObj[key2],
|
|
1898
|
-
raw: "",
|
|
1899
|
-
getRaw: getRawValue(examplesRawObj, key2)
|
|
1900
|
-
};
|
|
1901
|
-
break;
|
|
1902
1921
|
}
|
|
1903
1922
|
}
|
|
1904
1923
|
});
|
|
1924
|
+
if (exa.tests) {
|
|
1925
|
+
getTestArrs(arr, com, exa);
|
|
1926
|
+
}
|
|
1905
1927
|
com.tests = arr;
|
|
1906
1928
|
return arr;
|
|
1907
1929
|
}
|
|
1908
1930
|
}
|
|
1931
|
+
function getTestArrs(arr, com, exa) {
|
|
1932
|
+
const testurl = com.url.substring(0, com.url.lastIndexOf("/" + com.value + "/")) + "/" + com.value;
|
|
1933
|
+
const testsNanme = exa.testsNanme || "/tests/";
|
|
1934
|
+
if (typeof testsNanme == "string") {
|
|
1935
|
+
exa.examplessRaw.forEach((key) => {
|
|
1936
|
+
if (key.startsWith(testurl + "/")) {
|
|
1937
|
+
if (key == testurl + exa.md + ".md") {
|
|
1938
|
+
com.mds = com.mds || [];
|
|
1939
|
+
com.mds.push({
|
|
1940
|
+
topurl: testurl,
|
|
1941
|
+
comkey: com.key,
|
|
1942
|
+
suffix: getSuffix2(key),
|
|
1943
|
+
name: com.name,
|
|
1944
|
+
value: com.value,
|
|
1945
|
+
key,
|
|
1946
|
+
raw: "",
|
|
1947
|
+
getRaw: getRawValue(examplesRawObj, key)
|
|
1948
|
+
});
|
|
1949
|
+
} else if (key.startsWith(testurl + testsNanme)) {
|
|
1950
|
+
const reg = new RegExp(
|
|
1951
|
+
"/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
|
|
1952
|
+
);
|
|
1953
|
+
const reg2 = new RegExp(
|
|
1954
|
+
"/([^/]+)\\." + defaultExtensions.join("|") + "$"
|
|
1955
|
+
);
|
|
1956
|
+
let ms = key.match(reg) || key.match(reg2);
|
|
1957
|
+
if (ms && ms.length > 0) {
|
|
1958
|
+
let value = "";
|
|
1959
|
+
if (ms && ms.length > 1) {
|
|
1960
|
+
value = ms[1];
|
|
1961
|
+
}
|
|
1962
|
+
arr[key] = {
|
|
1963
|
+
topurl: testurl,
|
|
1964
|
+
name: com.value,
|
|
1965
|
+
value,
|
|
1966
|
+
suffix: getSuffix2(key),
|
|
1967
|
+
comname: com.name,
|
|
1968
|
+
comkey: com.key,
|
|
1969
|
+
key,
|
|
1970
|
+
dir: com.dir,
|
|
1971
|
+
url: key,
|
|
1972
|
+
component: examplesObj[key],
|
|
1973
|
+
raw: "",
|
|
1974
|
+
getRaw: getRawValue(examplesRawObj, key)
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
});
|
|
1980
|
+
} else {
|
|
1981
|
+
exa.examplessRaw.forEach((key) => {
|
|
1982
|
+
if (key.startsWith(testurl + "/")) {
|
|
1983
|
+
if (key == testurl + exa.md + ".md") {
|
|
1984
|
+
com.mds = com.mds || [];
|
|
1985
|
+
com.mds.push({
|
|
1986
|
+
topurl: testurl,
|
|
1987
|
+
comkey: com.key,
|
|
1988
|
+
suffix: getSuffix2(key),
|
|
1989
|
+
name: com.name,
|
|
1990
|
+
value: com.value,
|
|
1991
|
+
key,
|
|
1992
|
+
raw: "",
|
|
1993
|
+
getRaw: getRawValue(examplesRawObj, key)
|
|
1994
|
+
});
|
|
1995
|
+
} else if (testsNanme.test(key)) {
|
|
1996
|
+
const reg = new RegExp(
|
|
1997
|
+
"/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
|
|
1998
|
+
);
|
|
1999
|
+
const reg2 = new RegExp(
|
|
2000
|
+
"/([^/]+)\\." + defaultExtensions.join("|") + "$"
|
|
2001
|
+
);
|
|
2002
|
+
let ms = key.match(reg) || key.match(reg2);
|
|
2003
|
+
if (ms && ms.length > 0) {
|
|
2004
|
+
let value = "";
|
|
2005
|
+
if (ms && ms.length > 1) {
|
|
2006
|
+
value = ms[1];
|
|
2007
|
+
}
|
|
2008
|
+
arr[key] = {
|
|
2009
|
+
topurl: testurl,
|
|
2010
|
+
name: com.value,
|
|
2011
|
+
value,
|
|
2012
|
+
suffix: getSuffix2(key),
|
|
2013
|
+
comname: com.name,
|
|
2014
|
+
comkey: com.key,
|
|
2015
|
+
key,
|
|
2016
|
+
dir: com.dir,
|
|
2017
|
+
url: key,
|
|
2018
|
+
component: examplesObj[key],
|
|
2019
|
+
raw: "",
|
|
2020
|
+
getRaw: getRawValue(examplesRawObj, key)
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
1909
2028
|
function getTestName(url) {
|
|
1910
2029
|
if (url) {
|
|
1911
2030
|
const testObj = getTestObj(url);
|
|
@@ -1989,9 +2108,9 @@ function getComponents() {
|
|
|
1989
2108
|
const example = getTests();
|
|
1990
2109
|
const arr = getConfig("components");
|
|
1991
2110
|
arr?.forEach((v) => {
|
|
1992
|
-
setForComponentsValue(v);
|
|
2111
|
+
const comRaw = setForComponentsValue(v);
|
|
1993
2112
|
let dir = v.dir || "";
|
|
1994
|
-
setExampleObj(dir, example, v.example);
|
|
2113
|
+
setExampleObj(dir, example, v.example, comRaw);
|
|
1995
2114
|
});
|
|
1996
2115
|
}
|
|
1997
2116
|
var defaultName = "default";
|
|
@@ -2044,6 +2163,7 @@ function setForComponentsValue(v) {
|
|
|
2044
2163
|
});
|
|
2045
2164
|
}
|
|
2046
2165
|
setComponentsObj(alias, obj.components);
|
|
2166
|
+
return v.componentsRaw;
|
|
2047
2167
|
}
|
|
2048
2168
|
function getCompoNameObj() {
|
|
2049
2169
|
if (Object.keys(componentsObj).length == 0) {
|
|
@@ -3461,7 +3581,7 @@ function getName(obj) {
|
|
|
3461
3581
|
}
|
|
3462
3582
|
function gettests(obj, arr, n) {
|
|
3463
3583
|
const tests = getTestName(obj.key);
|
|
3464
|
-
if (tests && tests.length > 1 && configObj.
|
|
3584
|
+
if (tests && tests.length > 1 && configObj.generate?.type != 3) {
|
|
3465
3585
|
asyncMergeArray(tests, (res, _reject, zv, inde) => {
|
|
3466
3586
|
getLocalTextTests(zv).then((text) => {
|
|
3467
3587
|
arr.push(`### \u793A\u4F8B` + inde + 1);
|
|
@@ -3491,19 +3611,27 @@ function gettests(obj, arr, n) {
|
|
|
3491
3611
|
[]
|
|
3492
3612
|
);
|
|
3493
3613
|
arr.push(...setDom(dom));
|
|
3494
|
-
const
|
|
3495
|
-
let key = configObj.example.dir + "/" + getLevelUrl(configObj.example.level, obj) + "/" + obj.value + "/" +
|
|
3496
|
-
|
|
3614
|
+
const v = configObj.generate?.vue || "cs/index.vue";
|
|
3615
|
+
let key = configObj.example.dir + "/" + getLevelUrl(configObj.example.level, obj) + "/" + obj.value + "/" + v;
|
|
3616
|
+
if (configObj.generate?.tests) {
|
|
3617
|
+
const testurl = obj.url.substring(
|
|
3618
|
+
0,
|
|
3619
|
+
obj.url.lastIndexOf("/" + obj.value + "/")
|
|
3620
|
+
) + "/" + obj.value;
|
|
3621
|
+
const testsNanme = configObj.generate.testsNanme || "/tests/";
|
|
3622
|
+
key = testurl + testsNanme + v;
|
|
3623
|
+
}
|
|
3624
|
+
key = key.replace(/\/\//g, "/");
|
|
3497
3625
|
arr.push(
|
|
3498
3626
|
...setTestUrl(obj, {
|
|
3499
3627
|
key,
|
|
3500
|
-
value:
|
|
3628
|
+
value: v
|
|
3501
3629
|
})
|
|
3502
3630
|
);
|
|
3503
|
-
if (configObj.
|
|
3631
|
+
if (configObj.generate?.type != 2) {
|
|
3504
3632
|
setVue(getName(obj), n, (0, import_node_path.join)(configObj.dir, key));
|
|
3505
3633
|
}
|
|
3506
|
-
if (configObj.
|
|
3634
|
+
if (configObj.generate?.type != 3) {
|
|
3507
3635
|
setMd(obj, arr);
|
|
3508
3636
|
}
|
|
3509
3637
|
}
|
|
@@ -3584,14 +3712,19 @@ function setVue(propsname, param, url) {
|
|
|
3584
3712
|
const html = getHmtl(propsname, propsObj);
|
|
3585
3713
|
Fang.fileOpen(url, html);
|
|
3586
3714
|
}
|
|
3715
|
+
function getMdurl(obj) {
|
|
3716
|
+
const v = configObj.generate?.md || obj.value + ".md";
|
|
3717
|
+
if (configObj.generate?.tests) {
|
|
3718
|
+
const testurl = obj.url.substring(0, obj.url.lastIndexOf("/" + obj.value + "/")) + "/" + obj.value;
|
|
3719
|
+
const testsNanme = configObj.generate.testsNanme || "/tests/";
|
|
3720
|
+
return (0, import_node_path.join)(configObj.dir, testurl + testsNanme, v);
|
|
3721
|
+
}
|
|
3722
|
+
return (0, import_node_path.join)(configObj.dir, configObj.outDir, v);
|
|
3723
|
+
}
|
|
3587
3724
|
var lss = 0;
|
|
3588
3725
|
function setMd(obj, arr) {
|
|
3589
3726
|
lss++;
|
|
3590
|
-
const sc = (
|
|
3591
|
-
configObj.dir,
|
|
3592
|
-
configObj.outDir,
|
|
3593
|
-
"/" + obj.value + "/index.md"
|
|
3594
|
-
);
|
|
3727
|
+
const sc = getMdurl(obj);
|
|
3595
3728
|
Fang.fileOpen(sc, arr.join("\n\n"));
|
|
3596
3729
|
if (comps.length == lss) {
|
|
3597
3730
|
if (configObj._callback_) {
|
|
@@ -3602,11 +3735,7 @@ function setMd(obj, arr) {
|
|
|
3602
3735
|
function setTestUrl(obj, test) {
|
|
3603
3736
|
const arr = [];
|
|
3604
3737
|
const tu = (0, import_node_path.join)(configObj.dir, test.key);
|
|
3605
|
-
const sc = (
|
|
3606
|
-
configObj.dir,
|
|
3607
|
-
configObj.outDir,
|
|
3608
|
-
"/" + obj.value + "/index.md"
|
|
3609
|
-
);
|
|
3738
|
+
const sc = getMdurl(obj);
|
|
3610
3739
|
const url = getImportUrl(sc, tu);
|
|
3611
3740
|
if (configObj.setTest) {
|
|
3612
3741
|
arr.push(...configObj.setTest(url, test, obj));
|
package/dist/node/index.d.cts
CHANGED
|
@@ -29,7 +29,9 @@ interface Components extends Component {
|
|
|
29
29
|
example?: ExampleObj;
|
|
30
30
|
}
|
|
31
31
|
interface ExampleObj {
|
|
32
|
-
|
|
32
|
+
tests?: boolean;
|
|
33
|
+
testsNanme?: string;
|
|
34
|
+
dir?: string;
|
|
33
35
|
/**
|
|
34
36
|
* 0 : url 下面就是组件
|
|
35
37
|
* 1 : dir 名称开始
|
|
@@ -53,6 +55,7 @@ interface ExampleObj {
|
|
|
53
55
|
*/
|
|
54
56
|
componentName?: string | number;
|
|
55
57
|
examples?: GlobComs;
|
|
58
|
+
resolver?: Component;
|
|
56
59
|
urls?: string[];
|
|
57
60
|
examplesRaw?: Globs;
|
|
58
61
|
md?: string;
|
package/dist/node/index.d.ts
CHANGED
|
@@ -29,7 +29,9 @@ interface Components extends Component {
|
|
|
29
29
|
example?: ExampleObj;
|
|
30
30
|
}
|
|
31
31
|
interface ExampleObj {
|
|
32
|
-
|
|
32
|
+
tests?: boolean;
|
|
33
|
+
testsNanme?: string;
|
|
34
|
+
dir?: string;
|
|
33
35
|
/**
|
|
34
36
|
* 0 : url 下面就是组件
|
|
35
37
|
* 1 : dir 名称开始
|
|
@@ -53,6 +55,7 @@ interface ExampleObj {
|
|
|
53
55
|
*/
|
|
54
56
|
componentName?: string | number;
|
|
55
57
|
examples?: GlobComs;
|
|
58
|
+
resolver?: Component;
|
|
56
59
|
urls?: string[];
|
|
57
60
|
examplesRaw?: Globs;
|
|
58
61
|
md?: string;
|