change-image-suffix 2.1.9 → 2.1.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [2.1.10](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.9...v2.1.10) (2026-05-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * rewrite bat to avoid all path manipulation, pass directly to cis ([6c262fa](https://github.com/GuoSirius/change-image-suffix/commit/6c262fa190c8a7f380c29b0319ef860364bf90af))
11
+
5
12
  ### [2.1.9](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.8...v2.1.9) (2026-05-25)
6
13
 
7
14
 
package/dist/index.js CHANGED
@@ -57,24 +57,19 @@ function installContextMenu() {
57
57
  }
58
58
  const iconPath = fs.existsSync(icoTarget) ? icoTarget : cisCmd;
59
59
  const batPath = path.join(appDataDir, 'cis_file.bat');
60
- // ── bat 脚本:接收格式 + 文件/目录路径,直接调用 cis ──
60
+ // ── bat 脚本:逐项调用 cis,不做 if exist/set 路径操作,避免 cmd.exe 对 () & 等字符解析出错 ──
61
61
  // %1 = 格式, %2 %3 ... = Windows 传入的文件/目录路径
62
62
  const batContent = `
63
63
  @echo off
64
64
  chcp 65001 >nul
65
- setlocal enabledelayedexpansion
65
+ setlocal
66
66
 
67
- REM Find cis command in PATH
67
+ REM Find cis command in PATH (take first match via goto)
68
68
  set "CIS_CMD="
69
- for /f "delims=" %%c in ('where cis.cmd 2^>nul') do (
70
- if "!CIS_CMD!"=="" set "CIS_CMD=%%c"
71
- )
72
- if "!CIS_CMD!"=="" (
73
- for /f "delims=" %%c in ('where cis 2^>nul') do (
74
- if "!CIS_CMD!"=="" set "CIS_CMD=%%c"
75
- )
76
- )
77
- if "!CIS_CMD!"=="" (
69
+ for /f "delims=" %%c in ('where cis.cmd 2^>nul') do set "CIS_CMD=%%c" & goto :cis_found
70
+ :cis_found
71
+ if "%CIS_CMD%"=="" for /f "delims=" %%c in ('where cis 2^>nul') do set "CIS_CMD=%%c" & goto :cis_found
72
+ if "%CIS_CMD%"=="" (
78
73
  echo [change-image-suffix] cis command not found. Run: npm install -g change-image-suffix
79
74
  pause
80
75
  exit /b 1
@@ -89,36 +84,22 @@ if "%~1"=="" (
89
84
  set "format=%~1"
90
85
  shift
91
86
 
92
- set args=
93
- :parse
94
- if "%~1"=="" goto :run
95
- if exist "%~1\\*" goto :is_dir
96
- goto :is_file
97
-
98
- :is_dir
99
- set args=!args! -p "%~1"
100
- goto :next_arg
101
-
102
- :is_file
103
- set args=!args! -f "%~1"
87
+ if "%~1"=="" (
88
+ echo [change-image-suffix] No files or directories to process.
89
+ pause
90
+ exit /b 1
91
+ )
104
92
 
105
- :next_arg
93
+ :process
94
+ if "%~1"=="" goto :done
95
+ "%CIS_CMD%" -t %format% "%~1"
106
96
  shift
107
- goto :parse
108
-
109
- :run
110
- if "!args!"=="" goto :no_args
97
+ goto :process
111
98
 
112
- "!CIS_CMD!" -t !format! !args!
99
+ :done
113
100
  pause
114
101
  endlocal
115
102
  goto :eof
116
-
117
- :no_args
118
- echo [change-image-suffix] No files or directories to process.
119
- pause
120
- endlocal
121
- exit /b 1
122
103
  `;
123
104
  fs.writeFileSync(batPath, batContent, 'utf8');
124
105
  // ── 格式列表(webp 排第一,其他按常见程度排序)──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "change-image-suffix",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "type": "module",
5
5
  "description": "批量转换图片格式的CLI工具,支持递归搜索、深度限制、指定后缀、Windows右键菜单等功能",
6
6
  "main": "dist/index.js",