ms-vite-plugin 1.0.5 → 1.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +24 -9
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -228,7 +228,6 @@ async function wsStartCommand(options) {
228
228
  connected: ws.isClientConnected(),
229
229
  clientIp: ws.getConnectedClientIp(),
230
230
  });
231
- console.log("按 Ctrl+C 停止 WS 服务");
232
231
  await new Promise((resolve) => {
233
232
  const shutdown = async () => {
234
233
  process.off("SIGINT", shutdown);
@@ -289,7 +288,14 @@ async function wsStopCommand() {
289
288
  async function wsStatusCommand() {
290
289
  await ensureValidKuaiJSProject(process.cwd());
291
290
  if (!(await fsExtra.pathExists(WS_PID_FILE))) {
292
- console.log("服务状态: stopped");
291
+ console.log(JSON.stringify({
292
+ status: "stopped",
293
+ running: false,
294
+ pid: null,
295
+ address: null,
296
+ connected: false,
297
+ clientIp: null,
298
+ }));
293
299
  return;
294
300
  }
295
301
  const info = await fsExtra.readJSON(WS_PID_FILE);
@@ -309,15 +315,24 @@ async function wsStatusCommand() {
309
315
  }
310
316
  if (!running) {
311
317
  await fsExtra.remove(WS_PID_FILE);
312
- console.log("服务状态: stopped");
318
+ console.log(JSON.stringify({
319
+ status: "stopped",
320
+ running: false,
321
+ pid: null,
322
+ address: null,
323
+ connected: false,
324
+ clientIp: null,
325
+ }));
313
326
  return;
314
327
  }
315
- console.log(`服务状态: running (pid=${pid})`);
316
- console.log(`WS 地址: ${address}`);
317
- console.log(`连接状态: ${connected ? "connected" : "disconnected"}`);
318
- if (connected) {
319
- console.log(`设备IP: ${clientIp || "unknown"}`);
320
- }
328
+ console.log(JSON.stringify({
329
+ status: "running",
330
+ running: true,
331
+ pid,
332
+ address,
333
+ connected,
334
+ clientIp: connected ? clientIp || "unknown" : null,
335
+ }));
321
336
  }
322
337
  /**
323
338
  * 生成顶层 help 的详细命令参数说明
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {