zen-gitsync 2.11.39 → 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/README.md +695 -695
- 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-GS5cmh99.js +21 -0
- package/src/ui/public/assets/SourceMapView-DyMK80hS.css +1 -0
- package/src/ui/public/assets/SourceMapView-_YRtzmZZ.js +3 -0
- package/src/ui/public/assets/index-ML5Y-5lO.css +1 -0
- package/src/ui/public/assets/index-yky0Sd13.js +73 -0
- package/src/ui/public/assets/{ts.worker-Dth06zuC.js → ts.worker-METxwbDZ.js} +1 -16
- package/src/ui/public/assets/{vendor-B1T2uxYO.js → vendor-DITsiaGj.js} +294 -287
- package/src/ui/public/assets/vendor-q83wvJns.css +1 -0
- package/src/ui/public/index.html +4 -4
- package/src/ui/server/.claude/codediff.txt +6 -0
- 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 -699
- 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 +38 -24
- 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 +270 -256
- package/src/ui/server/utils/pathGuard.js +155 -0
- package/src/ui/server/utils/pathGuard.test.js +138 -0
- package/src/ui/server/utils/randomStartPort.js +51 -37
- package/src/ui/server/utils/startServerOnAvailablePort.js +101 -87
- package/src/utils/index.js +1058 -1044
- package/src/ui/public/assets/devopicons-QN4QXivI.woff2 +0 -0
- package/src/ui/public/assets/file-icons-C0jOugUK.woff2 +0 -0
- package/src/ui/public/assets/fontawesome-B-jkhYfk.woff2 +0 -0
- package/src/ui/public/assets/index-BvVl-092.js +0 -95
- package/src/ui/public/assets/index-DXO3Lvqi.css +0 -1
- package/src/ui/public/assets/mfixx-CpAhKOZz.woff2 +0 -0
- package/src/ui/public/assets/octicons-CaZ_fok2.woff2 +0 -0
- package/src/ui/public/assets/vendor-hOO_r_AU.css +0 -1
|
@@ -1,242 +1,256 @@
|
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
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
|
-
return
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
console.log(
|
|
226
|
-
console.log('
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
console.log('\n
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
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
|
+
* 将项目中所有 padding、margin、gap 相关属性的 px 值转换为标准的 CSS 变量
|
|
17
|
+
*
|
|
18
|
+
* 支持的属性:
|
|
19
|
+
* - padding, padding-top, padding-right, padding-bottom, padding-left
|
|
20
|
+
* - margin, margin-top, margin-right, margin-bottom, margin-left
|
|
21
|
+
* - gap, row-gap, column-gap
|
|
22
|
+
*
|
|
23
|
+
* 标准间距映射:
|
|
24
|
+
* 1px => 1px (保持原样,边框等特殊用途)
|
|
25
|
+
* 2px => var(--spacing-xs)
|
|
26
|
+
* 3px => 3px (保持原样,特殊值)
|
|
27
|
+
* 4px => var(--spacing-sm)
|
|
28
|
+
* 5px => 5px (保持原样,特殊值)
|
|
29
|
+
* 6px => 6px (保持原样,常用于紧凑布局)
|
|
30
|
+
* 8px => var(--spacing-base)
|
|
31
|
+
* 10px => 10px (保持原样,特殊值)
|
|
32
|
+
* 12px => var(--spacing-md)
|
|
33
|
+
* 16px => var(--spacing-lg)
|
|
34
|
+
* 18px => 18px (保持原样,字体相关)
|
|
35
|
+
* 20px => var(--spacing-xl)
|
|
36
|
+
* 24px => var(--spacing-2xl)
|
|
37
|
+
* 32px => var(--spacing-3xl)
|
|
38
|
+
* 40px => 40px (保持原样,大间距特殊值)
|
|
39
|
+
*
|
|
40
|
+
* 使用方式:
|
|
41
|
+
* node scripts/convert-spacing-to-vars.js [--strict]
|
|
42
|
+
*
|
|
43
|
+
* --strict: 严格模式,只替换精确匹配的值(2px, 4px, 8px, 12px, 16px, 20px, 24px, 32px)
|
|
44
|
+
* 默认模式:只替换标准间距值,保留特殊值(如 1px, 3px, 5px, 6px, 10px, 18px 等)
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
const fs = require('fs');
|
|
48
|
+
const path = require('path');
|
|
49
|
+
|
|
50
|
+
// 获取命令行参数
|
|
51
|
+
const args = process.argv.slice(2);
|
|
52
|
+
const isStrictMode = args.includes('--strict');
|
|
53
|
+
|
|
54
|
+
// 间距映射表(精确匹配标准间距)
|
|
55
|
+
const SPACING_MAP = {
|
|
56
|
+
'2px': 'var(--spacing-xs)', // 2px
|
|
57
|
+
'4px': 'var(--spacing-sm)', // 4px
|
|
58
|
+
'8px': 'var(--spacing-base)', // 8px
|
|
59
|
+
'12px': 'var(--spacing-md)', // 12px
|
|
60
|
+
'16px': 'var(--spacing-lg)', // 16px
|
|
61
|
+
'20px': 'var(--spacing-xl)', // 20px
|
|
62
|
+
'24px': 'var(--spacing-2xl)', // 24px
|
|
63
|
+
'32px': 'var(--spacing-3xl)', // 32px
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
console.log(`\n运行模式: ${isStrictMode ? '严格模式(只替换标准间距)' : '默认模式(只替换标准间距)'}\n`);
|
|
67
|
+
|
|
68
|
+
// 需要处理的文件扩展名
|
|
69
|
+
const TARGET_EXTENSIONS = ['.vue', '.scss', '.css'];
|
|
70
|
+
|
|
71
|
+
// 需要处理的 CSS 属性(包括所有方向性变体)
|
|
72
|
+
const TARGET_PROPERTIES = [
|
|
73
|
+
'padding',
|
|
74
|
+
'padding-top',
|
|
75
|
+
'padding-right',
|
|
76
|
+
'padding-bottom',
|
|
77
|
+
'padding-left',
|
|
78
|
+
'margin',
|
|
79
|
+
'margin-top',
|
|
80
|
+
'margin-right',
|
|
81
|
+
'margin-bottom',
|
|
82
|
+
'margin-left',
|
|
83
|
+
'gap',
|
|
84
|
+
'row-gap',
|
|
85
|
+
'column-gap',
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
// 统计信息
|
|
89
|
+
let stats = {
|
|
90
|
+
totalFiles: 0,
|
|
91
|
+
modifiedFiles: 0,
|
|
92
|
+
totalReplacements: 0,
|
|
93
|
+
replacementDetails: {},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 递归扫描目录
|
|
98
|
+
*/
|
|
99
|
+
function scanDirectory(dir, fileList = []) {
|
|
100
|
+
const files = fs.readdirSync(dir);
|
|
101
|
+
|
|
102
|
+
files.forEach(file => {
|
|
103
|
+
const filePath = path.join(dir, file);
|
|
104
|
+
const stat = fs.statSync(filePath);
|
|
105
|
+
|
|
106
|
+
if (stat.isDirectory()) {
|
|
107
|
+
// 跳过 node_modules 和 .git 目录
|
|
108
|
+
if (file !== 'node_modules' && file !== '.git' && file !== 'dist') {
|
|
109
|
+
scanDirectory(filePath, fileList);
|
|
110
|
+
}
|
|
111
|
+
} else {
|
|
112
|
+
const ext = path.extname(file);
|
|
113
|
+
if (TARGET_EXTENSIONS.includes(ext)) {
|
|
114
|
+
fileList.push(filePath);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return fileList;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 替换单个 px 值为变量
|
|
124
|
+
*/
|
|
125
|
+
function replacePxValue(value) {
|
|
126
|
+
if (SPACING_MAP[value]) {
|
|
127
|
+
const varName = SPACING_MAP[value];
|
|
128
|
+
// 记录替换详情
|
|
129
|
+
stats.replacementDetails[value] = (stats.replacementDetails[value] || 0) + 1;
|
|
130
|
+
stats.totalReplacements++;
|
|
131
|
+
return varName;
|
|
132
|
+
}
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 处理文件内容
|
|
138
|
+
*/
|
|
139
|
+
function processFileContent(content) {
|
|
140
|
+
let modified = false;
|
|
141
|
+
let newContent = content;
|
|
142
|
+
|
|
143
|
+
// 构建正则表达式,匹配 padding、margin、gap 属性
|
|
144
|
+
// 支持的格式:
|
|
145
|
+
// 1. padding: 12px;
|
|
146
|
+
// 2. padding: 12px 16px;
|
|
147
|
+
// 3. padding: 12px 16px 12px 16px;
|
|
148
|
+
// 4. padding: 12px var(--spacing-md);
|
|
149
|
+
TARGET_PROPERTIES.forEach(property => {
|
|
150
|
+
// 转义属性名中的连字符(如 padding-top 中的 -)
|
|
151
|
+
const escapedProperty = property.replace(/-/g, '\\-');
|
|
152
|
+
// 匹配属性及其值(包括多个值的情况)
|
|
153
|
+
const regex = new RegExp(
|
|
154
|
+
`(${escapedProperty}\\s*:\\s*)([^;{}]+)(;)`,
|
|
155
|
+
'g'
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
newContent = newContent.replace(regex, (match, prefix, values, suffix) => {
|
|
159
|
+
// 分割多个值
|
|
160
|
+
const parts = values.trim().split(/\s+/);
|
|
161
|
+
let hasChange = false;
|
|
162
|
+
|
|
163
|
+
// 处理每个值
|
|
164
|
+
const newParts = parts.map(part => {
|
|
165
|
+
// 检查是否是 px 值
|
|
166
|
+
if (/^\d+px$/.test(part)) {
|
|
167
|
+
const replaced = replacePxValue(part);
|
|
168
|
+
if (replaced !== part) {
|
|
169
|
+
hasChange = true;
|
|
170
|
+
return replaced;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return part;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
if (hasChange) {
|
|
177
|
+
modified = true;
|
|
178
|
+
return prefix + newParts.join(' ') + suffix;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return match;
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return { content: newContent, modified };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* 处理单个文件
|
|
190
|
+
*/
|
|
191
|
+
function processFile(filePath) {
|
|
192
|
+
try {
|
|
193
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
194
|
+
const { content: newContent, modified } = processFileContent(content);
|
|
195
|
+
|
|
196
|
+
if (modified) {
|
|
197
|
+
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
198
|
+
stats.modifiedFiles++;
|
|
199
|
+
console.log(`✅ 已修改: ${filePath}`);
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return false;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
console.error(`❌ 处理文件失败: ${filePath}`, error.message);
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* 主函数
|
|
212
|
+
*/
|
|
213
|
+
function main() {
|
|
214
|
+
const projectRoot = path.join(__dirname, '..');
|
|
215
|
+
const srcDir = path.join(projectRoot, 'src');
|
|
216
|
+
|
|
217
|
+
console.log('🚀 开始扫描项目文件...\n');
|
|
218
|
+
console.log(`📁 项目根目录: ${projectRoot}`);
|
|
219
|
+
console.log(`📁 扫描目录: ${srcDir}\n`);
|
|
220
|
+
|
|
221
|
+
// 扫描所有目标文件
|
|
222
|
+
const files = scanDirectory(srcDir);
|
|
223
|
+
stats.totalFiles = files.length;
|
|
224
|
+
|
|
225
|
+
console.log(`📊 找到 ${files.length} 个文件需要检查\n`);
|
|
226
|
+
console.log('🔄 开始处理文件...\n');
|
|
227
|
+
|
|
228
|
+
// 处理每个文件
|
|
229
|
+
files.forEach(file => {
|
|
230
|
+
processFile(file);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
// 输出统计信息
|
|
234
|
+
console.log('\n' + '='.repeat(60));
|
|
235
|
+
console.log('📊 转换统计报告');
|
|
236
|
+
console.log('='.repeat(60));
|
|
237
|
+
console.log(`总文件数: ${stats.totalFiles}`);
|
|
238
|
+
console.log(`修改文件数: ${stats.modifiedFiles}`);
|
|
239
|
+
console.log(`总替换次数: ${stats.totalReplacements}`);
|
|
240
|
+
console.log('\n📋 替换详情:');
|
|
241
|
+
|
|
242
|
+
Object.entries(stats.replacementDetails)
|
|
243
|
+
.sort((a, b) => b[1] - a[1])
|
|
244
|
+
.forEach(([px, count]) => {
|
|
245
|
+
console.log(` ${px} => ${SPACING_MAP[px]}: ${count} 次`);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
console.log('\n✨ 转换完成!');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// 运行主函数
|
|
252
|
+
if (require.main === module) {
|
|
253
|
+
main();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
module.exports = { processFileContent, replacePxValue };
|