@fangzhongya/vue-archive 0.1.12 → 0.1.14
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 +140 -55
- package/dist/node/index.js +140 -55
- package/dist/packages/index.cjs +1 -1
- package/dist/packages/index.d.ts +1 -1
- package/dist/packages/index.js +14 -10
- package/dist/packages/utils/glob.cjs +1 -1
- package/dist/packages/utils/glob.js +1 -1
- package/package.json +4 -4
package/dist/node/index.cjs
CHANGED
|
@@ -87,12 +87,12 @@ __export(index_exports, {
|
|
|
87
87
|
});
|
|
88
88
|
module.exports = __toCommonJS(index_exports);
|
|
89
89
|
|
|
90
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
90
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
|
|
91
91
|
function isArray(obj2) {
|
|
92
92
|
return Object.prototype.toString.call(obj2) == "[object Array]";
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
95
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
|
|
96
96
|
function getStartSames(str, val) {
|
|
97
97
|
let s = "";
|
|
98
98
|
const vs = [...val];
|
|
@@ -108,7 +108,7 @@ function getStartSames(str, val) {
|
|
|
108
108
|
return [s, str.substring(index), val.substring(index)];
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
111
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
|
|
112
112
|
function getImportUrl(url, imp) {
|
|
113
113
|
const arr = getStartSames(url, imp);
|
|
114
114
|
const ts2 = arr[0];
|
|
@@ -132,12 +132,12 @@ function getImportUrl(url, imp) {
|
|
|
132
132
|
return ds.join("") + arr[2].replace(/\\/g, "/");
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
135
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
|
|
136
136
|
function firstUpper(str) {
|
|
137
137
|
return str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
140
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
|
|
141
141
|
function lineToLargeHump(name) {
|
|
142
142
|
let arr = name.split("-");
|
|
143
143
|
arr = arr.map((vs) => {
|
|
@@ -846,7 +846,7 @@ function runDev(config2, configCallback) {
|
|
|
846
846
|
return new FangMd(config2, configCallback);
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
849
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
|
|
850
850
|
var zObj = {
|
|
851
851
|
"<": "<",
|
|
852
852
|
">": ">",
|
|
@@ -867,7 +867,7 @@ function htmlEscape(str) {
|
|
|
867
867
|
// packages/node/index.ts
|
|
868
868
|
var import_node_path = require("path");
|
|
869
869
|
|
|
870
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
870
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
|
|
871
871
|
function mergeObject(a, b, j = 0, i) {
|
|
872
872
|
if (a instanceof Array) {
|
|
873
873
|
if (j > 0 && i) {
|
|
@@ -921,54 +921,139 @@ function getConfig(key) {
|
|
|
921
921
|
return config[key];
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
925
|
-
function
|
|
926
|
-
const result =
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
const customBlockRegex = /<([a-z][a-z0-9-]*)([\s\S]*?)>([\s\S]*?)<\/\1>/g;
|
|
952
|
-
let customMatch;
|
|
953
|
-
while ((customMatch = customBlockRegex.exec(content)) !== null) {
|
|
954
|
-
if (!["template", "script", "style"].includes(customMatch[1])) {
|
|
955
|
-
result.customBlocks.push({
|
|
956
|
-
type: customMatch[1],
|
|
957
|
-
content: customMatch[3]
|
|
958
|
-
});
|
|
924
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-H3AJ6I4R.js
|
|
925
|
+
function getBlocks(content) {
|
|
926
|
+
const result = [];
|
|
927
|
+
function findMatchingEndTag(content2, startIndex, tagName) {
|
|
928
|
+
const endTag = `</${tagName}>`;
|
|
929
|
+
let i2 = startIndex;
|
|
930
|
+
let depth = 1;
|
|
931
|
+
while (i2 < content2.length) {
|
|
932
|
+
const nextOpen = content2.indexOf("<", i2);
|
|
933
|
+
if (nextOpen === -1) return -1;
|
|
934
|
+
if (content2[nextOpen + 1] === "/") {
|
|
935
|
+
if (content2.substring(nextOpen, nextOpen + endTag.length) === endTag) {
|
|
936
|
+
depth--;
|
|
937
|
+
if (depth === 0) {
|
|
938
|
+
return nextOpen;
|
|
939
|
+
}
|
|
940
|
+
i2 = nextOpen + endTag.length;
|
|
941
|
+
} else {
|
|
942
|
+
i2 = nextOpen + 1;
|
|
943
|
+
}
|
|
944
|
+
} else {
|
|
945
|
+
const nextTagMatch = content2.substring(nextOpen).match(/^<([a-zA-Z][a-zA-Z0-9\-]*)/);
|
|
946
|
+
if (nextTagMatch && nextTagMatch[1].toLowerCase() === tagName.toLowerCase()) {
|
|
947
|
+
depth++;
|
|
948
|
+
}
|
|
949
|
+
i2 = nextOpen + 1;
|
|
950
|
+
}
|
|
959
951
|
}
|
|
952
|
+
return -1;
|
|
953
|
+
}
|
|
954
|
+
let i = 0;
|
|
955
|
+
while (i < content.length) {
|
|
956
|
+
const openTagIndex = content.indexOf("<", i);
|
|
957
|
+
if (openTagIndex === -1) break;
|
|
958
|
+
if (content[openTagIndex + 1] === "/") {
|
|
959
|
+
i = openTagIndex + 1;
|
|
960
|
+
continue;
|
|
961
|
+
}
|
|
962
|
+
const tagMatch = content.substring(openTagIndex).match(/^<([a-zA-Z][a-zA-Z0-9\-]*)/);
|
|
963
|
+
if (!tagMatch) {
|
|
964
|
+
i = openTagIndex + 1;
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
const tagName = tagMatch[1].toLowerCase();
|
|
968
|
+
let startTagEnd = openTagIndex + tagMatch[0].length;
|
|
969
|
+
let inQuotes = false;
|
|
970
|
+
let quoteChar = "";
|
|
971
|
+
while (startTagEnd < content.length) {
|
|
972
|
+
const char = content[startTagEnd];
|
|
973
|
+
if (!inQuotes) {
|
|
974
|
+
if (char === ">") {
|
|
975
|
+
startTagEnd++;
|
|
976
|
+
break;
|
|
977
|
+
} else if (char === '"' || char === "'") {
|
|
978
|
+
inQuotes = true;
|
|
979
|
+
quoteChar = char;
|
|
980
|
+
}
|
|
981
|
+
} else {
|
|
982
|
+
if (char === quoteChar && content[startTagEnd - 1] !== "\\") {
|
|
983
|
+
inQuotes = false;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
startTagEnd++;
|
|
987
|
+
}
|
|
988
|
+
if (startTagEnd >= content.length) {
|
|
989
|
+
i = openTagIndex + 1;
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
const endTagIndex = findMatchingEndTag(content, startTagEnd, tagName);
|
|
993
|
+
if (endTagIndex === -1) {
|
|
994
|
+
if (content.substring(startTagEnd - 2, startTagEnd) === "/>") {
|
|
995
|
+
const selfClosingBlock = content.substring(
|
|
996
|
+
openTagIndex,
|
|
997
|
+
startTagEnd
|
|
998
|
+
);
|
|
999
|
+
result.push({
|
|
1000
|
+
type: tagName,
|
|
1001
|
+
content: "",
|
|
1002
|
+
block: selfClosingBlock
|
|
1003
|
+
});
|
|
1004
|
+
i = startTagEnd;
|
|
1005
|
+
} else {
|
|
1006
|
+
i = startTagEnd;
|
|
1007
|
+
}
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
const endTagLength = `</${tagName}>`.length;
|
|
1011
|
+
const tagContent = content.substring(startTagEnd, endTagIndex).trim();
|
|
1012
|
+
const wholeBlock = content.substring(
|
|
1013
|
+
openTagIndex,
|
|
1014
|
+
endTagIndex + endTagLength
|
|
1015
|
+
);
|
|
1016
|
+
result.push({
|
|
1017
|
+
type: tagName,
|
|
1018
|
+
content: tagContent,
|
|
1019
|
+
block: wholeBlock
|
|
1020
|
+
});
|
|
1021
|
+
i = endTagIndex + endTagLength;
|
|
960
1022
|
}
|
|
961
1023
|
return result;
|
|
962
1024
|
}
|
|
1025
|
+
function filterBlocksByType(blocks, type) {
|
|
1026
|
+
return blocks.filter((block) => block.type === type);
|
|
1027
|
+
}
|
|
1028
|
+
function getVueComponents(content) {
|
|
1029
|
+
const blocks = getBlocks(content);
|
|
1030
|
+
return {
|
|
1031
|
+
templates: filterBlocksByType(blocks, "template"),
|
|
1032
|
+
scripts: filterBlocksByType(blocks, "script"),
|
|
1033
|
+
styles: filterBlocksByType(blocks, "style"),
|
|
1034
|
+
customBlocks: blocks.filter(
|
|
1035
|
+
(block) => !["template", "script", "style"].includes(block.type)
|
|
1036
|
+
)
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
963
1039
|
function getVueTexts(content) {
|
|
964
|
-
const obj2 =
|
|
1040
|
+
const obj2 = getVueComponents(content);
|
|
1041
|
+
return {
|
|
1042
|
+
templates: obj2.templates,
|
|
1043
|
+
scripts: obj2.scripts,
|
|
1044
|
+
styles: obj2.styles
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function getVueText(content) {
|
|
1048
|
+
const obj2 = getVueTexts(content);
|
|
965
1049
|
return {
|
|
966
|
-
|
|
967
|
-
|
|
1050
|
+
template: obj2.templates.map((o) => o.content).join("\n"),
|
|
1051
|
+
script: obj2.scripts.map((o) => o.content).join("\n"),
|
|
1052
|
+
style: obj2.styles.map((o) => o.content).join("\n")
|
|
968
1053
|
};
|
|
969
1054
|
}
|
|
970
1055
|
|
|
971
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1056
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
|
|
972
1057
|
function humpToLine(name) {
|
|
973
1058
|
const reg = /(([A-Z])([^A-Z]*))/g;
|
|
974
1059
|
let result;
|
|
@@ -990,12 +1075,12 @@ function humpToLine(name) {
|
|
|
990
1075
|
}
|
|
991
1076
|
}
|
|
992
1077
|
|
|
993
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1078
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
|
|
994
1079
|
function firstLower(str) {
|
|
995
1080
|
return str.slice(0, 1).toLowerCase() + str.slice(1);
|
|
996
1081
|
}
|
|
997
1082
|
|
|
998
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1083
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
|
|
999
1084
|
function asyncMergeArray(arr, callback) {
|
|
1000
1085
|
return new Promise((resolve2, reject) => {
|
|
1001
1086
|
let index = 0;
|
|
@@ -1019,7 +1104,7 @@ function asyncMergeArray(arr, callback) {
|
|
|
1019
1104
|
});
|
|
1020
1105
|
}
|
|
1021
1106
|
|
|
1022
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1107
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
|
|
1023
1108
|
function getSuffix2(url) {
|
|
1024
1109
|
const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
|
|
1025
1110
|
const regs = reg.exec(url);
|
|
@@ -1029,7 +1114,7 @@ function getSuffix2(url) {
|
|
|
1029
1114
|
return "";
|
|
1030
1115
|
}
|
|
1031
1116
|
|
|
1032
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1117
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
|
|
1033
1118
|
function matchsStart2(key, matchs) {
|
|
1034
1119
|
if (matchs && matchs.length > 0) {
|
|
1035
1120
|
for (const value of matchs) {
|
|
@@ -1049,7 +1134,7 @@ function matchsStart2(key, matchs) {
|
|
|
1049
1134
|
}
|
|
1050
1135
|
}
|
|
1051
1136
|
|
|
1052
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1137
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
|
|
1053
1138
|
function matchsEnd2(key, matchs) {
|
|
1054
1139
|
if (matchs && matchs.length > 0) {
|
|
1055
1140
|
for (const value of matchs) {
|
|
@@ -1341,7 +1426,7 @@ function getRawValue(comRaw, key) {
|
|
|
1341
1426
|
}
|
|
1342
1427
|
}
|
|
1343
1428
|
|
|
1344
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1429
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
|
|
1345
1430
|
function deComment(code) {
|
|
1346
1431
|
let output = "";
|
|
1347
1432
|
let state = "code";
|
|
@@ -1433,7 +1518,7 @@ function deComment(code) {
|
|
|
1433
1518
|
return output;
|
|
1434
1519
|
}
|
|
1435
1520
|
|
|
1436
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1521
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
|
|
1437
1522
|
function getImports(code, includeType = false) {
|
|
1438
1523
|
code = deComment(code);
|
|
1439
1524
|
const imports = /* @__PURE__ */ new Set();
|
|
@@ -1580,7 +1665,7 @@ function getURLalias(value) {
|
|
|
1580
1665
|
async function getImport(text, type) {
|
|
1581
1666
|
let jstext = "";
|
|
1582
1667
|
if (type == "vue") {
|
|
1583
|
-
jstext =
|
|
1668
|
+
jstext = getVueText(text).script;
|
|
1584
1669
|
} else if (type == "js" || type == "ts" || type == "") {
|
|
1585
1670
|
jstext = text;
|
|
1586
1671
|
}
|
|
@@ -3765,7 +3850,7 @@ var top_default2 = (0, import_vue2.defineComponent)({
|
|
|
3765
3850
|
}
|
|
3766
3851
|
});
|
|
3767
3852
|
|
|
3768
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
3853
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
|
|
3769
3854
|
var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
|
|
3770
3855
|
function getFunctionFormat(v) {
|
|
3771
3856
|
if (!v) return;
|
package/dist/node/index.js
CHANGED
|
@@ -58,12 +58,12 @@ var init_prettier = __esm({
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
61
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-5PX3AFSC.js
|
|
62
62
|
function isArray(obj2) {
|
|
63
63
|
return Object.prototype.toString.call(obj2) == "[object Array]";
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
66
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-A276ZDLP.js
|
|
67
67
|
function getStartSames(str, val) {
|
|
68
68
|
let s = "";
|
|
69
69
|
const vs = [...val];
|
|
@@ -79,7 +79,7 @@ function getStartSames(str, val) {
|
|
|
79
79
|
return [s, str.substring(index), val.substring(index)];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
82
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-KDOS4NFR.js
|
|
83
83
|
function getImportUrl(url, imp) {
|
|
84
84
|
const arr = getStartSames(url, imp);
|
|
85
85
|
const ts2 = arr[0];
|
|
@@ -103,12 +103,12 @@ function getImportUrl(url, imp) {
|
|
|
103
103
|
return ds.join("") + arr[2].replace(/\\/g, "/");
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
106
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-EWJJKQIO.js
|
|
107
107
|
function firstUpper(str) {
|
|
108
108
|
return str.slice(0, 1).toUpperCase() + str.slice(1);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
111
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-XCDKXZFR.js
|
|
112
112
|
function lineToLargeHump(name) {
|
|
113
113
|
let arr = name.split("-");
|
|
114
114
|
arr = arr.map((vs) => {
|
|
@@ -828,7 +828,7 @@ function runDev(config2, configCallback) {
|
|
|
828
828
|
return new FangMd(config2, configCallback);
|
|
829
829
|
}
|
|
830
830
|
|
|
831
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
831
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-NCSN3MC5.js
|
|
832
832
|
var zObj = {
|
|
833
833
|
"<": "<",
|
|
834
834
|
">": ">",
|
|
@@ -849,7 +849,7 @@ function htmlEscape(str) {
|
|
|
849
849
|
// packages/node/index.ts
|
|
850
850
|
import { join as join4 } from "path";
|
|
851
851
|
|
|
852
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
852
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-RD4EP3M5.js
|
|
853
853
|
function mergeObject(a, b, j = 0, i) {
|
|
854
854
|
if (a instanceof Array) {
|
|
855
855
|
if (j > 0 && i) {
|
|
@@ -903,54 +903,139 @@ function getConfig(key) {
|
|
|
903
903
|
return config[key];
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
907
|
-
function
|
|
908
|
-
const result =
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
const customBlockRegex = /<([a-z][a-z0-9-]*)([\s\S]*?)>([\s\S]*?)<\/\1>/g;
|
|
934
|
-
let customMatch;
|
|
935
|
-
while ((customMatch = customBlockRegex.exec(content)) !== null) {
|
|
936
|
-
if (!["template", "script", "style"].includes(customMatch[1])) {
|
|
937
|
-
result.customBlocks.push({
|
|
938
|
-
type: customMatch[1],
|
|
939
|
-
content: customMatch[3]
|
|
940
|
-
});
|
|
906
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-H3AJ6I4R.js
|
|
907
|
+
function getBlocks(content) {
|
|
908
|
+
const result = [];
|
|
909
|
+
function findMatchingEndTag(content2, startIndex, tagName) {
|
|
910
|
+
const endTag = `</${tagName}>`;
|
|
911
|
+
let i2 = startIndex;
|
|
912
|
+
let depth = 1;
|
|
913
|
+
while (i2 < content2.length) {
|
|
914
|
+
const nextOpen = content2.indexOf("<", i2);
|
|
915
|
+
if (nextOpen === -1) return -1;
|
|
916
|
+
if (content2[nextOpen + 1] === "/") {
|
|
917
|
+
if (content2.substring(nextOpen, nextOpen + endTag.length) === endTag) {
|
|
918
|
+
depth--;
|
|
919
|
+
if (depth === 0) {
|
|
920
|
+
return nextOpen;
|
|
921
|
+
}
|
|
922
|
+
i2 = nextOpen + endTag.length;
|
|
923
|
+
} else {
|
|
924
|
+
i2 = nextOpen + 1;
|
|
925
|
+
}
|
|
926
|
+
} else {
|
|
927
|
+
const nextTagMatch = content2.substring(nextOpen).match(/^<([a-zA-Z][a-zA-Z0-9\-]*)/);
|
|
928
|
+
if (nextTagMatch && nextTagMatch[1].toLowerCase() === tagName.toLowerCase()) {
|
|
929
|
+
depth++;
|
|
930
|
+
}
|
|
931
|
+
i2 = nextOpen + 1;
|
|
932
|
+
}
|
|
941
933
|
}
|
|
934
|
+
return -1;
|
|
935
|
+
}
|
|
936
|
+
let i = 0;
|
|
937
|
+
while (i < content.length) {
|
|
938
|
+
const openTagIndex = content.indexOf("<", i);
|
|
939
|
+
if (openTagIndex === -1) break;
|
|
940
|
+
if (content[openTagIndex + 1] === "/") {
|
|
941
|
+
i = openTagIndex + 1;
|
|
942
|
+
continue;
|
|
943
|
+
}
|
|
944
|
+
const tagMatch = content.substring(openTagIndex).match(/^<([a-zA-Z][a-zA-Z0-9\-]*)/);
|
|
945
|
+
if (!tagMatch) {
|
|
946
|
+
i = openTagIndex + 1;
|
|
947
|
+
continue;
|
|
948
|
+
}
|
|
949
|
+
const tagName = tagMatch[1].toLowerCase();
|
|
950
|
+
let startTagEnd = openTagIndex + tagMatch[0].length;
|
|
951
|
+
let inQuotes = false;
|
|
952
|
+
let quoteChar = "";
|
|
953
|
+
while (startTagEnd < content.length) {
|
|
954
|
+
const char = content[startTagEnd];
|
|
955
|
+
if (!inQuotes) {
|
|
956
|
+
if (char === ">") {
|
|
957
|
+
startTagEnd++;
|
|
958
|
+
break;
|
|
959
|
+
} else if (char === '"' || char === "'") {
|
|
960
|
+
inQuotes = true;
|
|
961
|
+
quoteChar = char;
|
|
962
|
+
}
|
|
963
|
+
} else {
|
|
964
|
+
if (char === quoteChar && content[startTagEnd - 1] !== "\\") {
|
|
965
|
+
inQuotes = false;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
startTagEnd++;
|
|
969
|
+
}
|
|
970
|
+
if (startTagEnd >= content.length) {
|
|
971
|
+
i = openTagIndex + 1;
|
|
972
|
+
continue;
|
|
973
|
+
}
|
|
974
|
+
const endTagIndex = findMatchingEndTag(content, startTagEnd, tagName);
|
|
975
|
+
if (endTagIndex === -1) {
|
|
976
|
+
if (content.substring(startTagEnd - 2, startTagEnd) === "/>") {
|
|
977
|
+
const selfClosingBlock = content.substring(
|
|
978
|
+
openTagIndex,
|
|
979
|
+
startTagEnd
|
|
980
|
+
);
|
|
981
|
+
result.push({
|
|
982
|
+
type: tagName,
|
|
983
|
+
content: "",
|
|
984
|
+
block: selfClosingBlock
|
|
985
|
+
});
|
|
986
|
+
i = startTagEnd;
|
|
987
|
+
} else {
|
|
988
|
+
i = startTagEnd;
|
|
989
|
+
}
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
const endTagLength = `</${tagName}>`.length;
|
|
993
|
+
const tagContent = content.substring(startTagEnd, endTagIndex).trim();
|
|
994
|
+
const wholeBlock = content.substring(
|
|
995
|
+
openTagIndex,
|
|
996
|
+
endTagIndex + endTagLength
|
|
997
|
+
);
|
|
998
|
+
result.push({
|
|
999
|
+
type: tagName,
|
|
1000
|
+
content: tagContent,
|
|
1001
|
+
block: wholeBlock
|
|
1002
|
+
});
|
|
1003
|
+
i = endTagIndex + endTagLength;
|
|
942
1004
|
}
|
|
943
1005
|
return result;
|
|
944
1006
|
}
|
|
1007
|
+
function filterBlocksByType(blocks, type) {
|
|
1008
|
+
return blocks.filter((block) => block.type === type);
|
|
1009
|
+
}
|
|
1010
|
+
function getVueComponents(content) {
|
|
1011
|
+
const blocks = getBlocks(content);
|
|
1012
|
+
return {
|
|
1013
|
+
templates: filterBlocksByType(blocks, "template"),
|
|
1014
|
+
scripts: filterBlocksByType(blocks, "script"),
|
|
1015
|
+
styles: filterBlocksByType(blocks, "style"),
|
|
1016
|
+
customBlocks: blocks.filter(
|
|
1017
|
+
(block) => !["template", "script", "style"].includes(block.type)
|
|
1018
|
+
)
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
945
1021
|
function getVueTexts(content) {
|
|
946
|
-
const obj2 =
|
|
1022
|
+
const obj2 = getVueComponents(content);
|
|
1023
|
+
return {
|
|
1024
|
+
templates: obj2.templates,
|
|
1025
|
+
scripts: obj2.scripts,
|
|
1026
|
+
styles: obj2.styles
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
function getVueText(content) {
|
|
1030
|
+
const obj2 = getVueTexts(content);
|
|
947
1031
|
return {
|
|
948
|
-
|
|
949
|
-
|
|
1032
|
+
template: obj2.templates.map((o) => o.content).join("\n"),
|
|
1033
|
+
script: obj2.scripts.map((o) => o.content).join("\n"),
|
|
1034
|
+
style: obj2.styles.map((o) => o.content).join("\n")
|
|
950
1035
|
};
|
|
951
1036
|
}
|
|
952
1037
|
|
|
953
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1038
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-J7CICTHH.js
|
|
954
1039
|
function humpToLine(name) {
|
|
955
1040
|
const reg = /(([A-Z])([^A-Z]*))/g;
|
|
956
1041
|
let result;
|
|
@@ -972,12 +1057,12 @@ function humpToLine(name) {
|
|
|
972
1057
|
}
|
|
973
1058
|
}
|
|
974
1059
|
|
|
975
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1060
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-4OBNLDTJ.js
|
|
976
1061
|
function firstLower(str) {
|
|
977
1062
|
return str.slice(0, 1).toLowerCase() + str.slice(1);
|
|
978
1063
|
}
|
|
979
1064
|
|
|
980
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1065
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Q6FMBSK4.js
|
|
981
1066
|
function asyncMergeArray(arr, callback) {
|
|
982
1067
|
return new Promise((resolve2, reject) => {
|
|
983
1068
|
let index = 0;
|
|
@@ -1001,7 +1086,7 @@ function asyncMergeArray(arr, callback) {
|
|
|
1001
1086
|
});
|
|
1002
1087
|
}
|
|
1003
1088
|
|
|
1004
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1089
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Z7NTQAAJ.js
|
|
1005
1090
|
function getSuffix2(url) {
|
|
1006
1091
|
const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
|
|
1007
1092
|
const regs = reg.exec(url);
|
|
@@ -1011,7 +1096,7 @@ function getSuffix2(url) {
|
|
|
1011
1096
|
return "";
|
|
1012
1097
|
}
|
|
1013
1098
|
|
|
1014
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1099
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-S6JRKYPY.js
|
|
1015
1100
|
function matchsStart2(key, matchs) {
|
|
1016
1101
|
if (matchs && matchs.length > 0) {
|
|
1017
1102
|
for (const value of matchs) {
|
|
@@ -1031,7 +1116,7 @@ function matchsStart2(key, matchs) {
|
|
|
1031
1116
|
}
|
|
1032
1117
|
}
|
|
1033
1118
|
|
|
1034
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1119
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-YNOFNHEK.js
|
|
1035
1120
|
function matchsEnd2(key, matchs) {
|
|
1036
1121
|
if (matchs && matchs.length > 0) {
|
|
1037
1122
|
for (const value of matchs) {
|
|
@@ -1323,7 +1408,7 @@ function getRawValue(comRaw, key) {
|
|
|
1323
1408
|
}
|
|
1324
1409
|
}
|
|
1325
1410
|
|
|
1326
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1411
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-FS4JPT23.js
|
|
1327
1412
|
function deComment(code) {
|
|
1328
1413
|
let output = "";
|
|
1329
1414
|
let state = "code";
|
|
@@ -1415,7 +1500,7 @@ function deComment(code) {
|
|
|
1415
1500
|
return output;
|
|
1416
1501
|
}
|
|
1417
1502
|
|
|
1418
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
1503
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-N5Y3XGHX.js
|
|
1419
1504
|
function getImports(code, includeType = false) {
|
|
1420
1505
|
code = deComment(code);
|
|
1421
1506
|
const imports = /* @__PURE__ */ new Set();
|
|
@@ -1562,7 +1647,7 @@ function getURLalias(value) {
|
|
|
1562
1647
|
async function getImport(text, type) {
|
|
1563
1648
|
let jstext = "";
|
|
1564
1649
|
if (type == "vue") {
|
|
1565
|
-
jstext =
|
|
1650
|
+
jstext = getVueText(text).script;
|
|
1566
1651
|
} else if (type == "js" || type == "ts" || type == "") {
|
|
1567
1652
|
jstext = text;
|
|
1568
1653
|
}
|
|
@@ -3747,7 +3832,7 @@ var top_default2 = defineComponent2({
|
|
|
3747
3832
|
}
|
|
3748
3833
|
});
|
|
3749
3834
|
|
|
3750
|
-
// node_modules/.pnpm/@fangzhongya+utils@0.0.
|
|
3835
|
+
// node_modules/.pnpm/@fangzhongya+utils@0.0.80/node_modules/@fangzhongya/utils/dist/chunk-Q6BNW3MO.js
|
|
3751
3836
|
var FUNCTION_REGEX = /^\s*(?:(async)\s+)?(?:function\s*(\*?)\s*(\w*)\s*\(([\s\S]*?)\)|(\*?\s*)\b(\w+)\s*\(([\s\S]*?)\)|\(([\s\S]*?)\)|([^=>,\(\)]+?))\s*(?:=>)?\s*(?:\{([\s\S]*?)\}|([\s\S]*))$/;
|
|
3752
3837
|
function getFunctionFormat(v) {
|
|
3753
3838
|
if (!v) return;
|
package/dist/packages/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});;/* empty css */const t=require("./router/index.cjs"),i=require("./config.cjs");function r(n){if(typeof n=="function"){const e=n();return e instanceof Promise?e.then(i.userConfig):i.userConfig(e)}else return i.userConfig(n)}const u={install:function(n,e){t.init(e),n.use(e)}};exports.init=t.init;exports.default=u;exports.defineConfig=r;
|
package/dist/packages/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { init } from './router/index';
|
|
|
2
2
|
import { Config } from './config';
|
|
3
3
|
import { App } from '../vue/dist/vue.esm-bundler.js';
|
|
4
4
|
import { Router } from 'vue-router';
|
|
5
|
-
export declare function defineConfig(config: Config): Config
|
|
5
|
+
export declare function defineConfig(config: Config | (() => Config | Promise<Config>)): Config | Promise<Config>;
|
|
6
6
|
export { init };
|
|
7
7
|
declare const _default: {
|
|
8
8
|
install: (app: App, router: Router) => void;
|
package/dist/packages/index.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { init as
|
|
3
|
-
import { userConfig as
|
|
4
|
-
function
|
|
5
|
-
|
|
2
|
+
import { init as i } from "./router/index.js";
|
|
3
|
+
import { userConfig as e } from "./config.js";
|
|
4
|
+
function s(t) {
|
|
5
|
+
if (typeof t == "function") {
|
|
6
|
+
const n = t();
|
|
7
|
+
return n instanceof Promise ? n.then(e) : e(n);
|
|
8
|
+
} else
|
|
9
|
+
return e(t);
|
|
6
10
|
}
|
|
7
|
-
const
|
|
8
|
-
install: function(
|
|
9
|
-
|
|
11
|
+
const u = {
|
|
12
|
+
install: function(t, n) {
|
|
13
|
+
i(n), t.use(n);
|
|
10
14
|
}
|
|
11
15
|
};
|
|
12
16
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
u as default,
|
|
18
|
+
s as defineConfig,
|
|
19
|
+
i as init
|
|
16
20
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../config.cjs"),z=require("@fangzhongya/utils/html/getVueText"),p=require("./common.cjs"),F=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const T=require("@fangzhongya/utils/name/humpToLine"),v=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const A=require("@fangzhongya/utils/basic/string/firstLower"),D=require("@fangzhongya/utils/basic/array/duplicateRemoval"),W=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 J=require("./index.cjs"),w={},R={},M=[],$={},j={},m={};function Q(){return S.getConfig("example")}function X(t,e,n,r){const a=F.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 l=a.examplesRaw,u=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(o=>{u.push(o),l&&(m[o]=N(l,o))})):(a.exampless=s,l&&Object.keys(l).forEach(o=>{u.push(o),m[o]=N(l,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),u.push(f),m[f]=N(r,f))}):Object.keys(r).forEach(f=>{o.test(f)&&(a.exampless.push(f),u.push(f),m[f]=N(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(u)],a.examplesRaw=void 0,$[t]=a}function N(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function Y(t){const e=S.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 Z(t,e){let n="";if(e=="vue"?n=z.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../config.cjs"),z=require("@fangzhongya/utils/html/getVueText"),p=require("./common.cjs"),F=require("@fangzhongya/utils/basic/object/mergeObject");require("@fangzhongya/utils/basic/array/toggleArray");const T=require("@fangzhongya/utils/name/humpToLine"),v=require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");const A=require("@fangzhongya/utils/basic/string/firstLower"),D=require("@fangzhongya/utils/basic/array/duplicateRemoval"),W=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 J=require("./index.cjs"),w={},R={},M=[],$={},j={},m={};function Q(){return S.getConfig("example")}function X(t,e,n,r){const a=F.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 l=a.examplesRaw,u=[];if(a.urls&&a.urls.length>0?(a.exampless=a.urls,a.urls.forEach(o=>{u.push(o),l&&(m[o]=N(l,o))})):(a.exampless=s,l&&Object.keys(l).forEach(o=>{u.push(o),m[o]=N(l,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),u.push(f),m[f]=N(r,f))}):Object.keys(r).forEach(f=>{o.test(f)&&(a.exampless.push(f),u.push(f),m[f]=N(r,f))})}a.exampless=[...new Set(a.exampless)],a.examplessRaw=[...new Set(u)],a.examplesRaw=void 0,$[t]=a}function N(t,e){return typeof t=="function"?t:t&&(t[e]||t)}const q={};function Y(t){const e=S.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 Z(t,e){let n="";if(e=="vue"?n=z.getVueText(t).script:(e=="js"||e=="ts"||e=="")&&(n=t),n){const r=await J.getTextImport(n),a=[];return r&&r.length>0&&r.forEach(s=>{if(s)if(s.startsWith("./")||s.startsWith("../"))a.push(s);else{const i=Y(s);i&&a.push(i)}}),a}}function _(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 y(t,e,n){t=(t||"")+"",n=(n||"")+"";let r=T.humpToLine(e.name),a=[];t==="1"?e.alias&&a.push(e.alias+"-"+r):t==="3"?e.alias&&e.alias+"":t==="4"?e.aliasNames?.forEach(i=>{a.push(T.humpToLine(i))}):t=="9"&&(a.push(r),e.aliasNames?.forEach(i=>{a.push(T.humpToLine(i))})),a.length==0&&a.push(r);let s=[];return n==="1"?a.forEach(i=>{let l=v.lineToLargeHump(i);s.push(l,A.firstLower(l))}):n==="2"?a.forEach(i=>{let l=v.lineToLargeHump(i);s.push(i,l,A.firstLower(l))}):s=[...a],s=[...new Set(s)],s}function k(t,e,n,r){const a=[];return n.examplessRaw.forEach(s=>{for(let i=0;i<e.length;i++){const l=e[i];if(s==t+l+n.md+".md"){a.push({cwd:n.cwd||r.cwd,topurl:t,comkey:r.key,suffix:h.getSuffix(s),name:r.name,value:l,key:s,raw:"",getRaw:p.getRawValue(m,s)});break}}}),a}function P(t){O();const e=w[t];if(e.tests&&Object.keys(e.tests).length>0)return e.tests;{const n=$[e.dir],r=n.dir+K(n.level||0,e),a=y(n.aliaslevel||0,e,n.componentName||0);e.mds=k(r,a,n,e);const s={};return n.exampless.forEach(i=>{for(let l=0;l<a.length;l++){const u=a[l];if(i.startsWith(r+u+"/")){const o=new RegExp("/([^/]+)/index\\."+p.defaultExtensions.join("|")+"$"),f=new RegExp("/([^/]+)\\."+p.defaultExtensions.join("|")+"$");let c=i.match(o)||i.match(f);if(c&&c.length>0){let g="";c&&c.length>1&&(g=c[1]),s[i]={topurl:r,name:u,value:g,suffix:h.getSuffix(i),comname:e.name,comkey:e.key,cwd:n.cwd||e.cwd,key:i,dir:e.dir,url:i,component:j[i],raw:"",getRaw:p.getRawValue(m,i)};break}}}}),n.tests&&ee(s,e,n),e.tests=s,s}}function ee(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({cwd:e.cwd,topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:p.getRawValue(m,s)});else if(s.startsWith(r+a)){const i=new RegExp("/([^/]+)/index\\."+p.defaultExtensions.join("|")+"$"),l=new RegExp("/([^/]+)\\."+p.defaultExtensions.join("|")+"$");let u=s.match(i)||s.match(l);if(u&&u[1]){let o="";u&&u.length>1&&(o=u[1]),t[s]={topurl:r,name:e.value,value:o,suffix:h.getSuffix(s),comname:e.name,comkey:e.key,cwd:n.cwd||e.cwd,key:s,dir:e.dir,url:s,component:j[s],raw:"",getRaw:p.getRawValue(m,s)}}}}}):n.examplessRaw.forEach(s=>{if(s.startsWith(r+"/")){if(s==r+n.md+".md")e.mds=e.mds||[],e.mds.push({cwd:e.cwd,topurl:r,comkey:e.key,suffix:h.getSuffix(s),name:e.name,value:e.value,key:s,raw:"",getRaw:p.getRawValue(m,s)});else if(a.test(s)){const i=new RegExp("/([^/]+)/index\\."+p.defaultExtensions.join("|")+"$"),l=new RegExp("/([^/]+)\\."+p.defaultExtensions.join("|")+"$");let u=s.match(i)||s.match(l);if(u&&u.length>0){let o="";u&&u.length>1&&(o=u[1]),t[s]={cwd:n.cwd||e.cwd,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:p.getRawValue(m,s)}}}}})}function te(t){if(t){const e=P(t);return Object.values(e)}else return[]}function se(t,e,n){O();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 ne(t){return P(t),w[t].mds}async function U(t,e,n){let r=t.key,a=t.dir,s=t.url,i=t.comprops,l=t.curprops,u=await Z(e,n||t.suffix)||[],o=s.split("/");return u.map(f=>{if(f.startsWith("./")){let c=o.slice(0,o.length-1).join("/"),g=f.substring(2);const d=c.replace(/^\.\/|((\.\.\/)+)/,"/");let x=r.indexOf(d)+d.length;return{key:r.substring(0,x)+"/"+g,name:f,cwd:t.cwd,comprops:i,curprops:l,value:g,suffix:h.getSuffix(f),head:c,dir:a,url:c+"/"+g}}else if(f.startsWith("../")){let c=f.split("/"),g=0;for(let L=0;L<c.length;L++)if(c[L]!=".."){g=L;break}let d=c.slice(g,c.length),x=o.slice(0,o.length-g-1).join("/"),E=d.join("/");const b=x.replace(/^\.\/|((\.\.\/)+)/,"/");let G=r.indexOf(b)+b.length;return{key:r.substring(0,G)+"/"+E,name:E,cwd:t.cwd,comprops:i,curprops:l,value:E,suffix:h.getSuffix(f),head:x,dir:a,url:x+"/"+E}}else{const c=a.replace(/^\.\/|((\.\.\/)+)/,"/");let g=f.indexOf(c)+c.length,d=f.substring(g),x=a.substring(0,a.length-1);return{key:f,name:d,comprops:i,curprops:l,value:d,suffix:h.getSuffix(f),head:x,dir:a,cwd:t.cwd,url:x+"/"+d}}})}function re(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>({...r,raw:"",suffix:h.getSuffix(r.key),getRaw:p.getRawValue(m,r.key)}));W.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(l=>{const u=C(l);s.raw=u,s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}function ae(){const t=Q();S.getConfig("components")?.forEach(n=>{const r=oe(n);let a=n.dir||"";X(a,t,n.example,r)})}const I="default";function ie(t){let e=T.humpToLine(t.name),n=[...t.aliasNames];n.push(e),n.forEach(r=>{M.push({name:r,value:t.key})})}function le(t,e){e?.forEach(n=>{w[n.key]=n,ie(n)})}function oe(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||I;let a=t?.urls||Object.keys(t.componentsRaw);return n=p.getComponentsArr(a,t,t.componentsRaw,t.components),n&&n?.props&&n.props.forEach(s=>{R[s.url]=s}),le(e,n.components),t.componentsRaw}function ue(t){return O(),w[t]}function O(){return Object.keys(w).length==0&&ae(),Object.values(w)}function fe(){return O(),R}function ce(t,e,n){O();const r=[];if(n){let s=w[n];if(s&&s.key)return[s]}let a=T.humpToLine(t);return M.forEach(s=>{e?s.name.includes(a)&&r.push(w[s.value]):s.name==a&&r.push(w[s.value])}),D.duplicateRemoval(r,"key")}function pe(t){const e=t.url,n=t.key;return R[e]||R[e+".js"]||R[e+".ts"]||R[n]||R[n+".js"]||R[n+".ts"]}function H(t){return new Promise(e=>{if(t&&t.length>0){let n=t.map(r=>pe(r)).filter(r=>!!r);W.asyncMergeArray(n,(r,a,s,i)=>{s.raw?r():s.getRaw?s.getRaw(s).then(async l=>{const u=C(l);s.raw=await B(u,t[i]),s.getRaw=null,r()}):r()}).then(()=>{e(n)})}else e([])})}const V=`
|
|
2
2
|
fangzhongya@vue-archive@glob@vue-archive@fangzhongya
|
|
3
3
|
`;function ge(t){const e=t.split(V);return[...new Set(e)].join(`
|
|
4
4
|
`)}async function me(t){return((await H(t))?.map(r=>r.raw)||[]).filter(r=>!!r).join(V)}async function B(t,e){if(t){if(t=`/**${e.url}**/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getConfig as v } from "../config.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getVueText as B } from "@fangzhongya/utils/html/getVueText";
|
|
3
3
|
import { getRawValue as R, isComprops as z, isCurprops as F, getComponentsArr as G, defaultExtensions as E } from "./common.js";
|
|
4
4
|
import { mergeObject as H } from "@fangzhongya/utils/basic/object/mergeObject";
|
|
5
5
|
import "@fangzhongya/utils/basic/array/toggleArray";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fangzhongya/vue-archive",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description ": "vue 组件注释生成文档",
|
|
7
7
|
"author": "fangzhongya ",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@codemirror/lang-javascript": "^6.2.4",
|
|
25
25
|
"@codemirror/lang-json": "^6.0.2",
|
|
26
26
|
"@codemirror/state": "^6.5.4",
|
|
27
|
-
"@codemirror/view": "^6.39.
|
|
27
|
+
"@codemirror/view": "^6.39.13",
|
|
28
28
|
"@fangzhongya/create": "0.2.50",
|
|
29
|
-
"@fangzhongya/utils": "0.0.
|
|
29
|
+
"@fangzhongya/utils": "0.0.80",
|
|
30
30
|
"@fangzhongya/vue-components": "0.1.29",
|
|
31
31
|
"@highlightjs/vue-plugin": "^2.1.0",
|
|
32
|
-
"@types/node": "^25.2.
|
|
32
|
+
"@types/node": "^25.2.2",
|
|
33
33
|
"@vitejs/plugin-vue": "^6.0.4",
|
|
34
34
|
"@vue/compiler-dom": "3.5.27",
|
|
35
35
|
"@vue/compiler-sfc": "3.5.27",
|