@fangzhongya/icons 0.0.21 → 0.0.22

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.
@@ -1,909 +0,0 @@
1
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-4CBOJSDB.js
2
- function getStartSames(str, val) {
3
- let s = "";
4
- const vs = [...val];
5
- let index = 0;
6
- for (; index < vs.length; index++) {
7
- const element = vs[index];
8
- if (element === str.charAt(index)) {
9
- s += element;
10
- } else {
11
- break;
12
- }
13
- }
14
- return [s, str.substring(index), val.substring(index)];
15
- }
16
- function getImportUrl(url, imp) {
17
- const arr = getStartSames(url, imp);
18
- const ts = arr[0];
19
- if (!/[\\|\/]$/.test(ts)) {
20
- const regs = ts.match(/[\\|\/]([^\\|\/]*)$/);
21
- if (regs && regs.length > 0) {
22
- const a = regs[1];
23
- arr[0] = ts.substring(0, regs.index + 1);
24
- arr[1] = a + arr[1];
25
- arr[2] = a + arr[2];
26
- }
27
- }
28
- const l = arr[1].split(/\\|\//).length - 1;
29
- let ds = ["./"];
30
- if (l > 0) {
31
- ds = [];
32
- for (let index = 0; index < l; index++) {
33
- ds.push("../");
34
- }
35
- }
36
- return ds.join("") + arr[2].replace(/\\/g, "/");
37
- }
38
-
39
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-3GUX6LOY.js
40
- function getImportUrlSuffix(url, imp) {
41
- return getImportUrl(url, imp).replace(/\.([a-z|A-Z][a-z|A-Z|0-9]*)$/, "");
42
- }
43
-
44
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-I5KYQX4M.js
45
- import {
46
- open,
47
- readdir,
48
- stat,
49
- writeFile,
50
- write,
51
- mkdir,
52
- readFile,
53
- createReadStream,
54
- access,
55
- constants
56
- } from "fs";
57
- import { join } from "path";
58
- function getUrlCatalogueObj(str) {
59
- const reg = /(\\|\/)([^\\|\/]+)\.([a-z|A-Z][a-z|A-Z|0-9]*)$/g;
60
- const ml = str.replace(reg, "");
61
- let name = "";
62
- let suffix = "";
63
- let apart = "";
64
- const arr = reg.exec(str);
65
- if (arr) {
66
- apart = arr[1];
67
- name = arr[2];
68
- suffix = arr[3];
69
- }
70
- return {
71
- catalogue: ml,
72
- name,
73
- suffix,
74
- apart
75
- };
76
- }
77
- function getNewFileName(url) {
78
- const obj = getUrlCatalogueObj(url);
79
- let wb = obj.name;
80
- if (wb) {
81
- const reg = /([0-9]+)$/g;
82
- const regs = reg.exec(wb);
83
- if (regs && regs.length > 0) {
84
- const sl = Number(regs[1]) + 1;
85
- const reg1 = new RegExp(regs[1] + "$");
86
- wb = wb.replace(reg1, (sl + "").padStart(regs[1].length, "0"));
87
- } else {
88
- wb = wb + "1";
89
- }
90
- return obj.catalogue + obj.apart + wb + "." + obj.suffix;
91
- } else {
92
- return "";
93
- }
94
- }
95
- function fsReadFile(url, type) {
96
- if (!type || type === true) {
97
- type = "utf-8";
98
- }
99
- return new Promise((resolve3, reject) => {
100
- readFile(url, type, (err, dataStr) => {
101
- if (err) {
102
- console.log("2", err);
103
- reject("");
104
- } else {
105
- resolve3(dataStr);
106
- }
107
- });
108
- });
109
- }
110
- function fsCreateReadStream(url, type) {
111
- if (!type || type === true) {
112
- type = "utf-8";
113
- }
114
- return new Promise((resolve3) => {
115
- const stream = createReadStream(url, {
116
- start: 0,
117
- end: 100,
118
- encoding: type
119
- });
120
- let st = "";
121
- stream.on("data", (data) => {
122
- st += data;
123
- });
124
- stream.on("end", () => {
125
- resolve3(st);
126
- });
127
- stream.on("error", () => {
128
- resolve3("");
129
- });
130
- });
131
- }
132
- function fsAccess(reaPath) {
133
- return new Promise((resolve3) => {
134
- try {
135
- access(reaPath, constants.F_OK, (err) => {
136
- if (err) {
137
- resolve3(false);
138
- } else {
139
- resolve3(true);
140
- }
141
- });
142
- } catch (e) {
143
- resolve3(false);
144
- }
145
- });
146
- }
147
- function fsReaddir(filePath) {
148
- return new Promise((resolve3, reject) => {
149
- readdir(filePath, (err, files) => {
150
- if (err) {
151
- reject(err);
152
- } else {
153
- const lg = files.length;
154
- const dirs = [];
155
- const file = [];
156
- if (lg) {
157
- let i = 0;
158
- files.forEach((filename) => {
159
- const filedir = join(filePath, filename);
160
- stat(filedir, (err2, stats) => {
161
- i++;
162
- if (err2) {
163
- console.log("4", err2);
164
- } else {
165
- const isFile = stats.isFile();
166
- const isDir = stats.isDirectory();
167
- if (isFile) {
168
- file.push(filename);
169
- }
170
- if (isDir) {
171
- dirs.push(filename);
172
- }
173
- }
174
- if (i >= lg) {
175
- resolve3({
176
- file,
177
- dirs
178
- });
179
- }
180
- });
181
- });
182
- } else {
183
- resolve3({
184
- file,
185
- dirs
186
- });
187
- }
188
- }
189
- });
190
- });
191
- }
192
- function fsOpenStream(path, json, type = 0, cover, callback) {
193
- open(path, "wx", async (err, fd) => {
194
- if (err) {
195
- if (err.code === "EEXIST") {
196
- if (type == 1 || type == 0) {
197
- const fwrite = () => {
198
- writeFile(path, json, "utf-8", (err2) => {
199
- if (err2) {
200
- console.log("6", err2);
201
- if (callback) {
202
- callback(path, cover ? 3 : 2, false, type);
203
- }
204
- } else {
205
- if (callback) {
206
- callback(path, cover ? 3 : 2, true, type);
207
- }
208
- }
209
- });
210
- };
211
- if (cover) {
212
- const st = await fsCreateReadStream(path);
213
- if (!st.includes("@config cover=true")) {
214
- fwrite();
215
- } else {
216
- if (callback) callback(path, 3, false, type);
217
- }
218
- } else {
219
- fwrite();
220
- }
221
- } else if (type == 3) {
222
- path = getNewFileName(path);
223
- if (path) {
224
- fsOpenStream(path, json, type, cover, callback);
225
- } else {
226
- if (callback) {
227
- callback(path, 3, false, type);
228
- }
229
- }
230
- } else {
231
- if (callback) {
232
- callback(path, 2, false, type);
233
- }
234
- }
235
- } else {
236
- if (callback) {
237
- callback(path, 0, false, type);
238
- }
239
- }
240
- } else {
241
- if (type != 1) {
242
- write(fd, json, (err2) => {
243
- if (err2) {
244
- console.log("8", err2);
245
- if (callback) {
246
- callback(path, 1, false, type);
247
- }
248
- } else {
249
- if (callback) {
250
- callback(path, 1, true, type);
251
- }
252
- }
253
- });
254
- } else {
255
- if (callback) {
256
- callback(path, 1, false, type);
257
- }
258
- }
259
- }
260
- });
261
- }
262
- function fsMkdir(reaPath, callback) {
263
- mkdir(reaPath, { recursive: true }, (err, path) => {
264
- if (err) {
265
- console.log("0", err);
266
- if (callback) {
267
- callback(reaPath, false);
268
- }
269
- } else {
270
- if (callback) {
271
- callback(reaPath, true, path);
272
- }
273
- }
274
- });
275
- }
276
- function writeInit(url, callback, isDirs, isFile, issynch) {
277
- return new Promise(async (resolve3) => {
278
- if (url) {
279
- const data = await fsReaddir(url);
280
- const arr = await writeFileUrl(
281
- url,
282
- data,
283
- callback,
284
- isDirs,
285
- isFile,
286
- issynch
287
- );
288
- resolve3(arr);
289
- } else {
290
- resolve3([]);
291
- }
292
- });
293
- }
294
- function writeFileUrl(url, files, callback, isDirs, isFile, issynch) {
295
- return new Promise(async (resolve3) => {
296
- const arr = [];
297
- const dirs = [];
298
- if (files.dirs.length > 0) {
299
- for (let i = 0; i < files.dirs.length; i++) {
300
- const dir = files.dirs[i];
301
- let is = true;
302
- if (isDirs) {
303
- is = isDirs(url, dir);
304
- }
305
- if (is) {
306
- dirs.push(dir);
307
- const urls = await writeInit(
308
- join(url, dir),
309
- callback,
310
- isDirs,
311
- isFile,
312
- issynch
313
- );
314
- arr.push(...urls);
315
- }
316
- }
317
- }
318
- files.dirs = dirs;
319
- const file = [];
320
- if (files.file.length > 0) {
321
- files.file.forEach((name) => {
322
- let is = true;
323
- if (isFile) {
324
- is = isFile(url, name);
325
- }
326
- if (is) {
327
- file.push(name);
328
- arr.push(join(url, name));
329
- }
330
- });
331
- }
332
- files.file = file;
333
- if (callback) {
334
- if (issynch) {
335
- await callback(url, files, arr);
336
- } else {
337
- callback(url, files, arr);
338
- }
339
- }
340
- resolve3(arr);
341
- });
342
- }
343
-
344
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-FWEGYLR7.js
345
- import { resolve, join as join2 } from "path";
346
- function styleLog(msg = "", obj) {
347
- const arr = ["\x1B[0m"];
348
- if (obj == null ? void 0 : obj.revert) {
349
- arr.push("\x1B[4m");
350
- }
351
- if (obj == null ? void 0 : obj.lineThrough) {
352
- arr.push("\x1B[9m");
353
- }
354
- if (obj == null ? void 0 : obj.italic) {
355
- arr.push("\x1B[3m");
356
- }
357
- if (obj == null ? void 0 : obj.bold) {
358
- arr.push("\x1B[1m");
359
- }
360
- if (obj == null ? void 0 : obj.bag) {
361
- arr.push(`\x1B[4${obj == null ? void 0 : obj.bag}m`);
362
- } else {
363
- arr.push("\x1B[40m");
364
- }
365
- if (obj == null ? void 0 : obj.text) {
366
- arr.push(`\x1B[3${obj == null ? void 0 : obj.text}m`);
367
- } else {
368
- arr.push("\x1B[30m");
369
- }
370
- arr.push(msg);
371
- arr.push("\x1B[0m");
372
- return arr.join("");
373
- }
374
- function getSuffix(url) {
375
- const reg = /\.([a-z|A-Z][a-z|A-Z|0-9]*)$/;
376
- const regs = reg.exec(url);
377
- if (regs && regs.length > 0) {
378
- return regs[1];
379
- }
380
- return "";
381
- }
382
- function matchsEnd(key, matchs) {
383
- if (matchs && matchs.length > 0) {
384
- for (const value of matchs) {
385
- if (typeof value == "string") {
386
- if (key.endsWith(value)) {
387
- return true;
388
- }
389
- } else {
390
- if (value.test(key)) {
391
- return true;
392
- }
393
- }
394
- }
395
- return false;
396
- } else {
397
- return true;
398
- }
399
- }
400
- function matchsStart(key, matchs) {
401
- if (matchs && matchs.length > 0) {
402
- for (const value of matchs) {
403
- if (typeof value == "string") {
404
- if (key.startsWith(value)) {
405
- return true;
406
- }
407
- } else {
408
- if (value.test(key)) {
409
- return true;
410
- }
411
- }
412
- }
413
- return false;
414
- } else {
415
- return true;
416
- }
417
- }
418
- function getUrlCatalogue(str) {
419
- const reg = /((\\|\/)([^\\|\/]+)(\.[a-z|A-Z][a-z|A-Z|0-9]*))?$/g;
420
- return str.replace(reg, "");
421
- }
422
- var defaultSuffixReg = /\\.[a-z|A-Z]+$/;
423
- var defaultConfig = {
424
- name: "com",
425
- /**
426
- * 打包的文件地址
427
- */
428
- dir: "./packages/",
429
- /**
430
- * 文件后缀
431
- */
432
- extensions: ["js", "ts"],
433
- suffixReg: defaultSuffixReg,
434
- fileTongre: false,
435
- /**
436
- * 是否替换文件
437
- */
438
- fileCover: false,
439
- /**
440
- * 判断当前文件100个字节内存在 @config cover=true 就不写入
441
- */
442
- coverConfig: false,
443
- /**
444
- * 写入注释
445
- */
446
- writeNotes: false,
447
- /**
448
- * 读取当前文件,文件的编码类型,默认utf-8
449
- */
450
- read: false,
451
- /**
452
- * 匹配目录数组
453
- * 从头开始匹配
454
- */
455
- matchs: [],
456
- /**
457
- * 匹配文件路径
458
- * 从尾部开始匹配
459
- */
460
- matchexts: [],
461
- forceUpdate: [],
462
- /**
463
- * 不匹配目录数组
464
- * 从头开始匹配
465
- */
466
- nomatchs: [],
467
- /**
468
- * 不匹配文件路径
469
- * 从尾部开始匹配
470
- */
471
- nomatchexts: [],
472
- issort: false,
473
- issynch: false
474
- };
475
- function getSuffixReg(ex = []) {
476
- if (ex.length == 0) {
477
- return defaultSuffixReg;
478
- }
479
- return new RegExp(`\\.(${ex.join("|")})$`);
480
- }
481
- var FangCom = class {
482
- _configCallback;
483
- _defaultConfig;
484
- config;
485
- constructor(config, callback) {
486
- this.config = {};
487
- this._configCallback = callback;
488
- this._defaultConfig = defaultConfig;
489
- this.initConfig(config);
490
- }
491
- async runDev(callback, configCallback, config, nosort) {
492
- this.initConfig(config);
493
- const call = configCallback || this._configCallback;
494
- if (call) {
495
- const c = call(this.config);
496
- if (c) {
497
- this.initConfig(c);
498
- }
499
- }
500
- return await this.handle(callback, nosort);
501
- }
502
- /**
503
- * 初始化
504
- * @param config
505
- * @returns
506
- */
507
- initConfig(config) {
508
- if (config) {
509
- this.config = config;
510
- this.setDefaultConfig();
511
- this.config.suffixReg = getSuffixReg(this.config.extensions);
512
- if (!this.config.matchexts || this.config.matchexts.length == 0) {
513
- this.config.matchexts = [this.config.suffixReg];
514
- }
515
- }
516
- return this.config;
517
- }
518
- setDefaultConfig() {
519
- Object.keys(this._defaultConfig).forEach((key) => {
520
- if (typeof this.config[key] == "undefined") {
521
- this.config[key] = this._defaultConfig[key];
522
- }
523
- });
524
- }
525
- getFileName(name) {
526
- if (this.config.suffixReg) {
527
- return name.replace(this.config.suffixReg, "");
528
- } else {
529
- return name.replace(defaultSuffixReg, "");
530
- }
531
- }
532
- /**
533
- * 获取当前位置
534
- * @param dir
535
- * @returns
536
- */
537
- getDirUrl(dir) {
538
- const str = dir || this.config.dir;
539
- if (str) {
540
- return resolve(process.cwd(), str);
541
- } else {
542
- return "";
543
- }
544
- }
545
- isForceUpdate(url) {
546
- if (this.config.forceUpdate && this.config.forceUpdate.length > 0) {
547
- return matchsEnd(url.replace(/\\/g, "/"), this.config.forceUpdate);
548
- } else {
549
- return false;
550
- }
551
- }
552
- isMatchFile(url, name) {
553
- const dirUrl = this.getDirUrl();
554
- const dir = join2(url, name).replace(dirUrl, "").replace(/\\/g, "/");
555
- const is = matchsEnd(dir, this.config.matchexts);
556
- const nomatchexts = this.config.nomatchexts;
557
- if (is && nomatchexts && nomatchexts.length > 0) {
558
- if (matchsEnd(dir, nomatchexts)) {
559
- return false;
560
- } else {
561
- return true;
562
- }
563
- } else {
564
- return is;
565
- }
566
- }
567
- isMatchDir(url, name) {
568
- const dirUrl = this.getDirUrl();
569
- const dir = join2(url, name).replace(dirUrl, "").replace(/\\/g, "/");
570
- const is = matchsStart(dir, this.config.matchs);
571
- const nomatchs = this.config.nomatchs;
572
- if (is && nomatchs && nomatchs.length > 0) {
573
- if (matchsStart(dir, nomatchs)) {
574
- return false;
575
- } else {
576
- return true;
577
- }
578
- } else {
579
- return is;
580
- }
581
- }
582
- /**
583
- * 处理方法
584
- * @param callback
585
- */
586
- handle(callback, nosort) {
587
- return new Promise(async (resolve22) => {
588
- const url = this.getDirUrl();
589
- if (url) {
590
- const rarr = await writeInit(
591
- url,
592
- async (...arr) => {
593
- if (callback) {
594
- await callback(...arr);
595
- }
596
- return await this.writeCallback(...arr, nosort);
597
- },
598
- (...arr) => {
599
- return this.isMatchDir(...arr);
600
- },
601
- (...arr) => {
602
- return this.isMatchFile(...arr);
603
- },
604
- this.config.issynch
605
- );
606
- resolve22(rarr);
607
- } else {
608
- resolve22([]);
609
- }
610
- });
611
- }
612
- getFileNotes(url) {
613
- const suffix = getSuffix(url);
614
- const sz = [
615
- `@config cover=false`,
616
- `cover \u662F\u5426\u8986\u76D6\u5F53\u524D\u6587\u4EF6\uFF0C\u9ED8\u8BA4\u662Ffalse\uFF0C true \u8868\u793A\u4E0D\u8986\u76D6`,
617
- `\u5F53\u524D\u5DF2\u7ECF\u7531@fangzhongya/create\u81EA\u52A8\u751F\u6210`,
618
- `${(/* @__PURE__ */ new Date()).toString()}`
619
- ];
620
- const hy = ["md", "html", "vue"];
621
- if (hy.includes(suffix)) {
622
- const arr = ["<!--"];
623
- sz.forEach((v) => {
624
- arr.push(" - " + v);
625
- });
626
- arr.push("-->");
627
- return arr;
628
- } else {
629
- const arr = ["/**"];
630
- sz.forEach((v) => {
631
- arr.push(" * " + v);
632
- });
633
- arr.push(" */");
634
- return arr;
635
- }
636
- }
637
- /**
638
- * 输出文件,判断目录是否存在
639
- * @param url
640
- * @param sts
641
- */
642
- fileOpen(url, sts, fileUrls, type) {
643
- fsMkdir(getUrlCatalogue(url), (reaPath, is, ml) => {
644
- const logs = this.getLogs();
645
- logs.push(styleLog("dir", {}));
646
- if (is) {
647
- if (ml) {
648
- logs.push(
649
- styleLog("add", {
650
- text: 2,
651
- italic: true
652
- })
653
- );
654
- logs.push(
655
- styleLog(reaPath, {
656
- text: 2,
657
- revert: true
658
- })
659
- );
660
- console.log(logs.join(" "));
661
- }
662
- } else {
663
- logs.push(
664
- styleLog(reaPath, {
665
- text: 1,
666
- revert: true
667
- })
668
- );
669
- console.log(logs.join(" "));
670
- }
671
- this.setOpen(url, sts, type, (kurl, _type, is2, _tn) => {
672
- if (is2 && fileUrls) {
673
- fileUrls.push(kurl);
674
- }
675
- });
676
- });
677
- }
678
- /**
679
- * 输出文件
680
- * @param url
681
- * @param str
682
- * @param callback
683
- */
684
- setOpen(url, str, type, callback) {
685
- let tn = this.config.fileTongre ? 3 : 2;
686
- if (this.config.fileCover) {
687
- tn = 0;
688
- }
689
- if (tn == 2) {
690
- if (this.isForceUpdate(url)) {
691
- tn = 0;
692
- }
693
- }
694
- if (typeof type != "undefined") {
695
- tn = type;
696
- }
697
- if (this.config.writeNotes && !/\.json$/.test(url)) {
698
- str = this.getFileNotes(url).join("\n") + "\n" + str;
699
- }
700
- fsOpenStream(
701
- url,
702
- str,
703
- tn,
704
- this.config.coverConfig,
705
- (kurl, type2, is) => {
706
- if (!(tn == 2 && type2 == 2)) {
707
- const logs = this.getLogs();
708
- logs.push(styleLog("file", {}));
709
- if (type2 == 1) {
710
- logs.push(
711
- styleLog("add", {
712
- text: 2,
713
- italic: true
714
- })
715
- );
716
- } else if (type2 == 2) {
717
- logs.push(
718
- styleLog("update", {
719
- italic: true,
720
- text: 4
721
- })
722
- );
723
- }
724
- if (is) {
725
- logs.push(
726
- styleLog(kurl, {
727
- text: 2,
728
- revert: true
729
- })
730
- );
731
- } else {
732
- logs.push(
733
- styleLog(kurl, {
734
- text: 1,
735
- revert: true
736
- })
737
- );
738
- }
739
- console.log(logs.join(" "));
740
- }
741
- if (callback) {
742
- callback(kurl, type2, is, tn);
743
- }
744
- }
745
- );
746
- }
747
- /**
748
- * 获取日志头
749
- */
750
- getLogs() {
751
- const logs = [];
752
- logs.push(
753
- styleLog("[@fangzhongya/create]", {
754
- text: 3
755
- })
756
- );
757
- logs.push(
758
- styleLog(this._defaultConfig.name, {
759
- text: 4
760
- })
761
- );
762
- return logs;
763
- }
764
- };
765
-
766
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-IMEZSVK5.js
767
- import { resolve as resolve2, join as join3 } from "path";
768
- var defaultConfig2 = Object.assign({}, defaultConfig, {
769
- name: "file",
770
- /**
771
- * 生成的文件名称
772
- */
773
- gene: void 0,
774
- /**
775
- * 文件生成方法
776
- */
777
- fileSet: void 0
778
- });
779
- var FangFile = class extends FangCom {
780
- constructor(config, callback) {
781
- super();
782
- this.config = {};
783
- this._configCallback = callback;
784
- this._defaultConfig = defaultConfig2;
785
- this.initConfig(config || this.config);
786
- }
787
- getDefaultGene(name, url, _wj) {
788
- return join3(url, name);
789
- }
790
- getDefaultFileSet(_name, _url, _text, _wjm, _imp, _surl) {
791
- return [];
792
- }
793
- getGeneObj(url, name, outDir) {
794
- return getUrlCatalogueObj(
795
- join3(
796
- resolve2(process.cwd(), outDir),
797
- join3(url, name).replace(this.getDirUrl(), "")
798
- )
799
- );
800
- }
801
- /**
802
- * 获取输出地址方法
803
- * @param gene
804
- * @returns
805
- */
806
- getGene(gene) {
807
- gene = gene || this.config.gene;
808
- if (!gene) {
809
- return (...arr) => {
810
- return this.getDefaultGene(...arr);
811
- };
812
- } else {
813
- return gene;
814
- }
815
- }
816
- fileRead(url, type) {
817
- return new Promise((resolve22) => {
818
- fsAccess(url).then(() => {
819
- resolve22(fsReadFile(url, type));
820
- });
821
- });
822
- }
823
- getFileSet(fileSet) {
824
- fileSet = fileSet || this.config.fileSet;
825
- if (!fileSet) {
826
- return (...arr) => {
827
- return this.getDefaultFileSet(...arr);
828
- };
829
- } else {
830
- return fileSet;
831
- }
832
- }
833
- /**
834
- * 回调方法
835
- * @param url
836
- * @param file
837
- * @param urls
838
- */
839
- async writeCallback(url, readdir2, fileUrls) {
840
- const gene = this.getGene();
841
- const fileSet = this.getFileSet();
842
- const read = this.config.read;
843
- if (readdir2.file) {
844
- for (let i = 0; i < readdir2.file.length; i++) {
845
- const name = readdir2.file[i];
846
- const furl = join3(url, name);
847
- const wjmc = this.getFileName(name);
848
- const gu = gene(name, url, wjmc);
849
- const imp = getImportUrlSuffix(gu, furl);
850
- const arr = [];
851
- if (fileSet) {
852
- let text = "";
853
- if (read) {
854
- text = await fsReadFile(furl, read);
855
- }
856
- arr.push(...fileSet(name, url, text, wjmc, imp, gu));
857
- }
858
- if (arr.length > 0) {
859
- this.fileOpen(gu, arr.join("\n"), fileUrls);
860
- }
861
- }
862
- }
863
- return true;
864
- }
865
- };
866
-
867
- // node_modules/.pnpm/@fangzhongya+create@0.2.49/node_modules/@fangzhongya/create/dist/chunk-3VPCYJWK.js
868
- import { join as join4 } from "path";
869
- var defaultConfig22 = Object.assign({}, defaultConfig2, {
870
- name: "out",
871
- outDir: "./",
872
- isNeader: true
873
- });
874
- var FangOut = class extends FangFile {
875
- constructor(config, callback) {
876
- super();
877
- this.config = {};
878
- this._configCallback = callback;
879
- this._defaultConfig = defaultConfig22;
880
- this.initConfig(config || this.config);
881
- }
882
- getFileNeader(name, url) {
883
- return [`/**`, ` * ${join4(url, name).replace(/\\/g, "/")}`, " */"];
884
- }
885
- /**
886
- * 获取输出地址方法
887
- * @param gene
888
- * @returns
889
- */
890
- getDefaultGene(name, url, _wj) {
891
- const obj = this.getGeneObj(url, name, this.config.outDir);
892
- return join4(obj.catalogue, obj.name + "." + obj.suffix);
893
- }
894
- getDefaultFileSet(name, url, text, _wjm, _imp) {
895
- const arr = [text];
896
- if (this.config.isNeader) {
897
- return [...this.getFileNeader(name, url), ...arr];
898
- }
899
- return arr;
900
- }
901
- };
902
- function runDev(config, configCallback, callback) {
903
- const fang = new FangOut(config);
904
- fang.runDev(callback, configCallback);
905
- }
906
-
907
- export {
908
- runDev
909
- };