@fangzhongya/icons 0.0.50 → 0.0.52
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/async.cjs +56 -105
- package/dist/async.js +50 -104
- package/dist/components.cjs +42 -60
- package/dist/components.js +42 -61
- package/dist/config.cjs +5 -7
- package/dist/config.js +4 -7
- package/dist/humpToLine-Czhat99x.js +25 -0
- package/dist/humpToLine-gLzuzWOm.cjs +30 -0
- package/dist/icon/index.cjs +229 -13
- package/dist/icon/index.js +222 -12
- package/dist/iconify.cjs +102 -16
- package/dist/iconify.js +97 -15
- package/dist/index.cjs +100 -194
- package/dist/index.js +52 -194
- package/dist/index.json +1 -1
- package/dist/json-BpszFHNs.js +62 -0
- package/dist/json-C96CKb6M.cjs +67 -0
- package/dist/json.cjs +2 -7
- package/dist/json.js +2 -7
- package/dist/lineToLargeHump-BajF216g.cjs +30 -0
- package/dist/lineToLargeHump-CHL4-tNE.js +25 -0
- package/dist/name.cjs +68 -15
- package/dist/name.js +65 -15
- package/dist/picker/dialog.cjs +42 -7
- package/dist/picker/dialog.js +42 -7
- package/dist/picker/index.cjs +200 -324
- package/dist/picker/index.js +194 -325
- package/dist/util.cjs +13 -7
- package/dist/util.js +12 -7
- package/dist/vite/index.cjs +848 -1143
- package/dist/vite/index.js +848 -1144
- package/dist/vue/bar.cjs +16 -7
- package/dist/vue/bar.js +16 -7
- package/dist/vue/below.cjs +16 -7
- package/dist/vue/below.js +16 -7
- package/dist/vue/bicycle.cjs +16 -7
- package/dist/vue/bicycle.js +16 -7
- package/dist/vue/bottom-left.cjs +16 -7
- package/dist/vue/bottom-left.js +16 -7
- package/dist/vue/bottom-right.cjs +16 -7
- package/dist/vue/bottom-right.js +16 -7
- package/dist/vue/bottom.cjs +16 -7
- package/dist/vue/bottom.js +16 -7
- package/dist/vue/cascader-field.cjs +16 -7
- package/dist/vue/cascader-field.js +16 -7
- package/dist/vue/catalogue.cjs +16 -7
- package/dist/vue/catalogue.js +16 -7
- package/dist/vue/clear.cjs +16 -7
- package/dist/vue/clear.js +16 -7
- package/dist/vue/close.cjs +16 -7
- package/dist/vue/close.js +16 -7
- package/dist/vue/crl.cjs +16 -7
- package/dist/vue/crl.js +16 -7
- package/dist/vue/delete.cjs +16 -7
- package/dist/vue/delete.js +16 -7
- package/dist/vue/document.cjs +16 -7
- package/dist/vue/document.js +16 -7
- package/dist/vue/down.cjs +16 -7
- package/dist/vue/down.js +16 -7
- package/dist/vue/download.cjs +16 -7
- package/dist/vue/download.js +16 -7
- package/dist/vue/edit.cjs +16 -7
- package/dist/vue/edit.js +16 -7
- package/dist/vue/enter.cjs +16 -7
- package/dist/vue/enter.js +16 -7
- package/dist/vue/folder.cjs +16 -7
- package/dist/vue/folder.js +16 -7
- package/dist/vue/frame.cjs +16 -7
- package/dist/vue/frame.js +16 -7
- package/dist/vue/grid.cjs +16 -7
- package/dist/vue/grid.js +16 -7
- package/dist/vue/hidd.cjs +16 -7
- package/dist/vue/hidd.js +16 -7
- package/dist/vue/home.cjs +16 -7
- package/dist/vue/home.js +16 -7
- package/dist/vue/index.cjs +90 -180
- package/dist/vue/index.js +46 -180
- package/dist/vue/left.cjs +16 -7
- package/dist/vue/left.js +16 -7
- package/dist/vue/lock.cjs +16 -7
- package/dist/vue/lock.js +16 -7
- package/dist/vue/login.cjs +16 -7
- package/dist/vue/login.js +16 -7
- package/dist/vue/logink.cjs +16 -7
- package/dist/vue/logink.js +16 -7
- package/dist/vue/more.cjs +16 -7
- package/dist/vue/more.js +16 -7
- package/dist/vue/mr.cjs +16 -7
- package/dist/vue/mr.js +16 -7
- package/dist/vue/mute.cjs +16 -7
- package/dist/vue/mute.js +16 -7
- package/dist/vue/node-tree.cjs +16 -7
- package/dist/vue/node-tree.js +16 -7
- package/dist/vue/page.cjs +16 -7
- package/dist/vue/page.js +16 -7
- package/dist/vue/pause.cjs +16 -7
- package/dist/vue/pause.js +16 -7
- package/dist/vue/play.cjs +16 -7
- package/dist/vue/play.js +16 -7
- package/dist/vue/plus.cjs +16 -7
- package/dist/vue/plus.js +16 -7
- package/dist/vue/qx.cjs +16 -7
- package/dist/vue/qx.js +16 -7
- package/dist/vue/retreat.cjs +16 -7
- package/dist/vue/retreat.js +16 -7
- package/dist/vue/right.cjs +16 -7
- package/dist/vue/right.js +16 -7
- package/dist/vue/set.cjs +16 -7
- package/dist/vue/set.js +16 -7
- package/dist/vue/sound.cjs +16 -7
- package/dist/vue/sound.js +16 -7
- package/dist/vue/star.cjs +16 -7
- package/dist/vue/star.js +16 -7
- package/dist/vue/sub-form.cjs +16 -7
- package/dist/vue/sub-form.js +16 -7
- package/dist/vue/tab.cjs +16 -7
- package/dist/vue/tab.js +16 -7
- package/dist/vue/up.cjs +16 -7
- package/dist/vue/up.js +16 -7
- package/dist/vue/views.cjs +16 -7
- package/dist/vue/views.js +16 -7
- package/dist/vue-CR8K2hMZ.js +105 -0
- package/dist/vue-XcWpjtqA.cjs +110 -0
- package/package.json +32 -30
- package/dist/async.d.cts +0 -142
- package/dist/async.d.ts +0 -142
- package/dist/chunk-2D4VSAJ2.js +0 -13
- package/dist/chunk-2IK6ZEWL.js +0 -13
- package/dist/chunk-2TQQMTHZ.cjs +0 -13
- package/dist/chunk-32F77IBU.cjs +0 -13
- package/dist/chunk-3376ZTRC.cjs +0 -1
- package/dist/chunk-37O763HE.cjs +0 -152
- package/dist/chunk-37UZO7UL.cjs +0 -31
- package/dist/chunk-3AMDUJDV.js +0 -13
- package/dist/chunk-3AMS6SAI.js +0 -13
- package/dist/chunk-3TRFZFYF.js +0 -13
- package/dist/chunk-3YCLWMP7.cjs +0 -13
- package/dist/chunk-53VWOQDN.cjs +0 -13
- package/dist/chunk-5MQTT7S7.cjs +0 -188
- package/dist/chunk-5PXZNWE4.js +0 -13
- package/dist/chunk-5QUGHNG3.cjs +0 -13
- package/dist/chunk-5XDPKNBI.js +0 -13
- package/dist/chunk-66OLJGLO.js +0 -302
- package/dist/chunk-6BDDZBAQ.js +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-76TLDMR4.cjs +0 -13
- package/dist/chunk-7IBXEWY5.js +0 -13
- package/dist/chunk-7URGGQWA.js +0 -13
- package/dist/chunk-7ZWO2XCS.cjs +0 -13
- package/dist/chunk-AQDYWFIE.cjs +0 -13
- package/dist/chunk-AUEQIRLO.cjs +0 -13
- package/dist/chunk-BEQYH4ZH.js +0 -13
- package/dist/chunk-BMEJLYYZ.js +0 -13
- package/dist/chunk-BXEIRESQ.cjs +0 -17
- package/dist/chunk-BYXBJQAS.js +0 -0
- package/dist/chunk-D4YPZVLI.js +0 -13
- package/dist/chunk-DMNL42QX.cjs +0 -13
- package/dist/chunk-DOKVIYQP.cjs +0 -13
- package/dist/chunk-DSTHXXIG.js +0 -14
- package/dist/chunk-E3I6537N.js +0 -25
- package/dist/chunk-EEMF44IH.cjs +0 -58
- package/dist/chunk-EODYYDJS.js +0 -13
- package/dist/chunk-ERY3BNIM.js +0 -13
- package/dist/chunk-ESPY25SV.cjs +0 -13
- package/dist/chunk-EZJQO3RD.cjs +0 -13
- package/dist/chunk-FEFTZ7TT.cjs +0 -13
- package/dist/chunk-FZTWDRFN.js +0 -13
- package/dist/chunk-H4PA2G3N.cjs +0 -13
- package/dist/chunk-H7QPKI66.cjs +0 -13
- package/dist/chunk-HLATHB47.js +0 -13
- package/dist/chunk-I3A3AEAA.cjs +0 -13
- package/dist/chunk-I3U5MBNO.cjs +0 -13
- package/dist/chunk-I5KQLZMG.js +0 -58
- package/dist/chunk-IBTK77R3.cjs +0 -13
- package/dist/chunk-IEFCX4Q4.cjs +0 -13
- package/dist/chunk-IG3RZSAO.js +0 -152
- package/dist/chunk-IIVF4KK5.cjs +0 -6
- package/dist/chunk-ILE746VV.js +0 -13
- package/dist/chunk-IPHYXYU4.cjs +0 -13
- package/dist/chunk-J4G2OFZ4.js +0 -17
- package/dist/chunk-JJXGNEQB.js +0 -13
- package/dist/chunk-JT3V6FP7.js +0 -13
- package/dist/chunk-K5OMXRSR.js +0 -13
- package/dist/chunk-KDGKC2AD.cjs +0 -13
- package/dist/chunk-KZJIE3RV.cjs +0 -13
- package/dist/chunk-L7KCN6DV.cjs +0 -13
- package/dist/chunk-LBBA76TA.js +0 -13
- package/dist/chunk-LI54LRUK.cjs +0 -13
- package/dist/chunk-LLVO2B4L.js +0 -13
- package/dist/chunk-LZ5V6B6A.cjs +0 -13
- package/dist/chunk-MI2HCYC4.js +0 -13
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-MOHILOKE.js +0 -6
- package/dist/chunk-NEHQ24EP.js +0 -13
- package/dist/chunk-NESEKAGU.cjs +0 -13
- package/dist/chunk-NS5Q6ZYS.js +0 -13
- package/dist/chunk-OIX6AEOH.js +0 -13
- package/dist/chunk-OPZJWWQC.cjs +0 -13
- package/dist/chunk-PM3NSGHO.js +0 -13
- package/dist/chunk-Q7LKAKNO.js +0 -13
- package/dist/chunk-QTMLVSMQ.js +0 -188
- package/dist/chunk-RENPHZI7.cjs +0 -13
- package/dist/chunk-RHPG3BCQ.cjs +0 -13
- package/dist/chunk-S2QMZA7X.js +0 -13
- package/dist/chunk-S7LOBBW2.cjs +0 -13
- package/dist/chunk-T7E6HY2F.js +0 -13
- package/dist/chunk-TCAPRSWP.cjs +0 -13
- package/dist/chunk-TCP7WBEZ.cjs +0 -13
- package/dist/chunk-TT42MDI2.cjs +0 -13
- package/dist/chunk-TZWDBH6E.js +0 -13
- package/dist/chunk-U4CNUH3A.cjs +0 -302
- package/dist/chunk-UMRBYGCW.cjs +0 -13
- package/dist/chunk-UTRCC2RP.js +0 -13
- package/dist/chunk-UVMBRQNS.cjs +0 -13
- package/dist/chunk-UZWXBTQL.js +0 -31
- package/dist/chunk-VDTZORF6.cjs +0 -13
- package/dist/chunk-VO6GNJ4O.js +0 -13
- package/dist/chunk-VQ54VGY3.js +0 -13
- package/dist/chunk-VRWNZZCS.js +0 -13
- package/dist/chunk-W3IE4UWT.cjs +0 -13
- package/dist/chunk-WE4BXFRS.js +0 -13
- package/dist/chunk-WLDTS6EO.js +0 -13
- package/dist/chunk-WOAJW7OB.cjs +0 -13
- package/dist/chunk-WZX5LXRH.cjs +0 -13
- package/dist/chunk-XHXN5JNR.cjs +0 -14
- package/dist/chunk-XUPJ3XJL.js +0 -13
- package/dist/chunk-XYIWDMXZ.cjs +0 -13
- package/dist/chunk-Y2W7MENX.cjs +0 -13
- package/dist/chunk-YBGWOI5B.cjs +0 -13
- package/dist/chunk-YGLV5TML.js +0 -111
- package/dist/chunk-YJLFP6SE.js +0 -13
- package/dist/chunk-YJVFENGG.cjs +0 -111
- package/dist/chunk-YSDDIRK3.js +0 -13
- package/dist/chunk-YUYOWQ5M.js +0 -13
- package/dist/chunk-YW7CKAOG.cjs +0 -25
- package/dist/chunk-YYG5XGJC.js +0 -13
- package/dist/chunk-Z7LHYEQW.js +0 -13
- package/dist/chunk-ZWJ4O3II.cjs +0 -13
- package/dist/components.d.cts +0 -16
- package/dist/components.d.ts +0 -16
- package/dist/config.d.cts +0 -6
- package/dist/config.d.ts +0 -6
- package/dist/icon/index.d.cts +0 -136
- package/dist/icon/index.d.ts +0 -136
- package/dist/iconify.d.cts +0 -53
- package/dist/iconify.d.ts +0 -53
- package/dist/index.d.cts +0 -50
- package/dist/index.d.ts +0 -50
- package/dist/json.d.cts +0 -155
- package/dist/json.d.ts +0 -155
- package/dist/name.d.cts +0 -15
- package/dist/name.d.ts +0 -15
- package/dist/picker/dialog.d.cts +0 -19
- package/dist/picker/dialog.d.ts +0 -19
- package/dist/picker/index.d.cts +0 -123
- package/dist/picker/index.d.ts +0 -123
- package/dist/util.d.cts +0 -6
- package/dist/util.d.ts +0 -6
- package/dist/vite/index.d.cts +0 -56
- package/dist/vite/index.d.ts +0 -56
- package/dist/vue/bar.d.cts +0 -7
- package/dist/vue/bar.d.ts +0 -7
- package/dist/vue/below.d.cts +0 -7
- package/dist/vue/below.d.ts +0 -7
- package/dist/vue/bicycle.d.cts +0 -7
- package/dist/vue/bicycle.d.ts +0 -7
- package/dist/vue/bottom-left.d.cts +0 -7
- package/dist/vue/bottom-left.d.ts +0 -7
- package/dist/vue/bottom-right.d.cts +0 -7
- package/dist/vue/bottom-right.d.ts +0 -7
- package/dist/vue/bottom.d.cts +0 -7
- package/dist/vue/bottom.d.ts +0 -7
- package/dist/vue/cascader-field.d.cts +0 -7
- package/dist/vue/cascader-field.d.ts +0 -7
- package/dist/vue/catalogue.d.cts +0 -7
- package/dist/vue/catalogue.d.ts +0 -7
- package/dist/vue/clear.d.cts +0 -7
- package/dist/vue/clear.d.ts +0 -7
- package/dist/vue/close.d.cts +0 -7
- package/dist/vue/close.d.ts +0 -7
- package/dist/vue/crl.d.cts +0 -7
- package/dist/vue/crl.d.ts +0 -7
- package/dist/vue/delete.d.cts +0 -7
- package/dist/vue/delete.d.ts +0 -7
- package/dist/vue/document.d.cts +0 -7
- package/dist/vue/document.d.ts +0 -7
- package/dist/vue/down.d.cts +0 -7
- package/dist/vue/down.d.ts +0 -7
- package/dist/vue/download.d.cts +0 -7
- package/dist/vue/download.d.ts +0 -7
- package/dist/vue/edit.d.cts +0 -7
- package/dist/vue/edit.d.ts +0 -7
- package/dist/vue/enter.d.cts +0 -7
- package/dist/vue/enter.d.ts +0 -7
- package/dist/vue/folder.d.cts +0 -7
- package/dist/vue/folder.d.ts +0 -7
- package/dist/vue/frame.d.cts +0 -7
- package/dist/vue/frame.d.ts +0 -7
- package/dist/vue/grid.d.cts +0 -7
- package/dist/vue/grid.d.ts +0 -7
- package/dist/vue/hidd.d.cts +0 -7
- package/dist/vue/hidd.d.ts +0 -7
- package/dist/vue/home.d.cts +0 -7
- package/dist/vue/home.d.ts +0 -7
- package/dist/vue/index.d.cts +0 -45
- package/dist/vue/index.d.ts +0 -45
- package/dist/vue/left.d.cts +0 -7
- package/dist/vue/left.d.ts +0 -7
- package/dist/vue/lock.d.cts +0 -7
- package/dist/vue/lock.d.ts +0 -7
- package/dist/vue/login.d.cts +0 -7
- package/dist/vue/login.d.ts +0 -7
- package/dist/vue/logink.d.cts +0 -7
- package/dist/vue/logink.d.ts +0 -7
- package/dist/vue/more.d.cts +0 -7
- package/dist/vue/more.d.ts +0 -7
- package/dist/vue/mr.d.cts +0 -7
- package/dist/vue/mr.d.ts +0 -7
- package/dist/vue/mute.d.cts +0 -7
- package/dist/vue/mute.d.ts +0 -7
- package/dist/vue/node-tree.d.cts +0 -7
- package/dist/vue/node-tree.d.ts +0 -7
- package/dist/vue/page.d.cts +0 -7
- package/dist/vue/page.d.ts +0 -7
- package/dist/vue/pause.d.cts +0 -7
- package/dist/vue/pause.d.ts +0 -7
- package/dist/vue/play.d.cts +0 -7
- package/dist/vue/play.d.ts +0 -7
- package/dist/vue/plus.d.cts +0 -7
- package/dist/vue/plus.d.ts +0 -7
- package/dist/vue/qx.d.cts +0 -7
- package/dist/vue/qx.d.ts +0 -7
- package/dist/vue/retreat.d.cts +0 -7
- package/dist/vue/retreat.d.ts +0 -7
- package/dist/vue/right.d.cts +0 -7
- package/dist/vue/right.d.ts +0 -7
- package/dist/vue/set.d.cts +0 -7
- package/dist/vue/set.d.ts +0 -7
- package/dist/vue/sound.d.cts +0 -7
- package/dist/vue/sound.d.ts +0 -7
- package/dist/vue/star.d.cts +0 -7
- package/dist/vue/star.d.ts +0 -7
- package/dist/vue/sub-form.d.cts +0 -7
- package/dist/vue/sub-form.d.ts +0 -7
- package/dist/vue/tab.d.cts +0 -7
- package/dist/vue/tab.d.ts +0 -7
- package/dist/vue/up.d.cts +0 -7
- package/dist/vue/up.d.ts +0 -7
- package/dist/vue/views.d.cts +0 -7
- package/dist/vue/views.d.ts +0 -7
package/dist/vite/index.cjs
CHANGED
|
@@ -1,955 +1,723 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkBXEIRESQcjs = require('../chunk-BXEIRESQ.cjs');
|
|
10
|
-
require('../chunk-3376ZTRC.cjs');
|
|
11
|
-
require('../chunk-IIVF4KK5.cjs');
|
|
12
|
-
require('../chunk-75ZPJI57.cjs');
|
|
13
|
-
|
|
14
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-ER44O4IJ.js
|
|
15
|
-
function getStartSames(str, val) {
|
|
16
|
-
let s = "";
|
|
17
|
-
const vs = [...val];
|
|
18
|
-
let index = 0;
|
|
19
|
-
for (; index < vs.length; index++) {
|
|
20
|
-
const element = vs[index];
|
|
21
|
-
if (element === str.charAt(index)) {
|
|
22
|
-
s += element;
|
|
23
|
-
} else {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return [s, str.substring(index), val.substring(index)];
|
|
28
|
-
}
|
|
29
|
-
function getImportUrl(url, imp) {
|
|
30
|
-
const arr = getStartSames(url, imp);
|
|
31
|
-
const ts = arr[0];
|
|
32
|
-
if (!/[\\|\/]$/.test(ts)) {
|
|
33
|
-
const regs = ts.match(/[\\|\/]([^\\|\/]*)$/);
|
|
34
|
-
if (regs && regs.length > 0) {
|
|
35
|
-
const a = regs[1];
|
|
36
|
-
arr[0] = ts.substring(0, regs.index + 1);
|
|
37
|
-
arr[1] = a + arr[1];
|
|
38
|
-
arr[2] = a + arr[2];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
const l = arr[1].split(/\\|\//).length - 1;
|
|
42
|
-
let ds = ["./"];
|
|
43
|
-
if (l > 0) {
|
|
44
|
-
ds = [];
|
|
45
|
-
for (let index = 0; index < l; index++) {
|
|
46
|
-
ds.push("../");
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return ds.join("") + arr[2].replace(/\\/g, "/");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-A7RAGYE3.js
|
|
53
|
-
function getImportUrlSuffix(url, imp) {
|
|
54
|
-
return getImportUrl(url, imp).replace(/\.([a-z|A-Z][a-z|A-Z|0-9]*)$/, "");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-36XULS54.js
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _fs = require('fs');
|
|
70
|
-
var _path = require('path');
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_lineToLargeHump = require("../lineToLargeHump-BajF216g.cjs");
|
|
3
|
+
const require_iconify = require("../iconify.cjs");
|
|
4
|
+
const require_json = require("../json-C96CKb6M.cjs");
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
let node_fs = require("node:fs");
|
|
7
|
+
let path = require("path");
|
|
8
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/common-CbVDCztd.js
|
|
71
9
|
function getUrlCatalogueObj(str) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
10
|
+
const reg = /(\\|\/)([^\\|\/]+)\.([a-z|A-Z][a-z|A-Z|0-9]*)$/g;
|
|
11
|
+
const ml = str.replace(reg, "");
|
|
12
|
+
let name = "";
|
|
13
|
+
let suffix = "";
|
|
14
|
+
let apart = "";
|
|
15
|
+
const arr = reg.exec(str);
|
|
16
|
+
if (arr) {
|
|
17
|
+
apart = arr[1];
|
|
18
|
+
name = arr[2];
|
|
19
|
+
suffix = arr[3];
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
catalogue: ml,
|
|
23
|
+
name,
|
|
24
|
+
suffix,
|
|
25
|
+
apart
|
|
26
|
+
};
|
|
89
27
|
}
|
|
90
28
|
function getNewFileName(url) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return obj.catalogue + obj.apart + wb + "." + obj.suffix;
|
|
104
|
-
} else {
|
|
105
|
-
return "";
|
|
106
|
-
}
|
|
29
|
+
const obj = getUrlCatalogueObj(url);
|
|
30
|
+
let wb = obj.name;
|
|
31
|
+
if (wb) {
|
|
32
|
+
const regs = /([0-9]+)$/g.exec(wb);
|
|
33
|
+
if (regs && regs.length > 0) {
|
|
34
|
+
const sl = Number(regs[1]) + 1;
|
|
35
|
+
const reg1 = new RegExp(regs[1] + "$");
|
|
36
|
+
wb = wb.replace(reg1, (sl + "").padStart(regs[1].length, "0"));
|
|
37
|
+
} else wb = wb + "1";
|
|
38
|
+
return obj.catalogue + obj.apart + wb + "." + obj.suffix;
|
|
39
|
+
} else return "";
|
|
107
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 读取文件内容
|
|
43
|
+
* @param url 文件地址
|
|
44
|
+
* @param type 文件编码
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
108
47
|
function fsReadFile(url, type) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
resolve3(dataStr);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
48
|
+
if (!type || type === true) type = "utf-8";
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
(0, node_fs.readFile)(url, type, (err, dataStr) => {
|
|
51
|
+
if (err) {
|
|
52
|
+
console.log("2", err);
|
|
53
|
+
reject("");
|
|
54
|
+
} else resolve(dataStr);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
122
57
|
}
|
|
123
58
|
function fsCreateReadStream(url, type) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
});
|
|
143
|
-
});
|
|
59
|
+
if (!type || type === true) type = "utf-8";
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
const stream = (0, node_fs.createReadStream)(url, {
|
|
62
|
+
start: 0,
|
|
63
|
+
end: 100,
|
|
64
|
+
encoding: type
|
|
65
|
+
});
|
|
66
|
+
let st = "";
|
|
67
|
+
stream.on("data", (data) => {
|
|
68
|
+
st += data;
|
|
69
|
+
});
|
|
70
|
+
stream.on("end", () => {
|
|
71
|
+
resolve(st);
|
|
72
|
+
});
|
|
73
|
+
stream.on("error", () => {
|
|
74
|
+
resolve("");
|
|
75
|
+
});
|
|
76
|
+
});
|
|
144
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* 判断文件夹是否存在
|
|
80
|
+
* @param reaPath {String} 文件路径
|
|
81
|
+
* @returns {Promise<boolean>}
|
|
82
|
+
*/
|
|
145
83
|
function fsAccess(reaPath) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
resolve3(false);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
84
|
+
return new Promise((resolve) => {
|
|
85
|
+
try {
|
|
86
|
+
(0, node_fs.access)(reaPath, node_fs.constants.F_OK, (err) => {
|
|
87
|
+
if (err) resolve(false);
|
|
88
|
+
else resolve(true);
|
|
89
|
+
});
|
|
90
|
+
} catch (e) {
|
|
91
|
+
resolve(false);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
159
94
|
}
|
|
160
95
|
function fsReaddir(filePath) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
} else {
|
|
196
|
-
resolve3({
|
|
197
|
-
file,
|
|
198
|
-
dirs
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
});
|
|
96
|
+
return new Promise((resolve, reject) => {
|
|
97
|
+
(0, node_fs.readdir)(filePath, (err, files) => {
|
|
98
|
+
if (err) reject(err);
|
|
99
|
+
else {
|
|
100
|
+
const lg = files.length;
|
|
101
|
+
const dirs = [];
|
|
102
|
+
const file = [];
|
|
103
|
+
if (lg) {
|
|
104
|
+
let i = 0;
|
|
105
|
+
files.forEach((filename) => {
|
|
106
|
+
(0, node_fs.stat)((0, node_path.join)(filePath, filename), (err, stats) => {
|
|
107
|
+
i++;
|
|
108
|
+
if (err) console.log("4", err);
|
|
109
|
+
else {
|
|
110
|
+
const isFile = stats.isFile();
|
|
111
|
+
const isDir = stats.isDirectory();
|
|
112
|
+
if (isFile) file.push(filename);
|
|
113
|
+
if (isDir) dirs.push(filename);
|
|
114
|
+
}
|
|
115
|
+
if (i >= lg) resolve({
|
|
116
|
+
file,
|
|
117
|
+
dirs
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
} else resolve({
|
|
122
|
+
file,
|
|
123
|
+
dirs
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
204
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* 异步地打开文件。详见 open(2)。 flags 可以是:
|
|
131
|
+
* 以写入模式打开文件。文件会被创建(如果文件不存在)或截断(如果文件存在)。
|
|
132
|
+
* @param {*} path
|
|
133
|
+
* @param {*} json
|
|
134
|
+
* @param {number} type
|
|
135
|
+
* 0 文件不存在,或者存在都写入数据
|
|
136
|
+
* 1 文件不存在 就不写入数据
|
|
137
|
+
* 2 文件不存在 才写入数据
|
|
138
|
+
* 3 如果文件存在,追加
|
|
139
|
+
* @param {*} callback
|
|
140
|
+
*/
|
|
205
141
|
function fsOpenStream(path, json, type = 0, cover, callback) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (path) {
|
|
237
|
-
fsOpenStream(path, json, type, cover, callback);
|
|
238
|
-
} else {
|
|
239
|
-
if (callback) {
|
|
240
|
-
callback(path, 3, false, type);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
if (callback) {
|
|
245
|
-
callback(path, 2, false, type);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
} else {
|
|
249
|
-
if (callback) {
|
|
250
|
-
callback(path, 0, false, type);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
} else {
|
|
254
|
-
if (type != 1) {
|
|
255
|
-
_fs.write.call(void 0, fd, json, (err2) => {
|
|
256
|
-
if (err2) {
|
|
257
|
-
console.log("8", err2);
|
|
258
|
-
if (callback) {
|
|
259
|
-
callback(path, 1, false, type);
|
|
260
|
-
}
|
|
261
|
-
} else {
|
|
262
|
-
if (callback) {
|
|
263
|
-
callback(path, 1, true, type);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
} else {
|
|
268
|
-
if (callback) {
|
|
269
|
-
callback(path, 1, false, type);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
});
|
|
142
|
+
(0, node_fs.open)(path, "wx", async (err, fd) => {
|
|
143
|
+
if (err) {
|
|
144
|
+
if (err.code === "EEXIST") {
|
|
145
|
+
if (type == 1 || type == 0) {
|
|
146
|
+
const fwrite = () => {
|
|
147
|
+
(0, node_fs.writeFile)(path, json, "utf-8", (err) => {
|
|
148
|
+
if (err) {
|
|
149
|
+
console.log("6", err);
|
|
150
|
+
if (callback) callback(path, cover ? 3 : 2, false, type);
|
|
151
|
+
} else if (callback) callback(path, cover ? 3 : 2, true, type);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
if (cover) {
|
|
155
|
+
if (!(await fsCreateReadStream(path)).includes("@config cover=true")) fwrite();
|
|
156
|
+
else if (callback) callback(path, 3, false, type);
|
|
157
|
+
} else fwrite();
|
|
158
|
+
} else if (type == 3) {
|
|
159
|
+
path = getNewFileName(path);
|
|
160
|
+
if (path) fsOpenStream(path, json, type, cover, callback);
|
|
161
|
+
else if (callback) callback(path, 3, false, type);
|
|
162
|
+
} else if (callback) callback(path, 2, false, type);
|
|
163
|
+
} else if (callback) callback(path, 0, false, type);
|
|
164
|
+
} else if (type != 1) (0, node_fs.write)(fd, json, (err) => {
|
|
165
|
+
if (err) {
|
|
166
|
+
console.log("8", err);
|
|
167
|
+
if (callback) callback(path, 1, false, type);
|
|
168
|
+
} else if (callback) callback(path, 1, true, type);
|
|
169
|
+
});
|
|
170
|
+
else if (callback) callback(path, 1, false, type);
|
|
171
|
+
});
|
|
274
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* 判断文件夹是否存在,不存在可以直接创建
|
|
175
|
+
* @param reaPath {String} 文件路径
|
|
176
|
+
* @returns {Promise<boolean>}
|
|
177
|
+
*/
|
|
275
178
|
function fsMkdir(reaPath, callback) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
} else {
|
|
283
|
-
if (callback) {
|
|
284
|
-
callback(reaPath, true, path);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
});
|
|
179
|
+
(0, node_fs.mkdir)(reaPath, { recursive: true }, (err, path) => {
|
|
180
|
+
if (err) {
|
|
181
|
+
console.log("0", err);
|
|
182
|
+
if (callback) callback(reaPath, false);
|
|
183
|
+
} else if (callback) callback(reaPath, true, path);
|
|
184
|
+
});
|
|
288
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* 当前目录文件地址
|
|
188
|
+
* @param url 文件目录地址
|
|
189
|
+
* @param callback 执行回调方法
|
|
190
|
+
* @returns
|
|
191
|
+
*/
|
|
289
192
|
function writeInit(url, callback, isDirs, isFile, issynch) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
url,
|
|
295
|
-
data,
|
|
296
|
-
callback,
|
|
297
|
-
isDirs,
|
|
298
|
-
isFile,
|
|
299
|
-
issynch
|
|
300
|
-
);
|
|
301
|
-
resolve3(arr);
|
|
302
|
-
} else {
|
|
303
|
-
resolve3([]);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
193
|
+
return new Promise(async (resolve) => {
|
|
194
|
+
if (url) resolve(await writeFileUrl(url, await fsReaddir(url), callback, isDirs, isFile, issynch));
|
|
195
|
+
else resolve([]);
|
|
196
|
+
});
|
|
306
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* 读取子目录
|
|
200
|
+
* @param url
|
|
201
|
+
* @param file
|
|
202
|
+
* @param callback
|
|
203
|
+
* @returns
|
|
204
|
+
*/
|
|
307
205
|
function writeFileUrl(url, files, callback, isDirs, isFile, issynch) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (isFile) {
|
|
337
|
-
is = isFile(url, name);
|
|
338
|
-
}
|
|
339
|
-
if (is) {
|
|
340
|
-
file.push(name);
|
|
341
|
-
arr.push(_path.join.call(void 0, url, name));
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
files.file = file;
|
|
346
|
-
if (callback) {
|
|
347
|
-
if (issynch) {
|
|
348
|
-
await callback(url, files, arr);
|
|
349
|
-
} else {
|
|
350
|
-
callback(url, files, arr);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
resolve3(arr);
|
|
354
|
-
});
|
|
206
|
+
return new Promise(async (resolve) => {
|
|
207
|
+
const arr = [];
|
|
208
|
+
const dirs = [];
|
|
209
|
+
if (files.dirs.length > 0) for (let i = 0; i < files.dirs.length; i++) {
|
|
210
|
+
const dir = files.dirs[i];
|
|
211
|
+
let is = true;
|
|
212
|
+
if (isDirs) is = isDirs(url, dir);
|
|
213
|
+
if (is) {
|
|
214
|
+
dirs.push(dir);
|
|
215
|
+
const urls = await writeInit((0, node_path.join)(url, dir), callback, isDirs, isFile, issynch);
|
|
216
|
+
arr.push(...urls);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
files.dirs = dirs;
|
|
220
|
+
const file = [];
|
|
221
|
+
if (files.file.length > 0) files.file.forEach((name) => {
|
|
222
|
+
let is = true;
|
|
223
|
+
if (isFile) is = isFile(url, name);
|
|
224
|
+
if (is) {
|
|
225
|
+
file.push(name);
|
|
226
|
+
arr.push((0, node_path.join)(url, name));
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
files.file = file;
|
|
230
|
+
if (callback) if (issynch) await callback(url, files, arr);
|
|
231
|
+
else callback(url, files, arr);
|
|
232
|
+
resolve(arr);
|
|
233
|
+
});
|
|
355
234
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/com-CzlVBzld.js
|
|
359
237
|
function styleLog(msg = "", obj) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
if (obj == null ? void 0 : obj.bag) {
|
|
374
|
-
arr.push(`\x1B[4${obj == null ? void 0 : obj.bag}m`);
|
|
375
|
-
} else {
|
|
376
|
-
arr.push("\x1B[40m");
|
|
377
|
-
}
|
|
378
|
-
if (obj == null ? void 0 : obj.text) {
|
|
379
|
-
arr.push(`\x1B[3${obj == null ? void 0 : obj.text}m`);
|
|
380
|
-
} else {
|
|
381
|
-
arr.push("\x1B[30m");
|
|
382
|
-
}
|
|
383
|
-
arr.push(msg);
|
|
384
|
-
arr.push("\x1B[0m");
|
|
385
|
-
return arr.join("");
|
|
238
|
+
const arr = ["\x1B[0m"];
|
|
239
|
+
if (obj?.revert) arr.push("\x1B[4m");
|
|
240
|
+
if (obj?.lineThrough) arr.push("\x1B[9m");
|
|
241
|
+
if (obj?.italic) arr.push("\x1B[3m");
|
|
242
|
+
if (obj?.bold) arr.push("\x1B[1m");
|
|
243
|
+
if (obj?.bag) arr.push(`\x1B[4${obj?.bag}m`);
|
|
244
|
+
else arr.push("\x1B[40m");
|
|
245
|
+
if (obj?.text) arr.push(`\x1B[3${obj?.text}m`);
|
|
246
|
+
else arr.push("\x1B[30m");
|
|
247
|
+
arr.push(msg);
|
|
248
|
+
arr.push("\x1B[0m");
|
|
249
|
+
return arr.join("");
|
|
386
250
|
}
|
|
387
251
|
function getSuffix(url) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
return regs[1];
|
|
392
|
-
}
|
|
393
|
-
return "";
|
|
252
|
+
const regs = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/.exec(url);
|
|
253
|
+
if (regs && regs.length > 0) return regs[1];
|
|
254
|
+
return "";
|
|
394
255
|
}
|
|
395
256
|
function matchsEnd(key, matchs) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
} else {
|
|
403
|
-
if (value.test(key)) {
|
|
404
|
-
return true;
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return false;
|
|
409
|
-
} else {
|
|
410
|
-
return true;
|
|
411
|
-
}
|
|
257
|
+
if (matchs && matchs.length > 0) {
|
|
258
|
+
for (const value of matchs) if (typeof value == "string") {
|
|
259
|
+
if (key.endsWith(value)) return true;
|
|
260
|
+
} else if (value.test(key)) return true;
|
|
261
|
+
return false;
|
|
262
|
+
} else return true;
|
|
412
263
|
}
|
|
413
264
|
function matchsStart(key, matchs) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
} else {
|
|
421
|
-
if (value.test(key)) {
|
|
422
|
-
return true;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
return false;
|
|
427
|
-
} else {
|
|
428
|
-
return true;
|
|
429
|
-
}
|
|
265
|
+
if (matchs && matchs.length > 0) {
|
|
266
|
+
for (const value of matchs) if (typeof value == "string") {
|
|
267
|
+
if (key.startsWith(value)) return true;
|
|
268
|
+
} else if (value.test(key)) return true;
|
|
269
|
+
return false;
|
|
270
|
+
} else return true;
|
|
430
271
|
}
|
|
431
272
|
function getUrlCatalogue(str) {
|
|
432
|
-
|
|
433
|
-
return str.replace(reg, "");
|
|
273
|
+
return str.replace(/((\\|\/)([^\\|\/]+)(\.[a-z|A-Z][a-z|A-Z|0-9]*))?$/g, "");
|
|
434
274
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
275
|
+
const defaultSuffixReg = /\\.[a-z|A-Z]+$/;
|
|
276
|
+
const defaultConfig$2 = {
|
|
277
|
+
name: "com",
|
|
278
|
+
/**
|
|
279
|
+
* 打包的文件地址
|
|
280
|
+
*/
|
|
281
|
+
dir: "./packages/",
|
|
282
|
+
/**
|
|
283
|
+
* 文件后缀
|
|
284
|
+
*/
|
|
285
|
+
extensions: ["js", "ts"],
|
|
286
|
+
suffixReg: defaultSuffixReg,
|
|
287
|
+
fileTongre: false,
|
|
288
|
+
/**
|
|
289
|
+
* 是否替换文件
|
|
290
|
+
*/
|
|
291
|
+
fileCover: false,
|
|
292
|
+
/**
|
|
293
|
+
* 判断当前文件100个字节内存在 @config cover=true 就不写入
|
|
294
|
+
*/
|
|
295
|
+
coverConfig: false,
|
|
296
|
+
/**
|
|
297
|
+
* 写入注释
|
|
298
|
+
*/
|
|
299
|
+
writeNotes: false,
|
|
300
|
+
/**
|
|
301
|
+
* 读取当前文件,文件的编码类型,默认utf-8
|
|
302
|
+
*/
|
|
303
|
+
read: false,
|
|
304
|
+
/**
|
|
305
|
+
* 匹配目录数组
|
|
306
|
+
* 从头开始匹配
|
|
307
|
+
*/
|
|
308
|
+
matchs: [],
|
|
309
|
+
/**
|
|
310
|
+
* 匹配文件路径
|
|
311
|
+
* 从尾部开始匹配
|
|
312
|
+
*/
|
|
313
|
+
matchexts: [],
|
|
314
|
+
forceUpdate: [],
|
|
315
|
+
/**
|
|
316
|
+
* 不匹配目录数组
|
|
317
|
+
* 从头开始匹配
|
|
318
|
+
*/
|
|
319
|
+
nomatchs: [],
|
|
320
|
+
/**
|
|
321
|
+
* 不匹配文件路径
|
|
322
|
+
* 从尾部开始匹配
|
|
323
|
+
*/
|
|
324
|
+
nomatchexts: [],
|
|
325
|
+
issort: false,
|
|
326
|
+
issynch: false
|
|
487
327
|
};
|
|
488
328
|
function getSuffixReg(ex = []) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}
|
|
492
|
-
return new RegExp(`\\.(${ex.join("|")})$`);
|
|
329
|
+
if (ex.length == 0) return defaultSuffixReg;
|
|
330
|
+
return new RegExp(`\\.(${ex.join("|")})$`);
|
|
493
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* 不清楚怎么定义抽象方法
|
|
334
|
+
*/
|
|
494
335
|
var FangCom = class {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
* @param callback
|
|
696
|
-
*/
|
|
697
|
-
setOpen(url, str, type, callback) {
|
|
698
|
-
let tn = this.config.fileTongre ? 3 : 2;
|
|
699
|
-
if (this.config.fileCover) {
|
|
700
|
-
tn = 0;
|
|
701
|
-
}
|
|
702
|
-
if (tn == 2) {
|
|
703
|
-
if (this.isForceUpdate(url)) {
|
|
704
|
-
tn = 0;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
if (typeof type != "undefined") {
|
|
708
|
-
tn = type;
|
|
709
|
-
}
|
|
710
|
-
if (this.config.writeNotes && !/\.json$/.test(url)) {
|
|
711
|
-
str = this.getFileNotes(url).join("\n") + "\n" + str;
|
|
712
|
-
}
|
|
713
|
-
fsOpenStream(
|
|
714
|
-
url,
|
|
715
|
-
str,
|
|
716
|
-
tn,
|
|
717
|
-
this.config.coverConfig,
|
|
718
|
-
(kurl, type2, is) => {
|
|
719
|
-
if (!(tn == 2 && type2 == 2)) {
|
|
720
|
-
const logs = this.getLogs();
|
|
721
|
-
logs.push(styleLog("file", {}));
|
|
722
|
-
if (type2 == 1) {
|
|
723
|
-
logs.push(
|
|
724
|
-
styleLog("add", {
|
|
725
|
-
text: 2,
|
|
726
|
-
italic: true
|
|
727
|
-
})
|
|
728
|
-
);
|
|
729
|
-
} else if (type2 == 2) {
|
|
730
|
-
logs.push(
|
|
731
|
-
styleLog("update", {
|
|
732
|
-
italic: true,
|
|
733
|
-
text: 4
|
|
734
|
-
})
|
|
735
|
-
);
|
|
736
|
-
}
|
|
737
|
-
if (is) {
|
|
738
|
-
logs.push(
|
|
739
|
-
styleLog(kurl, {
|
|
740
|
-
text: 2,
|
|
741
|
-
revert: true
|
|
742
|
-
})
|
|
743
|
-
);
|
|
744
|
-
} else {
|
|
745
|
-
logs.push(
|
|
746
|
-
styleLog(kurl, {
|
|
747
|
-
text: 1,
|
|
748
|
-
revert: true
|
|
749
|
-
})
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
console.log(logs.join(" "));
|
|
753
|
-
}
|
|
754
|
-
if (callback) {
|
|
755
|
-
callback(kurl, type2, is, tn);
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
);
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* 获取日志头
|
|
762
|
-
*/
|
|
763
|
-
getLogs() {
|
|
764
|
-
const logs = [];
|
|
765
|
-
logs.push(
|
|
766
|
-
styleLog("[@fangzhongya/create]", {
|
|
767
|
-
text: 3
|
|
768
|
-
})
|
|
769
|
-
);
|
|
770
|
-
logs.push(
|
|
771
|
-
styleLog(this._defaultConfig.name, {
|
|
772
|
-
text: 4
|
|
773
|
-
})
|
|
774
|
-
);
|
|
775
|
-
return logs;
|
|
776
|
-
}
|
|
336
|
+
_configCallback;
|
|
337
|
+
_defaultConfig;
|
|
338
|
+
config;
|
|
339
|
+
constructor(config, callback) {
|
|
340
|
+
this.config = {};
|
|
341
|
+
this._configCallback = callback;
|
|
342
|
+
this._defaultConfig = defaultConfig$2;
|
|
343
|
+
this.initConfig(config);
|
|
344
|
+
}
|
|
345
|
+
async runDev(callback, configCallback, config, nosort) {
|
|
346
|
+
this.initConfig(config);
|
|
347
|
+
const call = configCallback || this._configCallback;
|
|
348
|
+
if (call) {
|
|
349
|
+
const c = call(this.config);
|
|
350
|
+
if (c) this.initConfig(c);
|
|
351
|
+
}
|
|
352
|
+
return await this.handle(callback, nosort);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* 初始化
|
|
356
|
+
* @param config
|
|
357
|
+
* @returns
|
|
358
|
+
*/
|
|
359
|
+
initConfig(config) {
|
|
360
|
+
if (config) {
|
|
361
|
+
this.config = config;
|
|
362
|
+
this.setDefaultConfig();
|
|
363
|
+
this.config.suffixReg = getSuffixReg(this.config.extensions);
|
|
364
|
+
if (!this.config.matchexts || this.config.matchexts.length == 0) this.config.matchexts = [this.config.suffixReg];
|
|
365
|
+
}
|
|
366
|
+
return this.config;
|
|
367
|
+
}
|
|
368
|
+
setDefaultConfig() {
|
|
369
|
+
Object.keys(this._defaultConfig).forEach((key) => {
|
|
370
|
+
if (typeof this.config[key] == "undefined") this.config[key] = this._defaultConfig[key];
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
getFileName(name) {
|
|
374
|
+
if (this.config.suffixReg) return name.replace(this.config.suffixReg, "");
|
|
375
|
+
else return name.replace(defaultSuffixReg, "");
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* 获取当前位置
|
|
379
|
+
* @param dir
|
|
380
|
+
* @returns
|
|
381
|
+
*/
|
|
382
|
+
getDirUrl(dir) {
|
|
383
|
+
const str = dir || this.config.dir;
|
|
384
|
+
if (str) return (0, node_path.resolve)(process.cwd(), str);
|
|
385
|
+
else return "";
|
|
386
|
+
}
|
|
387
|
+
isForceUpdate(url) {
|
|
388
|
+
if (this.config.forceUpdate && this.config.forceUpdate.length > 0) return matchsEnd(url.replace(/\\/g, "/"), this.config.forceUpdate);
|
|
389
|
+
else return false;
|
|
390
|
+
}
|
|
391
|
+
isMatchFile(url, name) {
|
|
392
|
+
const dirUrl = this.getDirUrl();
|
|
393
|
+
const dir = (0, node_path.join)(url, name).replace(dirUrl, "").replace(/\\/g, "/");
|
|
394
|
+
const is = matchsEnd(dir, this.config.matchexts);
|
|
395
|
+
const nomatchexts = this.config.nomatchexts;
|
|
396
|
+
if (is && nomatchexts && nomatchexts.length > 0) if (matchsEnd(dir, nomatchexts)) return false;
|
|
397
|
+
else return true;
|
|
398
|
+
else return is;
|
|
399
|
+
}
|
|
400
|
+
isMatchDir(url, name) {
|
|
401
|
+
const dirUrl = this.getDirUrl();
|
|
402
|
+
const dir = (0, node_path.join)(url, name).replace(dirUrl, "").replace(/\\/g, "/");
|
|
403
|
+
const is = matchsStart(dir, this.config.matchs);
|
|
404
|
+
const nomatchs = this.config.nomatchs;
|
|
405
|
+
if (is && nomatchs && nomatchs.length > 0) if (matchsStart(dir, nomatchs)) return false;
|
|
406
|
+
else return true;
|
|
407
|
+
else return is;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* 处理方法
|
|
411
|
+
* @param callback
|
|
412
|
+
*/
|
|
413
|
+
handle(callback, nosort) {
|
|
414
|
+
return new Promise(async (resolve) => {
|
|
415
|
+
const url = this.getDirUrl();
|
|
416
|
+
if (url) resolve(await writeInit(url, async (...arr) => {
|
|
417
|
+
if (callback) await callback(...arr);
|
|
418
|
+
return await this.writeCallback(...arr, nosort);
|
|
419
|
+
}, (...arr) => {
|
|
420
|
+
return this.isMatchDir(...arr);
|
|
421
|
+
}, (...arr) => {
|
|
422
|
+
return this.isMatchFile(...arr);
|
|
423
|
+
}, this.config.issynch));
|
|
424
|
+
else resolve([]);
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
getFileNotes(url) {
|
|
428
|
+
const suffix = getSuffix(url);
|
|
429
|
+
const sz = [
|
|
430
|
+
`@config cover=false`,
|
|
431
|
+
`cover 是否覆盖当前文件,默认是false, true 表示不覆盖`,
|
|
432
|
+
`当前已经由@fangzhongya/create自动生成`,
|
|
433
|
+
`${(/* @__PURE__ */ new Date()).toString()}`
|
|
434
|
+
];
|
|
435
|
+
if ([
|
|
436
|
+
"md",
|
|
437
|
+
"html",
|
|
438
|
+
"vue"
|
|
439
|
+
].includes(suffix)) {
|
|
440
|
+
const arr = ["<!--"];
|
|
441
|
+
sz.forEach((v) => {
|
|
442
|
+
arr.push(" - " + v);
|
|
443
|
+
});
|
|
444
|
+
arr.push("-->");
|
|
445
|
+
return arr;
|
|
446
|
+
} else {
|
|
447
|
+
const arr = ["/**"];
|
|
448
|
+
sz.forEach((v) => {
|
|
449
|
+
arr.push(" * " + v);
|
|
450
|
+
});
|
|
451
|
+
arr.push(" */");
|
|
452
|
+
return arr;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* 输出文件,判断目录是否存在
|
|
457
|
+
* @param url
|
|
458
|
+
* @param sts
|
|
459
|
+
*/
|
|
460
|
+
fileOpen(url, sts, fileUrls, type) {
|
|
461
|
+
fsMkdir(getUrlCatalogue(url), (reaPath, is, ml) => {
|
|
462
|
+
const logs = this.getLogs();
|
|
463
|
+
logs.push(styleLog("dir", {}));
|
|
464
|
+
if (is) {
|
|
465
|
+
if (ml) {
|
|
466
|
+
logs.push(styleLog("add", {
|
|
467
|
+
text: 2,
|
|
468
|
+
italic: true
|
|
469
|
+
}));
|
|
470
|
+
logs.push(styleLog(reaPath, {
|
|
471
|
+
text: 2,
|
|
472
|
+
revert: true
|
|
473
|
+
}));
|
|
474
|
+
console.log(logs.join(" "));
|
|
475
|
+
}
|
|
476
|
+
} else {
|
|
477
|
+
logs.push(styleLog(reaPath, {
|
|
478
|
+
text: 1,
|
|
479
|
+
revert: true
|
|
480
|
+
}));
|
|
481
|
+
console.log(logs.join(" "));
|
|
482
|
+
}
|
|
483
|
+
this.setOpen(url, sts, type, (kurl, _type, is, _tn) => {
|
|
484
|
+
if (is && fileUrls) fileUrls.push(kurl);
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* 输出文件
|
|
490
|
+
* @param url
|
|
491
|
+
* @param str
|
|
492
|
+
* @param callback
|
|
493
|
+
*/
|
|
494
|
+
setOpen(url, str, type, callback) {
|
|
495
|
+
let tn = this.config.fileTongre ? 3 : 2;
|
|
496
|
+
if (this.config.fileCover) tn = 0;
|
|
497
|
+
if (tn == 2) {
|
|
498
|
+
if (this.isForceUpdate(url)) tn = 0;
|
|
499
|
+
}
|
|
500
|
+
if (typeof type != "undefined") tn = type;
|
|
501
|
+
if (this.config.writeNotes && !/\.json$/.test(url)) str = this.getFileNotes(url).join("\n") + "\n" + str;
|
|
502
|
+
fsOpenStream(url, str, tn, this.config.coverConfig, (kurl, type, is) => {
|
|
503
|
+
if (!(tn == 2 && type == 2)) {
|
|
504
|
+
const logs = this.getLogs();
|
|
505
|
+
logs.push(styleLog("file", {}));
|
|
506
|
+
if (type == 1) logs.push(styleLog("add", {
|
|
507
|
+
text: 2,
|
|
508
|
+
italic: true
|
|
509
|
+
}));
|
|
510
|
+
else if (type == 2) logs.push(styleLog("update", {
|
|
511
|
+
italic: true,
|
|
512
|
+
text: 4
|
|
513
|
+
}));
|
|
514
|
+
if (is) logs.push(styleLog(kurl, {
|
|
515
|
+
text: 2,
|
|
516
|
+
revert: true
|
|
517
|
+
}));
|
|
518
|
+
else logs.push(styleLog(kurl, {
|
|
519
|
+
text: 1,
|
|
520
|
+
revert: true
|
|
521
|
+
}));
|
|
522
|
+
console.log(logs.join(" "));
|
|
523
|
+
}
|
|
524
|
+
if (callback) callback(kurl, type, is, tn);
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* 获取日志头
|
|
529
|
+
*/
|
|
530
|
+
getLogs() {
|
|
531
|
+
const logs = [];
|
|
532
|
+
logs.push(styleLog("[@fangzhongya/create]", { text: 3 }));
|
|
533
|
+
logs.push(styleLog(this._defaultConfig.name, { text: 4 }));
|
|
534
|
+
return logs;
|
|
535
|
+
}
|
|
777
536
|
};
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
537
|
+
//#endregion
|
|
538
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/chunk-KDOS4NFR-4twmajmu.js
|
|
539
|
+
function getStartSames(str, val) {
|
|
540
|
+
let s = "";
|
|
541
|
+
const vs = [...val];
|
|
542
|
+
let index = 0;
|
|
543
|
+
for (; index < vs.length; index++) {
|
|
544
|
+
const element = vs[index];
|
|
545
|
+
if (element === str.charAt(index)) s += element;
|
|
546
|
+
else break;
|
|
547
|
+
}
|
|
548
|
+
return [
|
|
549
|
+
s,
|
|
550
|
+
str.substring(index),
|
|
551
|
+
val.substring(index)
|
|
552
|
+
];
|
|
553
|
+
}
|
|
554
|
+
function getImportUrl(url, imp) {
|
|
555
|
+
const arr = getStartSames(url, imp);
|
|
556
|
+
const ts = arr[0];
|
|
557
|
+
if (!/[\\|\/]$/.test(ts)) {
|
|
558
|
+
const regs = ts.match(/[\\|\/]([^\\|\/]*)$/);
|
|
559
|
+
if (regs && regs.length > 0) {
|
|
560
|
+
const a = regs[1];
|
|
561
|
+
arr[0] = ts.substring(0, regs.index + 1);
|
|
562
|
+
arr[1] = a + arr[1];
|
|
563
|
+
arr[2] = a + arr[2];
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const l = arr[1].split(/\\|\//).length - 1;
|
|
567
|
+
let ds = ["./"];
|
|
568
|
+
if (l > 0) {
|
|
569
|
+
ds = [];
|
|
570
|
+
for (let index = 0; index < l; index++) ds.push("../");
|
|
571
|
+
}
|
|
572
|
+
return ds.join("") + arr[2].replace(/\\/g, "/");
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/chunk-NWIJYHAJ-CaD2i2BV.js
|
|
576
|
+
function getImportUrlSuffix(url, imp) {
|
|
577
|
+
return getImportUrl(url, imp).replace(/\.([a-z|A-Z][a-z|A-Z|0-9]*)$/, "");
|
|
578
|
+
}
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/file.js
|
|
581
|
+
const defaultConfig$1 = Object.assign({}, defaultConfig$2, {
|
|
582
|
+
name: "file",
|
|
583
|
+
/**
|
|
584
|
+
* 生成的文件名称
|
|
585
|
+
*/
|
|
586
|
+
gene: void 0,
|
|
587
|
+
/**
|
|
588
|
+
* 文件生成方法
|
|
589
|
+
*/
|
|
590
|
+
fileSet: void 0
|
|
791
591
|
});
|
|
792
592
|
var FangFile = class extends FangCom {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
const gu = gene(name, url, wjmc);
|
|
862
|
-
const imp = getImportUrlSuffix(gu, furl);
|
|
863
|
-
const arr = [];
|
|
864
|
-
if (fileSet) {
|
|
865
|
-
let text = "";
|
|
866
|
-
if (read) {
|
|
867
|
-
text = await fsReadFile(furl, read);
|
|
868
|
-
}
|
|
869
|
-
arr.push(...fileSet(name, url, text, wjmc, imp, gu));
|
|
870
|
-
}
|
|
871
|
-
if (arr.length > 0) {
|
|
872
|
-
this.fileOpen(gu, arr.join("\n"), fileUrls);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
return true;
|
|
877
|
-
}
|
|
593
|
+
constructor(config, callback) {
|
|
594
|
+
super();
|
|
595
|
+
this.config = {};
|
|
596
|
+
this._configCallback = callback;
|
|
597
|
+
this._defaultConfig = defaultConfig$1;
|
|
598
|
+
this.initConfig(config || this.config);
|
|
599
|
+
}
|
|
600
|
+
getDefaultGene(name, url, _wj) {
|
|
601
|
+
return (0, node_path.join)(url, name);
|
|
602
|
+
}
|
|
603
|
+
getDefaultFileSet(_name, _url, _text, _wjm, _imp, _surl) {
|
|
604
|
+
return [];
|
|
605
|
+
}
|
|
606
|
+
getGeneObj(url, name, outDir) {
|
|
607
|
+
return getUrlCatalogueObj((0, node_path.join)((0, node_path.resolve)(process.cwd(), outDir), (0, node_path.join)(url, name).replace(this.getDirUrl(), "")));
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* 获取输出地址方法
|
|
611
|
+
* @param gene
|
|
612
|
+
* @returns
|
|
613
|
+
*/
|
|
614
|
+
getGene(gene) {
|
|
615
|
+
gene = gene || this.config.gene;
|
|
616
|
+
if (!gene) return (...arr) => {
|
|
617
|
+
return this.getDefaultGene(...arr);
|
|
618
|
+
};
|
|
619
|
+
else return gene;
|
|
620
|
+
}
|
|
621
|
+
fileRead(url, type) {
|
|
622
|
+
return new Promise((resolve) => {
|
|
623
|
+
fsAccess(url).then(() => {
|
|
624
|
+
resolve(fsReadFile(url, type));
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
getFileSet(fileSet) {
|
|
629
|
+
fileSet = fileSet || this.config.fileSet;
|
|
630
|
+
if (!fileSet) return (...arr) => {
|
|
631
|
+
return this.getDefaultFileSet(...arr);
|
|
632
|
+
};
|
|
633
|
+
else return fileSet;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* 回调方法
|
|
637
|
+
* @param url
|
|
638
|
+
* @param file
|
|
639
|
+
* @param urls
|
|
640
|
+
*/
|
|
641
|
+
async writeCallback(url, readdir, fileUrls) {
|
|
642
|
+
const gene = this.getGene();
|
|
643
|
+
const fileSet = this.getFileSet();
|
|
644
|
+
const read = this.config.read;
|
|
645
|
+
if (readdir.file) for (let i = 0; i < readdir.file.length; i++) {
|
|
646
|
+
const name = readdir.file[i];
|
|
647
|
+
const furl = (0, node_path.join)(url, name);
|
|
648
|
+
const wjmc = this.getFileName(name);
|
|
649
|
+
const gu = gene(name, url, wjmc);
|
|
650
|
+
const imp = getImportUrlSuffix(gu, furl);
|
|
651
|
+
const arr = [];
|
|
652
|
+
if (fileSet) {
|
|
653
|
+
let text = "";
|
|
654
|
+
if (read) text = await fsReadFile(furl, read);
|
|
655
|
+
arr.push(...fileSet(name, url, text, wjmc, imp, gu));
|
|
656
|
+
}
|
|
657
|
+
if (arr.length > 0) this.fileOpen(gu, arr.join("\n"), fileUrls);
|
|
658
|
+
}
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
878
661
|
};
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
isNeader: true
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region node_modules/.pnpm/@fangzhongya+create@0.2.52/node_modules/@fangzhongya/create/dist/out/index.js
|
|
664
|
+
const defaultConfig = Object.assign({}, defaultConfig$1, {
|
|
665
|
+
name: "out",
|
|
666
|
+
outDir: "./",
|
|
667
|
+
isNeader: true
|
|
886
668
|
});
|
|
887
669
|
var FangOut = class extends FangFile {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
670
|
+
constructor(config, callback) {
|
|
671
|
+
super();
|
|
672
|
+
this.config = {};
|
|
673
|
+
this._configCallback = callback;
|
|
674
|
+
this._defaultConfig = defaultConfig;
|
|
675
|
+
this.initConfig(config || this.config);
|
|
676
|
+
}
|
|
677
|
+
getFileNeader(name, url) {
|
|
678
|
+
return [
|
|
679
|
+
`/**`,
|
|
680
|
+
` * ${(0, node_path.join)(url, name).replace(/\\/g, "/")}`,
|
|
681
|
+
" */"
|
|
682
|
+
];
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* 获取输出地址方法
|
|
686
|
+
* @param gene
|
|
687
|
+
* @returns
|
|
688
|
+
*/
|
|
689
|
+
getDefaultGene(name, url, _wj) {
|
|
690
|
+
const obj = this.getGeneObj(url, name, this.config.outDir);
|
|
691
|
+
return (0, node_path.join)(obj.catalogue, obj.name + "." + obj.suffix);
|
|
692
|
+
}
|
|
693
|
+
getDefaultFileSet(name, url, text, _wjm, _imp) {
|
|
694
|
+
const arr = [text];
|
|
695
|
+
if (this.config.isNeader) return [...this.getFileNeader(name, url), ...arr];
|
|
696
|
+
return arr;
|
|
697
|
+
}
|
|
914
698
|
};
|
|
915
699
|
function runDev(config, configCallback, callback) {
|
|
916
|
-
|
|
917
|
-
fang.runDev(callback, configCallback);
|
|
700
|
+
new FangOut(config).runDev(callback, configCallback);
|
|
918
701
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
var virtualModuleId = "virtual:fang-icon";
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region packages/vite/index.ts
|
|
704
|
+
const runType = "vue";
|
|
705
|
+
const virtualModuleId = "virtual:fang-icon";
|
|
924
706
|
function simpleFangIcon(options = {}) {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
dir: "./node_modules/@fangzhongya/icons/dist/svg",
|
|
940
|
-
outDir,
|
|
941
|
-
extensions: ["svg"],
|
|
942
|
-
read: true,
|
|
943
|
-
fileCover: true,
|
|
944
|
-
isNeader: false
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
const plugin = {
|
|
948
|
-
name: "simple-fang-icon"
|
|
949
|
-
};
|
|
950
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
951
|
-
if (virtual) {
|
|
952
|
-
const pub = `
|
|
707
|
+
const { name = "FangIcon", type = runType, directory = "/svg", dynamic = true, virtual = false, replaced = true, alias = "icon", customReplacement } = options;
|
|
708
|
+
if (options.mobile) runDev({
|
|
709
|
+
issort: true,
|
|
710
|
+
dir: "./node_modules/@fangzhongya/icons/dist/svg",
|
|
711
|
+
outDir: (0, path.join)("./public/", directory),
|
|
712
|
+
extensions: ["svg"],
|
|
713
|
+
read: true,
|
|
714
|
+
fileCover: true,
|
|
715
|
+
isNeader: false
|
|
716
|
+
});
|
|
717
|
+
const plugin = { name: "simple-fang-icon" };
|
|
718
|
+
const resolvedVirtualModuleId = "\0virtual:fang-icon";
|
|
719
|
+
if (virtual) {
|
|
720
|
+
const pub = `
|
|
953
721
|
import { defineComponent, h,} from 'vue'
|
|
954
722
|
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
955
723
|
const component = defineComponent({
|
|
@@ -978,13 +746,13 @@ function simpleFangIcon(options = {}) {
|
|
|
978
746
|
};
|
|
979
747
|
}
|
|
980
748
|
});
|
|
981
|
-
//
|
|
749
|
+
// 导出安装函数
|
|
982
750
|
component.install = (app) => {
|
|
983
751
|
app.component('${name}', component)
|
|
984
752
|
};
|
|
985
753
|
export const '${name}' = component;
|
|
986
754
|
export default component;`;
|
|
987
|
-
|
|
755
|
+
const svg = `
|
|
988
756
|
import { defineComponent, h, computed} from 'vue'
|
|
989
757
|
import FangIcon from '@fangzhongya/icons/icon/index'
|
|
990
758
|
import { icons } from '@fangzhongya/icons/async'
|
|
@@ -1033,264 +801,201 @@ function simpleFangIcon(options = {}) {
|
|
|
1033
801
|
};
|
|
1034
802
|
}
|
|
1035
803
|
});
|
|
1036
|
-
//
|
|
804
|
+
// 导出安装函数
|
|
1037
805
|
component.install = (app) => {
|
|
1038
806
|
app.component('${name}', component)
|
|
1039
807
|
};
|
|
1040
808
|
export const '${name}' = component;
|
|
1041
809
|
export default component;`;
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
plugin.resolveId = function(id) {
|
|
1057
|
-
if (id === virtualModuleId) {
|
|
1058
|
-
return resolvedVirtualModuleId;
|
|
1059
|
-
}
|
|
1060
|
-
return void 0;
|
|
1061
|
-
};
|
|
1062
|
-
plugin.load = function(id) {
|
|
1063
|
-
if (id === resolvedVirtualModuleId) {
|
|
1064
|
-
return `export const install = () => {};
|
|
810
|
+
const text = type === runType ? svg : pub;
|
|
811
|
+
plugin.resolveId = function(id) {
|
|
812
|
+
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
813
|
+
};
|
|
814
|
+
plugin.load = function(id) {
|
|
815
|
+
if (id === resolvedVirtualModuleId) return text;
|
|
816
|
+
return null;
|
|
817
|
+
};
|
|
818
|
+
} else {
|
|
819
|
+
plugin.resolveId = function(id) {
|
|
820
|
+
if (id === virtualModuleId) return resolvedVirtualModuleId;
|
|
821
|
+
};
|
|
822
|
+
plugin.load = function(id) {
|
|
823
|
+
if (id === resolvedVirtualModuleId) return `export const install = () => {};
|
|
1065
824
|
export default {};`;
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
code: transformedCode,
|
|
1117
|
-
map: null
|
|
1118
|
-
};
|
|
1119
|
-
}
|
|
1120
|
-
} catch (error) {
|
|
1121
|
-
console.error(`\u5904\u7406\u6587\u4EF6 ${id} \u65F6\u51FA\u9519:`, error);
|
|
1122
|
-
}
|
|
1123
|
-
return null;
|
|
1124
|
-
};
|
|
1125
|
-
plugin.handleHotUpdate = function({
|
|
1126
|
-
file,
|
|
1127
|
-
server
|
|
1128
|
-
}) {
|
|
1129
|
-
if (shouldProcess(file)) {
|
|
1130
|
-
server.ws.send({
|
|
1131
|
-
type: "full-reload"
|
|
1132
|
-
});
|
|
1133
|
-
return [];
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
return plugin;
|
|
825
|
+
return null;
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
if (replaced) {
|
|
829
|
+
const targetComponents = Array.isArray(name) ? name : [name];
|
|
830
|
+
plugin.enforce = "pre";
|
|
831
|
+
plugin.transform = function(code, id) {
|
|
832
|
+
if (!shouldProcess(id)) return null;
|
|
833
|
+
try {
|
|
834
|
+
const components = findComponents(code, targetComponents);
|
|
835
|
+
if (components.length === 0) return null;
|
|
836
|
+
let transformedCode = code;
|
|
837
|
+
let replacedCount = 0;
|
|
838
|
+
const imports = /* @__PURE__ */ new Set();
|
|
839
|
+
if (!virtual) {
|
|
840
|
+
imports.add(`import ${name} from '@fangzhongya/icons/icon/index'`);
|
|
841
|
+
replacedCount++;
|
|
842
|
+
}
|
|
843
|
+
for (let i = components.length - 1; i >= 0; i--) {
|
|
844
|
+
const component = components[i];
|
|
845
|
+
if (isReplaced(component)) {
|
|
846
|
+
const { text, imptext } = replaceComponent(component, type, dynamic, customReplacement, alias);
|
|
847
|
+
imports.add(imptext);
|
|
848
|
+
if (text !== component.fullMatch) {
|
|
849
|
+
transformedCode = transformedCode.slice(0, component.start) + text + transformedCode.slice(component.end);
|
|
850
|
+
replacedCount++;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
if (/.vue$/.test(id)) {
|
|
855
|
+
const i = transformedCode.indexOf("<\/script>");
|
|
856
|
+
transformedCode = transformedCode.slice(0, i) + [...imports].join(";\n") + transformedCode.slice(i);
|
|
857
|
+
} else transformedCode = [...imports].join(";\n") + transformedCode;
|
|
858
|
+
if (replacedCount > 0) return {
|
|
859
|
+
code: transformedCode,
|
|
860
|
+
map: null
|
|
861
|
+
};
|
|
862
|
+
} catch (error) {
|
|
863
|
+
console.error(`处理文件 ${id} 时出错:`, error);
|
|
864
|
+
}
|
|
865
|
+
return null;
|
|
866
|
+
};
|
|
867
|
+
plugin.handleHotUpdate = function({ file, server }) {
|
|
868
|
+
if (shouldProcess(file)) {
|
|
869
|
+
server.ws.send({ type: "full-reload" });
|
|
870
|
+
return [];
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
return plugin;
|
|
1138
875
|
}
|
|
1139
876
|
function parseAttributes(attrString) {
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
attributes[name] = value;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
return attributes;
|
|
877
|
+
const attributes = { name: "" };
|
|
878
|
+
const attrRegex = /(?:@|:|v-bind:)?([\w-]+)(?:="([^"]*)"|='([^']*)')/g;
|
|
879
|
+
let match;
|
|
880
|
+
while ((match = attrRegex.exec(attrString)) !== null) {
|
|
881
|
+
const name = match[1];
|
|
882
|
+
if (name) {
|
|
883
|
+
const value = match[2] || match[3] || "";
|
|
884
|
+
if (name === "name") attributes.name = value;
|
|
885
|
+
else if (value === "true" || value === "false") attributes[name] = value === "true";
|
|
886
|
+
else if (!isNaN(Number(value)) && value !== "") attributes[name] = Number(value);
|
|
887
|
+
else attributes[name] = value;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return attributes;
|
|
1159
891
|
}
|
|
1160
892
|
function hasStringNameAttribute(attrString) {
|
|
1161
|
-
|
|
1162
|
-
const singleQuoteRegex = /(?:^|\s)name='[^']*'/i;
|
|
1163
|
-
return nameRegex.test(attrString) || singleQuoteRegex.test(attrString);
|
|
893
|
+
return /(?:^|\s)name="[^"]*"/i.test(attrString) || /(?:^|\s)name='[^']*'/i.test(attrString);
|
|
1164
894
|
}
|
|
1165
895
|
function isOnlyWhitespace(content) {
|
|
1166
|
-
|
|
896
|
+
return !content || /^\s*$/.test(content);
|
|
1167
897
|
}
|
|
1168
898
|
function isReplaced(m) {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
}
|
|
1176
|
-
if (!attributes.name) {
|
|
1177
|
-
return false;
|
|
1178
|
-
}
|
|
1179
|
-
const content = fullMatch.slice(
|
|
1180
|
-
fullMatch.indexOf(">") + 1,
|
|
1181
|
-
fullMatch.indexOf("</")
|
|
1182
|
-
);
|
|
1183
|
-
if (!isOnlyWhitespace(content)) {
|
|
1184
|
-
return false;
|
|
1185
|
-
}
|
|
1186
|
-
return true;
|
|
899
|
+
if (!m) return false;
|
|
900
|
+
const { fullMatch, attributes } = m;
|
|
901
|
+
if (!hasStringNameAttribute(fullMatch)) return false;
|
|
902
|
+
if (!attributes.name) return false;
|
|
903
|
+
if (!isOnlyWhitespace(fullMatch.slice(fullMatch.indexOf(">") + 1, fullMatch.indexOf("</")))) return false;
|
|
904
|
+
return true;
|
|
1187
905
|
}
|
|
1188
906
|
function findComponents(code, name) {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
currentIndex = endIndex;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
return components;
|
|
907
|
+
const components = [];
|
|
908
|
+
for (const componentName of name) {
|
|
909
|
+
let currentIndex = 0;
|
|
910
|
+
while (currentIndex < code.length) {
|
|
911
|
+
const startTagIndex = code.indexOf(`<${componentName}`, currentIndex);
|
|
912
|
+
if (startTagIndex === -1) break;
|
|
913
|
+
let tagEndIndex = code.indexOf(">", startTagIndex);
|
|
914
|
+
if (tagEndIndex === -1) break;
|
|
915
|
+
const startTag = code.slice(startTagIndex, tagEndIndex + 1);
|
|
916
|
+
const attributes = parseAttributes(startTag.slice(componentName.length + 1, -1).trim());
|
|
917
|
+
const isSelfClosing = startTag.endsWith("/>");
|
|
918
|
+
let endIndex;
|
|
919
|
+
let fullMatch;
|
|
920
|
+
if (isSelfClosing) {
|
|
921
|
+
endIndex = tagEndIndex + 1;
|
|
922
|
+
fullMatch = startTag;
|
|
923
|
+
} else {
|
|
924
|
+
const endTag = `</${componentName}>`;
|
|
925
|
+
let endTagIndex = code.indexOf(endTag, tagEndIndex + 1);
|
|
926
|
+
if (endTagIndex === -1) {
|
|
927
|
+
currentIndex = startTagIndex + 1;
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
endIndex = endTagIndex + endTag.length;
|
|
931
|
+
fullMatch = code.slice(startTagIndex, endIndex);
|
|
932
|
+
}
|
|
933
|
+
components.push({
|
|
934
|
+
componentName,
|
|
935
|
+
fullMatch,
|
|
936
|
+
start: startTagIndex,
|
|
937
|
+
end: endIndex,
|
|
938
|
+
attributes,
|
|
939
|
+
isSelfClosing
|
|
940
|
+
});
|
|
941
|
+
currentIndex = endIndex;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return components;
|
|
1231
945
|
}
|
|
1232
946
|
function getText(iconName, match, name) {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
947
|
+
const svg = require_iconify.getIconifySVG(require_json.json_default, name);
|
|
948
|
+
return {
|
|
949
|
+
text: `${match.fullMatch.replace(`name="${iconName}"`, "").replace(`</${match.componentName}>`, "")}${svg}</${match.componentName}>`,
|
|
950
|
+
imptext: ""
|
|
951
|
+
};
|
|
1237
952
|
}
|
|
1238
953
|
function getImportName(iconName, alias) {
|
|
1239
|
-
|
|
954
|
+
return require_lineToLargeHump.lineToLargeHump(alias + "-" + iconName);
|
|
1240
955
|
}
|
|
1241
956
|
function getVue(iconName, match, name, alias = "icon") {
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
return {
|
|
1247
|
-
text,
|
|
1248
|
-
imptext: `import ${getImportName(
|
|
1249
|
-
name,
|
|
1250
|
-
alias
|
|
1251
|
-
)} from '@fangzhongya/icons/vue/${name}'`
|
|
1252
|
-
};
|
|
957
|
+
return {
|
|
958
|
+
text: match.fullMatch.replace(`name="${iconName}"`, `:name="${getImportName(name, alias)}"`),
|
|
959
|
+
imptext: `import ${getImportName(name, alias)} from '@fangzhongya/icons/vue/${name}'`
|
|
960
|
+
};
|
|
1253
961
|
}
|
|
1254
962
|
function replaceComponent(match, type, dynamic, customReplacement, alias) {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
`<${match.componentName}`,
|
|
1281
|
-
`<${match.componentName} default="${type}"`
|
|
1282
|
-
);
|
|
1283
|
-
return { text, imptext: "" };
|
|
1284
|
-
}
|
|
1285
|
-
return { text: match.fullMatch, imptext: "" };
|
|
963
|
+
const { attributes } = match;
|
|
964
|
+
const iconName = attributes.name;
|
|
965
|
+
if (customReplacement) return customReplacement(iconName, attributes, alias);
|
|
966
|
+
let name = iconName;
|
|
967
|
+
if (alias) {
|
|
968
|
+
if (iconName && iconName.startsWith(alias + "-")) name = iconName.substring(alias.length + 1);
|
|
969
|
+
}
|
|
970
|
+
if (!(require_json.json_default.icons[iconName] || require_json.json_default.icons[name])) return {
|
|
971
|
+
text: match.fullMatch,
|
|
972
|
+
imptext: ""
|
|
973
|
+
};
|
|
974
|
+
if (!attributes.type && type == runType || attributes.type === runType) if (dynamic) return getVue(iconName, match, name, alias);
|
|
975
|
+
else return getText(iconName, match, name);
|
|
976
|
+
if (type === "pub" && !attributes.type && !attributes.default) {
|
|
977
|
+
let text = match.fullMatch;
|
|
978
|
+
text = text.replace(`<${match.componentName}`, `<${match.componentName} default="${type}"`);
|
|
979
|
+
return {
|
|
980
|
+
text,
|
|
981
|
+
imptext: ""
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
return {
|
|
985
|
+
text: match.fullMatch,
|
|
986
|
+
imptext: ""
|
|
987
|
+
};
|
|
1286
988
|
}
|
|
1287
989
|
function shouldProcess(id) {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
990
|
+
if (![
|
|
991
|
+
".vue",
|
|
992
|
+
".jsx",
|
|
993
|
+
".tsx",
|
|
994
|
+
".js",
|
|
995
|
+
".ts"
|
|
996
|
+
].some((ext) => id.endsWith(ext))) return false;
|
|
997
|
+
if (id.includes("/node_modules/")) return false;
|
|
998
|
+
return true;
|
|
1293
999
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1000
|
+
//#endregion
|
|
1296
1001
|
exports.simpleFangIcon = simpleFangIcon;
|