@rsdoctor/utils 1.5.16 → 1.5.18
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/dist/0~rslib-runtime.js +8 -5
- package/dist/build.cjs +8 -5
- package/dist/common/global-config.d.cts +22 -1
- package/dist/common/global-config.d.ts +22 -1
- package/dist/common.cjs +81 -38
- package/dist/common.js +48 -10
- package/dist/error.cjs +8 -5
- package/dist/error.js +1 -1
- package/dist/logger.cjs +8 -5
- package/dist/ruleUtils.cjs +8 -5
- package/dist/ruleUtils.js +1 -1
- package/package.json +3 -3
- /package/dist/{496.js → 363.js} +0 -0
package/dist/0~rslib-runtime.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
var __webpack_require__ = {};
|
|
2
|
-
__webpack_require__.d = (exports,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
__webpack_require__.d = (exports, getters, values)=>{
|
|
3
|
+
var define = (defs, kind)=>{
|
|
4
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
5
|
+
enumerable: !0,
|
|
6
|
+
[kind]: defs[key]
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
define(getters, "get"), define(values, "value");
|
|
7
10
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
|
|
8
11
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
|
9
12
|
value: 'Module'
|
package/dist/build.cjs
CHANGED
|
@@ -121,11 +121,14 @@ __webpack_require__.n = (module)=>{
|
|
|
121
121
|
return __webpack_require__.d(getter, {
|
|
122
122
|
a: getter
|
|
123
123
|
}), getter;
|
|
124
|
-
}, __webpack_require__.d = (exports1,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
124
|
+
}, __webpack_require__.d = (exports1, getters, values)=>{
|
|
125
|
+
var define = (defs, kind)=>{
|
|
126
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
127
|
+
enumerable: !0,
|
|
128
|
+
[kind]: defs[key]
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
define(getters, "get"), define(values, "value");
|
|
129
132
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
130
133
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
131
134
|
value: 'Module'
|
|
@@ -7,13 +7,34 @@
|
|
|
7
7
|
* builder1: portNumber,
|
|
8
8
|
* builder2: portNumber,
|
|
9
9
|
* },
|
|
10
|
+
* socketUrlList: {
|
|
11
|
+
* builder1: socketUrl,
|
|
12
|
+
* builder2: socketUrl,
|
|
13
|
+
* },
|
|
10
14
|
* port: portNumber, // The port of the last builder is used by default
|
|
15
|
+
* socketUrl: socketUrl, // The socket URL of the last builder is used by default
|
|
11
16
|
* }
|
|
12
17
|
*
|
|
13
18
|
* @param {number} port - The port number to write.
|
|
14
19
|
* @param {string} [builderName] - The name of the builder.
|
|
20
|
+
* @param {string} [socketToken] - The socket token of the builder.
|
|
15
21
|
*/
|
|
16
|
-
export
|
|
22
|
+
export interface McpConfig {
|
|
23
|
+
portList: Record<string, number>;
|
|
24
|
+
port: number;
|
|
25
|
+
socketUrlList?: Record<string, string>;
|
|
26
|
+
socketUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function readMcpConfig(): McpConfig | undefined;
|
|
29
|
+
export declare function getMcpServerInfo(builderName?: string): {
|
|
30
|
+
port?: number;
|
|
31
|
+
socketUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getMcpServerInfoByPort(port: number): {
|
|
34
|
+
port?: number;
|
|
35
|
+
socketUrl?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function writeMcpPort(port: number, builderName?: string, socketToken?: string): void;
|
|
17
38
|
/**
|
|
18
39
|
* @description Gets the path to the mcp.json file.
|
|
19
40
|
* @returns {string} The path to the mcp.json file.
|
|
@@ -7,13 +7,34 @@
|
|
|
7
7
|
* builder1: portNumber,
|
|
8
8
|
* builder2: portNumber,
|
|
9
9
|
* },
|
|
10
|
+
* socketUrlList: {
|
|
11
|
+
* builder1: socketUrl,
|
|
12
|
+
* builder2: socketUrl,
|
|
13
|
+
* },
|
|
10
14
|
* port: portNumber, // The port of the last builder is used by default
|
|
15
|
+
* socketUrl: socketUrl, // The socket URL of the last builder is used by default
|
|
11
16
|
* }
|
|
12
17
|
*
|
|
13
18
|
* @param {number} port - The port number to write.
|
|
14
19
|
* @param {string} [builderName] - The name of the builder.
|
|
20
|
+
* @param {string} [socketToken] - The socket token of the builder.
|
|
15
21
|
*/
|
|
16
|
-
export
|
|
22
|
+
export interface McpConfig {
|
|
23
|
+
portList: Record<string, number>;
|
|
24
|
+
port: number;
|
|
25
|
+
socketUrlList?: Record<string, string>;
|
|
26
|
+
socketUrl?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function readMcpConfig(): McpConfig | undefined;
|
|
29
|
+
export declare function getMcpServerInfo(builderName?: string): {
|
|
30
|
+
port?: number;
|
|
31
|
+
socketUrl?: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function getMcpServerInfoByPort(port: number): {
|
|
34
|
+
port?: number;
|
|
35
|
+
socketUrl?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function writeMcpPort(port: number, builderName?: string, socketToken?: string): void;
|
|
17
38
|
/**
|
|
18
39
|
* @description Gets the path to the mcp.json file.
|
|
19
40
|
* @returns {string} The path to the mcp.json file.
|
package/dist/common.cjs
CHANGED
|
@@ -48,9 +48,6 @@ var __webpack_modules__ = {
|
|
|
48
48
|
});
|
|
49
49
|
},
|
|
50
50
|
"./src/common/decycle.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
51
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
52
|
-
Y: ()=>decycle
|
|
53
|
-
});
|
|
54
51
|
function decycle(object) {
|
|
55
52
|
let objects = [], paths = [];
|
|
56
53
|
return function derez(value, path) {
|
|
@@ -72,6 +69,9 @@ var __webpack_modules__ = {
|
|
|
72
69
|
return _value;
|
|
73
70
|
}(object, '$');
|
|
74
71
|
}
|
|
72
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
73
|
+
Y: ()=>decycle
|
|
74
|
+
});
|
|
75
75
|
},
|
|
76
76
|
"./src/common/fetch.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
77
77
|
function getFetch() {
|
|
@@ -177,12 +177,12 @@ var __webpack_modules__ = {
|
|
|
177
177
|
});
|
|
178
178
|
},
|
|
179
179
|
"./src/common/graph/entrypoints.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
180
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
181
|
-
W: ()=>getEntryPoints
|
|
182
|
-
});
|
|
183
180
|
function getEntryPoints(entrypoints) {
|
|
184
181
|
return entrypoints;
|
|
185
182
|
}
|
|
183
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
184
|
+
W: ()=>getEntryPoints
|
|
185
|
+
});
|
|
186
186
|
},
|
|
187
187
|
"./src/common/lodash.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
188
188
|
function isUndefined(value) {
|
|
@@ -206,27 +206,27 @@ var __webpack_modules__ = {
|
|
|
206
206
|
function isNil(value) {
|
|
207
207
|
return null == value;
|
|
208
208
|
}
|
|
209
|
+
function pick(obj, keys) {
|
|
210
|
+
let result = {};
|
|
211
|
+
for(let i = 0; i < keys.length; i++){
|
|
212
|
+
let key = keys[i];
|
|
213
|
+
Object.hasOwn(obj, key) && (result[key] = obj[key]);
|
|
214
|
+
}
|
|
215
|
+
return result;
|
|
216
|
+
}
|
|
209
217
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
210
218
|
compact: ()=>compact,
|
|
211
219
|
isEmpty: ()=>isEmpty,
|
|
212
220
|
isNil: ()=>isNil,
|
|
213
221
|
isNumber: ()=>isNumber,
|
|
214
222
|
isObject: ()=>isObject,
|
|
215
|
-
isPlainObject: ()=>isPlainObject,
|
|
216
|
-
isString: ()=>isString,
|
|
217
223
|
isUndefined: ()=>isUndefined,
|
|
218
224
|
last: ()=>last,
|
|
219
225
|
pick: ()=>pick
|
|
226
|
+
}, {
|
|
227
|
+
isPlainObject: (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype,
|
|
228
|
+
isString: (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v)
|
|
220
229
|
});
|
|
221
|
-
let isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && Object.getPrototypeOf(obj) === Object.prototype, isString = (v)=>'string' == typeof v || !!v && 'object' == typeof v && !Array.isArray(v) && '[object String]' === ({}).toString.call(v);
|
|
222
|
-
function pick(obj, keys) {
|
|
223
|
-
let result = {};
|
|
224
|
-
for(let i = 0; i < keys.length; i++){
|
|
225
|
-
let key = keys[i];
|
|
226
|
-
Object.hasOwn(obj, key) && (result[key] = obj[key]);
|
|
227
|
-
}
|
|
228
|
-
return result;
|
|
229
|
-
}
|
|
230
230
|
},
|
|
231
231
|
"./src/common/plugin.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
232
232
|
function getPluginHooks(plugin) {
|
|
@@ -272,12 +272,7 @@ var __webpack_modules__ = {
|
|
|
272
272
|
});
|
|
273
273
|
},
|
|
274
274
|
"./src/common/rspack.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
275
|
-
__webpack_require__.r(__webpack_exports__)
|
|
276
|
-
RspackLoaderInternalPropertyName: ()=>RspackLoaderInternalPropertyName,
|
|
277
|
-
RspackSummaryCostsDataName: ()=>RspackSummaryCostsDataName1,
|
|
278
|
-
checkSourceMapSupport: ()=>checkSourceMapSupport
|
|
279
|
-
});
|
|
280
|
-
let RspackLoaderInternalPropertyName = '__l__';
|
|
275
|
+
__webpack_require__.r(__webpack_exports__);
|
|
281
276
|
var RspackSummaryCostsDataName, RspackSummaryCostsDataName1 = ((RspackSummaryCostsDataName = {}).Bootstrap = "bootstrap->rspack:beforeCompile", RspackSummaryCostsDataName.Compile = "rspack:beforeCompile->afterCompile", RspackSummaryCostsDataName.Done = "rspack:afterCompile->done", RspackSummaryCostsDataName.Minify = "rspack:minify(rspack:optimizeChunkAssets)", RspackSummaryCostsDataName);
|
|
282
277
|
function checkSourceMapSupport(configs) {
|
|
283
278
|
if (!Array.isArray(configs) || !configs[0]) return {
|
|
@@ -290,12 +285,19 @@ var __webpack_modules__ = {
|
|
|
290
285
|
hasSourceMap: 'string' == typeof devtool && devtool.includes('source-map') && !devtool.includes('eval') || !!hasLynxSourcemapPlugin?.length
|
|
291
286
|
};
|
|
292
287
|
}
|
|
288
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
289
|
+
RspackSummaryCostsDataName: ()=>RspackSummaryCostsDataName1,
|
|
290
|
+
checkSourceMapSupport: ()=>checkSourceMapSupport
|
|
291
|
+
}, {
|
|
292
|
+
RspackLoaderInternalPropertyName: '__l__'
|
|
293
|
+
});
|
|
293
294
|
},
|
|
294
295
|
"./src/common/summary.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
295
|
-
__webpack_require__.r(__webpack_exports__)
|
|
296
|
+
__webpack_require__.r(__webpack_exports__);
|
|
297
|
+
var SummaryCostsDataName, SummaryCostsDataName1 = ((SummaryCostsDataName = {}).Bootstrap = "bootstrap->beforeCompile", SummaryCostsDataName.Compile = "beforeCompile->afterCompile", SummaryCostsDataName.Done = "afterCompile->done", SummaryCostsDataName.Minify = "minify(processAssets)", SummaryCostsDataName);
|
|
298
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
296
299
|
SummaryCostsDataName: ()=>SummaryCostsDataName1
|
|
297
300
|
});
|
|
298
|
-
var SummaryCostsDataName, SummaryCostsDataName1 = ((SummaryCostsDataName = {}).Bootstrap = "bootstrap->beforeCompile", SummaryCostsDataName.Compile = "beforeCompile->afterCompile", SummaryCostsDataName.Done = "afterCompile->done", SummaryCostsDataName.Minify = "minify(processAssets)", SummaryCostsDataName);
|
|
299
301
|
},
|
|
300
302
|
"./src/logger.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
301
303
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -362,11 +364,14 @@ __webpack_require__.n = (module)=>{
|
|
|
362
364
|
return __webpack_require__.d(getter, {
|
|
363
365
|
a: getter
|
|
364
366
|
}), getter;
|
|
365
|
-
}, __webpack_require__.d = (exports1,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
}, __webpack_require__.d = (exports1, getters, values)=>{
|
|
368
|
+
var define = (defs, kind)=>{
|
|
369
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
370
|
+
enumerable: !0,
|
|
371
|
+
[kind]: defs[key]
|
|
372
|
+
});
|
|
373
|
+
};
|
|
374
|
+
define(getters, "get"), define(values, "value");
|
|
370
375
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
371
376
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
372
377
|
value: 'Module'
|
|
@@ -504,6 +509,9 @@ for(var __rspack_i in (()=>{
|
|
|
504
509
|
var global_config_namespaceObject = {};
|
|
505
510
|
__webpack_require__.r(global_config_namespaceObject), __webpack_require__.d(global_config_namespaceObject, {
|
|
506
511
|
getMcpConfigPath: ()=>getMcpConfigPath,
|
|
512
|
+
getMcpServerInfo: ()=>getMcpServerInfo,
|
|
513
|
+
getMcpServerInfoByPort: ()=>getMcpServerInfoByPort,
|
|
514
|
+
readMcpConfig: ()=>readMcpConfig,
|
|
507
515
|
writeMcpPort: ()=>writeMcpPort
|
|
508
516
|
});
|
|
509
517
|
var common_summary = __webpack_require__("./src/common/summary.ts"), common_crypto = __webpack_require__("./src/common/crypto.ts"), algorithm = __webpack_require__("./src/common/algorithm.ts"), external_path_ = __webpack_require__("path"), external_path_default = __webpack_require__.n(external_path_);
|
|
@@ -1499,21 +1507,56 @@ for(var __rspack_i in (()=>{
|
|
|
1499
1507
|
};
|
|
1500
1508
|
};
|
|
1501
1509
|
var external_fs_ = __webpack_require__("fs"), external_fs_default = __webpack_require__.n(external_fs_), external_os_ = __webpack_require__("os"), external_os_default = __webpack_require__.n(external_os_);
|
|
1502
|
-
function
|
|
1510
|
+
function readMcpConfig() {
|
|
1511
|
+
let mcpPortFilePath = getMcpConfigPath();
|
|
1512
|
+
if (external_fs_default().existsSync(mcpPortFilePath)) try {
|
|
1513
|
+
return JSON.parse(external_fs_default().readFileSync(mcpPortFilePath, 'utf8'));
|
|
1514
|
+
} catch (error) {
|
|
1515
|
+
logger.logger.debug('Failed to parse mcp.json', error);
|
|
1516
|
+
return;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function getMcpServerInfo(builderName) {
|
|
1520
|
+
let mcpJson = readMcpConfig();
|
|
1521
|
+
if (!mcpJson) return {};
|
|
1522
|
+
if (builderName) {
|
|
1523
|
+
let port = mcpJson.portList?.[builderName], socketUrl = mcpJson.socketUrlList?.[builderName];
|
|
1524
|
+
if (port || socketUrl) return {
|
|
1525
|
+
port,
|
|
1526
|
+
socketUrl
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
return {
|
|
1530
|
+
port: mcpJson.port,
|
|
1531
|
+
socketUrl: mcpJson.socketUrl
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
function getMcpServerInfoByPort(port) {
|
|
1535
|
+
let mcpJson = readMcpConfig();
|
|
1536
|
+
if (!mcpJson) return {};
|
|
1537
|
+
let builderName = Object.entries(mcpJson.portList || {}).find(([, builderPort])=>builderPort === port)?.[0];
|
|
1538
|
+
return builderName ? {
|
|
1539
|
+
port,
|
|
1540
|
+
socketUrl: mcpJson.socketUrlList?.[builderName]
|
|
1541
|
+
} : mcpJson.port === port ? {
|
|
1542
|
+
port,
|
|
1543
|
+
socketUrl: mcpJson.socketUrl
|
|
1544
|
+
} : {
|
|
1545
|
+
port
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function writeMcpPort(port, builderName, socketToken) {
|
|
1503
1549
|
let homeDir = external_os_default().homedir(), rsdoctorDir = external_path_default().join(homeDir, '.cache/rsdoctor'), mcpPortFilePath = external_path_default().join(rsdoctorDir, 'mcp.json');
|
|
1504
1550
|
external_fs_default().existsSync(rsdoctorDir) || external_fs_default().mkdirSync(rsdoctorDir, {
|
|
1505
1551
|
recursive: !0
|
|
1506
1552
|
});
|
|
1507
|
-
let
|
|
1553
|
+
let builderKey = builderName || 'builder', socketUrl = function(port, socketToken) {
|
|
1554
|
+
if (port && socketToken) return `ws://localhost:${port}?token=${encodeURIComponent(socketToken)}`;
|
|
1555
|
+
}(port, socketToken), mcpJson = readMcpConfig() ?? {
|
|
1508
1556
|
portList: {},
|
|
1509
1557
|
port: 0
|
|
1510
1558
|
};
|
|
1511
|
-
|
|
1512
|
-
mcpJson = JSON.parse(external_fs_default().readFileSync(mcpPortFilePath, 'utf8'));
|
|
1513
|
-
} catch (error) {
|
|
1514
|
-
logger.logger.debug('Failed to parse mcp.json', error);
|
|
1515
|
-
}
|
|
1516
|
-
mcpJson.portList || (mcpJson.portList = {}), mcpJson.portList[builderName || 'builder'] = port, mcpJson.port = port, external_fs_default().writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
1559
|
+
mcpJson.portList || (mcpJson.portList = {}), mcpJson.portList[builderKey] = port, mcpJson.socketUrlList || (mcpJson.socketUrlList = {}), socketUrl ? (mcpJson.socketUrlList[builderKey] = socketUrl, mcpJson.socketUrl = socketUrl) : (delete mcpJson.socketUrlList[builderKey], delete mcpJson.socketUrl), mcpJson.port = port, socketUrl && (mcpJson.socketUrlList || (mcpJson.socketUrlList = {}), mcpJson.socketUrlList[builderName || 'builder'] = socketUrl, mcpJson.socketUrl = socketUrl), external_fs_default().writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
1517
1560
|
}
|
|
1518
1561
|
function getMcpConfigPath() {
|
|
1519
1562
|
let homeDir = external_os_default().homedir(), rsdoctorDir = external_path_default().join(homeDir, '.cache/rsdoctor');
|
package/dist/common.js
CHANGED
|
@@ -7,7 +7,7 @@ import { Client, Constants, Rule, SDK } from "@rsdoctor/types";
|
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import os from "os";
|
|
9
9
|
import { logger as rsdoctorLogger } from "./logger.js";
|
|
10
|
-
import { isEmpty, compact, last } from "./
|
|
10
|
+
import { isEmpty, compact, last } from "./363.js";
|
|
11
11
|
var SummaryCostsDataName, RspackSummaryCostsDataName, alerts_namespaceObject = {};
|
|
12
12
|
__webpack_require__.r(alerts_namespaceObject), __webpack_require__.d(alerts_namespaceObject, {
|
|
13
13
|
getPackageRelationAlertDetails: ()=>getPackageRelationAlertDetails
|
|
@@ -48,6 +48,9 @@ __webpack_require__.r(file_namespaceObject), __webpack_require__.d(file_namespac
|
|
|
48
48
|
var global_config_namespaceObject = {};
|
|
49
49
|
__webpack_require__.r(global_config_namespaceObject), __webpack_require__.d(global_config_namespaceObject, {
|
|
50
50
|
getMcpConfigPath: ()=>getMcpConfigPath,
|
|
51
|
+
getMcpServerInfo: ()=>getMcpServerInfo,
|
|
52
|
+
getMcpServerInfoByPort: ()=>getMcpServerInfoByPort,
|
|
53
|
+
readMcpConfig: ()=>readMcpConfig,
|
|
51
54
|
writeMcpPort: ()=>writeMcpPort
|
|
52
55
|
});
|
|
53
56
|
var graph_namespaceObject = {};
|
|
@@ -1280,21 +1283,56 @@ let PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, MODULE_PATH_PACKAGES
|
|
|
1280
1283
|
version: path && name && path.match(RegExp(`${name}@([\\d.]+)`))?.flat().slice(1)?.[0] || ''
|
|
1281
1284
|
};
|
|
1282
1285
|
};
|
|
1283
|
-
function
|
|
1286
|
+
function readMcpConfig() {
|
|
1287
|
+
let mcpPortFilePath = getMcpConfigPath();
|
|
1288
|
+
if (fs.existsSync(mcpPortFilePath)) try {
|
|
1289
|
+
return JSON.parse(fs.readFileSync(mcpPortFilePath, 'utf8'));
|
|
1290
|
+
} catch (error) {
|
|
1291
|
+
rsdoctorLogger.debug('Failed to parse mcp.json', error);
|
|
1292
|
+
return;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
function getMcpServerInfo(builderName) {
|
|
1296
|
+
let mcpJson = readMcpConfig();
|
|
1297
|
+
if (!mcpJson) return {};
|
|
1298
|
+
if (builderName) {
|
|
1299
|
+
let port = mcpJson.portList?.[builderName], socketUrl = mcpJson.socketUrlList?.[builderName];
|
|
1300
|
+
if (port || socketUrl) return {
|
|
1301
|
+
port,
|
|
1302
|
+
socketUrl
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
return {
|
|
1306
|
+
port: mcpJson.port,
|
|
1307
|
+
socketUrl: mcpJson.socketUrl
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
function getMcpServerInfoByPort(port) {
|
|
1311
|
+
let mcpJson = readMcpConfig();
|
|
1312
|
+
if (!mcpJson) return {};
|
|
1313
|
+
let builderName = Object.entries(mcpJson.portList || {}).find(([, builderPort])=>builderPort === port)?.[0];
|
|
1314
|
+
return builderName ? {
|
|
1315
|
+
port,
|
|
1316
|
+
socketUrl: mcpJson.socketUrlList?.[builderName]
|
|
1317
|
+
} : mcpJson.port === port ? {
|
|
1318
|
+
port,
|
|
1319
|
+
socketUrl: mcpJson.socketUrl
|
|
1320
|
+
} : {
|
|
1321
|
+
port
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
function writeMcpPort(port, builderName, socketToken) {
|
|
1284
1325
|
let homeDir = os.homedir(), rsdoctorDir = path_0.join(homeDir, '.cache/rsdoctor'), mcpPortFilePath = path_0.join(rsdoctorDir, 'mcp.json');
|
|
1285
1326
|
fs.existsSync(rsdoctorDir) || fs.mkdirSync(rsdoctorDir, {
|
|
1286
1327
|
recursive: !0
|
|
1287
1328
|
});
|
|
1288
|
-
let
|
|
1329
|
+
let builderKey = builderName || 'builder', socketUrl = function(port, socketToken) {
|
|
1330
|
+
if (port && socketToken) return `ws://localhost:${port}?token=${encodeURIComponent(socketToken)}`;
|
|
1331
|
+
}(port, socketToken), mcpJson = readMcpConfig() ?? {
|
|
1289
1332
|
portList: {},
|
|
1290
1333
|
port: 0
|
|
1291
1334
|
};
|
|
1292
|
-
|
|
1293
|
-
mcpJson = JSON.parse(fs.readFileSync(mcpPortFilePath, 'utf8'));
|
|
1294
|
-
} catch (error) {
|
|
1295
|
-
rsdoctorLogger.debug('Failed to parse mcp.json', error);
|
|
1296
|
-
}
|
|
1297
|
-
mcpJson.portList || (mcpJson.portList = {}), mcpJson.portList[builderName || 'builder'] = port, mcpJson.port = port, fs.writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
1335
|
+
mcpJson.portList || (mcpJson.portList = {}), mcpJson.portList[builderKey] = port, mcpJson.socketUrlList || (mcpJson.socketUrlList = {}), socketUrl ? (mcpJson.socketUrlList[builderKey] = socketUrl, mcpJson.socketUrl = socketUrl) : (delete mcpJson.socketUrlList[builderKey], delete mcpJson.socketUrl), mcpJson.port = port, socketUrl && (mcpJson.socketUrlList || (mcpJson.socketUrlList = {}), mcpJson.socketUrlList[builderName || 'builder'] = socketUrl, mcpJson.socketUrl = socketUrl), fs.writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
1298
1336
|
}
|
|
1299
1337
|
function getMcpConfigPath() {
|
|
1300
1338
|
let homeDir = os.homedir(), rsdoctorDir = path_0.join(homeDir, '.cache/rsdoctor');
|
|
@@ -1327,5 +1365,5 @@ function decycle(object) {
|
|
|
1327
1365
|
return _value;
|
|
1328
1366
|
}(object, '$');
|
|
1329
1367
|
}
|
|
1330
|
-
export { Lodash } from "./
|
|
1368
|
+
export { Lodash } from "./363.js";
|
|
1331
1369
|
export { alerts_namespaceObject as Alerts, algorithm_namespaceObject as Algorithm, bundle_namespaceObject as Bundle, crypto_namespaceObject as Crypto, data_namespaceObject as Data, decycle, fetch_namespaceObject as Fetch, file_namespaceObject as File, getPackageMetaFromModulePath, global_config_namespaceObject as GlobalConfig, graph_namespaceObject as Graph, loader_namespaceObject as Loader, manifest_namespaceObject as Manifest, package_namespaceObject as Package, plugin_namespaceObject as Plugin, random, resolver_namespaceObject as Resolver, rspack_namespaceObject as Rspack, summary_namespaceObject as Summary, time_namespaceObject as Time, url_namespaceObject as Url };
|
package/dist/error.cjs
CHANGED
|
@@ -6,11 +6,14 @@ __webpack_require__.n = (module)=>{
|
|
|
6
6
|
return __webpack_require__.d(getter, {
|
|
7
7
|
a: getter
|
|
8
8
|
}), getter;
|
|
9
|
-
}, __webpack_require__.d = (exports1,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
}, __webpack_require__.d = (exports1, getters, values)=>{
|
|
10
|
+
var define = (defs, kind)=>{
|
|
11
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
12
|
+
enumerable: !0,
|
|
13
|
+
[kind]: defs[key]
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
define(getters, "get"), define(values, "value");
|
|
14
17
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
15
18
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
16
19
|
value: 'Module'
|
package/dist/error.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Err, Linter } from "@rsdoctor/types";
|
|
|
3
3
|
import { createColors } from "picocolors";
|
|
4
4
|
import deep_eql from "deep-eql";
|
|
5
5
|
import strip_ansi from "strip-ansi";
|
|
6
|
-
import { isNil } from "./
|
|
6
|
+
import { isNil } from "./363.js";
|
|
7
7
|
function truncateMessage(input, maxLen = 1000) {
|
|
8
8
|
let str = 'string' == typeof input ? input : String(input ?? '');
|
|
9
9
|
return str.length > maxLen ? str.slice(0, maxLen) : str;
|
package/dist/logger.cjs
CHANGED
|
@@ -18,11 +18,14 @@ __webpack_require__.n = (module)=>{
|
|
|
18
18
|
return __webpack_require__.d(getter, {
|
|
19
19
|
a: getter
|
|
20
20
|
}), getter;
|
|
21
|
-
}, __webpack_require__.d = (exports1,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
}, __webpack_require__.d = (exports1, getters, values)=>{
|
|
22
|
+
var define = (defs, kind)=>{
|
|
23
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
24
|
+
enumerable: !0,
|
|
25
|
+
[kind]: defs[key]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
define(getters, "get"), define(values, "value");
|
|
26
29
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
27
30
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
28
31
|
value: 'Module'
|
package/dist/ruleUtils.cjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_require__ = {};
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: !0,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get"), define(values, "value");
|
|
9
12
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
10
13
|
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
11
14
|
value: 'Module'
|
package/dist/ruleUtils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { LinesAndColumns } from "lines-and-columns";
|
|
|
3
3
|
import { Parser, parse } from "acorn";
|
|
4
4
|
import { importAttributes } from "acorn-import-attributes";
|
|
5
5
|
import * as __rspack_external_acorn_walk_9c3ac672 from "acorn-walk";
|
|
6
|
-
import { isUndefined, isObject, isNumber } from "./
|
|
6
|
+
import { isUndefined, isObject, isNumber } from "./363.js";
|
|
7
7
|
var ECMAVersion, utils_namespaceObject = {};
|
|
8
8
|
__webpack_require__.r(utils_namespaceObject), __webpack_require__.d(utils_namespaceObject, {
|
|
9
9
|
canParse: ()=>canParse,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.18",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"lines-and-columns": "2.0.4",
|
|
101
101
|
"picocolors": "^1.1.1",
|
|
102
102
|
"rslog": "^2.1.2",
|
|
103
|
-
"strip-ansi": "^
|
|
104
|
-
"@rsdoctor/types": "1.5.
|
|
103
|
+
"strip-ansi": "^7.2.0",
|
|
104
|
+
"@rsdoctor/types": "1.5.18"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@types/babel__code-frame": "7.27.0",
|
/package/dist/{496.js → 363.js}
RENAMED
|
File without changes
|