@rsdoctor/utils 1.1.5 → 1.1.7-beta.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.
@@ -35,6 +35,7 @@ module.exports = __toCommonJS(global_config_exports);
35
35
  var import_fs = __toESM(require("fs"));
36
36
  var import_path = __toESM(require("path"));
37
37
  var import_os = __toESM(require("os"));
38
+ var import_logger = require("../logger");
38
39
  function writeMcpPort(port, builderName) {
39
40
  const homeDir = import_os.default.homedir();
40
41
  const rsdoctorDir = import_path.default.join(homeDir, ".cache/rsdoctor");
@@ -47,7 +48,11 @@ function writeMcpPort(port, builderName) {
47
48
  port: 0
48
49
  };
49
50
  if (import_fs.default.existsSync(mcpPortFilePath)) {
50
- mcpJson = JSON.parse(import_fs.default.readFileSync(mcpPortFilePath, "utf8"));
51
+ try {
52
+ mcpJson = JSON.parse(import_fs.default.readFileSync(mcpPortFilePath, "utf8"));
53
+ } catch (error) {
54
+ import_logger.logger.debug("Failed to parse mcp.json", error);
55
+ }
51
56
  }
52
57
  if (!mcpJson.portList)
53
58
  mcpJson.portList = {};
@@ -1,6 +1,7 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
3
  import os from "os";
4
+ import { logger } from "../logger";
4
5
  function writeMcpPort(port, builderName) {
5
6
  const homeDir = os.homedir();
6
7
  const rsdoctorDir = path.join(homeDir, ".cache/rsdoctor");
@@ -13,7 +14,11 @@ function writeMcpPort(port, builderName) {
13
14
  port: 0
14
15
  };
15
16
  if (fs.existsSync(mcpPortFilePath)) {
16
- mcpJson = JSON.parse(fs.readFileSync(mcpPortFilePath, "utf8"));
17
+ try {
18
+ mcpJson = JSON.parse(fs.readFileSync(mcpPortFilePath, "utf8"));
19
+ } catch (error) {
20
+ logger.debug("Failed to parse mcp.json", error);
21
+ }
17
22
  }
18
23
  if (!mcpJson.portList)
19
24
  mcpJson.portList = {};
@@ -1 +1 @@
1
- {"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../../src/common/global-config.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QAwB9D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,WAK/B"}
1
+ {"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../../src/common/global-config.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,QA6B9D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,WAK/B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/utils",
3
- "version": "1.1.5",
3
+ "version": "1.1.7-beta.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -72,7 +72,6 @@
72
72
  "acorn": "^8.10.0",
73
73
  "acorn-import-attributes": "^1.9.5",
74
74
  "acorn-walk": "8.3.4",
75
- "picocolors": "^1.1.1",
76
75
  "connect": "3.7.0",
77
76
  "deep-eql": "4.1.4",
78
77
  "envinfo": "7.14.0",
@@ -81,9 +80,10 @@
81
80
  "get-port": "5.1.1",
82
81
  "json-stream-stringify": "3.0.1",
83
82
  "lines-and-columns": "2.0.4",
84
- "rslog": "^1.2.7",
83
+ "picocolors": "^1.1.1",
84
+ "rslog": "^1.2.8",
85
85
  "strip-ansi": "^6.0.1",
86
- "@rsdoctor/types": "1.1.5"
86
+ "@rsdoctor/types": "1.1.7-beta.0"
87
87
  },
88
88
  "devDependencies": {
89
89
  "@types/babel__code-frame": "7.0.6",