zen-gitsync 2.12.2 → 2.12.3
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/LICENSE +190 -21
- package/index.js +25 -11
- package/package.json +2 -2
- package/scripts/convert-colors-to-vars.cjs +286 -272
- package/scripts/convert-fontsize-to-vars.cjs +221 -207
- package/scripts/convert-spacing-to-vars.cjs +256 -242
- package/scripts/convert-to-standard-vars.cjs +282 -268
- package/scripts/release.js +599 -585
- package/src/config.js +350 -336
- package/src/gitCommit.js +455 -440
- package/src/ui/public/assets/EditorView-CbqSI9nw.css +1 -0
- package/src/ui/public/assets/{EditorView-bnJmBq-i.js → EditorView-GS5cmh99.js} +2 -2
- package/src/ui/public/assets/SourceMapView-DyMK80hS.css +1 -0
- package/src/ui/public/assets/{SourceMapView-Rz5SD0A0.js → SourceMapView-_YRtzmZZ.js} +3 -3
- package/src/ui/public/assets/{index-bOs5P8fz.css → index-ML5Y-5lO.css} +1 -1
- package/src/ui/public/assets/{index-Bo3tntQh.js → index-yky0Sd13.js} +11 -11
- package/src/ui/public/index.html +2 -2
- package/src/ui/server/index.js +410 -396
- package/src/ui/server/middleware/requestLogger.js +51 -37
- package/src/ui/server/routes/branchStatus.js +101 -87
- package/src/ui/server/routes/code.js +110 -96
- package/src/ui/server/routes/codeAnalysis.js +995 -981
- package/src/ui/server/routes/config.js +1172 -1158
- package/src/ui/server/routes/exec.js +272 -258
- package/src/ui/server/routes/fileOpen.js +279 -265
- package/src/ui/server/routes/fs.js +701 -687
- package/src/ui/server/routes/git/diff.js +352 -338
- package/src/ui/server/routes/git/diffUtils.js +128 -114
- package/src/ui/server/routes/git/stash.js +552 -538
- package/src/ui/server/routes/git/tags.js +172 -158
- package/src/ui/server/routes/git.js +190 -176
- package/src/ui/server/routes/gitOps.js +1179 -1165
- package/src/ui/server/routes/instances.js +14 -0
- package/src/ui/server/routes/npm.js +1023 -1009
- package/src/ui/server/routes/process.js +82 -68
- package/src/ui/server/routes/status.js +67 -53
- package/src/ui/server/routes/terminal.js +319 -305
- package/src/ui/server/socket/registerUiSocketHandlers.js +226 -212
- package/src/ui/server/utils/createSavePortToFile.js +46 -32
- package/src/ui/server/utils/instanceRegistry.js +14 -0
- package/src/ui/server/utils/pathGuard.js +14 -0
- package/src/ui/server/utils/pathGuard.test.js +14 -0
- package/src/ui/server/utils/randomStartPort.js +14 -0
- package/src/ui/server/utils/startServerOnAvailablePort.js +101 -87
- package/src/utils/index.js +14 -0
- package/src/ui/public/assets/EditorView-CHBjgiZc.css +0 -1
- package/src/ui/public/assets/SourceMapView-DhQX0K7t.css +0 -1
|
@@ -1,268 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* --
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'
|
|
55
|
-
'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
'0
|
|
62
|
-
'0
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
stats.
|
|
129
|
-
stats.
|
|
130
|
-
modified = true;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
console.log(
|
|
234
|
-
console.log(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
1
|
+
// Copyright 2026 xz333221
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
/**
|
|
16
|
+
* 将项目中的 border-radius 和 box-shadow 值转换为标准的 CSS 变量
|
|
17
|
+
*
|
|
18
|
+
* 标准映射规则:
|
|
19
|
+
*
|
|
20
|
+
* border-radius:
|
|
21
|
+
* 2px => var(--radius-xs)
|
|
22
|
+
* 3px => var(--radius-sm)
|
|
23
|
+
* 4px => var(--radius-base)
|
|
24
|
+
* 6px => var(--radius-md)
|
|
25
|
+
* 8px => var(--radius-lg)
|
|
26
|
+
* 12px => var(--radius-xl)
|
|
27
|
+
*
|
|
28
|
+
* box-shadow:
|
|
29
|
+
* 0 1px 3px rgba(0, 0, 0, 0.04) => var(--shadow-sm)
|
|
30
|
+
* 0 1px 4px rgba(0, 0, 0, 0.04) => var(--shadow-base)
|
|
31
|
+
* 0 2px 8px rgba(0, 0, 0, 0.08) => var(--shadow-md)
|
|
32
|
+
* 0 4px 12px rgba(0, 0, 0, 0.08) => var(--shadow-lg)
|
|
33
|
+
* 0 8px 24px rgba(0, 0, 0, 0.12) => var(--shadow-xl)
|
|
34
|
+
*
|
|
35
|
+
* 使用方式:
|
|
36
|
+
* node scripts/convert-to-standard-vars.js [--dry-run]
|
|
37
|
+
*
|
|
38
|
+
* --dry-run: 仅预览更改,不实际修改文件
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const fs = require('fs');
|
|
42
|
+
const path = require('path');
|
|
43
|
+
|
|
44
|
+
// 获取命令行参数
|
|
45
|
+
const args = process.argv.slice(2);
|
|
46
|
+
const isDryRun = args.includes('--dry-run');
|
|
47
|
+
|
|
48
|
+
// border-radius 映射表
|
|
49
|
+
const RADIUS_MAP = {
|
|
50
|
+
'2px': 'var(--radius-xs)',
|
|
51
|
+
'3px': 'var(--radius-sm)',
|
|
52
|
+
'4px': 'var(--radius-base)',
|
|
53
|
+
'6px': 'var(--radius-md)',
|
|
54
|
+
'8px': 'var(--radius-lg)',
|
|
55
|
+
'12px': 'var(--radius-xl)',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// box-shadow 映射表(精确匹配)
|
|
59
|
+
const SHADOW_MAP = {
|
|
60
|
+
// 基础阴影
|
|
61
|
+
'0 1px 3px rgba(0, 0, 0, 0.04)': 'var(--shadow-sm)',
|
|
62
|
+
'0 1px 4px rgba(0, 0, 0, 0.04)': 'var(--shadow-base)',
|
|
63
|
+
'0 2px 8px rgba(0, 0, 0, 0.08)': 'var(--shadow-md)',
|
|
64
|
+
'0 4px 12px rgba(0, 0, 0, 0.08)': 'var(--shadow-lg)',
|
|
65
|
+
'0 8px 24px rgba(0, 0, 0, 0.12)': 'var(--shadow-xl)',
|
|
66
|
+
|
|
67
|
+
// 常见变体(不同透明度)
|
|
68
|
+
'0 2px 8px rgba(0, 0, 0, 0.1)': 'var(--shadow-md)',
|
|
69
|
+
'0 4px 12px rgba(0, 0, 0, 0.1)': 'var(--shadow-lg)',
|
|
70
|
+
'0 2px 6px rgba(0, 0, 0, 0.1)': 'var(--shadow-sm)',
|
|
71
|
+
'0 2px 12px rgba(0, 0, 0, 0.08)': 'var(--shadow-md)',
|
|
72
|
+
'0 4px 16px rgba(0, 0, 0, 0.12)': 'var(--shadow-lg)',
|
|
73
|
+
|
|
74
|
+
// 交互阴影
|
|
75
|
+
'0 4px 12px rgba(0, 0, 0, 0.08)': 'var(--shadow-hover)',
|
|
76
|
+
'0 2px 6px rgba(0, 0, 0, 0.12)': 'var(--shadow-active)',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// 需要处理的文件扩展名
|
|
80
|
+
const TARGET_EXTENSIONS = ['.vue', '.scss', '.css'];
|
|
81
|
+
|
|
82
|
+
// 统计信息
|
|
83
|
+
let stats = {
|
|
84
|
+
totalFiles: 0,
|
|
85
|
+
modifiedFiles: 0,
|
|
86
|
+
radiusReplacements: 0,
|
|
87
|
+
shadowReplacements: 0,
|
|
88
|
+
radiusDetails: {},
|
|
89
|
+
shadowDetails: {},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 递归扫描目录
|
|
94
|
+
*/
|
|
95
|
+
function scanDirectory(dir, fileList = []) {
|
|
96
|
+
const files = fs.readdirSync(dir);
|
|
97
|
+
|
|
98
|
+
files.forEach(file => {
|
|
99
|
+
const filePath = path.join(dir, file);
|
|
100
|
+
const stat = fs.statSync(filePath);
|
|
101
|
+
|
|
102
|
+
if (stat.isDirectory()) {
|
|
103
|
+
if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
|
|
104
|
+
scanDirectory(filePath, fileList);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
const ext = path.extname(file);
|
|
108
|
+
if (TARGET_EXTENSIONS.includes(ext)) {
|
|
109
|
+
fileList.push(filePath);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return fileList;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 处理文件内容
|
|
119
|
+
*/
|
|
120
|
+
function processFileContent(content) {
|
|
121
|
+
let modified = false;
|
|
122
|
+
let newContent = content;
|
|
123
|
+
|
|
124
|
+
// 1. 处理 border-radius
|
|
125
|
+
const radiusRegex = /(border-radius\s*:\s*)(\d+px)(;)/g;
|
|
126
|
+
newContent = newContent.replace(radiusRegex, (match, prefix, value, suffix) => {
|
|
127
|
+
if (RADIUS_MAP[value]) {
|
|
128
|
+
stats.radiusDetails[value] = (stats.radiusDetails[value] || 0) + 1;
|
|
129
|
+
stats.radiusReplacements++;
|
|
130
|
+
modified = true;
|
|
131
|
+
return prefix + RADIUS_MAP[value] + suffix;
|
|
132
|
+
}
|
|
133
|
+
return match;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// 2. 处理 box-shadow(精确匹配)
|
|
137
|
+
Object.keys(SHADOW_MAP).forEach(shadowValue => {
|
|
138
|
+
const escapedValue = shadowValue.replace(/[()]/g, '\\$&');
|
|
139
|
+
const shadowRegex = new RegExp(`(box-shadow\\s*:\\s*)(${escapedValue})(;)`, 'g');
|
|
140
|
+
|
|
141
|
+
if (newContent.match(shadowRegex)) {
|
|
142
|
+
stats.shadowDetails[shadowValue] = (stats.shadowDetails[shadowValue] || 0) + 1;
|
|
143
|
+
stats.shadowReplacements++;
|
|
144
|
+
modified = true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
newContent = newContent.replace(shadowRegex, (match, prefix, value, suffix) => {
|
|
148
|
+
return prefix + SHADOW_MAP[shadowValue] + suffix;
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// 3. 处理 box-shadow 的模糊匹配(针对未精确匹配的常见模式)
|
|
153
|
+
const generalShadowRegex = /(box-shadow\s*:\s*)(0\s+\d+px\s+\d+px\s+rgba\([^)]+\))(;)/g;
|
|
154
|
+
newContent = newContent.replace(generalShadowRegex, (match, prefix, value, suffix) => {
|
|
155
|
+
// 如果已经被精确匹配处理过,跳过
|
|
156
|
+
if (SHADOW_MAP[value]) {
|
|
157
|
+
return match;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 根据模糊程度和偏移量选择合适的阴影
|
|
161
|
+
const normalized = value.replace(/\s+/g, ' ').trim();
|
|
162
|
+
|
|
163
|
+
// 小阴影:offset <= 2px, blur <= 4px
|
|
164
|
+
if (normalized.match(/0\s+[12]px\s+[234]px/)) {
|
|
165
|
+
stats.shadowDetails[value] = (stats.shadowDetails[value] || 0) + 1;
|
|
166
|
+
stats.shadowReplacements++;
|
|
167
|
+
modified = true;
|
|
168
|
+
return prefix + 'var(--shadow-sm)' + suffix;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 中等阴影:offset 2-4px, blur 6-12px
|
|
172
|
+
if (normalized.match(/0\s+[234]px\s+(6|8|10|12)px/)) {
|
|
173
|
+
stats.shadowDetails[value] = (stats.shadowDetails[value] || 0) + 1;
|
|
174
|
+
stats.shadowReplacements++;
|
|
175
|
+
modified = true;
|
|
176
|
+
return prefix + 'var(--shadow-md)' + suffix;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 大阴影:offset 4-8px, blur 12-24px
|
|
180
|
+
if (normalized.match(/0\s+[4-8]px\s+(12|16|20|24)px/)) {
|
|
181
|
+
stats.shadowDetails[value] = (stats.shadowDetails[value] || 0) + 1;
|
|
182
|
+
stats.shadowReplacements++;
|
|
183
|
+
modified = true;
|
|
184
|
+
return prefix + 'var(--shadow-lg)' + suffix;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return match;
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return { content: newContent, modified };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 处理单个文件
|
|
195
|
+
*/
|
|
196
|
+
function processFile(filePath) {
|
|
197
|
+
try {
|
|
198
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
199
|
+
const { content: newContent, modified } = processFileContent(content);
|
|
200
|
+
|
|
201
|
+
if (modified) {
|
|
202
|
+
if (!isDryRun) {
|
|
203
|
+
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
204
|
+
}
|
|
205
|
+
stats.modifiedFiles++;
|
|
206
|
+
console.log(`${isDryRun ? '📋 [预览]' : '✅'} ${filePath}`);
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return false;
|
|
211
|
+
} catch (error) {
|
|
212
|
+
console.error(`❌ 处理文件失败: ${filePath}`, error.message);
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* 主函数
|
|
219
|
+
*/
|
|
220
|
+
function main() {
|
|
221
|
+
const projectRoot = path.join(__dirname, '..');
|
|
222
|
+
const srcDir = path.join(projectRoot, 'src');
|
|
223
|
+
|
|
224
|
+
console.log('🚀 开始标准化 CSS 样式变量...\n');
|
|
225
|
+
console.log(`📁 项目根目录: ${projectRoot}`);
|
|
226
|
+
console.log(`📁 扫描目录: ${srcDir}`);
|
|
227
|
+
console.log(`模式: ${isDryRun ? '预览模式(不会修改文件)' : '修改模式'}\n`);
|
|
228
|
+
|
|
229
|
+
// 扫描所有目标文件
|
|
230
|
+
const files = scanDirectory(srcDir);
|
|
231
|
+
stats.totalFiles = files.length;
|
|
232
|
+
|
|
233
|
+
console.log(`📊 找到 ${files.length} 个文件需要检查\n`);
|
|
234
|
+
console.log('🔄 开始处理文件...\n');
|
|
235
|
+
|
|
236
|
+
// 处理每个文件
|
|
237
|
+
files.forEach(file => {
|
|
238
|
+
processFile(file);
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// 输出统计信息
|
|
242
|
+
console.log('\n' + '='.repeat(60));
|
|
243
|
+
console.log('📊 转换统计报告');
|
|
244
|
+
console.log('='.repeat(60));
|
|
245
|
+
console.log(`总文件数: ${stats.totalFiles}`);
|
|
246
|
+
console.log(`修改文件数: ${stats.modifiedFiles}`);
|
|
247
|
+
console.log(`border-radius 替换次数: ${stats.radiusReplacements}`);
|
|
248
|
+
console.log(`box-shadow 替换次数: ${stats.shadowReplacements}`);
|
|
249
|
+
|
|
250
|
+
if (Object.keys(stats.radiusDetails).length > 0) {
|
|
251
|
+
console.log('\n📋 border-radius 替换详情:');
|
|
252
|
+
Object.entries(stats.radiusDetails)
|
|
253
|
+
.sort((a, b) => b[1] - a[1])
|
|
254
|
+
.forEach(([px, count]) => {
|
|
255
|
+
console.log(` ${px} => ${RADIUS_MAP[px]}: ${count} 次`);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (Object.keys(stats.shadowDetails).length > 0) {
|
|
260
|
+
console.log('\n📋 box-shadow 替换详情:');
|
|
261
|
+
Object.entries(stats.shadowDetails)
|
|
262
|
+
.sort((a, b) => b[1] - a[1])
|
|
263
|
+
.forEach(([shadow, count]) => {
|
|
264
|
+
const mapped = SHADOW_MAP[shadow] || '(模糊匹配)';
|
|
265
|
+
console.log(` ${shadow} => ${mapped}: ${count} 次`);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (isDryRun) {
|
|
270
|
+
console.log('\n💡 提示: 这是预览模式,文件未被修改');
|
|
271
|
+
console.log(' 移除 --dry-run 参数以实际应用更改');
|
|
272
|
+
} else {
|
|
273
|
+
console.log('\n✨ 转换完成!');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 运行主函数
|
|
278
|
+
if (require.main === module) {
|
|
279
|
+
main();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
module.exports = { processFileContent };
|