ms-vite-plugin 1.4.3 → 1.4.5
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/package.json +4 -2
- package/webview/assets/index-CFwoQXO_.js +13 -0
- package/webview/assets/vendor-modules-Oqi8dZEn.js +42198 -0
- package/webview/index.html +20 -0
- package/webview_other/live-view.html +839 -0
- package/webview_other/login.html +475 -0
- package/webview_other/package-config.html +459 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta
|
|
7
|
+
http-equiv="Content-Security-Policy"
|
|
8
|
+
content="default-src 'none'; style-src 'unsafe-inline'; img-src vscode-resource: https: data:; script-src 'unsafe-inline';"
|
|
9
|
+
/>
|
|
10
|
+
<title>应用打包配置</title>
|
|
11
|
+
<style>
|
|
12
|
+
* {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
font-family: var(--vscode-font-family);
|
|
18
|
+
font-size: var(--vscode-font-size);
|
|
19
|
+
color: var(--vscode-foreground);
|
|
20
|
+
background-color: var(--vscode-editor-background);
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
line-height: 1.5;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.container {
|
|
27
|
+
max-width: 500px;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
h1 {
|
|
32
|
+
color: var(--vscode-foreground);
|
|
33
|
+
margin-bottom: 20px;
|
|
34
|
+
font-size: 16px;
|
|
35
|
+
font-weight: 600;
|
|
36
|
+
border-bottom: 1px solid var(--vscode-widget-border);
|
|
37
|
+
padding-bottom: 8px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.form-group {
|
|
41
|
+
margin-bottom: 20px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
label {
|
|
45
|
+
display: block;
|
|
46
|
+
margin-bottom: 4px;
|
|
47
|
+
font-weight: normal;
|
|
48
|
+
color: var(--vscode-foreground);
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input[type='text'],
|
|
53
|
+
input[type='file'],
|
|
54
|
+
input[type='number'],
|
|
55
|
+
textarea {
|
|
56
|
+
width: 100%;
|
|
57
|
+
padding: 4px 8px;
|
|
58
|
+
border: 1px solid var(--vscode-input-border);
|
|
59
|
+
background-color: var(--vscode-input-background);
|
|
60
|
+
color: var(--vscode-input-foreground);
|
|
61
|
+
border-radius: 0;
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
height: 26px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
textarea {
|
|
68
|
+
resize: vertical;
|
|
69
|
+
min-height: 60px;
|
|
70
|
+
height: auto;
|
|
71
|
+
font-family: inherit;
|
|
72
|
+
line-height: 1.4;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.radio-group {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: 8px;
|
|
79
|
+
margin-top: 4px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.radio-group label {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.radio-group input[type='radio'] {
|
|
90
|
+
width: auto;
|
|
91
|
+
height: auto;
|
|
92
|
+
margin-right: 8px;
|
|
93
|
+
margin-bottom: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
input[type='text']:focus,
|
|
97
|
+
input[type='file']:focus {
|
|
98
|
+
outline: none;
|
|
99
|
+
border-color: var(--vscode-focusBorder);
|
|
100
|
+
box-shadow: 0 0 0 1px var(--vscode-focusBorder);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.button-group {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: flex-end;
|
|
106
|
+
margin-top: 30px;
|
|
107
|
+
padding-top: 16px;
|
|
108
|
+
border-top: 1px solid var(--vscode-widget-border);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.btn {
|
|
112
|
+
padding: 6px 14px;
|
|
113
|
+
margin: 0 4px;
|
|
114
|
+
border: 1px solid var(--vscode-button-border);
|
|
115
|
+
border-radius: 0;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
font-weight: normal;
|
|
119
|
+
height: 28px;
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.btn-primary {
|
|
126
|
+
background-color: var(--vscode-button-background);
|
|
127
|
+
color: var(--vscode-button-foreground);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.btn-primary:hover {
|
|
131
|
+
background-color: var(--vscode-button-hoverBackground);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.help-text {
|
|
135
|
+
font-size: 11px;
|
|
136
|
+
color: var(--vscode-descriptionForeground);
|
|
137
|
+
margin-top: 2px;
|
|
138
|
+
font-style: italic;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.error {
|
|
142
|
+
color: var(--vscode-errorForeground);
|
|
143
|
+
background-color: var(--vscode-inputValidation-errorBackground);
|
|
144
|
+
border: 1px solid var(--vscode-inputValidation-errorBorder);
|
|
145
|
+
padding: 8px;
|
|
146
|
+
border-radius: 2px;
|
|
147
|
+
margin-top: 8px;
|
|
148
|
+
display: none;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* 进度条样式 */
|
|
153
|
+
.progress-container {
|
|
154
|
+
margin: 16px 0;
|
|
155
|
+
padding: 16px;
|
|
156
|
+
background-color: var(--vscode-editor-background);
|
|
157
|
+
border: 1px solid var(--vscode-panel-border);
|
|
158
|
+
border-radius: 4px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.progress-header {
|
|
162
|
+
display: flex;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
align-items: center;
|
|
165
|
+
margin-bottom: 8px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.progress-text {
|
|
169
|
+
font-size: 14px;
|
|
170
|
+
color: var(--vscode-foreground);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.progress-percentage {
|
|
174
|
+
font-size: 14px;
|
|
175
|
+
font-weight: bold;
|
|
176
|
+
color: var(--vscode-charts-blue);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.progress-bar-container {
|
|
180
|
+
width: 100%;
|
|
181
|
+
height: 8px;
|
|
182
|
+
background-color: var(--vscode-editorWidget-background, #e0e0e0);
|
|
183
|
+
border-radius: 4px;
|
|
184
|
+
overflow: hidden;
|
|
185
|
+
margin-bottom: 8px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.progress-bar {
|
|
189
|
+
height: 100%;
|
|
190
|
+
background-color: var(--vscode-progressBar-foreground, #007acc);
|
|
191
|
+
width: 0%;
|
|
192
|
+
transition: width 0.3s ease;
|
|
193
|
+
border-radius: 4px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.progress-details {
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
font-size: 12px;
|
|
200
|
+
color: var(--vscode-descriptionForeground);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.progress-details span {
|
|
204
|
+
flex: 1;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.progress-speed {
|
|
208
|
+
text-align: center;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.progress-time {
|
|
212
|
+
text-align: right;
|
|
213
|
+
}
|
|
214
|
+
</style>
|
|
215
|
+
</head>
|
|
216
|
+
|
|
217
|
+
<body>
|
|
218
|
+
<div class="container">
|
|
219
|
+
<h1>应用打包配置</h1>
|
|
220
|
+
|
|
221
|
+
<form id="packageForm">
|
|
222
|
+
<div class="form-group">
|
|
223
|
+
<label for="appId">AppID</label>
|
|
224
|
+
<input type="text" id="appId" placeholder="请输入应用ID" />
|
|
225
|
+
<div class="help-text">AppID从 开发者后台->网络验证管理->软件列表 获取</div>
|
|
226
|
+
</div>
|
|
227
|
+
<div class="form-group">
|
|
228
|
+
<label for="appVersion">版本号 *</label>
|
|
229
|
+
<input type="number" id="appVersion" placeholder="请输入版本号(仅数字,如:123)" />
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div id="hotupdateTabContent">
|
|
233
|
+
<div class="form-group">
|
|
234
|
+
<label for="updateNotice">更新内容</label>
|
|
235
|
+
<textarea
|
|
236
|
+
id="updateNotice"
|
|
237
|
+
placeholder="请输入更新内容(可选,最多200字)"
|
|
238
|
+
rows="4"
|
|
239
|
+
maxlength="200"
|
|
240
|
+
></textarea>
|
|
241
|
+
</div>
|
|
242
|
+
|
|
243
|
+
<div class="form-group">
|
|
244
|
+
<label>打包选项</label>
|
|
245
|
+
<div class="radio-group">
|
|
246
|
+
<label>
|
|
247
|
+
<input type="radio" name="packageOption" value="package" checked />
|
|
248
|
+
仅打包
|
|
249
|
+
</label>
|
|
250
|
+
<label>
|
|
251
|
+
<input type="radio" name="packageOption" value="upload" />
|
|
252
|
+
打包并上传到快点JS热更新服务(上限200MB)
|
|
253
|
+
</label>
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
<div class="error" id="errorMessage"></div>
|
|
259
|
+
|
|
260
|
+
<!-- 上传进度条 -->
|
|
261
|
+
<div class="progress-container" id="progressContainer" style="display: none">
|
|
262
|
+
<div class="progress-header">
|
|
263
|
+
<span class="progress-text" id="progressText">上传中...</span>
|
|
264
|
+
<span class="progress-percentage" id="progressPercentage">0%</span>
|
|
265
|
+
</div>
|
|
266
|
+
<div class="progress-bar-container">
|
|
267
|
+
<div class="progress-bar" id="progressBar"></div>
|
|
268
|
+
</div>
|
|
269
|
+
<div class="progress-details">
|
|
270
|
+
<span class="progress-size" id="progressSize">0 B / 0 B</span>
|
|
271
|
+
<span class="progress-speed" id="progressSpeed">速度: 0 B/s</span>
|
|
272
|
+
<span class="progress-time" id="progressTime">剩余时间: --</span>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div class="button-group">
|
|
277
|
+
<button type="submit" class="btn btn-primary" id="packageButton">开始打包</button>
|
|
278
|
+
</div>
|
|
279
|
+
</form>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<script>
|
|
283
|
+
const vscode = acquireVsCodeApi();
|
|
284
|
+
|
|
285
|
+
// 监听来自扩展的消息
|
|
286
|
+
window.addEventListener('message', (event) => {
|
|
287
|
+
const message = event.data;
|
|
288
|
+
switch (message.command) {
|
|
289
|
+
case 'setPackageConfig':
|
|
290
|
+
if (message.config) {
|
|
291
|
+
if (message.config.appId) {
|
|
292
|
+
document.getElementById('appId').value = message.config.appId;
|
|
293
|
+
}
|
|
294
|
+
if (message.config.appVersion) {
|
|
295
|
+
document.getElementById('appVersion').value = message.config.appVersion;
|
|
296
|
+
}
|
|
297
|
+
if (message.config.updateNotice) {
|
|
298
|
+
document.getElementById('updateNotice').value = message.config.updateNotice;
|
|
299
|
+
}
|
|
300
|
+
if (message.config.uploadToPlatform !== undefined) {
|
|
301
|
+
const radioValue = message.config.uploadToPlatform ? 'upload' : 'package';
|
|
302
|
+
document.querySelector(
|
|
303
|
+
`input[name="packageOption"][value="${radioValue}"]`
|
|
304
|
+
).checked = true;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
case 'packageError':
|
|
309
|
+
showError(message.error);
|
|
310
|
+
break;
|
|
311
|
+
case 'packageSuccess':
|
|
312
|
+
vscode.postMessage({ command: 'close' });
|
|
313
|
+
break;
|
|
314
|
+
case 'uploadStart':
|
|
315
|
+
showProgress();
|
|
316
|
+
updateProgress(0, 0, message.total || 0, 0, 0);
|
|
317
|
+
break;
|
|
318
|
+
case 'uploadProgress':
|
|
319
|
+
updateProgress(
|
|
320
|
+
message.percentage || 0,
|
|
321
|
+
message.loaded || 0,
|
|
322
|
+
message.total || 0,
|
|
323
|
+
message.speed || 0,
|
|
324
|
+
message.timeRemaining || 0
|
|
325
|
+
);
|
|
326
|
+
break;
|
|
327
|
+
case 'uploadComplete':
|
|
328
|
+
hideProgress();
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
function showError(message) {
|
|
334
|
+
const errorDiv = document.getElementById('errorMessage');
|
|
335
|
+
errorDiv.textContent = message;
|
|
336
|
+
errorDiv.style.display = 'block';
|
|
337
|
+
setTimeout(() => {
|
|
338
|
+
errorDiv.style.display = 'none';
|
|
339
|
+
}, 5000);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// 收集所有表单数据的统一函数
|
|
343
|
+
function collectAllFormData() {
|
|
344
|
+
const appId = document.getElementById('appId').value.trim();
|
|
345
|
+
const appVersion = parseInt(document.getElementById('appVersion').value) || 1;
|
|
346
|
+
|
|
347
|
+
// 基础数据
|
|
348
|
+
const data = {
|
|
349
|
+
appId,
|
|
350
|
+
appVersion
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
data.updateNotice = document.getElementById('updateNotice').value.trim();
|
|
354
|
+
data.uploadToPlatform =
|
|
355
|
+
document.querySelector('input[name="packageOption"]:checked')?.value === 'upload';
|
|
356
|
+
|
|
357
|
+
return data;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// 表单提交处理
|
|
361
|
+
document.getElementById('packageForm').addEventListener('submit', function (e) {
|
|
362
|
+
e.preventDefault();
|
|
363
|
+
|
|
364
|
+
// 收集所有表单数据
|
|
365
|
+
const config = collectAllFormData();
|
|
366
|
+
|
|
367
|
+
// 热更新包模式验证
|
|
368
|
+
if (config.appVersion <= 0) {
|
|
369
|
+
showError('请输入版本号');
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// 验证更新内容长度(如果有输入的话)
|
|
374
|
+
if (config.updateNotice.length > 200) {
|
|
375
|
+
showError('更新内容不能超过200字');
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// 发送打包请求,包含所有配置字段
|
|
380
|
+
vscode.postMessage({
|
|
381
|
+
command: 'startPackage',
|
|
382
|
+
config: config
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// 进度条相关函数
|
|
387
|
+
function showProgress() {
|
|
388
|
+
const progressContainer = document.getElementById('progressContainer');
|
|
389
|
+
const packageButton = document.getElementById('packageButton');
|
|
390
|
+
|
|
391
|
+
progressContainer.style.display = 'block';
|
|
392
|
+
packageButton.disabled = true;
|
|
393
|
+
packageButton.textContent = '上传中...';
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function hideProgress() {
|
|
397
|
+
const progressContainer = document.getElementById('progressContainer');
|
|
398
|
+
const packageButton = document.getElementById('packageButton');
|
|
399
|
+
|
|
400
|
+
progressContainer.style.display = 'none';
|
|
401
|
+
packageButton.disabled = false;
|
|
402
|
+
packageButton.textContent = '开始打包';
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function updateProgress(percentage, loaded, total, speed, timeRemaining) {
|
|
406
|
+
// 确保百分比是有效数字
|
|
407
|
+
if (typeof percentage !== 'number' || isNaN(percentage)) {
|
|
408
|
+
percentage = 0;
|
|
409
|
+
}
|
|
410
|
+
percentage = Math.max(0, Math.min(100, percentage));
|
|
411
|
+
|
|
412
|
+
// 获取DOM元素
|
|
413
|
+
const progressBar = document.getElementById('progressBar');
|
|
414
|
+
const progressPercentage = document.getElementById('progressPercentage');
|
|
415
|
+
const progressSize = document.getElementById('progressSize');
|
|
416
|
+
const progressSpeed = document.getElementById('progressSpeed');
|
|
417
|
+
const progressTime = document.getElementById('progressTime');
|
|
418
|
+
|
|
419
|
+
// 直接更新进度条宽度和文本,利用CSS transition实现平滑效果
|
|
420
|
+
progressBar.style.width = percentage + '%';
|
|
421
|
+
progressPercentage.textContent = Math.round(percentage) + '%';
|
|
422
|
+
|
|
423
|
+
// 更新其他信息
|
|
424
|
+
progressSize.textContent = `${formatBytes(loaded)} / ${formatBytes(total)}`;
|
|
425
|
+
progressSpeed.textContent = `速度: ${formatBytes(speed)}/s`;
|
|
426
|
+
progressTime.textContent = `剩余时间: ${formatTime(timeRemaining)}`;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function formatBytes(bytes) {
|
|
430
|
+
if (bytes === 0) return '0 B';
|
|
431
|
+
const k = 1024;
|
|
432
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
433
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
434
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function formatTime(seconds) {
|
|
438
|
+
if (seconds === 0 || !isFinite(seconds)) return '--';
|
|
439
|
+
const hours = Math.floor(seconds / 3600);
|
|
440
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
441
|
+
const secs = Math.floor(seconds % 60);
|
|
442
|
+
|
|
443
|
+
if (hours > 0) {
|
|
444
|
+
return `${hours}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
|
|
445
|
+
} else if (minutes > 0) {
|
|
446
|
+
return `${minutes}:${secs.toString().padStart(2, '0')}`;
|
|
447
|
+
} else {
|
|
448
|
+
return `${secs}秒`;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
453
|
+
vscode.postMessage({
|
|
454
|
+
command: 'getPackageConfig'
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
</script>
|
|
458
|
+
</body>
|
|
459
|
+
</html>
|