mock-service-cli 3.6.5 → 4.0.0
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/README.md +22 -21
- package/bin/mock-service-cli +1 -266
- package/{lib → dist}/asyncTaskQueue.js +6 -18
- package/dist/cli.js +6608 -0
- package/{lib → dist}/file-explorer.html +40 -4
- package/dist/fileExplorerServer.js +28186 -0
- package/dist/manageMockFiles.js +5020 -0
- package/dist/mockServer.js +53214 -0
- package/dist/packageInfo.js +19 -0
- package/dist/staticServer.js +26688 -0
- package/dist/utils.js +857 -0
- package/package.json +21 -17
- package/lib/fileExplorerServer.js +0 -329
- package/lib/manageMockFiles.js +0 -252
- package/lib/mockServer.js +0 -497
- package/lib/staticServer.js +0 -104
- package/lib/utils.js +0 -297
- /package/{lib → dist}/api-overview.html +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="zh-CN">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
@@ -379,6 +379,9 @@
|
|
|
379
379
|
font-size: 10px;
|
|
380
380
|
color: #999;
|
|
381
381
|
}
|
|
382
|
+
.birthtime {
|
|
383
|
+
padding-right: 4px;
|
|
384
|
+
}
|
|
382
385
|
|
|
383
386
|
.list-view .file-meta {
|
|
384
387
|
display: flex;
|
|
@@ -751,6 +754,14 @@
|
|
|
751
754
|
>
|
|
752
755
|
👁️
|
|
753
756
|
</button>
|
|
757
|
+
<button
|
|
758
|
+
class="toggle-hidden-btn"
|
|
759
|
+
id="toggleBirthtimeBtn"
|
|
760
|
+
onclick="toggleBirthtimeFiles()"
|
|
761
|
+
title="显示/隐藏创建时间"
|
|
762
|
+
>
|
|
763
|
+
⌛️
|
|
764
|
+
</button>
|
|
754
765
|
<div class="stats-info" id="statsInfo"></div>
|
|
755
766
|
<div class="search-box">
|
|
756
767
|
<input type="text" id="searchInput" placeholder="搜索文件名..." oninput="handleSearch()" />
|
|
@@ -803,6 +814,7 @@
|
|
|
803
814
|
let sortBy = 'name';
|
|
804
815
|
let sortAscending = true;
|
|
805
816
|
let showHiddenFiles = true;
|
|
817
|
+
let showBirthtime = false;
|
|
806
818
|
let currentPreviewContent = '';
|
|
807
819
|
let currentZoom = 1;
|
|
808
820
|
let currentRotation = 0;
|
|
@@ -1058,10 +1070,16 @@
|
|
|
1058
1070
|
function updateStatsInfo(files) {
|
|
1059
1071
|
const statsInfo = document.getElementById('statsInfo');
|
|
1060
1072
|
if (!statsInfo) return;
|
|
1061
|
-
|
|
1062
|
-
const dirCount = files.filter(f =>
|
|
1073
|
+
let fileTotalSize = 0;
|
|
1074
|
+
const dirCount = files.filter(f => {
|
|
1075
|
+
if (!f.isDirectory) {
|
|
1076
|
+
fileTotalSize += f.size;
|
|
1077
|
+
}
|
|
1078
|
+
return f.isDirectory;
|
|
1079
|
+
}).length;
|
|
1063
1080
|
const fileCount = files.length - dirCount;
|
|
1064
|
-
|
|
1081
|
+
const totalSize = formatSize(fileTotalSize);
|
|
1082
|
+
statsInfo.textContent = `${dirCount} 个文件夹, ${fileCount} 个文件 (${totalSize})`;
|
|
1065
1083
|
}
|
|
1066
1084
|
|
|
1067
1085
|
function processAndRenderFiles() {
|
|
@@ -1116,6 +1134,18 @@
|
|
|
1116
1134
|
updateStatsInfo(files);
|
|
1117
1135
|
renderFiles(files);
|
|
1118
1136
|
}
|
|
1137
|
+
function toggleBirthtimeFiles() {
|
|
1138
|
+
showBirthtime = !showBirthtime;
|
|
1139
|
+
const btn = document.getElementById('toggleBirthtimeBtn');
|
|
1140
|
+
if (!showBirthtime) {
|
|
1141
|
+
btn.classList.remove('active');
|
|
1142
|
+
btn.title = '显示创建时间';
|
|
1143
|
+
} else {
|
|
1144
|
+
btn.classList.add('active');
|
|
1145
|
+
btn.title = '隐藏创建时间';
|
|
1146
|
+
}
|
|
1147
|
+
processAndRenderFiles();
|
|
1148
|
+
}
|
|
1119
1149
|
|
|
1120
1150
|
function toggleHiddenFiles() {
|
|
1121
1151
|
showHiddenFiles = !showHiddenFiles;
|
|
@@ -1212,11 +1242,14 @@
|
|
|
1212
1242
|
|
|
1213
1243
|
function renderFiles(files) {
|
|
1214
1244
|
const fileGrid = document.getElementById('fileGrid');
|
|
1245
|
+
const toggleBirthtimeBtn = document.getElementById('toggleBirthtimeBtn');
|
|
1215
1246
|
|
|
1216
1247
|
// 确保视图类名正确
|
|
1217
1248
|
if (currentView === 'list') {
|
|
1218
1249
|
fileGrid.classList.add('list-view');
|
|
1250
|
+
toggleBirthtimeBtn.style.display = 'inline-block';
|
|
1219
1251
|
} else {
|
|
1252
|
+
toggleBirthtimeBtn.style.display = 'none';
|
|
1220
1253
|
fileGrid.classList.remove('list-view');
|
|
1221
1254
|
}
|
|
1222
1255
|
|
|
@@ -1231,6 +1264,7 @@
|
|
|
1231
1264
|
const icon = getFileIcon(file);
|
|
1232
1265
|
const size = formatSize(file.size);
|
|
1233
1266
|
const mtime = formatDate(file.mtime);
|
|
1267
|
+
const birthtime = formatDate(file.birthtime);
|
|
1234
1268
|
const hiddenClass = file.isHidden ? 'hidden-file' : '';
|
|
1235
1269
|
|
|
1236
1270
|
const fileItem = document.createElement('div');
|
|
@@ -1246,6 +1280,7 @@
|
|
|
1246
1280
|
<div class="file-meta">
|
|
1247
1281
|
${file.isDirectory ? '<span>目录</span>' : `<span>${size}</span>`}
|
|
1248
1282
|
<span>${mtime}</span>
|
|
1283
|
+
<span class="birthtime" style="display: ${showBirthtime ? 'inline-block' : 'none'};">${birthtime}</span>
|
|
1249
1284
|
</div>
|
|
1250
1285
|
</div>
|
|
1251
1286
|
<div class="action-buttons">
|
|
@@ -1390,6 +1425,7 @@
|
|
|
1390
1425
|
return {
|
|
1391
1426
|
size: file.size,
|
|
1392
1427
|
mtime: file.mtime,
|
|
1428
|
+
birthtime: file.birthtime,
|
|
1393
1429
|
name: file.name
|
|
1394
1430
|
};
|
|
1395
1431
|
}
|