@zwa73/dev-utils 1.0.41 → 1.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Command/MapPath.js +2 -2
- package/dist/Command/ScanDups.js +2 -2
- package/dist/UtilDevTool.js +1 -1
- package/dist/UtilMacro.js +1 -1
- package/package.json +2 -2
- package/src/Command/MapPath.ts +2 -2
- package/src/Command/ScanDups.ts +2 -2
- package/src/UtilDevTool.ts +1 -1
- package/src/UtilMacro.ts +1 -1
package/dist/Command/MapPath.js
CHANGED
@@ -27,9 +27,9 @@ 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 = process.cwd();
|
31
31
|
// 遍历当前目录下的所有文件
|
32
|
-
const filePaths = utils_1.UtilFT.fileSearchRegex(basePath, regex.source, { relative: options.recursive,
|
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))
|
34
34
|
.filter((filePath) => excludeRegex ? (!excludeRegex.test(filePath)) : true);
|
35
35
|
//对单个路径映射
|
package/dist/Command/ScanDups.js
CHANGED
@@ -27,10 +27,10 @@ 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 = 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",
|
34
34
|
}).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
|
35
35
|
const hashMap = (await Promise.all(pList)).reduce((obj, cur) => {
|
36
36
|
obj[cur.hash] = (obj[cur.hash] ?? []).concat(cur.filePath);
|
package/dist/UtilDevTool.js
CHANGED
@@ -140,7 +140,7 @@ var UtilDT;
|
|
140
140
|
const basePath = loc?.filePath;
|
141
141
|
return opt?.filePath
|
142
142
|
? opt.glob
|
143
|
-
? utils_1.UtilFT.fileSearchGlob(process.cwd(), opt.filePath, {
|
143
|
+
? utils_1.UtilFT.fileSearchGlob(process.cwd(), opt.filePath, { style: "posix" })
|
144
144
|
: typeof opt?.filePath === "string"
|
145
145
|
? [opt?.filePath.replaceAll('\\', '/')]
|
146
146
|
: opt?.filePath.map((filepath) => filepath.replaceAll('\\', '/'))
|
package/dist/UtilMacro.js
CHANGED
@@ -16,7 +16,7 @@ var UtilMacro;
|
|
16
16
|
function exportComment(glob) {
|
17
17
|
(0, QuickFunc_1.commentMacro)(/export (\S*)/, ({ filePath, matchId, execArr }) => {
|
18
18
|
const basedir = path_1.default.dirname(filePath).replaceAll('\\', '/');
|
19
|
-
const result = utils_1.UtilFT.fileSearchGlob(basedir, execArr[1], {
|
19
|
+
const result = utils_1.UtilFT.fileSearchGlob(basedir, execArr[1], { style: 'posix' })
|
20
20
|
.map((file) => path_1.default.posix.relative(basedir, file))
|
21
21
|
.map((file) => path_1.default.parse(file).name)
|
22
22
|
.filter((file) => file != path_1.default.parse(filePath).name)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zwa73/dev-utils",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.42",
|
4
4
|
"description": "编译与调试工具",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"author": "zwa73",
|
17
17
|
"license": "ISC",
|
18
18
|
"dependencies": {
|
19
|
-
"@zwa73/utils": "^1.0.
|
19
|
+
"@zwa73/utils": "^1.0.118",
|
20
20
|
"commander": "^11.1.0",
|
21
21
|
"ts-node": "^10.9.2",
|
22
22
|
"tsconfig-paths": "^4.2.0",
|
package/src/Command/MapPath.ts
CHANGED
@@ -25,9 +25,9 @@ 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 = process.cwd();
|
29
29
|
// 遍历当前目录下的所有文件
|
30
|
-
const filePaths = UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive,
|
30
|
+
const filePaths = UtilFT.fileSearchRegex(basePath, regex.source,{relative:options.recursive,style:"posix"})
|
31
31
|
.map((filePath)=>path.posix.relative(basePath, filePath))
|
32
32
|
.filter((filePath)=>excludeRegex ? (!excludeRegex.test(filePath)) : true);
|
33
33
|
|
package/src/Command/ScanDups.ts
CHANGED
@@ -25,10 +25,10 @@ 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 = 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",
|
32
32
|
}).map(async (filePath) => ({ filePath, hash: await calculateHash(filePath) }));
|
33
33
|
|
34
34
|
const hashMap = (await Promise.all(pList)).reduce((obj,cur)=>{
|
package/src/UtilDevTool.ts
CHANGED
@@ -158,7 +158,7 @@ const parseMacroPaths = (opt?:MacroOpt)=>{
|
|
158
158
|
const basePath = loc?.filePath!;
|
159
159
|
return opt?.filePath
|
160
160
|
? opt.glob
|
161
|
-
? UtilFT.fileSearchGlob(process.cwd(),opt.filePath,{
|
161
|
+
? UtilFT.fileSearchGlob(process.cwd(),opt.filePath,{style:"posix"})
|
162
162
|
: typeof opt?.filePath==="string"
|
163
163
|
? [opt?.filePath.replaceAll('\\','/')]
|
164
164
|
: opt?.filePath.map((filepath)=>filepath.replaceAll('\\','/'))
|
package/src/UtilMacro.ts
CHANGED
@@ -11,7 +11,7 @@ export namespace UtilMacro{
|
|
11
11
|
export function exportComment(glob:string){
|
12
12
|
commentMacro(/export (\S*)/,({filePath,matchId,execArr})=>{
|
13
13
|
const basedir = path.dirname(filePath).replaceAll('\\','/');
|
14
|
-
const result = UtilFT.fileSearchGlob(basedir,execArr[1],{
|
14
|
+
const result = UtilFT.fileSearchGlob(basedir,execArr[1],{style:'posix'})
|
15
15
|
.map((file)=>path.posix.relative(basedir,file))
|
16
16
|
.map((file)=>path.parse(file).name)
|
17
17
|
.filter((file)=>file!=path.parse(filePath).name)
|