@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.
Files changed (350) hide show
  1. package/dist/async.cjs +56 -105
  2. package/dist/async.js +50 -104
  3. package/dist/components.cjs +42 -60
  4. package/dist/components.js +42 -61
  5. package/dist/config.cjs +5 -7
  6. package/dist/config.js +4 -7
  7. package/dist/humpToLine-Czhat99x.js +25 -0
  8. package/dist/humpToLine-gLzuzWOm.cjs +30 -0
  9. package/dist/icon/index.cjs +229 -13
  10. package/dist/icon/index.js +222 -12
  11. package/dist/iconify.cjs +102 -16
  12. package/dist/iconify.js +97 -15
  13. package/dist/index.cjs +100 -194
  14. package/dist/index.js +52 -194
  15. package/dist/index.json +1 -1
  16. package/dist/json-BpszFHNs.js +62 -0
  17. package/dist/json-C96CKb6M.cjs +67 -0
  18. package/dist/json.cjs +2 -7
  19. package/dist/json.js +2 -7
  20. package/dist/lineToLargeHump-BajF216g.cjs +30 -0
  21. package/dist/lineToLargeHump-CHL4-tNE.js +25 -0
  22. package/dist/name.cjs +68 -15
  23. package/dist/name.js +65 -15
  24. package/dist/picker/dialog.cjs +42 -7
  25. package/dist/picker/dialog.js +42 -7
  26. package/dist/picker/index.cjs +200 -324
  27. package/dist/picker/index.js +194 -325
  28. package/dist/util.cjs +13 -7
  29. package/dist/util.js +12 -7
  30. package/dist/vite/index.cjs +848 -1143
  31. package/dist/vite/index.js +848 -1144
  32. package/dist/vue/bar.cjs +16 -7
  33. package/dist/vue/bar.js +16 -7
  34. package/dist/vue/below.cjs +16 -7
  35. package/dist/vue/below.js +16 -7
  36. package/dist/vue/bicycle.cjs +16 -7
  37. package/dist/vue/bicycle.js +16 -7
  38. package/dist/vue/bottom-left.cjs +16 -7
  39. package/dist/vue/bottom-left.js +16 -7
  40. package/dist/vue/bottom-right.cjs +16 -7
  41. package/dist/vue/bottom-right.js +16 -7
  42. package/dist/vue/bottom.cjs +16 -7
  43. package/dist/vue/bottom.js +16 -7
  44. package/dist/vue/cascader-field.cjs +16 -7
  45. package/dist/vue/cascader-field.js +16 -7
  46. package/dist/vue/catalogue.cjs +16 -7
  47. package/dist/vue/catalogue.js +16 -7
  48. package/dist/vue/clear.cjs +16 -7
  49. package/dist/vue/clear.js +16 -7
  50. package/dist/vue/close.cjs +16 -7
  51. package/dist/vue/close.js +16 -7
  52. package/dist/vue/crl.cjs +16 -7
  53. package/dist/vue/crl.js +16 -7
  54. package/dist/vue/delete.cjs +16 -7
  55. package/dist/vue/delete.js +16 -7
  56. package/dist/vue/document.cjs +16 -7
  57. package/dist/vue/document.js +16 -7
  58. package/dist/vue/down.cjs +16 -7
  59. package/dist/vue/down.js +16 -7
  60. package/dist/vue/download.cjs +16 -7
  61. package/dist/vue/download.js +16 -7
  62. package/dist/vue/edit.cjs +16 -7
  63. package/dist/vue/edit.js +16 -7
  64. package/dist/vue/enter.cjs +16 -7
  65. package/dist/vue/enter.js +16 -7
  66. package/dist/vue/folder.cjs +16 -7
  67. package/dist/vue/folder.js +16 -7
  68. package/dist/vue/frame.cjs +16 -7
  69. package/dist/vue/frame.js +16 -7
  70. package/dist/vue/grid.cjs +16 -7
  71. package/dist/vue/grid.js +16 -7
  72. package/dist/vue/hidd.cjs +16 -7
  73. package/dist/vue/hidd.js +16 -7
  74. package/dist/vue/home.cjs +16 -7
  75. package/dist/vue/home.js +16 -7
  76. package/dist/vue/index.cjs +90 -180
  77. package/dist/vue/index.js +46 -180
  78. package/dist/vue/left.cjs +16 -7
  79. package/dist/vue/left.js +16 -7
  80. package/dist/vue/lock.cjs +16 -7
  81. package/dist/vue/lock.js +16 -7
  82. package/dist/vue/login.cjs +16 -7
  83. package/dist/vue/login.js +16 -7
  84. package/dist/vue/logink.cjs +16 -7
  85. package/dist/vue/logink.js +16 -7
  86. package/dist/vue/more.cjs +16 -7
  87. package/dist/vue/more.js +16 -7
  88. package/dist/vue/mr.cjs +16 -7
  89. package/dist/vue/mr.js +16 -7
  90. package/dist/vue/mute.cjs +16 -7
  91. package/dist/vue/mute.js +16 -7
  92. package/dist/vue/node-tree.cjs +16 -7
  93. package/dist/vue/node-tree.js +16 -7
  94. package/dist/vue/page.cjs +16 -7
  95. package/dist/vue/page.js +16 -7
  96. package/dist/vue/pause.cjs +16 -7
  97. package/dist/vue/pause.js +16 -7
  98. package/dist/vue/play.cjs +16 -7
  99. package/dist/vue/play.js +16 -7
  100. package/dist/vue/plus.cjs +16 -7
  101. package/dist/vue/plus.js +16 -7
  102. package/dist/vue/qx.cjs +16 -7
  103. package/dist/vue/qx.js +16 -7
  104. package/dist/vue/retreat.cjs +16 -7
  105. package/dist/vue/retreat.js +16 -7
  106. package/dist/vue/right.cjs +16 -7
  107. package/dist/vue/right.js +16 -7
  108. package/dist/vue/set.cjs +16 -7
  109. package/dist/vue/set.js +16 -7
  110. package/dist/vue/sound.cjs +16 -7
  111. package/dist/vue/sound.js +16 -7
  112. package/dist/vue/star.cjs +16 -7
  113. package/dist/vue/star.js +16 -7
  114. package/dist/vue/sub-form.cjs +16 -7
  115. package/dist/vue/sub-form.js +16 -7
  116. package/dist/vue/tab.cjs +16 -7
  117. package/dist/vue/tab.js +16 -7
  118. package/dist/vue/up.cjs +16 -7
  119. package/dist/vue/up.js +16 -7
  120. package/dist/vue/views.cjs +16 -7
  121. package/dist/vue/views.js +16 -7
  122. package/dist/vue-CR8K2hMZ.js +105 -0
  123. package/dist/vue-XcWpjtqA.cjs +110 -0
  124. package/package.json +32 -30
  125. package/dist/async.d.cts +0 -142
  126. package/dist/async.d.ts +0 -142
  127. package/dist/chunk-2D4VSAJ2.js +0 -13
  128. package/dist/chunk-2IK6ZEWL.js +0 -13
  129. package/dist/chunk-2TQQMTHZ.cjs +0 -13
  130. package/dist/chunk-32F77IBU.cjs +0 -13
  131. package/dist/chunk-3376ZTRC.cjs +0 -1
  132. package/dist/chunk-37O763HE.cjs +0 -152
  133. package/dist/chunk-37UZO7UL.cjs +0 -31
  134. package/dist/chunk-3AMDUJDV.js +0 -13
  135. package/dist/chunk-3AMS6SAI.js +0 -13
  136. package/dist/chunk-3TRFZFYF.js +0 -13
  137. package/dist/chunk-3YCLWMP7.cjs +0 -13
  138. package/dist/chunk-53VWOQDN.cjs +0 -13
  139. package/dist/chunk-5MQTT7S7.cjs +0 -188
  140. package/dist/chunk-5PXZNWE4.js +0 -13
  141. package/dist/chunk-5QUGHNG3.cjs +0 -13
  142. package/dist/chunk-5XDPKNBI.js +0 -13
  143. package/dist/chunk-66OLJGLO.js +0 -302
  144. package/dist/chunk-6BDDZBAQ.js +0 -13
  145. package/dist/chunk-75ZPJI57.cjs +0 -9
  146. package/dist/chunk-76TLDMR4.cjs +0 -13
  147. package/dist/chunk-7IBXEWY5.js +0 -13
  148. package/dist/chunk-7URGGQWA.js +0 -13
  149. package/dist/chunk-7ZWO2XCS.cjs +0 -13
  150. package/dist/chunk-AQDYWFIE.cjs +0 -13
  151. package/dist/chunk-AUEQIRLO.cjs +0 -13
  152. package/dist/chunk-BEQYH4ZH.js +0 -13
  153. package/dist/chunk-BMEJLYYZ.js +0 -13
  154. package/dist/chunk-BXEIRESQ.cjs +0 -17
  155. package/dist/chunk-BYXBJQAS.js +0 -0
  156. package/dist/chunk-D4YPZVLI.js +0 -13
  157. package/dist/chunk-DMNL42QX.cjs +0 -13
  158. package/dist/chunk-DOKVIYQP.cjs +0 -13
  159. package/dist/chunk-DSTHXXIG.js +0 -14
  160. package/dist/chunk-E3I6537N.js +0 -25
  161. package/dist/chunk-EEMF44IH.cjs +0 -58
  162. package/dist/chunk-EODYYDJS.js +0 -13
  163. package/dist/chunk-ERY3BNIM.js +0 -13
  164. package/dist/chunk-ESPY25SV.cjs +0 -13
  165. package/dist/chunk-EZJQO3RD.cjs +0 -13
  166. package/dist/chunk-FEFTZ7TT.cjs +0 -13
  167. package/dist/chunk-FZTWDRFN.js +0 -13
  168. package/dist/chunk-H4PA2G3N.cjs +0 -13
  169. package/dist/chunk-H7QPKI66.cjs +0 -13
  170. package/dist/chunk-HLATHB47.js +0 -13
  171. package/dist/chunk-I3A3AEAA.cjs +0 -13
  172. package/dist/chunk-I3U5MBNO.cjs +0 -13
  173. package/dist/chunk-I5KQLZMG.js +0 -58
  174. package/dist/chunk-IBTK77R3.cjs +0 -13
  175. package/dist/chunk-IEFCX4Q4.cjs +0 -13
  176. package/dist/chunk-IG3RZSAO.js +0 -152
  177. package/dist/chunk-IIVF4KK5.cjs +0 -6
  178. package/dist/chunk-ILE746VV.js +0 -13
  179. package/dist/chunk-IPHYXYU4.cjs +0 -13
  180. package/dist/chunk-J4G2OFZ4.js +0 -17
  181. package/dist/chunk-JJXGNEQB.js +0 -13
  182. package/dist/chunk-JT3V6FP7.js +0 -13
  183. package/dist/chunk-K5OMXRSR.js +0 -13
  184. package/dist/chunk-KDGKC2AD.cjs +0 -13
  185. package/dist/chunk-KZJIE3RV.cjs +0 -13
  186. package/dist/chunk-L7KCN6DV.cjs +0 -13
  187. package/dist/chunk-LBBA76TA.js +0 -13
  188. package/dist/chunk-LI54LRUK.cjs +0 -13
  189. package/dist/chunk-LLVO2B4L.js +0 -13
  190. package/dist/chunk-LZ5V6B6A.cjs +0 -13
  191. package/dist/chunk-MI2HCYC4.js +0 -13
  192. package/dist/chunk-MLKGABMK.js +0 -9
  193. package/dist/chunk-MOHILOKE.js +0 -6
  194. package/dist/chunk-NEHQ24EP.js +0 -13
  195. package/dist/chunk-NESEKAGU.cjs +0 -13
  196. package/dist/chunk-NS5Q6ZYS.js +0 -13
  197. package/dist/chunk-OIX6AEOH.js +0 -13
  198. package/dist/chunk-OPZJWWQC.cjs +0 -13
  199. package/dist/chunk-PM3NSGHO.js +0 -13
  200. package/dist/chunk-Q7LKAKNO.js +0 -13
  201. package/dist/chunk-QTMLVSMQ.js +0 -188
  202. package/dist/chunk-RENPHZI7.cjs +0 -13
  203. package/dist/chunk-RHPG3BCQ.cjs +0 -13
  204. package/dist/chunk-S2QMZA7X.js +0 -13
  205. package/dist/chunk-S7LOBBW2.cjs +0 -13
  206. package/dist/chunk-T7E6HY2F.js +0 -13
  207. package/dist/chunk-TCAPRSWP.cjs +0 -13
  208. package/dist/chunk-TCP7WBEZ.cjs +0 -13
  209. package/dist/chunk-TT42MDI2.cjs +0 -13
  210. package/dist/chunk-TZWDBH6E.js +0 -13
  211. package/dist/chunk-U4CNUH3A.cjs +0 -302
  212. package/dist/chunk-UMRBYGCW.cjs +0 -13
  213. package/dist/chunk-UTRCC2RP.js +0 -13
  214. package/dist/chunk-UVMBRQNS.cjs +0 -13
  215. package/dist/chunk-UZWXBTQL.js +0 -31
  216. package/dist/chunk-VDTZORF6.cjs +0 -13
  217. package/dist/chunk-VO6GNJ4O.js +0 -13
  218. package/dist/chunk-VQ54VGY3.js +0 -13
  219. package/dist/chunk-VRWNZZCS.js +0 -13
  220. package/dist/chunk-W3IE4UWT.cjs +0 -13
  221. package/dist/chunk-WE4BXFRS.js +0 -13
  222. package/dist/chunk-WLDTS6EO.js +0 -13
  223. package/dist/chunk-WOAJW7OB.cjs +0 -13
  224. package/dist/chunk-WZX5LXRH.cjs +0 -13
  225. package/dist/chunk-XHXN5JNR.cjs +0 -14
  226. package/dist/chunk-XUPJ3XJL.js +0 -13
  227. package/dist/chunk-XYIWDMXZ.cjs +0 -13
  228. package/dist/chunk-Y2W7MENX.cjs +0 -13
  229. package/dist/chunk-YBGWOI5B.cjs +0 -13
  230. package/dist/chunk-YGLV5TML.js +0 -111
  231. package/dist/chunk-YJLFP6SE.js +0 -13
  232. package/dist/chunk-YJVFENGG.cjs +0 -111
  233. package/dist/chunk-YSDDIRK3.js +0 -13
  234. package/dist/chunk-YUYOWQ5M.js +0 -13
  235. package/dist/chunk-YW7CKAOG.cjs +0 -25
  236. package/dist/chunk-YYG5XGJC.js +0 -13
  237. package/dist/chunk-Z7LHYEQW.js +0 -13
  238. package/dist/chunk-ZWJ4O3II.cjs +0 -13
  239. package/dist/components.d.cts +0 -16
  240. package/dist/components.d.ts +0 -16
  241. package/dist/config.d.cts +0 -6
  242. package/dist/config.d.ts +0 -6
  243. package/dist/icon/index.d.cts +0 -136
  244. package/dist/icon/index.d.ts +0 -136
  245. package/dist/iconify.d.cts +0 -53
  246. package/dist/iconify.d.ts +0 -53
  247. package/dist/index.d.cts +0 -50
  248. package/dist/index.d.ts +0 -50
  249. package/dist/json.d.cts +0 -155
  250. package/dist/json.d.ts +0 -155
  251. package/dist/name.d.cts +0 -15
  252. package/dist/name.d.ts +0 -15
  253. package/dist/picker/dialog.d.cts +0 -19
  254. package/dist/picker/dialog.d.ts +0 -19
  255. package/dist/picker/index.d.cts +0 -123
  256. package/dist/picker/index.d.ts +0 -123
  257. package/dist/util.d.cts +0 -6
  258. package/dist/util.d.ts +0 -6
  259. package/dist/vite/index.d.cts +0 -56
  260. package/dist/vite/index.d.ts +0 -56
  261. package/dist/vue/bar.d.cts +0 -7
  262. package/dist/vue/bar.d.ts +0 -7
  263. package/dist/vue/below.d.cts +0 -7
  264. package/dist/vue/below.d.ts +0 -7
  265. package/dist/vue/bicycle.d.cts +0 -7
  266. package/dist/vue/bicycle.d.ts +0 -7
  267. package/dist/vue/bottom-left.d.cts +0 -7
  268. package/dist/vue/bottom-left.d.ts +0 -7
  269. package/dist/vue/bottom-right.d.cts +0 -7
  270. package/dist/vue/bottom-right.d.ts +0 -7
  271. package/dist/vue/bottom.d.cts +0 -7
  272. package/dist/vue/bottom.d.ts +0 -7
  273. package/dist/vue/cascader-field.d.cts +0 -7
  274. package/dist/vue/cascader-field.d.ts +0 -7
  275. package/dist/vue/catalogue.d.cts +0 -7
  276. package/dist/vue/catalogue.d.ts +0 -7
  277. package/dist/vue/clear.d.cts +0 -7
  278. package/dist/vue/clear.d.ts +0 -7
  279. package/dist/vue/close.d.cts +0 -7
  280. package/dist/vue/close.d.ts +0 -7
  281. package/dist/vue/crl.d.cts +0 -7
  282. package/dist/vue/crl.d.ts +0 -7
  283. package/dist/vue/delete.d.cts +0 -7
  284. package/dist/vue/delete.d.ts +0 -7
  285. package/dist/vue/document.d.cts +0 -7
  286. package/dist/vue/document.d.ts +0 -7
  287. package/dist/vue/down.d.cts +0 -7
  288. package/dist/vue/down.d.ts +0 -7
  289. package/dist/vue/download.d.cts +0 -7
  290. package/dist/vue/download.d.ts +0 -7
  291. package/dist/vue/edit.d.cts +0 -7
  292. package/dist/vue/edit.d.ts +0 -7
  293. package/dist/vue/enter.d.cts +0 -7
  294. package/dist/vue/enter.d.ts +0 -7
  295. package/dist/vue/folder.d.cts +0 -7
  296. package/dist/vue/folder.d.ts +0 -7
  297. package/dist/vue/frame.d.cts +0 -7
  298. package/dist/vue/frame.d.ts +0 -7
  299. package/dist/vue/grid.d.cts +0 -7
  300. package/dist/vue/grid.d.ts +0 -7
  301. package/dist/vue/hidd.d.cts +0 -7
  302. package/dist/vue/hidd.d.ts +0 -7
  303. package/dist/vue/home.d.cts +0 -7
  304. package/dist/vue/home.d.ts +0 -7
  305. package/dist/vue/index.d.cts +0 -45
  306. package/dist/vue/index.d.ts +0 -45
  307. package/dist/vue/left.d.cts +0 -7
  308. package/dist/vue/left.d.ts +0 -7
  309. package/dist/vue/lock.d.cts +0 -7
  310. package/dist/vue/lock.d.ts +0 -7
  311. package/dist/vue/login.d.cts +0 -7
  312. package/dist/vue/login.d.ts +0 -7
  313. package/dist/vue/logink.d.cts +0 -7
  314. package/dist/vue/logink.d.ts +0 -7
  315. package/dist/vue/more.d.cts +0 -7
  316. package/dist/vue/more.d.ts +0 -7
  317. package/dist/vue/mr.d.cts +0 -7
  318. package/dist/vue/mr.d.ts +0 -7
  319. package/dist/vue/mute.d.cts +0 -7
  320. package/dist/vue/mute.d.ts +0 -7
  321. package/dist/vue/node-tree.d.cts +0 -7
  322. package/dist/vue/node-tree.d.ts +0 -7
  323. package/dist/vue/page.d.cts +0 -7
  324. package/dist/vue/page.d.ts +0 -7
  325. package/dist/vue/pause.d.cts +0 -7
  326. package/dist/vue/pause.d.ts +0 -7
  327. package/dist/vue/play.d.cts +0 -7
  328. package/dist/vue/play.d.ts +0 -7
  329. package/dist/vue/plus.d.cts +0 -7
  330. package/dist/vue/plus.d.ts +0 -7
  331. package/dist/vue/qx.d.cts +0 -7
  332. package/dist/vue/qx.d.ts +0 -7
  333. package/dist/vue/retreat.d.cts +0 -7
  334. package/dist/vue/retreat.d.ts +0 -7
  335. package/dist/vue/right.d.cts +0 -7
  336. package/dist/vue/right.d.ts +0 -7
  337. package/dist/vue/set.d.cts +0 -7
  338. package/dist/vue/set.d.ts +0 -7
  339. package/dist/vue/sound.d.cts +0 -7
  340. package/dist/vue/sound.d.ts +0 -7
  341. package/dist/vue/star.d.cts +0 -7
  342. package/dist/vue/star.d.ts +0 -7
  343. package/dist/vue/sub-form.d.cts +0 -7
  344. package/dist/vue/sub-form.d.ts +0 -7
  345. package/dist/vue/tab.d.cts +0 -7
  346. package/dist/vue/tab.d.ts +0 -7
  347. package/dist/vue/up.d.cts +0 -7
  348. package/dist/vue/up.d.ts +0 -7
  349. package/dist/vue/views.d.cts +0 -7
  350. package/dist/vue/views.d.ts +0 -7
@@ -1,955 +1,723 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkYJVFENGGcjs = require('../chunk-YJVFENGG.cjs');
4
-
5
-
6
- var _chunk37O763HEcjs = require('../chunk-37O763HE.cjs');
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
- const reg = /(\\|\/)([^\\|\/]+)\.([a-z|A-Z][a-z|A-Z|0-9]*)$/g;
73
- const ml = str.replace(reg, "");
74
- let name = "";
75
- let suffix = "";
76
- let apart = "";
77
- const arr = reg.exec(str);
78
- if (arr) {
79
- apart = arr[1];
80
- name = arr[2];
81
- suffix = arr[3];
82
- }
83
- return {
84
- catalogue: ml,
85
- name,
86
- suffix,
87
- apart
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
- const obj = getUrlCatalogueObj(url);
92
- let wb = obj.name;
93
- if (wb) {
94
- const reg = /([0-9]+)$/g;
95
- const regs = reg.exec(wb);
96
- if (regs && regs.length > 0) {
97
- const sl = Number(regs[1]) + 1;
98
- const reg1 = new RegExp(regs[1] + "$");
99
- wb = wb.replace(reg1, (sl + "").padStart(regs[1].length, "0"));
100
- } else {
101
- wb = wb + "1";
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
- if (!type || type === true) {
110
- type = "utf-8";
111
- }
112
- return new Promise((resolve3, reject) => {
113
- _fs.readFile.call(void 0, url, type, (err, dataStr) => {
114
- if (err) {
115
- console.log("2", err);
116
- reject("");
117
- } else {
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
- if (!type || type === true) {
125
- type = "utf-8";
126
- }
127
- return new Promise((resolve3) => {
128
- const stream = _fs.createReadStream.call(void 0, url, {
129
- start: 0,
130
- end: 100,
131
- encoding: type
132
- });
133
- let st = "";
134
- stream.on("data", (data) => {
135
- st += data;
136
- });
137
- stream.on("end", () => {
138
- resolve3(st);
139
- });
140
- stream.on("error", () => {
141
- resolve3("");
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
- return new Promise((resolve3) => {
147
- try {
148
- _fs.access.call(void 0, reaPath, _fs.constants.F_OK, (err) => {
149
- if (err) {
150
- resolve3(false);
151
- } else {
152
- resolve3(true);
153
- }
154
- });
155
- } catch (e) {
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
- return new Promise((resolve3, reject) => {
162
- _fs.readdir.call(void 0, filePath, (err, files) => {
163
- if (err) {
164
- reject(err);
165
- } else {
166
- const lg = files.length;
167
- const dirs = [];
168
- const file = [];
169
- if (lg) {
170
- let i = 0;
171
- files.forEach((filename) => {
172
- const filedir = _path.join.call(void 0, filePath, filename);
173
- _fs.stat.call(void 0, filedir, (err2, stats) => {
174
- i++;
175
- if (err2) {
176
- console.log("4", err2);
177
- } else {
178
- const isFile = stats.isFile();
179
- const isDir = stats.isDirectory();
180
- if (isFile) {
181
- file.push(filename);
182
- }
183
- if (isDir) {
184
- dirs.push(filename);
185
- }
186
- }
187
- if (i >= lg) {
188
- resolve3({
189
- file,
190
- dirs
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
- _fs.open.call(void 0, path, "wx", async (err, fd) => {
207
- if (err) {
208
- if (err.code === "EEXIST") {
209
- if (type == 1 || type == 0) {
210
- const fwrite = () => {
211
- _fs.writeFile.call(void 0, path, json, "utf-8", (err2) => {
212
- if (err2) {
213
- console.log("6", err2);
214
- if (callback) {
215
- callback(path, cover ? 3 : 2, false, type);
216
- }
217
- } else {
218
- if (callback) {
219
- callback(path, cover ? 3 : 2, true, type);
220
- }
221
- }
222
- });
223
- };
224
- if (cover) {
225
- const st = await fsCreateReadStream(path);
226
- if (!st.includes("@config cover=true")) {
227
- fwrite();
228
- } else {
229
- if (callback) callback(path, 3, false, type);
230
- }
231
- } else {
232
- fwrite();
233
- }
234
- } else if (type == 3) {
235
- path = getNewFileName(path);
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
- _fs.mkdir.call(void 0, reaPath, { recursive: true }, (err, path) => {
277
- if (err) {
278
- console.log("0", err);
279
- if (callback) {
280
- callback(reaPath, false);
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
- return new Promise(async (resolve3) => {
291
- if (url) {
292
- const data = await fsReaddir(url);
293
- const arr = await writeFileUrl(
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
- return new Promise(async (resolve3) => {
309
- const arr = [];
310
- const dirs = [];
311
- if (files.dirs.length > 0) {
312
- for (let i = 0; i < files.dirs.length; i++) {
313
- const dir = files.dirs[i];
314
- let is = true;
315
- if (isDirs) {
316
- is = isDirs(url, dir);
317
- }
318
- if (is) {
319
- dirs.push(dir);
320
- const urls = await writeInit(
321
- _path.join.call(void 0, url, dir),
322
- callback,
323
- isDirs,
324
- isFile,
325
- issynch
326
- );
327
- arr.push(...urls);
328
- }
329
- }
330
- }
331
- files.dirs = dirs;
332
- const file = [];
333
- if (files.file.length > 0) {
334
- files.file.forEach((name) => {
335
- let is = true;
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
- // node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-55GZI3ZZ.js
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
- const arr = ["\x1B[0m"];
361
- if (obj == null ? void 0 : obj.revert) {
362
- arr.push("\x1B[4m");
363
- }
364
- if (obj == null ? void 0 : obj.lineThrough) {
365
- arr.push("\x1B[9m");
366
- }
367
- if (obj == null ? void 0 : obj.italic) {
368
- arr.push("\x1B[3m");
369
- }
370
- if (obj == null ? void 0 : obj.bold) {
371
- arr.push("\x1B[1m");
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
- const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
389
- const regs = reg.exec(url);
390
- if (regs && regs.length > 0) {
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
- if (matchs && matchs.length > 0) {
397
- for (const value of matchs) {
398
- if (typeof value == "string") {
399
- if (key.endsWith(value)) {
400
- return true;
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
- if (matchs && matchs.length > 0) {
415
- for (const value of matchs) {
416
- if (typeof value == "string") {
417
- if (key.startsWith(value)) {
418
- return true;
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
- const reg = /((\\|\/)([^\\|\/]+)(\.[a-z|A-Z][a-z|A-Z|0-9]*))?$/g;
433
- return str.replace(reg, "");
273
+ return str.replace(/((\\|\/)([^\\|\/]+)(\.[a-z|A-Z][a-z|A-Z|0-9]*))?$/g, "");
434
274
  }
435
- var defaultSuffixReg = /\\.[a-z|A-Z]+$/;
436
- var defaultConfig = {
437
- name: "com",
438
- /**
439
- * 打包的文件地址
440
- */
441
- dir: "./packages/",
442
- /**
443
- * 文件后缀
444
- */
445
- extensions: ["js", "ts"],
446
- suffixReg: defaultSuffixReg,
447
- fileTongre: false,
448
- /**
449
- * 是否替换文件
450
- */
451
- fileCover: false,
452
- /**
453
- * 判断当前文件100个字节内存在 @config cover=true 就不写入
454
- */
455
- coverConfig: false,
456
- /**
457
- * 写入注释
458
- */
459
- writeNotes: false,
460
- /**
461
- * 读取当前文件,文件的编码类型,默认utf-8
462
- */
463
- read: false,
464
- /**
465
- * 匹配目录数组
466
- * 从头开始匹配
467
- */
468
- matchs: [],
469
- /**
470
- * 匹配文件路径
471
- * 从尾部开始匹配
472
- */
473
- matchexts: [],
474
- forceUpdate: [],
475
- /**
476
- * 不匹配目录数组
477
- * 从头开始匹配
478
- */
479
- nomatchs: [],
480
- /**
481
- * 不匹配文件路径
482
- * 从尾部开始匹配
483
- */
484
- nomatchexts: [],
485
- issort: false,
486
- issynch: false
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
- if (ex.length == 0) {
490
- return defaultSuffixReg;
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
- constructor(config, callback) {
499
- this.config = {};
500
- this._configCallback = callback;
501
- this._defaultConfig = defaultConfig;
502
- this.initConfig(config);
503
- }
504
- async runDev(callback, configCallback, config, nosort) {
505
- this.initConfig(config);
506
- const call = configCallback || this._configCallback;
507
- if (call) {
508
- const c = call(this.config);
509
- if (c) {
510
- this.initConfig(c);
511
- }
512
- }
513
- return await this.handle(callback, nosort);
514
- }
515
- /**
516
- * 初始化
517
- * @param config
518
- * @returns
519
- */
520
- initConfig(config) {
521
- if (config) {
522
- this.config = config;
523
- this.setDefaultConfig();
524
- this.config.suffixReg = getSuffixReg(this.config.extensions);
525
- if (!this.config.matchexts || this.config.matchexts.length == 0) {
526
- this.config.matchexts = [this.config.suffixReg];
527
- }
528
- }
529
- return this.config;
530
- }
531
- setDefaultConfig() {
532
- Object.keys(this._defaultConfig).forEach((key) => {
533
- if (typeof this.config[key] == "undefined") {
534
- this.config[key] = this._defaultConfig[key];
535
- }
536
- });
537
- }
538
- getFileName(name) {
539
- if (this.config.suffixReg) {
540
- return name.replace(this.config.suffixReg, "");
541
- } else {
542
- return name.replace(defaultSuffixReg, "");
543
- }
544
- }
545
- /**
546
- * 获取当前位置
547
- * @param dir
548
- * @returns
549
- */
550
- getDirUrl(dir) {
551
- const str = dir || this.config.dir;
552
- if (str) {
553
- return _path.resolve.call(void 0, process.cwd(), str);
554
- } else {
555
- return "";
556
- }
557
- }
558
- isForceUpdate(url) {
559
- if (this.config.forceUpdate && this.config.forceUpdate.length > 0) {
560
- return matchsEnd(url.replace(/\\/g, "/"), this.config.forceUpdate);
561
- } else {
562
- return false;
563
- }
564
- }
565
- isMatchFile(url, name) {
566
- const dirUrl = this.getDirUrl();
567
- const dir = _path.join.call(void 0, url, name).replace(dirUrl, "").replace(/\\/g, "/");
568
- const is = matchsEnd(dir, this.config.matchexts);
569
- const nomatchexts = this.config.nomatchexts;
570
- if (is && nomatchexts && nomatchexts.length > 0) {
571
- if (matchsEnd(dir, nomatchexts)) {
572
- return false;
573
- } else {
574
- return true;
575
- }
576
- } else {
577
- return is;
578
- }
579
- }
580
- isMatchDir(url, name) {
581
- const dirUrl = this.getDirUrl();
582
- const dir = _path.join.call(void 0, url, name).replace(dirUrl, "").replace(/\\/g, "/");
583
- const is = matchsStart(dir, this.config.matchs);
584
- const nomatchs = this.config.nomatchs;
585
- if (is && nomatchs && nomatchs.length > 0) {
586
- if (matchsStart(dir, nomatchs)) {
587
- return false;
588
- } else {
589
- return true;
590
- }
591
- } else {
592
- return is;
593
- }
594
- }
595
- /**
596
- * 处理方法
597
- * @param callback
598
- */
599
- handle(callback, nosort) {
600
- return new Promise(async (resolve22) => {
601
- const url = this.getDirUrl();
602
- if (url) {
603
- const rarr = await writeInit(
604
- url,
605
- async (...arr) => {
606
- if (callback) {
607
- await callback(...arr);
608
- }
609
- return await this.writeCallback(...arr, nosort);
610
- },
611
- (...arr) => {
612
- return this.isMatchDir(...arr);
613
- },
614
- (...arr) => {
615
- return this.isMatchFile(...arr);
616
- },
617
- this.config.issynch
618
- );
619
- resolve22(rarr);
620
- } else {
621
- resolve22([]);
622
- }
623
- });
624
- }
625
- getFileNotes(url) {
626
- const suffix = getSuffix(url);
627
- const sz = [
628
- `@config cover=false`,
629
- `cover \u662F\u5426\u8986\u76D6\u5F53\u524D\u6587\u4EF6\uFF0C\u9ED8\u8BA4\u662Ffalse\uFF0C true \u8868\u793A\u4E0D\u8986\u76D6`,
630
- `\u5F53\u524D\u5DF2\u7ECF\u7531@fangzhongya/create\u81EA\u52A8\u751F\u6210`,
631
- `${(/* @__PURE__ */ new Date()).toString()}`
632
- ];
633
- const hy = ["md", "html", "vue"];
634
- if (hy.includes(suffix)) {
635
- const arr = ["<!--"];
636
- sz.forEach((v) => {
637
- arr.push(" - " + v);
638
- });
639
- arr.push("-->");
640
- return arr;
641
- } else {
642
- const arr = ["/**"];
643
- sz.forEach((v) => {
644
- arr.push(" * " + v);
645
- });
646
- arr.push(" */");
647
- return arr;
648
- }
649
- }
650
- /**
651
- * 输出文件,判断目录是否存在
652
- * @param url
653
- * @param sts
654
- */
655
- fileOpen(url, sts, fileUrls, type) {
656
- fsMkdir(getUrlCatalogue(url), (reaPath, is, ml) => {
657
- const logs = this.getLogs();
658
- logs.push(styleLog("dir", {}));
659
- if (is) {
660
- if (ml) {
661
- logs.push(
662
- styleLog("add", {
663
- text: 2,
664
- italic: true
665
- })
666
- );
667
- logs.push(
668
- styleLog(reaPath, {
669
- text: 2,
670
- revert: true
671
- })
672
- );
673
- console.log(logs.join(" "));
674
- }
675
- } else {
676
- logs.push(
677
- styleLog(reaPath, {
678
- text: 1,
679
- revert: true
680
- })
681
- );
682
- console.log(logs.join(" "));
683
- }
684
- this.setOpen(url, sts, type, (kurl, _type, is2, _tn) => {
685
- if (is2 && fileUrls) {
686
- fileUrls.push(kurl);
687
- }
688
- });
689
- });
690
- }
691
- /**
692
- * 输出文件
693
- * @param url
694
- * @param str
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
- // node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-VZKQWRZ3.js
780
-
781
- var defaultConfig2 = Object.assign({}, defaultConfig, {
782
- name: "file",
783
- /**
784
- * 生成的文件名称
785
- */
786
- gene: void 0,
787
- /**
788
- * 文件生成方法
789
- */
790
- fileSet: void 0
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
- constructor(config, callback) {
794
- super();
795
- this.config = {};
796
- this._configCallback = callback;
797
- this._defaultConfig = defaultConfig2;
798
- this.initConfig(config || this.config);
799
- }
800
- getDefaultGene(name, url, _wj) {
801
- return _path.join.call(void 0, url, name);
802
- }
803
- getDefaultFileSet(_name, _url, _text, _wjm, _imp, _surl) {
804
- return [];
805
- }
806
- getGeneObj(url, name, outDir) {
807
- return getUrlCatalogueObj(
808
- _path.join.call(void 0,
809
- _path.resolve.call(void 0, process.cwd(), outDir),
810
- _path.join.call(void 0, url, name).replace(this.getDirUrl(), "")
811
- )
812
- );
813
- }
814
- /**
815
- * 获取输出地址方法
816
- * @param gene
817
- * @returns
818
- */
819
- getGene(gene) {
820
- gene = gene || this.config.gene;
821
- if (!gene) {
822
- return (...arr) => {
823
- return this.getDefaultGene(...arr);
824
- };
825
- } else {
826
- return gene;
827
- }
828
- }
829
- fileRead(url, type) {
830
- return new Promise((resolve22) => {
831
- fsAccess(url).then(() => {
832
- resolve22(fsReadFile(url, type));
833
- });
834
- });
835
- }
836
- getFileSet(fileSet) {
837
- fileSet = fileSet || this.config.fileSet;
838
- if (!fileSet) {
839
- return (...arr) => {
840
- return this.getDefaultFileSet(...arr);
841
- };
842
- } else {
843
- return fileSet;
844
- }
845
- }
846
- /**
847
- * 回调方法
848
- * @param url
849
- * @param file
850
- * @param urls
851
- */
852
- async writeCallback(url, readdir2, fileUrls) {
853
- const gene = this.getGene();
854
- const fileSet = this.getFileSet();
855
- const read = this.config.read;
856
- if (readdir2.file) {
857
- for (let i = 0; i < readdir2.file.length; i++) {
858
- const name = readdir2.file[i];
859
- const furl = _path.join.call(void 0, url, name);
860
- const wjmc = this.getFileName(name);
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
- // node_modules/.pnpm/@fangzhongya+create@0.2.50/node_modules/@fangzhongya/create/dist/chunk-WJXYWEHS.js
881
-
882
- var defaultConfig22 = Object.assign({}, defaultConfig2, {
883
- name: "out",
884
- outDir: "./",
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
- constructor(config, callback) {
889
- super();
890
- this.config = {};
891
- this._configCallback = callback;
892
- this._defaultConfig = defaultConfig22;
893
- this.initConfig(config || this.config);
894
- }
895
- getFileNeader(name, url) {
896
- return [`/**`, ` * ${_path.join.call(void 0, url, name).replace(/\\/g, "/")}`, " */"];
897
- }
898
- /**
899
- * 获取输出地址方法
900
- * @param gene
901
- * @returns
902
- */
903
- getDefaultGene(name, url, _wj) {
904
- const obj = this.getGeneObj(url, name, this.config.outDir);
905
- return _path.join.call(void 0, obj.catalogue, obj.name + "." + obj.suffix);
906
- }
907
- getDefaultFileSet(name, url, text, _wjm, _imp) {
908
- const arr = [text];
909
- if (this.config.isNeader) {
910
- return [...this.getFileNeader(name, url), ...arr];
911
- }
912
- return arr;
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
- const fang = new FangOut(config);
917
- fang.runDev(callback, configCallback);
700
+ new FangOut(config).runDev(callback, configCallback);
918
701
  }
919
-
920
- // packages/vite/index.ts
921
-
922
- var runType = "vue";
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
- const {
926
- name = "FangIcon",
927
- type = runType,
928
- directory = "/svg",
929
- dynamic = true,
930
- virtual = false,
931
- replaced = true,
932
- alias = "icon",
933
- customReplacement
934
- } = options;
935
- if (options.mobile) {
936
- const outDir = _path.join.call(void 0, "./public/", directory);
937
- runDev({
938
- issort: true,
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
- // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
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
- const svg = `
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
- // \u5BFC\u51FA\u5B89\u88C5\u51FD\u6570
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
- const text = type === runType ? svg : pub;
1043
- plugin.resolveId = function(id) {
1044
- if (id === virtualModuleId) {
1045
- return resolvedVirtualModuleId;
1046
- }
1047
- return void 0;
1048
- };
1049
- plugin.load = function(id) {
1050
- if (id === resolvedVirtualModuleId) {
1051
- return text;
1052
- }
1053
- return null;
1054
- };
1055
- } else {
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
- return null;
1068
- };
1069
- }
1070
- if (replaced) {
1071
- const targetComponents = Array.isArray(name) ? name : [name];
1072
- plugin.enforce = "pre";
1073
- plugin.transform = function(code, id) {
1074
- if (!shouldProcess(id)) {
1075
- return null;
1076
- }
1077
- try {
1078
- const components = findComponents(code, targetComponents);
1079
- if (components.length === 0) {
1080
- return null;
1081
- }
1082
- let transformedCode = code;
1083
- let replacedCount = 0;
1084
- const imports = /* @__PURE__ */ new Set();
1085
- if (!virtual) {
1086
- imports.add(
1087
- `import ${name} from '@fangzhongya/icons/icon/index'`
1088
- );
1089
- replacedCount++;
1090
- }
1091
- for (let i = components.length - 1; i >= 0; i--) {
1092
- const component = components[i];
1093
- if (isReplaced(component)) {
1094
- const { text, imptext } = replaceComponent(
1095
- component,
1096
- type,
1097
- dynamic,
1098
- customReplacement,
1099
- alias
1100
- );
1101
- imports.add(imptext);
1102
- if (text !== component.fullMatch) {
1103
- transformedCode = transformedCode.slice(0, component.start) + text + transformedCode.slice(component.end);
1104
- replacedCount++;
1105
- }
1106
- }
1107
- }
1108
- if (/.vue$/.test(id)) {
1109
- const i = transformedCode.indexOf("</script>");
1110
- transformedCode = transformedCode.slice(0, i) + [...imports].join(";\n") + transformedCode.slice(i);
1111
- } else {
1112
- transformedCode = [...imports].join(";\n") + transformedCode;
1113
- }
1114
- if (replacedCount > 0) {
1115
- return {
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
- const attributes = { name: "" };
1141
- const attrRegex = /(?:@|:|v-bind:)?([\w-]+)(?:="([^"]*)"|='([^']*)')/g;
1142
- let match;
1143
- while ((match = attrRegex.exec(attrString)) !== null) {
1144
- const name = match[1];
1145
- if (name) {
1146
- const value = match[2] || match[3] || "";
1147
- if (name === "name") {
1148
- attributes.name = value;
1149
- } else if (value === "true" || value === "false") {
1150
- attributes[name] = value === "true";
1151
- } else if (!isNaN(Number(value)) && value !== "") {
1152
- attributes[name] = Number(value);
1153
- } else {
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
- const nameRegex = /(?:^|\s)name="[^"]*"/i;
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
- return !content || /^\s*$/.test(content);
896
+ return !content || /^\s*$/.test(content);
1167
897
  }
1168
898
  function isReplaced(m) {
1169
- if (!m) {
1170
- return false;
1171
- }
1172
- const { fullMatch, attributes } = m;
1173
- if (!hasStringNameAttribute(fullMatch)) {
1174
- return false;
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
- const components = [];
1190
- for (const componentName of name) {
1191
- let currentIndex = 0;
1192
- while (currentIndex < code.length) {
1193
- const startTagIndex = code.indexOf(
1194
- `<${componentName}`,
1195
- currentIndex
1196
- );
1197
- if (startTagIndex === -1) break;
1198
- let tagEndIndex = code.indexOf(">", startTagIndex);
1199
- if (tagEndIndex === -1) break;
1200
- const startTag = code.slice(startTagIndex, tagEndIndex + 1);
1201
- const attrString = startTag.slice(componentName.length + 1, -1).trim();
1202
- const attributes = parseAttributes(attrString);
1203
- const isSelfClosing = startTag.endsWith("/>");
1204
- let endIndex;
1205
- let fullMatch;
1206
- if (isSelfClosing) {
1207
- endIndex = tagEndIndex + 1;
1208
- fullMatch = startTag;
1209
- } else {
1210
- const endTag = `</${componentName}>`;
1211
- let endTagIndex = code.indexOf(endTag, tagEndIndex + 1);
1212
- if (endTagIndex === -1) {
1213
- currentIndex = startTagIndex + 1;
1214
- continue;
1215
- }
1216
- endIndex = endTagIndex + endTag.length;
1217
- fullMatch = code.slice(startTagIndex, endIndex);
1218
- }
1219
- components.push({
1220
- componentName,
1221
- fullMatch,
1222
- start: startTagIndex,
1223
- end: endIndex,
1224
- attributes,
1225
- isSelfClosing
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
- const svg = _chunkYJVFENGGcjs.getIconifySVG.call(void 0, _chunk37O763HEcjs.json_default, name);
1234
- const s = match.fullMatch.replace(`name="${iconName}"`, "").replace(`</${match.componentName}>`, "");
1235
- const text = `${s}${svg}</${match.componentName}>`;
1236
- return { text, imptext: "" };
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
- return _chunkBXEIRESQcjs.lineToLargeHump.call(void 0, alias + "-" + iconName);
954
+ return require_lineToLargeHump.lineToLargeHump(alias + "-" + iconName);
1240
955
  }
1241
956
  function getVue(iconName, match, name, alias = "icon") {
1242
- const text = match.fullMatch.replace(
1243
- `name="${iconName}"`,
1244
- `:name="${getImportName(name, alias)}"`
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
- const { attributes } = match;
1256
- const iconName = attributes.name;
1257
- if (customReplacement) {
1258
- return customReplacement(iconName, attributes, alias);
1259
- }
1260
- let name = iconName;
1261
- if (alias) {
1262
- if (iconName && iconName.startsWith(alias + "-")) {
1263
- name = iconName.substring(alias.length + 1);
1264
- }
1265
- }
1266
- let svgContent = _chunk37O763HEcjs.json_default.icons[iconName] || _chunk37O763HEcjs.json_default.icons[name];
1267
- if (!svgContent) {
1268
- return { text: match.fullMatch, imptext: "" };
1269
- }
1270
- if (!attributes.type && type == runType || attributes.type === runType) {
1271
- if (dynamic) {
1272
- return getVue(iconName, match, name, alias);
1273
- } else {
1274
- return getText(iconName, match, name);
1275
- }
1276
- }
1277
- if (type === "pub" && !attributes.type && !attributes.default) {
1278
- let text = match.fullMatch;
1279
- text = text.replace(
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
- const validExtensions = [".vue", ".jsx", ".tsx", ".js", ".ts"];
1289
- const hasValidExtension = validExtensions.some((ext) => id.endsWith(ext));
1290
- if (!hasValidExtension) return false;
1291
- if (id.includes("/node_modules/")) return false;
1292
- return true;
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;