@zwa73/dev-utils 1.0.43 → 1.0.44

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.
@@ -27,7 +27,7 @@ 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 = process.cwd();
30
+ const basePath = (0, utils_1.posixizePath)(process.cwd());
31
31
  // 遍历当前目录下的所有文件
32
32
  const filePaths = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, { relative: options.recursive, style: "posix" })
33
33
  .map((filePath) => path_1.default.posix.relative(basePath, filePath))
@@ -124,7 +124,7 @@ var UtilDT;
124
124
  if (!Array.isArray(filepath))
125
125
  filepath = [filepath];
126
126
  // 将所有的相对路径转换为绝对路径
127
- const absolutePaths = filepath.map(fp => (0, utils_1.posixizePath)(path.resolve(process.cwd(), fp)));
127
+ const absolutePaths = filepath.map(fp => path.posix.resolve((0, utils_1.posixizePath)(process.cwd()), (0, utils_1.posixizePath)(fp)));
128
128
  // 创建一个字符串,其中包含所有文件的 require 语句
129
129
  const requires = absolutePaths.map(fp => `require('${fp}')`).join(';');
130
130
  // 创建并执行 ts-node 命令
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zwa73/dev-utils",
3
- "version": "1.0.43",
3
+ "version": "1.0.44",
4
4
  "description": "编译与调试工具",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { SLogger, UtilFT, matchProc, throwError } from "@zwa73/utils";
1
+ import { SLogger, UtilFT, matchProc, posixizePath, throwError } from "@zwa73/utils";
2
2
  import { Command } from "commander";
3
3
  import fs from "fs";
4
4
  import path from "path";
@@ -25,7 +25,7 @@ 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 = process.cwd();
28
+ const basePath = posixizePath(process.cwd());
29
29
  // 遍历当前目录下的所有文件
30
30
  const filePaths = UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive,style:"posix"})
31
31
  .map((filePath)=>path.posix.relative(basePath, filePath))
@@ -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 => posixizePath(path.resolve(process.cwd(), fp)));
126
+ const absolutePaths = filepath.map(fp => path.posix.resolve(posixizePath(process.cwd()), posixizePath(fp)));
127
127
  // 创建一个字符串,其中包含所有文件的 require 语句
128
128
  const requires = absolutePaths.map(fp => `require('${fp}')`).join(';');
129
129
  // 创建并执行 ts-node 命令