@fangzhongya/vue-archive 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.24/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-AWC672JW.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
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.29/node_modules/@fangzhongya/create/dist/chunk-7V2NDMIF.js
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.29/node_modules/@fangzhongya/create/dist/chunk-PXLSY3ZR.js
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.29/node_modules/@fangzhongya/create/dist/bins/md.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
789
+ // node_modules/.pnpm/@fangzhongya+utils@0.0.25/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
790
790
  var zObj = {
791
791
  "<": "&lt;",
792
792
  ">": "&gt;",
@@ -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.24/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-LPMR5W6M.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-UOADEBDH.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-7PJ2D3KR.js
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("/" + comprops + "(\\.(js|ts))?$");
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.24/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
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.24/node_modules/@fangzhongya/utils/dist/chunk-I4VBDCIM.js
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 = Object.assign(
1655
- {
1656
- exampless: [],
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,13 +1677,31 @@ function setExampleObj(dir, example, vexample) {
1682
1677
  if (examplesRaw) {
1683
1678
  Object.keys(examplesRaw).forEach((key) => {
1684
1679
  arrraw.push(key);
1685
- if (examplesRaw) {
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;
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
+ }
1692
1705
  obj.examplessRaw = arrraw;
1693
1706
  obj.examplesRaw = void 0;
1694
1707
  exampleObj[dir] = obj;
@@ -1840,7 +1853,7 @@ function getTestMd(topurl, mlurl, exa, com) {
1840
1853
  exa.examplessRaw.forEach((key) => {
1841
1854
  for (let index = 0; index < mlurl.length; index++) {
1842
1855
  const comName = mlurl[index];
1843
- if (key == topurl + comName + "/" + exa.md + ".md") {
1856
+ if (key == topurl + comName + exa.md + ".md") {
1844
1857
  arr.push({
1845
1858
  topurl,
1846
1859
  comkey: com.key,
@@ -1860,7 +1873,7 @@ function getTestMd(topurl, mlurl, exa, com) {
1860
1873
  function getTestObj(key) {
1861
1874
  getCompoNameObj();
1862
1875
  const com = componentsObj[key];
1863
- if (com.tests) {
1876
+ if (com.tests && Object.keys(com.tests).length > 0) {
1864
1877
  return com.tests;
1865
1878
  } else {
1866
1879
  const exa = exampleObj[com.dir];
@@ -1877,33 +1890,138 @@ function getTestObj(key) {
1877
1890
  const bname = mlurl[index];
1878
1891
  if (key2.startsWith(topurl + bname + "/")) {
1879
1892
  const reg = new RegExp(
1880
- "^\\" + topurl + bname + "/(.*)/index\\." + defaultExtensions.join("|") + "$"
1893
+ "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1894
+ );
1895
+ const reg2 = new RegExp(
1896
+ "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1897
+ );
1898
+ let ms = key2.match(reg) || key2.match(reg2);
1899
+ if (ms && ms.length > 0) {
1900
+ let value = "";
1901
+ if (ms && ms.length > 1) {
1902
+ value = ms[1];
1903
+ }
1904
+ arr[key2] = {
1905
+ topurl,
1906
+ name: bname,
1907
+ value,
1908
+ suffix: getSuffix2(key2),
1909
+ comname: com.name,
1910
+ comkey: com.key,
1911
+ key: key2,
1912
+ dir: com.dir,
1913
+ url: key2,
1914
+ component: examplesObj[key2],
1915
+ raw: "",
1916
+ getRaw: getRawValue(examplesRawObj, key2)
1917
+ };
1918
+ break;
1919
+ }
1920
+ }
1921
+ }
1922
+ });
1923
+ if (exa.tests) {
1924
+ getTestArrs(arr, com, exa);
1925
+ }
1926
+ com.tests = arr;
1927
+ return arr;
1928
+ }
1929
+ }
1930
+ function getTestArrs(arr, com, exa) {
1931
+ const testurl = com.url.substring(0, com.url.lastIndexOf("/" + com.value + "/")) + "/" + com.value;
1932
+ const testsNanme = exa.testsNanme || "/tests/";
1933
+ if (typeof testsNanme == "string") {
1934
+ exa.exampless.forEach((key) => {
1935
+ if (key.startsWith(testurl + "/")) {
1936
+ if (key.startsWith(testurl + testsNanme)) {
1937
+ const reg = new RegExp(
1938
+ "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1939
+ );
1940
+ const reg2 = new RegExp(
1941
+ "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1942
+ );
1943
+ let ms = key.match(reg) || key.match(reg2);
1944
+ let value = "";
1945
+ if (ms && ms.length > 1) {
1946
+ value = ms[1];
1947
+ }
1948
+ arr[key] = {
1949
+ topurl: testurl,
1950
+ name: com.value,
1951
+ value,
1952
+ suffix: getSuffix2(key),
1953
+ comname: com.name,
1954
+ comkey: com.key,
1955
+ key,
1956
+ dir: com.dir,
1957
+ url: key,
1958
+ component: examplesObj[key],
1959
+ raw: "",
1960
+ getRaw: getRawValue(examplesRawObj, key)
1961
+ };
1962
+ } else {
1963
+ if (key == testurl + exa.md + ".md") {
1964
+ com.mds = com.mds || [];
1965
+ com.mds.push({
1966
+ topurl: testurl,
1967
+ comkey: com.key,
1968
+ suffix: getSuffix2(key),
1969
+ name: com.name,
1970
+ value: com.value,
1971
+ key,
1972
+ raw: "",
1973
+ getRaw: getRawValue(examplesRawObj, key)
1974
+ });
1975
+ }
1976
+ }
1977
+ }
1978
+ });
1979
+ } else {
1980
+ exa.exampless.forEach((key) => {
1981
+ if (key.startsWith(testurl + "/")) {
1982
+ if (testsNanme.test(key)) {
1983
+ const reg = new RegExp(
1984
+ "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1985
+ );
1986
+ const reg2 = new RegExp(
1987
+ "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1881
1988
  );
1989
+ let ms = key.match(reg) || key.match(reg2);
1882
1990
  let value = "";
1883
- let ms = key2.match(reg);
1884
1991
  if (ms && ms.length > 1) {
1885
1992
  value = ms[1];
1886
1993
  }
1887
- arr[key2] = {
1888
- topurl,
1889
- name: bname,
1994
+ arr[key] = {
1995
+ topurl: testurl,
1996
+ name: com.value,
1890
1997
  value,
1891
- suffix: getSuffix2(key2),
1998
+ suffix: getSuffix2(key),
1892
1999
  comname: com.name,
1893
2000
  comkey: com.key,
1894
- key: key2,
2001
+ key,
1895
2002
  dir: com.dir,
1896
- url: key2,
1897
- component: examplesObj[key2],
2003
+ url: key,
2004
+ component: examplesObj[key],
1898
2005
  raw: "",
1899
- getRaw: getRawValue(examplesRawObj, key2)
2006
+ getRaw: getRawValue(examplesRawObj, key)
1900
2007
  };
1901
- break;
2008
+ } else {
2009
+ if (key == testurl + exa.md + ".md") {
2010
+ com.mds = com.mds || [];
2011
+ com.mds.push({
2012
+ topurl: testurl,
2013
+ comkey: com.key,
2014
+ suffix: getSuffix2(key),
2015
+ name: com.name,
2016
+ value: com.value,
2017
+ key,
2018
+ raw: "",
2019
+ getRaw: getRawValue(examplesRawObj, key)
2020
+ });
2021
+ }
1902
2022
  }
1903
2023
  }
1904
2024
  });
1905
- com.tests = arr;
1906
- return arr;
1907
2025
  }
1908
2026
  }
1909
2027
  function getTestName(url) {
@@ -1989,9 +2107,9 @@ function getComponents() {
1989
2107
  const example = getTests();
1990
2108
  const arr = getConfig("components");
1991
2109
  arr?.forEach((v) => {
1992
- setForComponentsValue(v);
2110
+ const comRaw = setForComponentsValue(v);
1993
2111
  let dir = v.dir || "";
1994
- setExampleObj(dir, example, v.example);
2112
+ setExampleObj(dir, example, v.example, comRaw);
1995
2113
  });
1996
2114
  }
1997
2115
  var defaultName = "default";
@@ -2044,6 +2162,7 @@ function setForComponentsValue(v) {
2044
2162
  });
2045
2163
  }
2046
2164
  setComponentsObj(alias, obj.components);
2165
+ return v.componentsRaw;
2047
2166
  }
2048
2167
  function getCompoNameObj() {
2049
2168
  if (Object.keys(componentsObj).length == 0) {
@@ -29,7 +29,9 @@ interface Components extends Component {
29
29
  example?: ExampleObj;
30
30
  }
31
31
  interface ExampleObj {
32
- dir: string;
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;
@@ -29,7 +29,9 @@ interface Components extends Component {
29
29
  example?: ExampleObj;
30
30
  }
31
31
  interface ExampleObj {
32
- dir: string;
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;