@fangzhongya/vue-archive 0.0.16 → 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.
@@ -1702,7 +1702,8 @@ function setExampleObj(dir, example, vexample, comRaw) {
1702
1702
  });
1703
1703
  }
1704
1704
  }
1705
- obj.examplessRaw = arrraw;
1705
+ obj.exampless = [...new Set(obj.exampless)];
1706
+ obj.examplessRaw = [...new Set(arrraw)];
1706
1707
  obj.examplesRaw = void 0;
1707
1708
  exampleObj[dir] = obj;
1708
1709
  }
@@ -1931,9 +1932,21 @@ function getTestArrs(arr, com, exa) {
1931
1932
  const testurl = com.url.substring(0, com.url.lastIndexOf("/" + com.value + "/")) + "/" + com.value;
1932
1933
  const testsNanme = exa.testsNanme || "/tests/";
1933
1934
  if (typeof testsNanme == "string") {
1934
- exa.exampless.forEach((key) => {
1935
+ exa.examplessRaw.forEach((key) => {
1935
1936
  if (key.startsWith(testurl + "/")) {
1936
- if (key.startsWith(testurl + testsNanme)) {
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)) {
1937
1950
  const reg = new RegExp(
1938
1951
  "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1939
1952
  );
@@ -1941,45 +1954,45 @@ function getTestArrs(arr, com, exa) {
1941
1954
  "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1942
1955
  );
1943
1956
  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({
1957
+ if (ms && ms.length > 0) {
1958
+ let value = "";
1959
+ if (ms && ms.length > 1) {
1960
+ value = ms[1];
1961
+ }
1962
+ arr[key] = {
1966
1963
  topurl: testurl,
1967
- comkey: com.key,
1964
+ name: com.value,
1965
+ value,
1968
1966
  suffix: getSuffix2(key),
1969
- name: com.name,
1970
- value: com.value,
1967
+ comname: com.name,
1968
+ comkey: com.key,
1971
1969
  key,
1970
+ dir: com.dir,
1971
+ url: key,
1972
+ component: examplesObj[key],
1972
1973
  raw: "",
1973
1974
  getRaw: getRawValue(examplesRawObj, key)
1974
- });
1975
+ };
1975
1976
  }
1976
1977
  }
1977
1978
  }
1978
1979
  });
1979
1980
  } else {
1980
- exa.exampless.forEach((key) => {
1981
+ exa.examplessRaw.forEach((key) => {
1981
1982
  if (key.startsWith(testurl + "/")) {
1982
- if (testsNanme.test(key)) {
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)) {
1983
1996
  const reg = new RegExp(
1984
1997
  "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1985
1998
  );
@@ -1987,37 +2000,25 @@ function getTestArrs(arr, com, exa) {
1987
2000
  "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1988
2001
  );
1989
2002
  let ms = key.match(reg) || key.match(reg2);
1990
- let value = "";
1991
- if (ms && ms.length > 1) {
1992
- value = ms[1];
1993
- }
1994
- arr[key] = {
1995
- topurl: testurl,
1996
- name: com.value,
1997
- value,
1998
- suffix: getSuffix2(key),
1999
- comname: com.name,
2000
- comkey: com.key,
2001
- key,
2002
- dir: com.dir,
2003
- url: key,
2004
- component: examplesObj[key],
2005
- raw: "",
2006
- getRaw: getRawValue(examplesRawObj, key)
2007
- };
2008
- } else {
2009
- if (key == testurl + exa.md + ".md") {
2010
- com.mds = com.mds || [];
2011
- com.mds.push({
2003
+ if (ms && ms.length > 0) {
2004
+ let value = "";
2005
+ if (ms && ms.length > 1) {
2006
+ value = ms[1];
2007
+ }
2008
+ arr[key] = {
2012
2009
  topurl: testurl,
2013
- comkey: com.key,
2010
+ name: com.value,
2011
+ value,
2014
2012
  suffix: getSuffix2(key),
2015
- name: com.name,
2016
- value: com.value,
2013
+ comname: com.name,
2014
+ comkey: com.key,
2017
2015
  key,
2016
+ dir: com.dir,
2017
+ url: key,
2018
+ component: examplesObj[key],
2018
2019
  raw: "",
2019
2020
  getRaw: getRawValue(examplesRawObj, key)
2020
- });
2021
+ };
2021
2022
  }
2022
2023
  }
2023
2024
  }
@@ -3580,7 +3581,7 @@ function getName(obj) {
3580
3581
  }
3581
3582
  function gettests(obj, arr, n) {
3582
3583
  const tests = getTestName(obj.key);
3583
- if (tests && tests.length > 1 && configObj.generatetype != 3) {
3584
+ if (tests && tests.length > 1 && configObj.generate?.type != 3) {
3584
3585
  asyncMergeArray(tests, (res, _reject, zv, inde) => {
3585
3586
  getLocalTextTests(zv).then((text) => {
3586
3587
  arr.push(`### \u793A\u4F8B` + inde + 1);
@@ -3610,19 +3611,27 @@ function gettests(obj, arr, n) {
3610
3611
  []
3611
3612
  );
3612
3613
  arr.push(...setDom(dom));
3613
- const name = "cs";
3614
- let key = configObj.example.dir + "/" + getLevelUrl(configObj.example.level, obj) + "/" + obj.value + "/" + name + "/index.vue";
3615
- key = key.replace(/\/\//g, "/").replace(/\/\//g, "/");
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, "/");
3616
3625
  arr.push(
3617
3626
  ...setTestUrl(obj, {
3618
3627
  key,
3619
- value: name
3628
+ value: v
3620
3629
  })
3621
3630
  );
3622
- if (configObj.generatetype != 2) {
3631
+ if (configObj.generate?.type != 2) {
3623
3632
  setVue(getName(obj), n, (0, import_node_path.join)(configObj.dir, key));
3624
3633
  }
3625
- if (configObj.generatetype != 3) {
3634
+ if (configObj.generate?.type != 3) {
3626
3635
  setMd(obj, arr);
3627
3636
  }
3628
3637
  }
@@ -3703,14 +3712,19 @@ function setVue(propsname, param, url) {
3703
3712
  const html = getHmtl(propsname, propsObj);
3704
3713
  Fang.fileOpen(url, html);
3705
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
+ }
3706
3724
  var lss = 0;
3707
3725
  function setMd(obj, arr) {
3708
3726
  lss++;
3709
- const sc = (0, import_node_path.join)(
3710
- configObj.dir,
3711
- configObj.outDir,
3712
- "/" + obj.value + "/index.md"
3713
- );
3727
+ const sc = getMdurl(obj);
3714
3728
  Fang.fileOpen(sc, arr.join("\n\n"));
3715
3729
  if (comps.length == lss) {
3716
3730
  if (configObj._callback_) {
@@ -3721,11 +3735,7 @@ function setMd(obj, arr) {
3721
3735
  function setTestUrl(obj, test) {
3722
3736
  const arr = [];
3723
3737
  const tu = (0, import_node_path.join)(configObj.dir, test.key);
3724
- const sc = (0, import_node_path.join)(
3725
- configObj.dir,
3726
- configObj.outDir,
3727
- "/" + obj.value + "/index.md"
3728
- );
3738
+ const sc = getMdurl(obj);
3729
3739
  const url = getImportUrl(sc, tu);
3730
3740
  if (configObj.setTest) {
3731
3741
  arr.push(...configObj.setTest(url, test, obj));
@@ -1687,7 +1687,8 @@ function setExampleObj(dir, example, vexample, comRaw) {
1687
1687
  });
1688
1688
  }
1689
1689
  }
1690
- obj.examplessRaw = arrraw;
1690
+ obj.exampless = [...new Set(obj.exampless)];
1691
+ obj.examplessRaw = [...new Set(arrraw)];
1691
1692
  obj.examplesRaw = void 0;
1692
1693
  exampleObj[dir] = obj;
1693
1694
  }
@@ -1916,9 +1917,21 @@ function getTestArrs(arr, com, exa) {
1916
1917
  const testurl = com.url.substring(0, com.url.lastIndexOf("/" + com.value + "/")) + "/" + com.value;
1917
1918
  const testsNanme = exa.testsNanme || "/tests/";
1918
1919
  if (typeof testsNanme == "string") {
1919
- exa.exampless.forEach((key) => {
1920
+ exa.examplessRaw.forEach((key) => {
1920
1921
  if (key.startsWith(testurl + "/")) {
1921
- if (key.startsWith(testurl + testsNanme)) {
1922
+ if (key == testurl + exa.md + ".md") {
1923
+ com.mds = com.mds || [];
1924
+ com.mds.push({
1925
+ topurl: testurl,
1926
+ comkey: com.key,
1927
+ suffix: getSuffix2(key),
1928
+ name: com.name,
1929
+ value: com.value,
1930
+ key,
1931
+ raw: "",
1932
+ getRaw: getRawValue(examplesRawObj, key)
1933
+ });
1934
+ } else if (key.startsWith(testurl + testsNanme)) {
1922
1935
  const reg = new RegExp(
1923
1936
  "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1924
1937
  );
@@ -1926,45 +1939,45 @@ function getTestArrs(arr, com, exa) {
1926
1939
  "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1927
1940
  );
1928
1941
  let ms = key.match(reg) || key.match(reg2);
1929
- let value = "";
1930
- if (ms && ms.length > 1) {
1931
- value = ms[1];
1932
- }
1933
- arr[key] = {
1934
- topurl: testurl,
1935
- name: com.value,
1936
- value,
1937
- suffix: getSuffix2(key),
1938
- comname: com.name,
1939
- comkey: com.key,
1940
- key,
1941
- dir: com.dir,
1942
- url: key,
1943
- component: examplesObj[key],
1944
- raw: "",
1945
- getRaw: getRawValue(examplesRawObj, key)
1946
- };
1947
- } else {
1948
- if (key == testurl + exa.md + ".md") {
1949
- com.mds = com.mds || [];
1950
- com.mds.push({
1942
+ if (ms && ms.length > 0) {
1943
+ let value = "";
1944
+ if (ms && ms.length > 1) {
1945
+ value = ms[1];
1946
+ }
1947
+ arr[key] = {
1951
1948
  topurl: testurl,
1952
- comkey: com.key,
1949
+ name: com.value,
1950
+ value,
1953
1951
  suffix: getSuffix2(key),
1954
- name: com.name,
1955
- value: com.value,
1952
+ comname: com.name,
1953
+ comkey: com.key,
1956
1954
  key,
1955
+ dir: com.dir,
1956
+ url: key,
1957
+ component: examplesObj[key],
1957
1958
  raw: "",
1958
1959
  getRaw: getRawValue(examplesRawObj, key)
1959
- });
1960
+ };
1960
1961
  }
1961
1962
  }
1962
1963
  }
1963
1964
  });
1964
1965
  } else {
1965
- exa.exampless.forEach((key) => {
1966
+ exa.examplessRaw.forEach((key) => {
1966
1967
  if (key.startsWith(testurl + "/")) {
1967
- if (testsNanme.test(key)) {
1968
+ if (key == testurl + exa.md + ".md") {
1969
+ com.mds = com.mds || [];
1970
+ com.mds.push({
1971
+ topurl: testurl,
1972
+ comkey: com.key,
1973
+ suffix: getSuffix2(key),
1974
+ name: com.name,
1975
+ value: com.value,
1976
+ key,
1977
+ raw: "",
1978
+ getRaw: getRawValue(examplesRawObj, key)
1979
+ });
1980
+ } else if (testsNanme.test(key)) {
1968
1981
  const reg = new RegExp(
1969
1982
  "/([^/]+)/index\\." + defaultExtensions.join("|") + "$"
1970
1983
  );
@@ -1972,37 +1985,25 @@ function getTestArrs(arr, com, exa) {
1972
1985
  "/([^/]+)\\." + defaultExtensions.join("|") + "$"
1973
1986
  );
1974
1987
  let ms = key.match(reg) || key.match(reg2);
1975
- let value = "";
1976
- if (ms && ms.length > 1) {
1977
- value = ms[1];
1978
- }
1979
- arr[key] = {
1980
- topurl: testurl,
1981
- name: com.value,
1982
- value,
1983
- suffix: getSuffix2(key),
1984
- comname: com.name,
1985
- comkey: com.key,
1986
- key,
1987
- dir: com.dir,
1988
- url: key,
1989
- component: examplesObj[key],
1990
- raw: "",
1991
- getRaw: getRawValue(examplesRawObj, key)
1992
- };
1993
- } else {
1994
- if (key == testurl + exa.md + ".md") {
1995
- com.mds = com.mds || [];
1996
- com.mds.push({
1988
+ if (ms && ms.length > 0) {
1989
+ let value = "";
1990
+ if (ms && ms.length > 1) {
1991
+ value = ms[1];
1992
+ }
1993
+ arr[key] = {
1997
1994
  topurl: testurl,
1998
- comkey: com.key,
1995
+ name: com.value,
1996
+ value,
1999
1997
  suffix: getSuffix2(key),
2000
- name: com.name,
2001
- value: com.value,
1998
+ comname: com.name,
1999
+ comkey: com.key,
2002
2000
  key,
2001
+ dir: com.dir,
2002
+ url: key,
2003
+ component: examplesObj[key],
2003
2004
  raw: "",
2004
2005
  getRaw: getRawValue(examplesRawObj, key)
2005
- });
2006
+ };
2006
2007
  }
2007
2008
  }
2008
2009
  }
@@ -3565,7 +3566,7 @@ function getName(obj) {
3565
3566
  }
3566
3567
  function gettests(obj, arr, n) {
3567
3568
  const tests = getTestName(obj.key);
3568
- if (tests && tests.length > 1 && configObj.generatetype != 3) {
3569
+ if (tests && tests.length > 1 && configObj.generate?.type != 3) {
3569
3570
  asyncMergeArray(tests, (res, _reject, zv, inde) => {
3570
3571
  getLocalTextTests(zv).then((text) => {
3571
3572
  arr.push(`### \u793A\u4F8B` + inde + 1);
@@ -3595,19 +3596,27 @@ function gettests(obj, arr, n) {
3595
3596
  []
3596
3597
  );
3597
3598
  arr.push(...setDom(dom));
3598
- const name = "cs";
3599
- let key = configObj.example.dir + "/" + getLevelUrl(configObj.example.level, obj) + "/" + obj.value + "/" + name + "/index.vue";
3600
- key = key.replace(/\/\//g, "/").replace(/\/\//g, "/");
3599
+ const v = configObj.generate?.vue || "cs/index.vue";
3600
+ let key = configObj.example.dir + "/" + getLevelUrl(configObj.example.level, obj) + "/" + obj.value + "/" + v;
3601
+ if (configObj.generate?.tests) {
3602
+ const testurl = obj.url.substring(
3603
+ 0,
3604
+ obj.url.lastIndexOf("/" + obj.value + "/")
3605
+ ) + "/" + obj.value;
3606
+ const testsNanme = configObj.generate.testsNanme || "/tests/";
3607
+ key = testurl + testsNanme + v;
3608
+ }
3609
+ key = key.replace(/\/\//g, "/");
3601
3610
  arr.push(
3602
3611
  ...setTestUrl(obj, {
3603
3612
  key,
3604
- value: name
3613
+ value: v
3605
3614
  })
3606
3615
  );
3607
- if (configObj.generatetype != 2) {
3616
+ if (configObj.generate?.type != 2) {
3608
3617
  setVue(getName(obj), n, join4(configObj.dir, key));
3609
3618
  }
3610
- if (configObj.generatetype != 3) {
3619
+ if (configObj.generate?.type != 3) {
3611
3620
  setMd(obj, arr);
3612
3621
  }
3613
3622
  }
@@ -3688,14 +3697,19 @@ function setVue(propsname, param, url) {
3688
3697
  const html = getHmtl(propsname, propsObj);
3689
3698
  Fang.fileOpen(url, html);
3690
3699
  }
3700
+ function getMdurl(obj) {
3701
+ const v = configObj.generate?.md || obj.value + ".md";
3702
+ if (configObj.generate?.tests) {
3703
+ const testurl = obj.url.substring(0, obj.url.lastIndexOf("/" + obj.value + "/")) + "/" + obj.value;
3704
+ const testsNanme = configObj.generate.testsNanme || "/tests/";
3705
+ return join4(configObj.dir, testurl + testsNanme, v);
3706
+ }
3707
+ return join4(configObj.dir, configObj.outDir, v);
3708
+ }
3691
3709
  var lss = 0;
3692
3710
  function setMd(obj, arr) {
3693
3711
  lss++;
3694
- const sc = join4(
3695
- configObj.dir,
3696
- configObj.outDir,
3697
- "/" + obj.value + "/index.md"
3698
- );
3712
+ const sc = getMdurl(obj);
3699
3713
  Fang.fileOpen(sc, arr.join("\n\n"));
3700
3714
  if (comps.length == lss) {
3701
3715
  if (configObj._callback_) {
@@ -3706,11 +3720,7 @@ function setMd(obj, arr) {
3706
3720
  function setTestUrl(obj, test) {
3707
3721
  const arr = [];
3708
3722
  const tu = join4(configObj.dir, test.key);
3709
- const sc = join4(
3710
- configObj.dir,
3711
- configObj.outDir,
3712
- "/" + obj.value + "/index.md"
3713
- );
3723
+ const sc = getMdurl(obj);
3714
3724
  const url = getImportUrl(sc, tu);
3715
3725
  if (configObj.setTest) {
3716
3726
  arr.push(...configObj.setTest(url, test, obj));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/vue-archive",
3
3
  "private": false,
4
- "version": "0.0.16",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "description ": "vue 组件注释生成文档",
7
7
  "author": "fangzhongya ",