ms-vite-plugin 1.1.15 → 1.1.16

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.
Files changed (2) hide show
  1. package/dist/mcp/tools.js +17 -2
  2. package/package.json +1 -1
package/dist/mcp/tools.js CHANGED
@@ -371,7 +371,7 @@ function ensureDeviceLogSubscription(ip, port) {
371
371
  function buildDeviceLogSnapshotText(limit, runtimeStatusLimit) {
372
372
  const recentLogs = deviceLogSubscriptionState.logs
373
373
  .slice(-limit)
374
- .map((log) => `[${log.timestamp}] [${log.level.toUpperCase()}] ${log.message}`);
374
+ .map((log) => `[${formatDisplayTimestamp(log.timestamp)}] [${log.level.toUpperCase()}] ${log.message}`);
375
375
  const recentRuntimeStatus = deviceLogSubscriptionState.runtimeStatus
376
376
  .slice(-runtimeStatusLimit)
377
377
  .map((entry) => formatRuntimeStatusEntry(entry));
@@ -393,6 +393,21 @@ function buildDeviceLogSnapshotText(limit, runtimeStatusLimit) {
393
393
  : "无运行状态",
394
394
  ].join("\n");
395
395
  }
396
+ /**
397
+ * 按日志页面风格格式化时间
398
+ * @param value ISO 时间字符串
399
+ * @returns 返回 `yyyy/mm/dd hh:mm:ss.xxx` 风格文本,异常时回退原值
400
+ * @example
401
+ * formatDisplayTimestamp("2026-05-07T11:34:48.776Z")
402
+ */
403
+ function formatDisplayTimestamp(value) {
404
+ const date = new Date(value);
405
+ if (Number.isNaN(date.getTime())) {
406
+ return value;
407
+ }
408
+ const pad = (number, length = 2) => String(number).padStart(length, "0");
409
+ return `${date.getFullYear()}/${pad(date.getMonth() + 1)}/${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
410
+ }
396
411
  /**
397
412
  * 将日志订阅连接状态转为中文文本
398
413
  * @param status 原始连接状态
@@ -443,7 +458,7 @@ function formatRuntimeStatusEntry(entry) {
443
458
  ? raw.memory
444
459
  : {};
445
460
  return [
446
- `[${entry.timestamp}]`,
461
+ `[${formatDisplayTimestamp(entry.timestamp)}]`,
447
462
  `UI: ${typeof raw.isUIShowing === "boolean"
448
463
  ? raw.isUIShowing
449
464
  ? "显示中"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {