@zwa73/dev-utils 1.0.44 → 1.0.45

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.
@@ -22,10 +22,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.CmdInit = void 0;
27
30
  const fs = __importStar(require("fs"));
28
- const path = __importStar(require("path"));
31
+ const pathe_1 = __importDefault(require("pathe"));
29
32
  const utils_1 = require("@zwa73/utils");
30
33
  const RouteInterface_1 = require("./RouteInterface");
31
34
  /**复制基础文件 */
@@ -33,8 +36,8 @@ async function copyData() {
33
36
  const filelist = await fs.promises.readdir(RouteInterface_1.DATA_PATH);
34
37
  const plist = filelist.map(async (fileName) => {
35
38
  utils_1.SLogger.info(`正在复制 ${fileName}`);
36
- const filePath = path.join(RouteInterface_1.DATA_PATH, fileName);
37
- const targetPath = path.join(RouteInterface_1.PROJECT_PATH, fileName);
39
+ const filePath = pathe_1.default.join(RouteInterface_1.DATA_PATH, fileName);
40
+ const targetPath = pathe_1.default.join(RouteInterface_1.PROJECT_PATH, fileName);
38
41
  if (!await utils_1.UtilFT.pathExists(targetPath))
39
42
  await fs.promises.cp(filePath, targetPath, { recursive: true });
40
43
  else
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CmdMapPath = void 0;
7
7
  const utils_1 = require("@zwa73/utils");
8
8
  const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
9
+ const pathe_1 = __importDefault(require("pathe"));
10
10
  const DupMethodList = ["no-rename", "overwrite", "move"];
11
11
  /**重命名文件或路径 */
12
12
  const CmdMapPath = (program) => program
@@ -27,14 +27,14 @@ const CmdMapPath = (program) => program
27
27
  if (!DupMethodList.includes(options.duplicateHandling))
28
28
  (0, utils_1.throwError)(`${options.duplicateHandling} 不是有效的 duplicate-handling`);
29
29
  const duplicateHandling = options.duplicateHandling;
30
- const basePath = (0, utils_1.posixizePath)(process.cwd());
30
+ const basePath = process.cwd();
31
31
  // 遍历当前目录下的所有文件
32
32
  const filePaths = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, { relative: options.recursive, style: "posix" })
33
- .map((filePath) => path_1.default.posix.relative(basePath, filePath))
33
+ .map((filePath) => pathe_1.default.relative(basePath, filePath))
34
34
  .filter((filePath) => excludeRegex ? (!excludeRegex.test(filePath)) : true);
35
35
  //对单个路径映射
36
36
  const mapPath = async (source, target) => {
37
- const dir = path_1.default.parse(target).dir;
37
+ const dir = pathe_1.default.parse(target).dir;
38
38
  await utils_1.UtilFT.ensurePathExists(dir, { dir: true });
39
39
  if (options.test)
40
40
  return utils_1.SLogger.info(`${source} -> ${target}`);
@@ -52,7 +52,7 @@ const CmdMapPath = (program) => program
52
52
  //如果文件已存在
53
53
  if (await utils_1.UtilFT.pathExists(newFilePath)) {
54
54
  await (0, utils_1.matchProc)(duplicateHandling, {
55
- 'move': () => mapPath(filePath, path_1.default.posix.join(options.duplicateOutput, newFilePath)),
55
+ 'move': () => mapPath(filePath, pathe_1.default.join(options.duplicateOutput, newFilePath)),
56
56
  'no-rename': () => utils_1.SLogger.info(`重名文件存在,跳过:${newFilePath}`),
57
57
  'overwrite': () => mapPath(filePath, newFilePath),
58
58
  });
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CmdRelease = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const pathe_1 = __importDefault(require("pathe"));
8
8
  const utils_1 = require("@zwa73/utils");
9
9
  const RouteInterface_1 = require("./RouteInterface");
10
10
  /**解析版本号为number数组 */
@@ -31,7 +31,7 @@ function checkVersion(oldVersion, newVersion) {
31
31
  }
32
32
  /**更新版本号 */
33
33
  async function updateVersion(newVersion) {
34
- const packagePath = path_1.default.join(RouteInterface_1.PROJECT_PATH, "package.json");
34
+ const packagePath = pathe_1.default.join(RouteInterface_1.PROJECT_PATH, "package.json");
35
35
  const packageData = await utils_1.UtilFT.loadJSONFile(packagePath);
36
36
  if (newVersion) {
37
37
  checkVersion(packageData.version, newVersion);
@@ -1,37 +1,17 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
6
  exports.checkProject = exports.withOfficialSource = exports.withMirrorSource = exports.parseBoolean = exports.parseNumber = exports.parseInteger = exports.PROJECT_PATH = exports.DATA_PATH = exports.OFFICIAL_SOURCE = exports.MIRROR_SOURCE = void 0;
27
- const path = __importStar(require("path"));
7
+ const pathe_1 = __importDefault(require("pathe"));
28
8
  const utils_1 = require("@zwa73/utils");
29
9
  /**npm镜像源 */
30
10
  exports.MIRROR_SOURCE = "https://registry.npmmirror.com/";
31
11
  /**npm官方源 */
32
12
  exports.OFFICIAL_SOURCE = "https://registry.npmjs.org/";
33
13
  /**data文件夹路径 */
34
- exports.DATA_PATH = path.join(__dirname, '..', '..', 'data');
14
+ exports.DATA_PATH = pathe_1.default.join(__dirname, '..', '..', 'data');
35
15
  /**项目路径 */
36
16
  exports.PROJECT_PATH = process.cwd();
37
17
  /** 检测非浮点的整数类型 */
@@ -79,7 +59,7 @@ async function withOfficialSource(func) {
79
59
  exports.withOfficialSource = withOfficialSource;
80
60
  /**检查目录是否为项目 */
81
61
  async function checkProject() {
82
- const filePath = path.join(exports.PROJECT_PATH, "package.json");
62
+ const filePath = pathe_1.default.join(exports.PROJECT_PATH, "package.json");
83
63
  if (!(await utils_1.UtilFT.pathExists(filePath)))
84
64
  (0, utils_1.throwError)(`当前目录: ${exports.PROJECT_PATH} 不是npm项目目录, 请先使用 npm init`);
85
65
  }
@@ -7,7 +7,7 @@ exports.CmdScanDups = void 0;
7
7
  const utils_1 = require("@zwa73/utils");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const crypto_1 = __importDefault(require("crypto"));
10
- const path_1 = __importDefault(require("path"));
10
+ const pathe_1 = __importDefault(require("pathe"));
11
11
  async function calculateHash(filePath) {
12
12
  return new Promise((resolve, reject) => {
13
13
  const hash = crypto_1.default.createHash('md5');
@@ -27,7 +27,7 @@ const CmdScanDups = (program) => program
27
27
  .option("-r, --recursive", "是否处理子目录, 默认 true", true)
28
28
  .action(async (options) => {
29
29
  const regex = new RegExp(options.regex);
30
- const basePath = (0, utils_1.posixizePath)(process.cwd());
30
+ const basePath = process.cwd();
31
31
  const pList = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, {
32
32
  relative: options.recursive,
33
33
  style: "posix",
@@ -46,6 +46,6 @@ const CmdScanDups = (program) => program
46
46
  if (options.out === "console")
47
47
  utils_1.SLogger.info(out);
48
48
  else
49
- await utils_1.UtilFT.writeJSONFile(path_1.default.join(basePath, options.out), out);
49
+ await utils_1.UtilFT.writeJSONFile(pathe_1.default.join(basePath, options.out), out);
50
50
  });
51
51
  exports.CmdScanDups = CmdScanDups;
@@ -22,9 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.UtilDT = void 0;
27
- const path = __importStar(require("path"));
30
+ const pathe_1 = __importDefault(require("pathe"));
28
31
  const TJS = __importStar(require("typescript-json-schema"));
29
32
  const fs = __importStar(require("fs"));
30
33
  const utils_1 = require("@zwa73/utils");
@@ -55,8 +58,8 @@ var UtilDT;
55
58
  const files = utils_1.UtilFT.fileSearchGlob(dir, opt?.include ?? "**/*.schema.ts", { ingore: opt?.exclude });
56
59
  const program = TJS.getProgramFromFiles(files, compilerOptions);
57
60
  const schema = TJS.generateSchema(program, "*", settings);
58
- const outDir = opt?.outDir ?? path.join(process.cwd(), 'schema');
59
- const schemasPath = path.join(outDir, 'schemas.json');
61
+ const outDir = opt?.outDir ?? pathe_1.default.join(process.cwd(), 'schema');
62
+ const schemasPath = pathe_1.default.join(outDir, 'schemas.json');
60
63
  //进行预处理并展开
61
64
  await expandSchema(schemasPath, schema, opt?.coverDefine ?? {});
62
65
  }
@@ -78,8 +81,8 @@ var UtilDT;
78
81
  continue;
79
82
  if ((/^.+_[0-9]/).test(typeName) || (/^{./).test(typeName))
80
83
  continue;
81
- const basename = path.basename(schemasPath);
82
- const tpath = path.join(path.dirname(schemasPath), `${typeName}.schema.json`);
84
+ const basename = pathe_1.default.basename(schemasPath);
85
+ const tpath = pathe_1.default.join(pathe_1.default.dirname(schemasPath), `${typeName}.schema.json`);
83
86
  if (!utils_1.UtilFT.isValidFilePath(tpath))
84
87
  continue;
85
88
  plist.push(utils_1.UtilFT.writeJSONFile(tpath, {
@@ -124,7 +127,7 @@ var UtilDT;
124
127
  if (!Array.isArray(filepath))
125
128
  filepath = [filepath];
126
129
  // 将所有的相对路径转换为绝对路径
127
- const absolutePaths = filepath.map(fp => path.posix.resolve((0, utils_1.posixizePath)(process.cwd()), (0, utils_1.posixizePath)(fp)));
130
+ const absolutePaths = filepath.map(fp => pathe_1.default.resolve(process.cwd(), fp));
128
131
  // 创建一个字符串,其中包含所有文件的 require 语句
129
132
  const requires = absolutePaths.map(fp => `require('${fp}')`).join(';');
130
133
  // 创建并执行 ts-node 命令
@@ -142,9 +145,9 @@ var UtilDT;
142
145
  ? opt.glob
143
146
  ? utils_1.UtilFT.fileSearchGlob(process.cwd(), opt.filePath, { style: "posix" })
144
147
  : typeof opt?.filePath === "string"
145
- ? [(0, utils_1.posixizePath)(opt?.filePath)]
146
- : opt?.filePath.map((filepath) => (0, utils_1.posixizePath)(filepath))
147
- : [(0, utils_1.posixizePath)(basePath.replace(/(.+)\.macro\.(js|ts|cjs|mjs)$/, "$1.$2"))];
148
+ ? [opt?.filePath]
149
+ : opt?.filePath.map((filepath) => filepath)
150
+ : [basePath.replace(/(.+)\.macro\.(js|ts|cjs|mjs)$/, "$1.$2")];
148
151
  };
149
152
  const readFile = async (basePath) => (await fs.promises.readFile(basePath, 'utf-8')).replaceAll("\r\n", "\n");
150
153
  const parseCodeText = async (codeText, opt) => {
@@ -205,7 +208,7 @@ var UtilDT;
205
208
  else if (!opt?.glob)
206
209
  utils_1.SLogger.error(`UtilDT.regionMacro 无法找到区域 ${regionId}`);
207
210
  };
208
- plist.push(utils_1.UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\", "/")), queuefunc));
211
+ plist.push(utils_1.UtilFunc.queueProc(pathe_1.default.normalize(filePath), queuefunc));
209
212
  }
210
213
  await Promise.all(plist);
211
214
  }
@@ -263,7 +266,7 @@ var UtilDT;
263
266
  else if (!opt?.glob)
264
267
  utils_1.SLogger.error(`UtilDT.commentMacro 无法找到注释 ${commentId}`);
265
268
  };
266
- plist.push(utils_1.UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\", "/")), queuefunc));
269
+ plist.push(utils_1.UtilFunc.queueProc(pathe_1.default.normalize(filePath), queuefunc));
267
270
  }
268
271
  await Promise.all(plist);
269
272
  }
@@ -290,7 +293,7 @@ var UtilDT;
290
293
  });
291
294
  await fs.promises.writeFile(filePath, parseCode, 'utf-8');
292
295
  };
293
- plist.push(utils_1.UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\", "/")), queuefunc));
296
+ plist.push(utils_1.UtilFunc.queueProc(pathe_1.default.normalize(filePath), queuefunc));
294
297
  }
295
298
  await Promise.all(plist);
296
299
  }
package/dist/UtilMacro.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.UtilMacro = void 0;
7
7
  const utils_1 = require("@zwa73/utils");
8
8
  const QuickFunc_1 = require("./QuickFunc");
9
- const path_1 = __importDefault(require("path"));
9
+ const pathe_1 = __importDefault(require("pathe"));
10
10
  var UtilMacro;
11
11
  (function (UtilMacro) {
12
12
  /**根据注释批量生成导出
@@ -15,11 +15,11 @@ var UtilMacro;
15
15
  */
16
16
  function exportComment(glob) {
17
17
  (0, QuickFunc_1.commentMacro)(/export (\S*)/, ({ filePath, matchId, execArr }) => {
18
- const basedir = (0, utils_1.posixizePath)(path_1.default.dirname(filePath));
19
- const result = utils_1.UtilFT.fileSearchGlob(basedir, execArr[1], { style: 'posix' })
20
- .map((file) => path_1.default.posix.relative(basedir, file))
21
- .map((file) => path_1.default.parse(file).name)
22
- .filter((file) => file != path_1.default.parse(filePath).name)
18
+ const basedir = pathe_1.default.dirname(filePath);
19
+ const result = utils_1.UtilFT.fileSearchGlob(basedir, execArr[1])
20
+ .map((file) => pathe_1.default.relative(basedir, file))
21
+ .map((file) => pathe_1.default.parse(file).name)
22
+ .filter((file) => file != pathe_1.default.parse(filePath).name)
23
23
  .map((file) => `export * from './${file}'`)
24
24
  .join(';');
25
25
  return result.length > 0 ? `${result};` : result;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/dev-utils",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "编译与调试工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,8 +16,9 @@
16
16
  "author": "zwa73",
17
17
  "license": "ISC",
18
18
  "dependencies": {
19
- "@zwa73/utils": "^1.0.119",
19
+ "@zwa73/utils": "^1.0.121",
20
20
  "commander": "^11.1.0",
21
+ "pathe": "^1.1.2",
21
22
  "ts-node": "^10.9.2",
22
23
  "tsconfig-paths": "^4.2.0",
23
24
  "typescript-json-schema": "^0.63.0"
@@ -1,6 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import * as fs from 'fs';
3
- import * as path from 'path';
3
+ import path from 'pathe';
4
4
 
5
5
  import { SLogger, UtilFT, UtilFunc } from '@zwa73/utils';
6
6
 
@@ -1,7 +1,7 @@
1
- import { SLogger, UtilFT, matchProc, posixizePath, throwError } from "@zwa73/utils";
1
+ import { SLogger, UtilFT, matchProc, throwError } from "@zwa73/utils";
2
2
  import { Command } from "commander";
3
3
  import fs from "fs";
4
- import path from "path";
4
+ import path from "pathe";
5
5
 
6
6
  const DupMethodList = ["no-rename","overwrite","move"] as const;
7
7
  type DupMethod = typeof DupMethodList[number];
@@ -25,10 +25,10 @@ export const CmdMapPath = (program: Command) => program
25
25
  if(!DupMethodList.includes(options.duplicateHandling))
26
26
  throwError(`${options.duplicateHandling} 不是有效的 duplicate-handling`);
27
27
  const duplicateHandling = options.duplicateHandling as DupMethod;
28
- const basePath = posixizePath(process.cwd());
28
+ const basePath = process.cwd();
29
29
  // 遍历当前目录下的所有文件
30
30
  const filePaths = UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive,style:"posix"})
31
- .map((filePath)=>path.posix.relative(basePath, filePath))
31
+ .map((filePath)=>path.relative(basePath, filePath))
32
32
  .filter((filePath)=>excludeRegex ? (!excludeRegex.test(filePath)) : true);
33
33
 
34
34
  //对单个路径映射
@@ -50,7 +50,7 @@ export const CmdMapPath = (program: Command) => program
50
50
  //如果文件已存在
51
51
  if(await UtilFT.pathExists(newFilePath)){
52
52
  await matchProc(duplicateHandling,{
53
- 'move': ()=> mapPath(filePath, path.posix.join(options.duplicateOutput, newFilePath)),
53
+ 'move': ()=> mapPath(filePath, path.join(options.duplicateOutput, newFilePath)),
54
54
  'no-rename': ()=> SLogger.info(`重名文件存在,跳过:${newFilePath}`),
55
55
  'overwrite': ()=> mapPath(filePath,newFilePath),
56
56
  })
@@ -1,5 +1,5 @@
1
1
  import { Command } from 'commander';
2
- import path from 'path';
2
+ import path from 'pathe';
3
3
 
4
4
  import { SLogger, throwError, UtilFT, UtilFunc } from '@zwa73/utils';
5
5
 
@@ -1,4 +1,4 @@
1
- import * as path from 'path';
1
+ import path from 'pathe';
2
2
 
3
3
  import { SLogger, throwError, UtilFT, UtilFunc } from '@zwa73/utils';
4
4
 
@@ -1,8 +1,8 @@
1
- import { SLogger, UtilFT, posixizePath, stylizePath } from "@zwa73/utils";
1
+ import { SLogger, UtilFT } from "@zwa73/utils";
2
2
  import { Command } from "commander";
3
3
  import fs from "fs";
4
4
  import crypto from 'crypto';
5
- import path from "path";
5
+ import path from "pathe";
6
6
 
7
7
  async function calculateHash(filePath:string) {
8
8
  return new Promise<string>((resolve, reject) => {
@@ -25,7 +25,7 @@ export const CmdScanDups = (program: Command) => program
25
25
  .option("-r, --recursive", "是否处理子目录, 默认 true", true)
26
26
  .action(async (options) => {
27
27
  const regex = new RegExp(options.regex);
28
- const basePath = posixizePath(process.cwd());
28
+ const basePath = process.cwd();
29
29
  const pList = UtilFT.fileSearchRegex(basePath, regex.source, {
30
30
  relative: options.recursive,
31
31
  style: "posix",
@@ -1,7 +1,7 @@
1
- import * as path from 'path';
1
+ import path from 'pathe';
2
2
  import * as TJS from 'typescript-json-schema';
3
3
  import * as fs from 'fs';
4
- import { JObject, SLogger, UtilFT, UtilFunc, dedent, posixizePath, stylizePath, throwError } from '@zwa73/utils';
4
+ import { JObject, SLogger, UtilFT, UtilFunc, dedent, throwError } from '@zwa73/utils';
5
5
 
6
6
  export namespace UtilDT{
7
7
 
@@ -123,7 +123,7 @@ export async function batchNode(filepath:string|string[],opt?:BatchNodeOpt) {
123
123
  // 确保 filepath 总是一个数组
124
124
  if (!Array.isArray(filepath)) filepath = [filepath];
125
125
  // 将所有的相对路径转换为绝对路径
126
- const absolutePaths = filepath.map(fp => path.posix.resolve(posixizePath(process.cwd()), posixizePath(fp)));
126
+ const absolutePaths = filepath.map(fp => path.resolve(process.cwd(), fp));
127
127
  // 创建一个字符串,其中包含所有文件的 require 语句
128
128
  const requires = absolutePaths.map(fp => `require('${fp}')`).join(';');
129
129
  // 创建并执行 ts-node 命令
@@ -160,9 +160,9 @@ const parseMacroPaths = (opt?:MacroOpt)=>{
160
160
  ? opt.glob
161
161
  ? UtilFT.fileSearchGlob(process.cwd(),opt.filePath,{style:"posix"})
162
162
  : typeof opt?.filePath==="string"
163
- ? [posixizePath(opt?.filePath)]
164
- : opt?.filePath.map((filepath)=>posixizePath(filepath))
165
- : [posixizePath(basePath.replace(/(.+)\.macro\.(js|ts|cjs|mjs)$/,"$1.$2"))];
163
+ ? [opt?.filePath]
164
+ : opt?.filePath.map((filepath)=>filepath)
165
+ : [basePath.replace(/(.+)\.macro\.(js|ts|cjs|mjs)$/,"$1.$2")];
166
166
  }
167
167
  const readFile = async (basePath:string)=>
168
168
  (await fs.promises.readFile(basePath,'utf-8')).replaceAll("\r\n","\n");
@@ -226,7 +226,7 @@ export async function regionMacro(regionId:string|RegExp,codeText:string|((opt:C
226
226
  await fs.promises.writeFile(filePath, fileText, 'utf-8');
227
227
  else if(!opt?.glob) SLogger.error(`UtilDT.regionMacro 无法找到区域 ${regionId}`);
228
228
  }
229
- plist.push(UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\","/")),queuefunc))
229
+ plist.push(UtilFunc.queueProc(path.normalize(filePath),queuefunc))
230
230
  }
231
231
  await Promise.all(plist);
232
232
  }
@@ -284,7 +284,7 @@ export async function commentMacro(commentId:string|RegExp,codeText:string|((opt
284
284
  await fs.promises.writeFile(filePath, fileText, 'utf-8');
285
285
  else if(!opt?.glob) SLogger.error(`UtilDT.commentMacro 无法找到注释 ${commentId}`);
286
286
  }
287
- plist.push(UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\","/")),queuefunc))
287
+ plist.push(UtilFunc.queueProc(path.normalize(filePath),queuefunc))
288
288
  }
289
289
  await Promise.all(plist);
290
290
  }
@@ -310,7 +310,7 @@ export async function fileMacro(codeText:string|((opt:Omit<CodeTextOpt,'ident'|'
310
310
  });
311
311
  await fs.promises.writeFile(filePath, parseCode, 'utf-8');
312
312
  }
313
- plist.push(UtilFunc.queueProc(path.posix.normalize(filePath.replaceAll("\\","/")),queuefunc))
313
+ plist.push(UtilFunc.queueProc(path.normalize(filePath),queuefunc))
314
314
  }
315
315
  await Promise.all(plist);
316
316
  }
package/src/UtilMacro.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { UtilFT, posixizePath, stylizePath } from "@zwa73/utils";
1
+ import { UtilFT } from "@zwa73/utils";
2
2
  import { commentMacro } from "./QuickFunc"
3
- import path from "path";
3
+ import path from "pathe";
4
4
 
5
5
 
6
6
  export namespace UtilMacro{
@@ -10,9 +10,9 @@ export namespace UtilMacro{
10
10
  */
11
11
  export function exportComment(glob:string){
12
12
  commentMacro(/export (\S*)/,({filePath,matchId,execArr})=>{
13
- const basedir = posixizePath(path.dirname(filePath));
14
- const result = UtilFT.fileSearchGlob(basedir,execArr[1],{style:'posix'})
15
- .map((file)=>path.posix.relative(basedir,file))
13
+ const basedir = path.dirname(filePath);
14
+ const result = UtilFT.fileSearchGlob(basedir,execArr[1])
15
+ .map((file)=>path.relative(basedir,file))
16
16
  .map((file)=>path.parse(file).name)
17
17
  .filter((file)=>file!=path.parse(filePath).name)
18
18
  .map((file)=>`export * from './${file}'`)