@rsdoctor/utils 1.2.2 → 1.2.4-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.
- package/compiled/connect/index.d.ts +90 -0
- package/compiled/connect/index.js +2427 -0
- package/compiled/connect/license +25 -0
- package/compiled/connect/package.json +1 -0
- package/compiled/filesize/index.d.ts +58 -0
- package/compiled/filesize/index.js +255 -0
- package/compiled/filesize/license +28 -0
- package/compiled/filesize/package.json +1 -0
- package/dist/{type/build → build}/envinfo.d.ts +0 -1
- package/dist/{type/build → build}/file/cache.d.ts +0 -1
- package/dist/build/file/index.d.ts +3 -0
- package/dist/{type/build → build}/file/sharding.d.ts +0 -1
- package/dist/{type/build → build}/index.d.ts +0 -1
- package/dist/{type/build → build}/json.d.ts +0 -1
- package/dist/{type/build → build}/process.d.ts +0 -1
- package/dist/{type/build → build}/server.d.ts +0 -1
- package/dist/build.cjs +1310 -0
- package/dist/build.js +343 -0
- package/dist/{type/common → common}/alerts.d.ts +0 -1
- package/dist/{type/common → common}/algorithm.d.ts +0 -1
- package/dist/{type/common → common}/bundle.d.ts +0 -1
- package/dist/{type/common → common}/crypto.d.ts +0 -1
- package/dist/{type/common → common}/data/index.d.ts +0 -1
- package/dist/{type/common → common}/file.d.ts +0 -1
- package/dist/{type/common → common}/global-config.d.ts +0 -1
- package/dist/{type/common → common}/graph/assets.d.ts +0 -1
- package/dist/{type/common → common}/graph/chunk.d.ts +0 -1
- package/dist/{type/common → common}/graph/dependency.d.ts +0 -1
- package/dist/{type/common → common}/graph/entrypoints.d.ts +0 -1
- package/dist/{type/common → common}/graph/index.d.ts +0 -1
- package/dist/{type/common → common}/graph/modules.d.ts +0 -1
- package/dist/{type/common → common}/index.d.ts +0 -1
- package/dist/{type/common → common}/loader.d.ts +0 -1
- package/dist/{type/common → common}/lodash.d.ts +0 -1
- package/dist/{type/common → common}/manifest.d.ts +0 -1
- package/dist/{type/common → common}/package.d.ts +0 -1
- package/dist/{type/common → common}/plugin.d.ts +0 -1
- package/dist/{type/common → common}/resolver.d.ts +0 -1
- package/dist/{type/common → common}/rspack.d.ts +0 -1
- package/dist/{type/common → common}/summary.d.ts +0 -1
- package/dist/{type/common → common}/time.d.ts +0 -1
- package/dist/{type/common → common}/url.d.ts +0 -1
- package/dist/common.cjs +1328 -0
- package/dist/common.js +1255 -0
- package/dist/{type/error → error}/error.d.ts +0 -1
- package/dist/{type/error → error}/index.d.ts +0 -1
- package/dist/{type/error → error}/transform.d.ts +0 -1
- package/dist/{type/error → error}/utils.d.ts +0 -1
- package/dist/error.cjs +310 -0
- package/dist/error.js +232 -0
- package/dist/logger.cjs +82 -0
- package/dist/{type/logger.d.ts → logger.d.ts} +0 -1
- package/dist/{esm/logger.mjs → logger.js} +8 -13
- package/dist/{type/rule-utils → rule-utils}/document/document.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/server.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/document/types.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/asserts.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/index.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/parser.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/types.d.ts +0 -1
- package/dist/{type/rule-utils → rule-utils}/parser/utils.d.ts +0 -1
- package/dist/ruleUtils.cjs +320 -0
- package/dist/ruleUtils.js +256 -0
- package/package.json +35 -39
- package/dist/cjs/build/envinfo.js +0 -121
- package/dist/cjs/build/file/cache.js +0 -76
- package/dist/cjs/build/file/index.js +0 -81
- package/dist/cjs/build/file/sharding.js +0 -96
- package/dist/cjs/build/index.js +0 -52
- package/dist/cjs/build/json.js +0 -103
- package/dist/cjs/build/process.js +0 -54
- package/dist/cjs/build/server.js +0 -158
- package/dist/cjs/common/alerts.js +0 -51
- package/dist/cjs/common/algorithm.js +0 -75
- package/dist/cjs/common/bundle.js +0 -62
- package/dist/cjs/common/crypto.js +0 -54
- package/dist/cjs/common/data/index.js +0 -396
- package/dist/cjs/common/file.js +0 -44
- package/dist/cjs/common/global-config.js +0 -81
- package/dist/cjs/common/graph/assets.js +0 -314
- package/dist/cjs/common/graph/chunk.js +0 -81
- package/dist/cjs/common/graph/dependency.js +0 -50
- package/dist/cjs/common/graph/entrypoints.js +0 -38
- package/dist/cjs/common/graph/index.js +0 -96
- package/dist/cjs/common/graph/modules.js +0 -133
- package/dist/cjs/common/index.js +0 -104
- package/dist/cjs/common/loader.js +0 -320
- package/dist/cjs/common/lodash.js +0 -93
- package/dist/cjs/common/manifest.js +0 -70
- package/dist/cjs/common/package.js +0 -96
- package/dist/cjs/common/plugin.js +0 -91
- package/dist/cjs/common/resolver.js +0 -92
- package/dist/cjs/common/rspack.js +0 -65
- package/dist/cjs/common/summary.js +0 -42
- package/dist/cjs/common/time.js +0 -86
- package/dist/cjs/common/url.js +0 -54
- package/dist/cjs/error/error.js +0 -199
- package/dist/cjs/error/index.js +0 -73
- package/dist/cjs/error/transform.js +0 -182
- package/dist/cjs/error/utils.js +0 -62
- package/dist/cjs/index.js +0 -40
- package/dist/cjs/logger.js +0 -106
- package/dist/cjs/rule-utils/document/document.js +0 -92
- package/dist/cjs/rule-utils/document/index.js +0 -78
- package/dist/cjs/rule-utils/document/server.js +0 -49
- package/dist/cjs/rule-utils/document/types.js +0 -18
- package/dist/cjs/rule-utils/index.js +0 -69
- package/dist/cjs/rule-utils/parser/asserts.js +0 -138
- package/dist/cjs/rule-utils/parser/index.js +0 -87
- package/dist/cjs/rule-utils/parser/parser.js +0 -57
- package/dist/cjs/rule-utils/parser/types.js +0 -41
- package/dist/cjs/rule-utils/parser/utils.js +0 -170
- package/dist/esm/build/envinfo.mjs +0 -57
- package/dist/esm/build/file/cache.mjs +0 -23
- package/dist/esm/build/file/index.mjs +0 -4
- package/dist/esm/build/file/sharding.mjs +0 -50
- package/dist/esm/build/index.mjs +0 -6
- package/dist/esm/build/json.mjs +0 -66
- package/dist/esm/build/process.mjs +0 -17
- package/dist/esm/build/server.mjs +0 -96
- package/dist/esm/common/alerts.mjs +0 -17
- package/dist/esm/common/algorithm.mjs +0 -32
- package/dist/esm/common/bundle.mjs +0 -22
- package/dist/esm/common/crypto.mjs +0 -17
- package/dist/esm/common/data/index.mjs +0 -362
- package/dist/esm/common/file.mjs +0 -7
- package/dist/esm/common/global-config.mjs +0 -32
- package/dist/esm/common/graph/assets.mjs +0 -238
- package/dist/esm/common/graph/chunk.mjs +0 -32
- package/dist/esm/common/graph/dependency.mjs +0 -10
- package/dist/esm/common/graph/entrypoints.mjs +0 -4
- package/dist/esm/common/graph/index.mjs +0 -5
- package/dist/esm/common/graph/modules.mjs +0 -78
- package/dist/esm/common/index.mjs +0 -19
- package/dist/esm/common/loader.mjs +0 -247
- package/dist/esm/common/lodash.mjs +0 -32
- package/dist/esm/common/manifest.mjs +0 -30
- package/dist/esm/common/package.mjs +0 -56
- package/dist/esm/common/plugin.mjs +0 -48
- package/dist/esm/common/resolver.mjs +0 -46
- package/dist/esm/common/rspack.mjs +0 -25
- package/dist/esm/common/summary.mjs +0 -8
- package/dist/esm/common/time.mjs +0 -43
- package/dist/esm/common/url.mjs +0 -14
- package/dist/esm/error/error.mjs +0 -154
- package/dist/esm/error/index.mjs +0 -3
- package/dist/esm/error/transform.mjs +0 -138
- package/dist/esm/error/utils.mjs +0 -22
- package/dist/esm/index.mjs +0 -3
- package/dist/esm/rule-utils/document/document.mjs +0 -58
- package/dist/esm/rule-utils/document/index.mjs +0 -3
- package/dist/esm/rule-utils/document/server.mjs +0 -12
- package/dist/esm/rule-utils/document/types.mjs +0 -0
- package/dist/esm/rule-utils/index.mjs +0 -2
- package/dist/esm/rule-utils/parser/asserts.mjs +0 -104
- package/dist/esm/rule-utils/parser/index.mjs +0 -4
- package/dist/esm/rule-utils/parser/parser.mjs +0 -23
- package/dist/esm/rule-utils/parser/types.mjs +0 -7
- package/dist/esm/rule-utils/parser/utils.mjs +0 -109
- package/dist/type/build/envinfo.d.ts.map +0 -1
- package/dist/type/build/file/cache.d.ts.map +0 -1
- package/dist/type/build/file/index.d.ts +0 -4
- package/dist/type/build/file/index.d.ts.map +0 -1
- package/dist/type/build/file/sharding.d.ts.map +0 -1
- package/dist/type/build/index.d.ts.map +0 -1
- package/dist/type/build/json.d.ts.map +0 -1
- package/dist/type/build/process.d.ts.map +0 -1
- package/dist/type/build/server.d.ts.map +0 -1
- package/dist/type/common/alerts.d.ts.map +0 -1
- package/dist/type/common/algorithm.d.ts.map +0 -1
- package/dist/type/common/bundle.d.ts.map +0 -1
- package/dist/type/common/crypto.d.ts.map +0 -1
- package/dist/type/common/data/index.d.ts.map +0 -1
- package/dist/type/common/file.d.ts.map +0 -1
- package/dist/type/common/global-config.d.ts.map +0 -1
- package/dist/type/common/graph/assets.d.ts.map +0 -1
- package/dist/type/common/graph/chunk.d.ts.map +0 -1
- package/dist/type/common/graph/dependency.d.ts.map +0 -1
- package/dist/type/common/graph/entrypoints.d.ts.map +0 -1
- package/dist/type/common/graph/index.d.ts.map +0 -1
- package/dist/type/common/graph/modules.d.ts.map +0 -1
- package/dist/type/common/index.d.ts.map +0 -1
- package/dist/type/common/loader.d.ts.map +0 -1
- package/dist/type/common/lodash.d.ts.map +0 -1
- package/dist/type/common/manifest.d.ts.map +0 -1
- package/dist/type/common/package.d.ts.map +0 -1
- package/dist/type/common/plugin.d.ts.map +0 -1
- package/dist/type/common/resolver.d.ts.map +0 -1
- package/dist/type/common/rspack.d.ts.map +0 -1
- package/dist/type/common/summary.d.ts.map +0 -1
- package/dist/type/common/time.d.ts.map +0 -1
- package/dist/type/common/url.d.ts.map +0 -1
- package/dist/type/error/error.d.ts.map +0 -1
- package/dist/type/error/index.d.ts.map +0 -1
- package/dist/type/error/transform.d.ts.map +0 -1
- package/dist/type/error/utils.d.ts.map +0 -1
- package/dist/type/index.d.ts +0 -3
- package/dist/type/index.d.ts.map +0 -1
- package/dist/type/logger.d.ts.map +0 -1
- package/dist/type/rule-utils/document/document.d.ts.map +0 -1
- package/dist/type/rule-utils/document/index.d.ts.map +0 -1
- package/dist/type/rule-utils/document/server.d.ts.map +0 -1
- package/dist/type/rule-utils/document/types.d.ts.map +0 -1
- package/dist/type/rule-utils/index.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/asserts.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/index.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/parser.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/types.d.ts.map +0 -1
- package/dist/type/rule-utils/parser/utils.d.ts.map +0 -1
package/dist/common.js
ADDED
|
@@ -0,0 +1,1255 @@
|
|
|
1
|
+
import { deflateSync, inflateSync } from "zlib";
|
|
2
|
+
import { Buffer } from "buffer";
|
|
3
|
+
import picocolors from "picocolors";
|
|
4
|
+
import { createLogger } from "rslog";
|
|
5
|
+
import { Client, Constants as types_Constants, Rule, SDK } from "@rsdoctor/types";
|
|
6
|
+
import path_0, { isAbsolute, relative } from "path";
|
|
7
|
+
import { hrtime } from "process";
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import os from "os";
|
|
10
|
+
var SummaryCostsDataName, RspackSummaryCostsDataName, __webpack_require__ = {};
|
|
11
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
12
|
+
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: !0,
|
|
14
|
+
get: definition[key]
|
|
15
|
+
});
|
|
16
|
+
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
|
|
17
|
+
'undefined' != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
}), Object.defineProperty(exports, '__esModule', {
|
|
20
|
+
value: !0
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var summary_namespaceObject = {};
|
|
24
|
+
__webpack_require__.r(summary_namespaceObject), __webpack_require__.d(summary_namespaceObject, {
|
|
25
|
+
SummaryCostsDataName: ()=>summary_SummaryCostsDataName
|
|
26
|
+
});
|
|
27
|
+
var crypto_namespaceObject = {};
|
|
28
|
+
__webpack_require__.r(crypto_namespaceObject), __webpack_require__.d(crypto_namespaceObject, {
|
|
29
|
+
decode: ()=>decode,
|
|
30
|
+
encode: ()=>encode
|
|
31
|
+
});
|
|
32
|
+
var algorithm_namespaceObject = {};
|
|
33
|
+
__webpack_require__.r(algorithm_namespaceObject), __webpack_require__.d(algorithm_namespaceObject, {
|
|
34
|
+
compressText: ()=>compressText,
|
|
35
|
+
decompressText: ()=>decompressText,
|
|
36
|
+
mergeIntervals: ()=>mergeIntervals,
|
|
37
|
+
random: ()=>random
|
|
38
|
+
});
|
|
39
|
+
var url_namespaceObject = {};
|
|
40
|
+
__webpack_require__.r(url_namespaceObject), __webpack_require__.d(url_namespaceObject, {
|
|
41
|
+
isFilePath: ()=>isFilePath,
|
|
42
|
+
isRemoteUrl: ()=>isRemoteUrl,
|
|
43
|
+
isUrl: ()=>isUrl
|
|
44
|
+
});
|
|
45
|
+
var manifest_namespaceObject = {};
|
|
46
|
+
__webpack_require__.r(manifest_namespaceObject), __webpack_require__.d(manifest_namespaceObject, {
|
|
47
|
+
fetchShardingData: ()=>fetchShardingData,
|
|
48
|
+
fetchShardingFiles: ()=>fetchShardingFiles,
|
|
49
|
+
isShardingData: ()=>isShardingData
|
|
50
|
+
});
|
|
51
|
+
var loader_namespaceObject = {};
|
|
52
|
+
__webpack_require__.r(loader_namespaceObject), __webpack_require__.d(loader_namespaceObject, {
|
|
53
|
+
LoaderInternalPropertyName: ()=>LoaderInternalPropertyName,
|
|
54
|
+
findLoaderTotalTiming: ()=>findLoaderTotalTiming,
|
|
55
|
+
getDirectoriesLoaders: ()=>getDirectoriesLoaders,
|
|
56
|
+
getLoaderChartData: ()=>getLoaderChartData,
|
|
57
|
+
getLoaderCosts: ()=>getLoaderCosts,
|
|
58
|
+
getLoaderFileDetails: ()=>getLoaderFileDetails,
|
|
59
|
+
getLoaderFileFirstInput: ()=>getLoaderFileFirstInput,
|
|
60
|
+
getLoaderFileInputAndOutput: ()=>getLoaderFileInputAndOutput,
|
|
61
|
+
getLoaderFileTree: ()=>getLoaderFileTree,
|
|
62
|
+
getLoaderFolderStatistics: ()=>getLoaderFolderStatistics,
|
|
63
|
+
getLoaderNames: ()=>getLoaderNames,
|
|
64
|
+
getLoadersCosts: ()=>getLoadersCosts,
|
|
65
|
+
getLoadersTransformData: ()=>getLoadersTransformData,
|
|
66
|
+
isVue: ()=>isVue
|
|
67
|
+
});
|
|
68
|
+
var time_namespaceObject = {};
|
|
69
|
+
__webpack_require__.r(time_namespaceObject), __webpack_require__.d(time_namespaceObject, {
|
|
70
|
+
formatCosts: ()=>formatCosts,
|
|
71
|
+
getCurrentTimestamp: ()=>getCurrentTimestamp,
|
|
72
|
+
getUnit: ()=>getUnit,
|
|
73
|
+
toFixedDigits: ()=>toFixedDigits
|
|
74
|
+
});
|
|
75
|
+
var resolver_namespaceObject = {};
|
|
76
|
+
__webpack_require__.r(resolver_namespaceObject), __webpack_require__.d(resolver_namespaceObject, {
|
|
77
|
+
getResolverCosts: ()=>getResolverCosts,
|
|
78
|
+
getResolverFileDetails: ()=>getResolverFileDetails,
|
|
79
|
+
getResolverFileTree: ()=>getResolverFileTree,
|
|
80
|
+
isResolveFailData: ()=>isResolveFailData,
|
|
81
|
+
isResolveSuccessData: ()=>isResolveSuccessData
|
|
82
|
+
});
|
|
83
|
+
var file_namespaceObject = {};
|
|
84
|
+
__webpack_require__.r(file_namespaceObject), __webpack_require__.d(file_namespaceObject, {
|
|
85
|
+
isJsExt: ()=>isJsExt,
|
|
86
|
+
isStyleExt: ()=>isStyleExt
|
|
87
|
+
});
|
|
88
|
+
var graph_namespaceObject = {};
|
|
89
|
+
__webpack_require__.r(graph_namespaceObject), __webpack_require__.d(graph_namespaceObject, {
|
|
90
|
+
diffAssetsByExtensions: ()=>diffAssetsByExtensions,
|
|
91
|
+
diffSize: ()=>diffSize,
|
|
92
|
+
extname: ()=>extname,
|
|
93
|
+
filterAssets: ()=>filterAssets,
|
|
94
|
+
filterAssetsByExtensions: ()=>filterAssetsByExtensions,
|
|
95
|
+
filterModulesAndDependenciesByPackageDeps: ()=>filterModulesAndDependenciesByPackageDeps,
|
|
96
|
+
formatAssetName: ()=>formatAssetName,
|
|
97
|
+
getAllBundleData: ()=>getAllBundleData,
|
|
98
|
+
getAssetDetails: ()=>getAssetDetails,
|
|
99
|
+
getAssetsDiffResult: ()=>getAssetsDiffResult,
|
|
100
|
+
getAssetsSizeInfo: ()=>getAssetsSizeInfo,
|
|
101
|
+
getAssetsSummary: ()=>getAssetsSummary,
|
|
102
|
+
getChunkByChunkId: ()=>getChunkByChunkId,
|
|
103
|
+
getChunkIdsByAsset: ()=>getChunkIdsByAsset,
|
|
104
|
+
getChunksByAsset: ()=>getChunksByAsset,
|
|
105
|
+
getChunksByChunkIds: ()=>getChunksByChunkIds,
|
|
106
|
+
getChunksByModule: ()=>getChunksByModule,
|
|
107
|
+
getChunksByModuleId: ()=>getChunksByModuleId,
|
|
108
|
+
getDependenciesByModule: ()=>getDependenciesByModule,
|
|
109
|
+
getDependencyByPackageData: ()=>getDependencyByPackageData,
|
|
110
|
+
getDependencyByResolvedRequest: ()=>getDependencyByResolvedRequest,
|
|
111
|
+
getEntryPoints: ()=>getEntryPoints,
|
|
112
|
+
getInitialAssetsSizeInfo: ()=>getInitialAssetsSizeInfo,
|
|
113
|
+
getModuleByDependency: ()=>getModuleByDependency,
|
|
114
|
+
getModuleDetails: ()=>getModuleDetails,
|
|
115
|
+
getModuleIdsByChunk: ()=>getModuleIdsByChunk,
|
|
116
|
+
getModuleIdsByModulesIds: ()=>getModuleIdsByModulesIds,
|
|
117
|
+
getModulesByAsset: ()=>getModulesByAsset,
|
|
118
|
+
getModulesByChunk: ()=>getModulesByChunk,
|
|
119
|
+
getModulesByChunks: ()=>getModulesByChunks,
|
|
120
|
+
isAssetMatchExtension: ()=>isAssetMatchExtension,
|
|
121
|
+
isAssetMatchExtensions: ()=>isAssetMatchExtensions,
|
|
122
|
+
isInitialAsset: ()=>isInitialAsset
|
|
123
|
+
});
|
|
124
|
+
var bundle_namespaceObject = {};
|
|
125
|
+
__webpack_require__.r(bundle_namespaceObject), __webpack_require__.d(bundle_namespaceObject, {
|
|
126
|
+
getBundleDiffPageQueryString: ()=>getBundleDiffPageQueryString,
|
|
127
|
+
getBundleDiffPageUrl: ()=>getBundleDiffPageUrl,
|
|
128
|
+
parseFilesFromBundlePageUrlQuery: ()=>parseFilesFromBundlePageUrlQuery
|
|
129
|
+
});
|
|
130
|
+
var plugin_namespaceObject = {};
|
|
131
|
+
__webpack_require__.r(plugin_namespaceObject), __webpack_require__.d(plugin_namespaceObject, {
|
|
132
|
+
getPluginData: ()=>getPluginData,
|
|
133
|
+
getPluginHooks: ()=>getPluginHooks,
|
|
134
|
+
getPluginSummary: ()=>getPluginSummary,
|
|
135
|
+
getPluginTapNames: ()=>getPluginTapNames
|
|
136
|
+
});
|
|
137
|
+
var alerts_namespaceObject = {};
|
|
138
|
+
__webpack_require__.r(alerts_namespaceObject), __webpack_require__.d(alerts_namespaceObject, {
|
|
139
|
+
getPackageRelationAlertDetails: ()=>getPackageRelationAlertDetails
|
|
140
|
+
});
|
|
141
|
+
var rspack_namespaceObject = {};
|
|
142
|
+
__webpack_require__.r(rspack_namespaceObject), __webpack_require__.d(rspack_namespaceObject, {
|
|
143
|
+
RspackLoaderInternalPropertyName: ()=>RspackLoaderInternalPropertyName,
|
|
144
|
+
RspackSummaryCostsDataName: ()=>rspack_RspackSummaryCostsDataName,
|
|
145
|
+
checkSourceMapSupport: ()=>checkSourceMapSupport
|
|
146
|
+
});
|
|
147
|
+
var data_namespaceObject = {};
|
|
148
|
+
__webpack_require__.r(data_namespaceObject), __webpack_require__.d(data_namespaceObject, {
|
|
149
|
+
APIDataLoader: ()=>APIDataLoader
|
|
150
|
+
});
|
|
151
|
+
var lodash_namespaceObject = {};
|
|
152
|
+
__webpack_require__.r(lodash_namespaceObject), __webpack_require__.d(lodash_namespaceObject, {
|
|
153
|
+
compact: ()=>compact,
|
|
154
|
+
isEmpty: ()=>isEmpty,
|
|
155
|
+
isNil: ()=>isNil,
|
|
156
|
+
isNumber: ()=>isNumber,
|
|
157
|
+
isObject: ()=>isObject,
|
|
158
|
+
isPlainObject: ()=>isPlainObject,
|
|
159
|
+
isString: ()=>isString,
|
|
160
|
+
isUndefined: ()=>isUndefined,
|
|
161
|
+
last: ()=>last,
|
|
162
|
+
pick: ()=>pick
|
|
163
|
+
});
|
|
164
|
+
var package_namespaceObject = {};
|
|
165
|
+
__webpack_require__.r(package_namespaceObject), __webpack_require__.d(package_namespaceObject, {
|
|
166
|
+
MODULE_PATH_PACKAGES: ()=>MODULE_PATH_PACKAGES,
|
|
167
|
+
PACKAGE_PATH_NAME: ()=>PACKAGE_PATH_NAME,
|
|
168
|
+
getPackageMetaFromModulePath: ()=>getPackageMetaFromModulePath
|
|
169
|
+
});
|
|
170
|
+
var global_config_namespaceObject = {};
|
|
171
|
+
__webpack_require__.r(global_config_namespaceObject), __webpack_require__.d(global_config_namespaceObject, {
|
|
172
|
+
getMcpConfigPath: ()=>getMcpConfigPath,
|
|
173
|
+
writeMcpPort: ()=>writeMcpPort
|
|
174
|
+
});
|
|
175
|
+
var summary_SummaryCostsDataName = ((SummaryCostsDataName = {}).Bootstrap = "bootstrap->beforeCompile", SummaryCostsDataName.Compile = "beforeCompile->afterCompile", SummaryCostsDataName.Done = "afterCompile->done", SummaryCostsDataName.Minify = "minify(processAssets)", SummaryCostsDataName);
|
|
176
|
+
function encode(str) {
|
|
177
|
+
let res = `${str.charCodeAt(0)}`;
|
|
178
|
+
for(let i = 1; i < str.length; i++)res += `!${str.charCodeAt(i)}`;
|
|
179
|
+
return res;
|
|
180
|
+
}
|
|
181
|
+
function decode(str) {
|
|
182
|
+
let res = '', tmp = '';
|
|
183
|
+
for(let i = 0; i < str.length; i++)'!' === str[i] ? (res += String.fromCharCode(+tmp), tmp = '') : tmp += str[i];
|
|
184
|
+
return tmp && (res += String.fromCharCode(+tmp)), res;
|
|
185
|
+
}
|
|
186
|
+
let rsdoctorLogger = createLogger();
|
|
187
|
+
function mergeIntervals(intervals) {
|
|
188
|
+
let previous, current;
|
|
189
|
+
intervals.sort((a, b)=>a[0] - b[0]);
|
|
190
|
+
let result = [];
|
|
191
|
+
for(let i = 0; i < intervals.length; i++)current = intervals[i], !previous || current[0] > previous[1] ? (previous = current, result.push(current)) : previous[1] = Math.max(previous[1], current[1]);
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
function compressText(input) {
|
|
195
|
+
try {
|
|
196
|
+
return deflateSync(input).toString('base64');
|
|
197
|
+
} catch (e) {
|
|
198
|
+
return rsdoctorLogger.debug(`compressText error: ${e}`), '';
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function decompressText(input) {
|
|
202
|
+
return inflateSync(Buffer.from(input, 'base64')).toString();
|
|
203
|
+
}
|
|
204
|
+
function random(min, max) {
|
|
205
|
+
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
206
|
+
}
|
|
207
|
+
function isUrl(uri) {
|
|
208
|
+
return /^https?:\/\//.test(uri);
|
|
209
|
+
}
|
|
210
|
+
function isFilePath(uri) {
|
|
211
|
+
return isAbsolute(uri);
|
|
212
|
+
}
|
|
213
|
+
function isRemoteUrl(uri) {
|
|
214
|
+
return !!('string' == typeof uri && (isUrl(uri) || isAbsolute(uri)));
|
|
215
|
+
}
|
|
216
|
+
function isShardingData(data) {
|
|
217
|
+
return !!(Array.isArray(data) && data.length > 0 && data.every((e)=>isRemoteUrl(e)));
|
|
218
|
+
}
|
|
219
|
+
async function fetchShardingData(shardingFiles, fetchImplement) {
|
|
220
|
+
let res = await Promise.all(shardingFiles.map((url)=>fetchImplement(url))), strings = 0 === res.length ? [] : res.reduce((t, e)=>t + e);
|
|
221
|
+
return 'object' == typeof strings ? strings : JSON.parse(decompressText(strings));
|
|
222
|
+
}
|
|
223
|
+
async function fetchShardingFiles(data, fetchImplement, filterKeys) {
|
|
224
|
+
return (await Promise.all(Object.keys(data).map(async (_key)=>{
|
|
225
|
+
let val = data[_key];
|
|
226
|
+
return filterKeys?.length && 0 > filterKeys.indexOf(_key) ? {
|
|
227
|
+
[_key]: []
|
|
228
|
+
} : isShardingData(val) ? {
|
|
229
|
+
[_key]: await fetchShardingData(val, fetchImplement)
|
|
230
|
+
} : {
|
|
231
|
+
[_key]: val
|
|
232
|
+
};
|
|
233
|
+
}))).reduce((t, c)=>Object.assign(t, c));
|
|
234
|
+
}
|
|
235
|
+
function findLoaderTotalTiming(loaders) {
|
|
236
|
+
let start = 1 / 0, end = -1 / 0;
|
|
237
|
+
for(let i = 0; i < loaders.length; i++){
|
|
238
|
+
let loader = loaders[i];
|
|
239
|
+
loader.startAt <= start && (start = loader.startAt), loader.endAt >= end && (end = loader.endAt);
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
start,
|
|
243
|
+
end
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function getLoadersCosts(filter, loaders) {
|
|
247
|
+
let match = {}, others = {};
|
|
248
|
+
loaders.forEach((e)=>{
|
|
249
|
+
filter(e) ? (match[e.pid] || (match[e.pid] = []), match[e.pid].push([
|
|
250
|
+
e.startAt,
|
|
251
|
+
e.endAt
|
|
252
|
+
])) : (others[e.pid] || (others[e.pid] = []), others[e.pid].push([
|
|
253
|
+
e.startAt,
|
|
254
|
+
e.endAt
|
|
255
|
+
]));
|
|
256
|
+
});
|
|
257
|
+
let costs = 0, pids = Object.keys(match);
|
|
258
|
+
for(let i = 0; i < pids.length; i++){
|
|
259
|
+
let pid = pids[i], _match = mergeIntervals(match[pid]), _others = mergeIntervals(others[pid] || []).filter(([s, e])=>_match.some((el)=>s >= el[0] && e <= el[1]));
|
|
260
|
+
costs += (_match.length ? _match.reduce((t, c)=>t += c[1] - c[0], 0) : 0) - (_others.length ? _others.reduce((t, c)=>t += c[1] - c[0], 0) : 0);
|
|
261
|
+
}
|
|
262
|
+
return costs;
|
|
263
|
+
}
|
|
264
|
+
function getLoaderCosts(loader, loaders) {
|
|
265
|
+
let blocked = loaders.filter((e)=>!e.loader.includes('builtin') && e !== loader && e.pid === loader.pid && !!(e.startAt >= loader.startAt) && !!(e.endAt <= loader.endAt)), costs = loader.endAt - loader.startAt;
|
|
266
|
+
return blocked.length && mergeIntervals(blocked.map((e)=>[
|
|
267
|
+
Math.max(e.startAt, loader.startAt),
|
|
268
|
+
Math.min(e.endAt, loader.endAt)
|
|
269
|
+
])).forEach((e)=>{
|
|
270
|
+
let sub = e[1] - e[0];
|
|
271
|
+
costs -= sub;
|
|
272
|
+
}), costs;
|
|
273
|
+
}
|
|
274
|
+
function getLoaderNames(loaders) {
|
|
275
|
+
let names = new Set();
|
|
276
|
+
return loaders.forEach((e)=>e.loaders.forEach((l)=>names.add(getLoadrName(l.loader)))), [
|
|
277
|
+
...names
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
function getLoadersTransformData(loaders) {
|
|
281
|
+
let res = [];
|
|
282
|
+
for(let i = 0; i < loaders.length; i++){
|
|
283
|
+
let item = loaders[i];
|
|
284
|
+
for(let j = 0; j < item.loaders.length; j++){
|
|
285
|
+
let loader = item.loaders[j];
|
|
286
|
+
res.push(loader);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return res;
|
|
290
|
+
}
|
|
291
|
+
function getLoaderChartData(loaders) {
|
|
292
|
+
let res = [], list = getLoadersTransformData(loaders);
|
|
293
|
+
return loaders.forEach((item)=>{
|
|
294
|
+
item.loaders.forEach((el)=>{
|
|
295
|
+
res.push({
|
|
296
|
+
layer: item.resource.layer,
|
|
297
|
+
loader: getLoadrName(el.loader),
|
|
298
|
+
isPitch: el.isPitch,
|
|
299
|
+
startAt: el.startAt,
|
|
300
|
+
endAt: el.endAt,
|
|
301
|
+
pid: el.pid,
|
|
302
|
+
sync: el.sync,
|
|
303
|
+
resource: item.resource.path,
|
|
304
|
+
costs: getLoaderCosts(el, list)
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}), res;
|
|
308
|
+
}
|
|
309
|
+
function getLoaderFileTree(loaders) {
|
|
310
|
+
let list = getLoadersTransformData(loaders);
|
|
311
|
+
return loaders.map((data)=>{
|
|
312
|
+
let { loaders: arr, resource } = data;
|
|
313
|
+
return {
|
|
314
|
+
path: resource.path,
|
|
315
|
+
layer: resource.layer,
|
|
316
|
+
loaders: arr.map((l)=>({
|
|
317
|
+
key: l.path,
|
|
318
|
+
loader: getLoadrName(l.loader),
|
|
319
|
+
path: l.path,
|
|
320
|
+
errors: l.errors,
|
|
321
|
+
costs: getLoaderCosts(l, list)
|
|
322
|
+
}))
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
function getLoaderFileDetails(path, loaders) {
|
|
327
|
+
let data = loaders.find((e)=>e.resource.path === path);
|
|
328
|
+
if (!data) throw Error(`"${path}" not match any loader data`);
|
|
329
|
+
let list = getLoadersTransformData(loaders);
|
|
330
|
+
return {
|
|
331
|
+
...data,
|
|
332
|
+
loaders: data.loaders.map((el)=>({
|
|
333
|
+
...el,
|
|
334
|
+
loader: getLoadrName(el.loader),
|
|
335
|
+
costs: getLoaderCosts(el, list)
|
|
336
|
+
}))
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function getLoaderFolderStatistics(folder, loaders) {
|
|
340
|
+
let datas = loaders.filter((data)=>{
|
|
341
|
+
let { path } = data.resource;
|
|
342
|
+
return path.startsWith(folder);
|
|
343
|
+
}), filteredLoaders = [], uniqueLoaders = new Map();
|
|
344
|
+
return datas.forEach((data)=>{
|
|
345
|
+
data.loaders.forEach((fl)=>{
|
|
346
|
+
let uniqueLoader = uniqueLoaders.get(fl.loader);
|
|
347
|
+
return uniqueLoader ? uniqueLoaders.set(fl.loader, {
|
|
348
|
+
files: uniqueLoader.files + 1,
|
|
349
|
+
path: fl.path
|
|
350
|
+
}) : uniqueLoaders.set(fl.loader, {
|
|
351
|
+
files: 1,
|
|
352
|
+
path: fl.path
|
|
353
|
+
}), filteredLoaders.push({
|
|
354
|
+
loader: fl.loader,
|
|
355
|
+
startAt: fl.startAt,
|
|
356
|
+
endAt: fl.endAt,
|
|
357
|
+
pid: fl.pid
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
}), Array.from(uniqueLoaders).map((uniqueLoader)=>{
|
|
361
|
+
let costs = getLoadersCosts((l)=>l.loader === uniqueLoader[0], filteredLoaders);
|
|
362
|
+
return {
|
|
363
|
+
loader: uniqueLoader[0],
|
|
364
|
+
files: uniqueLoader[1].files,
|
|
365
|
+
path: uniqueLoader[1].path,
|
|
366
|
+
costs
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function getDirectoriesLoaders(loaders, root) {
|
|
371
|
+
return (function(loaders, root) {
|
|
372
|
+
let directories = new Set();
|
|
373
|
+
return loaders.forEach((item)=>{
|
|
374
|
+
if (item.resource.path.startsWith(root)) {
|
|
375
|
+
let pathParts = item.resource.path.split(root).slice(1).join('/').split('/');
|
|
376
|
+
if (pathParts.length >= 2) {
|
|
377
|
+
let twoLevelDir = pathParts.slice(0, 2).join('/');
|
|
378
|
+
directories.add(`${root}/${twoLevelDir}`);
|
|
379
|
+
}
|
|
380
|
+
} else {
|
|
381
|
+
let pathParts = item.resource.path.split('/'), twoLevelDir = pathParts.slice(0, pathParts.length - 1).join('/');
|
|
382
|
+
directories.add(twoLevelDir);
|
|
383
|
+
}
|
|
384
|
+
}), Array.from(directories);
|
|
385
|
+
})(loaders, root || process.cwd()).map((directory)=>{
|
|
386
|
+
let stats = getLoaderFolderStatistics(directory, loaders);
|
|
387
|
+
return {
|
|
388
|
+
directory,
|
|
389
|
+
stats
|
|
390
|
+
};
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
function getLoaderFileFirstInput(file, loaders) {
|
|
394
|
+
for(let i = 0; i < loaders.length; i++){
|
|
395
|
+
let item = loaders[i];
|
|
396
|
+
if (item.resource.path === file) {
|
|
397
|
+
let nonPitchLoaders = item.loaders.filter((e)=>!e.isPitch);
|
|
398
|
+
if (!nonPitchLoaders.length) return '';
|
|
399
|
+
return nonPitchLoaders[0].input || '';
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return '';
|
|
403
|
+
}
|
|
404
|
+
function getLoaderFileInputAndOutput(file, loader, loaderIndex, loaders) {
|
|
405
|
+
for(let i = 0; i < loaders.length; i++){
|
|
406
|
+
let item = loaders[i];
|
|
407
|
+
if (item.resource.path === file) for(let j = 0; j < item.loaders.length; j++){
|
|
408
|
+
let l = item.loaders[j];
|
|
409
|
+
if (l.loader === loader && l.loaderIndex === loaderIndex) return {
|
|
410
|
+
input: l.input || '',
|
|
411
|
+
output: l.result || ''
|
|
412
|
+
};
|
|
413
|
+
return {
|
|
414
|
+
input: '',
|
|
415
|
+
output: ''
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return {
|
|
420
|
+
input: '',
|
|
421
|
+
output: ''
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
rsdoctorLogger.override({
|
|
425
|
+
log: (message)=>{
|
|
426
|
+
console.log(`${picocolors.green('[RSDOCTOR LOG]')} ${message}`);
|
|
427
|
+
},
|
|
428
|
+
info: (message)=>{
|
|
429
|
+
console.log(`${picocolors.yellow('[RSDOCTOR INFO]')} ${message}`);
|
|
430
|
+
},
|
|
431
|
+
warn: (message)=>{
|
|
432
|
+
console.warn(`${picocolors.yellow('[RSDOCTOR WARN]')} ${message}`);
|
|
433
|
+
},
|
|
434
|
+
start: (message)=>{
|
|
435
|
+
console.log(`${picocolors.green('[RSDOCTOR START]')} ${message}`);
|
|
436
|
+
},
|
|
437
|
+
ready: (message)=>{
|
|
438
|
+
console.log(`${picocolors.green('[RSDOCTOR READY]')} ${message}`);
|
|
439
|
+
},
|
|
440
|
+
error: (message)=>{
|
|
441
|
+
console.error(`${picocolors.red('[RSDOCTOR ERROR]')} ${message}`);
|
|
442
|
+
},
|
|
443
|
+
success: (message)=>{
|
|
444
|
+
console.error(`${picocolors.green('[RSDOCTOR SUCCESS]')} ${message}`);
|
|
445
|
+
},
|
|
446
|
+
debug: (message)=>{
|
|
447
|
+
process.env.DEBUG && console.log(`${picocolors.blue('[RSDOCTOR DEBUG]')} ${message}`);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
let LoaderInternalPropertyName = '__l__', isVue = (compiler)=>('module' in compiler.options && compiler.options.module.rules || []).some((rule)=>!!(rule && 'object' == typeof rule && rule.test instanceof RegExp && rule.test?.test('.vue'))), getLoadrName = (loader)=>{
|
|
451
|
+
let regResults = loader.includes('node_modules') ? loader.split('node_modules') : null;
|
|
452
|
+
return regResults ? regResults[regResults.length - 1] : loader;
|
|
453
|
+
};
|
|
454
|
+
function toFixedDigits(num, digits = 2) {
|
|
455
|
+
return 0 === digits ? Math.floor(num) : +num.toFixed(digits);
|
|
456
|
+
}
|
|
457
|
+
function getUnit(num, type) {
|
|
458
|
+
return 'm' === type ? num > 1 ? 'mins' : 'min' : num > 1 ? 'hours' : 'hour';
|
|
459
|
+
}
|
|
460
|
+
function formatCosts(costs) {
|
|
461
|
+
if ((costs = Number(costs)) >= 1000) {
|
|
462
|
+
let sec = costs / 1000;
|
|
463
|
+
if (sec >= 60) {
|
|
464
|
+
let mins = sec / 60;
|
|
465
|
+
if (mins >= 60) {
|
|
466
|
+
let hours = toFixedDigits(mins / 60, 0), restMins = toFixedDigits(mins % 60, 1), hUnit = getUnit(hours, 'h');
|
|
467
|
+
return restMins > 0 ? `${hours}${hUnit} ${restMins}${getUnit(restMins, 'm')}` : `${hours}${hUnit}`;
|
|
468
|
+
}
|
|
469
|
+
let mUnit = getUnit(mins = toFixedDigits(mins, 0), 'm'), restSec = toFixedDigits(sec % 60, 0);
|
|
470
|
+
return restSec > 0 ? `${mins}${mUnit} ${restSec}s` : `${mins}${mUnit}`;
|
|
471
|
+
}
|
|
472
|
+
return `${toFixedDigits(sec, 1)}s`;
|
|
473
|
+
}
|
|
474
|
+
if (costs >= 10) return `${+toFixedDigits(costs, 0)}ms`;
|
|
475
|
+
if (costs >= 1) return `${+toFixedDigits(costs, 1)}ms`;
|
|
476
|
+
let r = +toFixedDigits(costs, 2);
|
|
477
|
+
return 0 === r && (r = +toFixedDigits(costs, 3)), `${r}ms`;
|
|
478
|
+
}
|
|
479
|
+
function getCurrentTimestamp(start, startHRTime) {
|
|
480
|
+
let endHRTime = hrtime(startHRTime);
|
|
481
|
+
return start + 1000 * endHRTime[0] + (process.env.RSTEST ? Math.round(endHRTime[1] / 1000000) : endHRTime[1] / 1000000);
|
|
482
|
+
}
|
|
483
|
+
function isResolveSuccessData(data) {
|
|
484
|
+
return !!data.result;
|
|
485
|
+
}
|
|
486
|
+
function isResolveFailData(data) {
|
|
487
|
+
return !!data.error;
|
|
488
|
+
}
|
|
489
|
+
function getResolverCosts(resolver, resolvers) {
|
|
490
|
+
let blocked = resolvers.filter((e)=>e !== resolver && e.pid === resolver.pid && e.startAt >= resolver.startAt && e.endAt <= resolver.endAt), costs = resolver.endAt - resolver.startAt;
|
|
491
|
+
return blocked.length && mergeIntervals(blocked.map((e)=>[
|
|
492
|
+
Math.max(e.startAt, resolver.startAt),
|
|
493
|
+
Math.min(e.endAt, resolver.endAt)
|
|
494
|
+
])).forEach((e)=>{
|
|
495
|
+
let sub = e[1] - e[0];
|
|
496
|
+
costs -= sub;
|
|
497
|
+
}), costs;
|
|
498
|
+
}
|
|
499
|
+
function getResolverFileTree(resolver) {
|
|
500
|
+
return resolver.map((e)=>({
|
|
501
|
+
issuerPath: e.issuerPath
|
|
502
|
+
}));
|
|
503
|
+
}
|
|
504
|
+
function getResolverFileDetails(filepath, resolvers, modules, moduleCodeMap) {
|
|
505
|
+
let module = modules.find((item)=>item.path === filepath), matchResolvers = resolvers.filter((e)=>e.issuerPath === filepath), before = module && moduleCodeMap && moduleCodeMap[module.id] ? moduleCodeMap[module.id].source : '', after = matchResolvers.reduce((t, c)=>c.request && isResolveSuccessData(c) ? t.replace(RegExp(`["']${c.request}["']`), `"${c.result}"`) : t, before);
|
|
506
|
+
return {
|
|
507
|
+
filepath,
|
|
508
|
+
before,
|
|
509
|
+
after,
|
|
510
|
+
resolvers: matchResolvers.map((e)=>({
|
|
511
|
+
...e,
|
|
512
|
+
costs: getResolverCosts(e, resolvers)
|
|
513
|
+
}))
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
function getChunkIdsByAsset(asset) {
|
|
517
|
+
return asset.chunks ? asset.chunks : [];
|
|
518
|
+
}
|
|
519
|
+
function getChunksByModule(module, chunks) {
|
|
520
|
+
return module.chunks.length ? getChunksByChunkIds(module.chunks, chunks) : [];
|
|
521
|
+
}
|
|
522
|
+
function getChunkByChunkId(chunkId, chunks) {
|
|
523
|
+
return chunks.find((e)=>e.id === chunkId);
|
|
524
|
+
}
|
|
525
|
+
function getChunksByChunkIds(chunkIds, chunks, filters) {
|
|
526
|
+
return chunkIds.length ? chunkIds.map((id)=>chunks.find((e)=>e.id === id)).filter(Boolean).map((chunk)=>{
|
|
527
|
+
if (filters && filters.length > 0) {
|
|
528
|
+
let filtered = {};
|
|
529
|
+
for (let key of filters)void 0 !== chunk[key] && (filtered[key] = chunk[key]);
|
|
530
|
+
return filtered;
|
|
531
|
+
}
|
|
532
|
+
return chunk;
|
|
533
|
+
}) : [];
|
|
534
|
+
}
|
|
535
|
+
function getChunksByAsset(asset, chunks, filters) {
|
|
536
|
+
return getChunksByChunkIds(getChunkIdsByAsset(asset), chunks, filters);
|
|
537
|
+
}
|
|
538
|
+
function getChunksByModuleId(id, modules, chunks) {
|
|
539
|
+
let mod = modules.find((e)=>e.id === id);
|
|
540
|
+
return mod ? getChunksByModule(mod, chunks) : [];
|
|
541
|
+
}
|
|
542
|
+
function getDependencyByPackageData(dep, dependencies) {
|
|
543
|
+
return dependencies.find((item)=>item.id === dep.dependencyId);
|
|
544
|
+
}
|
|
545
|
+
function getDependenciesByModule(module, dependencies) {
|
|
546
|
+
return module.dependencies.map((id)=>dependencies.find((dep)=>dep.id === id)).filter(Boolean);
|
|
547
|
+
}
|
|
548
|
+
function getDependencyByResolvedRequest(resolvedRequest, dependencies) {
|
|
549
|
+
return dependencies.find((e)=>e.resolvedRequest === resolvedRequest);
|
|
550
|
+
}
|
|
551
|
+
function isStyleExt(path) {
|
|
552
|
+
return /\.(c|le|sa|sc)ss(\?.*)?$/.test(path);
|
|
553
|
+
}
|
|
554
|
+
function isJsExt(path) {
|
|
555
|
+
return /\.(js|ts|jsx|tsx)(\?.*)?$/.test(path);
|
|
556
|
+
}
|
|
557
|
+
function getModulesByAsset(asset, chunks, modules, filterModules, checkModules) {
|
|
558
|
+
let cks = getChunksByChunkIds(getChunkIdsByAsset(asset), chunks);
|
|
559
|
+
return getModulesByChunks(asset.path, cks, modules, filterModules, checkModules);
|
|
560
|
+
}
|
|
561
|
+
function getModuleIdsByChunk(chunk) {
|
|
562
|
+
let { modules = [] } = chunk;
|
|
563
|
+
return modules;
|
|
564
|
+
}
|
|
565
|
+
function getModuleIdsByModulesIds(moduleIds, modules) {
|
|
566
|
+
return moduleIds.map((id)=>modules.find((m)=>m.id === id)).filter(Boolean);
|
|
567
|
+
}
|
|
568
|
+
function getModulesByChunk(chunk, modules, filterModules) {
|
|
569
|
+
return getModuleIdsByChunk(chunk).map((id)=>{
|
|
570
|
+
let module = modules.find((e)=>e.id === id);
|
|
571
|
+
if (filterModules && filterModules.length > 0) {
|
|
572
|
+
if (!module) return null;
|
|
573
|
+
let filtered = {};
|
|
574
|
+
for (let key of filterModules)void 0 !== module[key] && (filtered[key] = module[key]);
|
|
575
|
+
return filtered;
|
|
576
|
+
}
|
|
577
|
+
return module;
|
|
578
|
+
}).filter(Boolean);
|
|
579
|
+
}
|
|
580
|
+
function getModulesByChunks(assetPath, chunks, modules, filterModules, checkModules) {
|
|
581
|
+
let res = [], typeChecker = isStyleExt(assetPath) ? isStyleExt : isJsExt(assetPath) ? isJsExt : ()=>!0;
|
|
582
|
+
try {
|
|
583
|
+
chunks.forEach((chunk)=>{
|
|
584
|
+
getModulesByChunk(chunk, modules, filterModules).forEach((md)=>{
|
|
585
|
+
let name = md.path || '';
|
|
586
|
+
typeChecker(name) && (!checkModules || checkModules(md)) && !res.filter((_m)=>_m.id === md.id).length && res.push(md);
|
|
587
|
+
});
|
|
588
|
+
});
|
|
589
|
+
} catch (error) {
|
|
590
|
+
rsdoctorLogger.debug(error);
|
|
591
|
+
}
|
|
592
|
+
return res;
|
|
593
|
+
}
|
|
594
|
+
function getModuleByDependency(dep, modules) {
|
|
595
|
+
return modules.find((item)=>item.id === dep.module);
|
|
596
|
+
}
|
|
597
|
+
function filterModulesAndDependenciesByPackageDeps(deps, dependencies, modules) {
|
|
598
|
+
let _dependencies = [], _modules = [];
|
|
599
|
+
for(let i = 0; i < deps.length; i++){
|
|
600
|
+
let dep = getDependencyByPackageData(deps[i], dependencies);
|
|
601
|
+
if (dep) {
|
|
602
|
+
_dependencies.push(dep);
|
|
603
|
+
let module = getModuleByDependency(dep, modules);
|
|
604
|
+
module && _modules.push(module);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return {
|
|
608
|
+
dependencies: _dependencies,
|
|
609
|
+
modules: _modules
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
function getModuleDetails(moduleId, modules, dependencies) {
|
|
613
|
+
let module = modules.find((e)=>e.id === moduleId);
|
|
614
|
+
return {
|
|
615
|
+
module,
|
|
616
|
+
dependencies: getDependenciesByModule(module, dependencies)
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
let filenamePattern = RegExp(`(.*)${/[-|.]/.source}${/[a-z|A-Z|0-9]{4,32}/.source}(${/(?:\.[a-z|A-Z|0-9]{2,}){1,}/.source})$`);
|
|
620
|
+
function formatAssetName(assetName, fileConfig) {
|
|
621
|
+
let splitFilesList = fileConfig?.split('.'), outputFileTailName = '', unHashedFileName = assetName;
|
|
622
|
+
return splitFilesList?.length && splitFilesList.length >= 3 && splitFilesList[splitFilesList.length - 2]?.indexOf('[') < 0 && 'js|css|html'.indexOf(splitFilesList[splitFilesList.length - 1]) > -1 ? (outputFileTailName = splitFilesList[splitFilesList.length - 2], unHashedFileName = assetName.replace(/(.*)(\.[a-f0-9]{4,32})([^.]*.[^.]+){2,}/g, '$1'), `${unHashedFileName}.${outputFileTailName}.${assetName.substring(assetName.lastIndexOf('.') + 1)}`) : assetName.replace(filenamePattern, '$1$2');
|
|
623
|
+
}
|
|
624
|
+
function isAssetMatchExtension(asset, ext) {
|
|
625
|
+
return asset.path.slice(-ext.length) === ext || extname(asset.path) === ext;
|
|
626
|
+
}
|
|
627
|
+
function isAssetMatchExtensions(asset, exts) {
|
|
628
|
+
return !!exts.length && exts.some((ext)=>isAssetMatchExtension(asset, ext));
|
|
629
|
+
}
|
|
630
|
+
function filterAssetsByExtensions(assets, exts) {
|
|
631
|
+
return 'string' == typeof exts ? assets.filter((e)=>isAssetMatchExtension(e, exts)) : Array.isArray(exts) ? assets.filter((e)=>isAssetMatchExtensions(e, exts)) : [];
|
|
632
|
+
}
|
|
633
|
+
function filterAssets(assets, filterOrExtensions) {
|
|
634
|
+
return filterOrExtensions && (assets = 'function' == typeof filterOrExtensions ? assets.filter(filterOrExtensions) : filterAssetsByExtensions(assets, filterOrExtensions)), assets;
|
|
635
|
+
}
|
|
636
|
+
function getAssetsSizeInfo(assets, chunks, options = {}) {
|
|
637
|
+
let { withFileContent = !0, filterOrExtensions } = options;
|
|
638
|
+
return (assets = assets.filter((e)=>!isAssetMatchExtensions(e, types_Constants.MapExtensions)), filterOrExtensions && (assets = filterAssets(assets, filterOrExtensions)), assets.length) ? {
|
|
639
|
+
count: assets.length,
|
|
640
|
+
size: assets.reduce((t, c)=>t + c.size, 0),
|
|
641
|
+
files: assets.map((e)=>({
|
|
642
|
+
path: e.path,
|
|
643
|
+
size: e.size,
|
|
644
|
+
gzipSize: e.gzipSize,
|
|
645
|
+
initial: isInitialAsset(e, chunks),
|
|
646
|
+
content: withFileContent ? e.content : void 0
|
|
647
|
+
}))
|
|
648
|
+
} : {
|
|
649
|
+
count: 0,
|
|
650
|
+
size: 0,
|
|
651
|
+
files: []
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
function isInitialAsset(asset, chunks) {
|
|
655
|
+
return getChunksByAsset(asset, chunks).some((e)=>!!e.initial);
|
|
656
|
+
}
|
|
657
|
+
function getInitialAssetsSizeInfo(assets, chunks, options = {}) {
|
|
658
|
+
return options.filterOrExtensions && (assets = filterAssets(assets, options.filterOrExtensions)), getAssetsSizeInfo(assets, chunks, {
|
|
659
|
+
...options,
|
|
660
|
+
filterOrExtensions: (asset)=>isInitialAsset(asset, chunks)
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
function getAssetsDiffResult(baseline, current) {
|
|
664
|
+
return {
|
|
665
|
+
all: {
|
|
666
|
+
total: diffAssetsByExtensions(baseline, current)
|
|
667
|
+
},
|
|
668
|
+
js: {
|
|
669
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.JSExtension),
|
|
670
|
+
initial: diffAssetsByExtensions(baseline, current, types_Constants.JSExtension, !0)
|
|
671
|
+
},
|
|
672
|
+
css: {
|
|
673
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.CSSExtension),
|
|
674
|
+
initial: diffAssetsByExtensions(baseline, current, types_Constants.CSSExtension, !0)
|
|
675
|
+
},
|
|
676
|
+
imgs: {
|
|
677
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.ImgExtensions)
|
|
678
|
+
},
|
|
679
|
+
html: {
|
|
680
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.HtmlExtension)
|
|
681
|
+
},
|
|
682
|
+
media: {
|
|
683
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.MediaExtensions)
|
|
684
|
+
},
|
|
685
|
+
fonts: {
|
|
686
|
+
total: diffAssetsByExtensions(baseline, current, types_Constants.FontExtensions)
|
|
687
|
+
},
|
|
688
|
+
others: {
|
|
689
|
+
total: diffAssetsByExtensions(baseline, current, (asset)=>!isAssetMatchExtensions(asset, [
|
|
690
|
+
types_Constants.JSExtension,
|
|
691
|
+
types_Constants.CSSExtension,
|
|
692
|
+
types_Constants.HtmlExtension
|
|
693
|
+
].concat(types_Constants.ImgExtensions, types_Constants.MediaExtensions, types_Constants.FontExtensions, types_Constants.MapExtensions)))
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
function diffSize(bSize, cSize) {
|
|
698
|
+
let isEqual = bSize === cSize;
|
|
699
|
+
return {
|
|
700
|
+
percent: isEqual ? 0 : 0 === bSize ? 100 : Math.abs(cSize - bSize) / bSize * 100,
|
|
701
|
+
state: isEqual ? Client.RsdoctorClientDiffState.Equal : bSize > cSize ? Client.RsdoctorClientDiffState.Down : Client.RsdoctorClientDiffState.Up
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function diffAssetsByExtensions(baseline, current, filterOrExtensions, isInitial = !1) {
|
|
705
|
+
let cSize, cCount, { size: bSize, count: bCount } = isInitial ? getInitialAssetsSizeInfo(baseline.assets, baseline.chunks, {
|
|
706
|
+
filterOrExtensions
|
|
707
|
+
}) : getAssetsSizeInfo(baseline.assets, baseline.chunks, {
|
|
708
|
+
filterOrExtensions
|
|
709
|
+
});
|
|
710
|
+
if (baseline === current) cSize = bSize, cCount = bCount;
|
|
711
|
+
else {
|
|
712
|
+
let { size, count } = isInitial ? getInitialAssetsSizeInfo(current.assets, current.chunks, {
|
|
713
|
+
filterOrExtensions
|
|
714
|
+
}) : getAssetsSizeInfo(current.assets, current.chunks, {
|
|
715
|
+
filterOrExtensions
|
|
716
|
+
});
|
|
717
|
+
cSize = size, cCount = count;
|
|
718
|
+
}
|
|
719
|
+
let { percent, state } = diffSize(bSize, cSize);
|
|
720
|
+
return {
|
|
721
|
+
size: {
|
|
722
|
+
baseline: bSize,
|
|
723
|
+
current: cSize
|
|
724
|
+
},
|
|
725
|
+
count: {
|
|
726
|
+
baseline: bCount,
|
|
727
|
+
current: cCount
|
|
728
|
+
},
|
|
729
|
+
percent,
|
|
730
|
+
state
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function getAssetsSummary(assets, chunks, options = {}) {
|
|
734
|
+
let jsOpt = {
|
|
735
|
+
...options,
|
|
736
|
+
filterOrExtensions: types_Constants.JSExtension
|
|
737
|
+
}, cssOpt = {
|
|
738
|
+
...options,
|
|
739
|
+
filterOrExtensions: types_Constants.CSSExtension
|
|
740
|
+
}, imgOpt = {
|
|
741
|
+
...options,
|
|
742
|
+
filterOrExtensions: types_Constants.ImgExtensions
|
|
743
|
+
}, htmlOpt = {
|
|
744
|
+
...options,
|
|
745
|
+
filterOrExtensions: types_Constants.HtmlExtension
|
|
746
|
+
}, mediaOpt = {
|
|
747
|
+
...options,
|
|
748
|
+
filterOrExtensions: types_Constants.MediaExtensions
|
|
749
|
+
}, fontOpt = {
|
|
750
|
+
...options,
|
|
751
|
+
filterOrExtensions: types_Constants.FontExtensions
|
|
752
|
+
}, otherOpt = {
|
|
753
|
+
...options,
|
|
754
|
+
filterOrExtensions: (asset)=>!isAssetMatchExtensions(asset, [
|
|
755
|
+
types_Constants.JSExtension,
|
|
756
|
+
types_Constants.CSSExtension,
|
|
757
|
+
types_Constants.HtmlExtension
|
|
758
|
+
].concat(types_Constants.ImgExtensions, types_Constants.MediaExtensions, types_Constants.FontExtensions, types_Constants.MapExtensions))
|
|
759
|
+
};
|
|
760
|
+
return {
|
|
761
|
+
all: {
|
|
762
|
+
total: getAssetsSizeInfo(assets, chunks, options)
|
|
763
|
+
},
|
|
764
|
+
js: {
|
|
765
|
+
total: getAssetsSizeInfo(assets, chunks, jsOpt),
|
|
766
|
+
initial: getInitialAssetsSizeInfo(assets, chunks, jsOpt)
|
|
767
|
+
},
|
|
768
|
+
css: {
|
|
769
|
+
total: getAssetsSizeInfo(assets, chunks, cssOpt),
|
|
770
|
+
initial: getInitialAssetsSizeInfo(assets, chunks, cssOpt)
|
|
771
|
+
},
|
|
772
|
+
imgs: {
|
|
773
|
+
total: getAssetsSizeInfo(assets, chunks, imgOpt)
|
|
774
|
+
},
|
|
775
|
+
html: {
|
|
776
|
+
total: getAssetsSizeInfo(assets, chunks, htmlOpt)
|
|
777
|
+
},
|
|
778
|
+
media: {
|
|
779
|
+
total: getAssetsSizeInfo(assets, chunks, mediaOpt)
|
|
780
|
+
},
|
|
781
|
+
fonts: {
|
|
782
|
+
total: getAssetsSizeInfo(assets, chunks, fontOpt)
|
|
783
|
+
},
|
|
784
|
+
others: {
|
|
785
|
+
total: getAssetsSizeInfo(assets, chunks, otherOpt)
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function getAssetDetails(assetPath, assets, chunks, modules, checkModules) {
|
|
790
|
+
let asset = assets.find((e)=>e.path === assetPath);
|
|
791
|
+
return {
|
|
792
|
+
asset,
|
|
793
|
+
chunks: getChunksByAsset(asset, chunks),
|
|
794
|
+
modules: getModulesByAsset(asset, chunks, modules, void 0, checkModules)
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
function getAllBundleData(assets, chunks, modules, filtersModules) {
|
|
798
|
+
let result = [];
|
|
799
|
+
try {
|
|
800
|
+
for(let i = 0; i < assets.length; i++){
|
|
801
|
+
let asset = assets[i];
|
|
802
|
+
result.push({
|
|
803
|
+
asset,
|
|
804
|
+
modules: getModulesByAsset(asset, chunks, modules, filtersModules)
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
} catch (error) {
|
|
809
|
+
return console.error(error), [];
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
function extname(filename) {
|
|
813
|
+
let matches = filename.split('?')[0].match(/\.([0-9a-z]+)(?:[\?#]|$)/i);
|
|
814
|
+
return matches ? `.${matches[1]}` : '';
|
|
815
|
+
}
|
|
816
|
+
function getEntryPoints(entrypoints) {
|
|
817
|
+
return entrypoints;
|
|
818
|
+
}
|
|
819
|
+
function getBundleDiffPageQueryString(files) {
|
|
820
|
+
let qs = encodeURIComponent(files.join(','));
|
|
821
|
+
return qs && (qs = `?${Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`), qs;
|
|
822
|
+
}
|
|
823
|
+
function getBundleDiffPageUrl(files) {
|
|
824
|
+
let qs = getBundleDiffPageQueryString(files);
|
|
825
|
+
if ('development' === process.env.NODE_ENV && 'undefined' != typeof location) {
|
|
826
|
+
let { search = '', origin } = location;
|
|
827
|
+
return search && (qs += `&${search.slice(1)}`), `${origin}${qs}#${Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
828
|
+
}
|
|
829
|
+
return `${qs}#${Client.RsdoctorClientRoutes.BundleDiff}`;
|
|
830
|
+
}
|
|
831
|
+
function parseFilesFromBundlePageUrlQuery(queryValue) {
|
|
832
|
+
return decodeURIComponent(queryValue).split(',');
|
|
833
|
+
}
|
|
834
|
+
function getPluginHooks(plugin) {
|
|
835
|
+
return Object.keys(plugin);
|
|
836
|
+
}
|
|
837
|
+
function getPluginTapNames(plugin) {
|
|
838
|
+
let hooks = getPluginHooks(plugin), tapNames = new Set();
|
|
839
|
+
return hooks.forEach((hook)=>{
|
|
840
|
+
plugin[hook].forEach((data)=>{
|
|
841
|
+
tapNames.add(data.tapName);
|
|
842
|
+
});
|
|
843
|
+
}), [
|
|
844
|
+
...tapNames
|
|
845
|
+
];
|
|
846
|
+
}
|
|
847
|
+
function getPluginSummary(plugin) {
|
|
848
|
+
return {
|
|
849
|
+
hooks: getPluginHooks(plugin),
|
|
850
|
+
tapNames: getPluginTapNames(plugin)
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
function getPluginData(plugin, selectedHooks = [], selectedTapNames = []) {
|
|
854
|
+
let hooks = getPluginHooks(plugin).filter((hook)=>!selectedHooks.length || -1 !== selectedHooks.indexOf(hook));
|
|
855
|
+
return hooks.length ? getPluginTapNames(plugin).reduce((total, tapName)=>(selectedTapNames.length && -1 === selectedTapNames.indexOf(tapName) || hooks.forEach((hook)=>{
|
|
856
|
+
let hookData = plugin[hook].filter((e)=>e.tapName === tapName);
|
|
857
|
+
0 !== hookData.length && total.push({
|
|
858
|
+
tapName,
|
|
859
|
+
hook,
|
|
860
|
+
data: hookData.map((e)=>({
|
|
861
|
+
startAt: e.startAt,
|
|
862
|
+
endAt: e.endAt,
|
|
863
|
+
costs: e.costs,
|
|
864
|
+
type: e.type
|
|
865
|
+
}))
|
|
866
|
+
});
|
|
867
|
+
}), total), []) : [];
|
|
868
|
+
}
|
|
869
|
+
function getPackageRelationAlertDetails(modules, dependencies, root, packageDependencies, moduleCodeMap) {
|
|
870
|
+
return packageDependencies.slice().reverse().map((dep)=>{
|
|
871
|
+
let dependency = dependencies.find((item)=>item.id === dep.dependencyId);
|
|
872
|
+
if (!dependency) return null;
|
|
873
|
+
let module = modules.find((item)=>item.id === dependency.module);
|
|
874
|
+
return module ? {
|
|
875
|
+
group: dep.group,
|
|
876
|
+
module,
|
|
877
|
+
dependency,
|
|
878
|
+
relativePath: relative(root, module.path),
|
|
879
|
+
moduleCode: moduleCodeMap?.[module.id]
|
|
880
|
+
} : null;
|
|
881
|
+
}).filter(Boolean);
|
|
882
|
+
}
|
|
883
|
+
let RspackLoaderInternalPropertyName = '__l__';
|
|
884
|
+
var rspack_RspackSummaryCostsDataName = ((RspackSummaryCostsDataName = {}).Bootstrap = "bootstrap->rspack:beforeCompile", RspackSummaryCostsDataName.Compile = "rspack:beforeCompile->afterCompile", RspackSummaryCostsDataName.Done = "rspack:afterCompile->done", RspackSummaryCostsDataName.Minify = "rspack:minify(rspack:optimizeChunkAssets)", RspackSummaryCostsDataName);
|
|
885
|
+
function checkSourceMapSupport(configs) {
|
|
886
|
+
if (!Array.isArray(configs) || !configs[0]) return {
|
|
887
|
+
isRspack: !1,
|
|
888
|
+
hasSourceMap: !1
|
|
889
|
+
};
|
|
890
|
+
let isRspack = 'rspack' === configs[0].name && configs[0]?.config?.name !== 'lynx', devtool = configs[0].config?.devtool, plugins = configs[0].config?.plugins, hasLynxSourcemapPlugin = plugins?.filter((plugin)=>plugin && plugin.includes('SourceMapDevToolPlugin'));
|
|
891
|
+
return {
|
|
892
|
+
isRspack,
|
|
893
|
+
hasSourceMap: 'string' == typeof devtool && devtool.includes('source-map') && !devtool.includes('eval') || !!hasLynxSourcemapPlugin?.length
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
class APIDataLoader {
|
|
897
|
+
loader;
|
|
898
|
+
constructor(loader){
|
|
899
|
+
this.loader = loader, this.loadAPI = this.loadAPI.bind(this);
|
|
900
|
+
}
|
|
901
|
+
log(...args) {
|
|
902
|
+
console.log(`[${this.constructor.name}]`, ...args);
|
|
903
|
+
}
|
|
904
|
+
loadAPI(...args) {
|
|
905
|
+
let [api, body] = args;
|
|
906
|
+
switch(api){
|
|
907
|
+
case SDK.ServerAPI.API.LoadDataByKey:
|
|
908
|
+
return this.loader.loadData(body.key);
|
|
909
|
+
case SDK.ServerAPI.API.GetProjectInfo:
|
|
910
|
+
return Promise.all([
|
|
911
|
+
this.loader.loadData('root'),
|
|
912
|
+
this.loader.loadData('pid'),
|
|
913
|
+
this.loader.loadData('hash'),
|
|
914
|
+
this.loader.loadData('summary'),
|
|
915
|
+
this.loader.loadData('configs'),
|
|
916
|
+
this.loader.loadData('envinfo'),
|
|
917
|
+
this.loader.loadData('errors')
|
|
918
|
+
]).then(([root, pid, hash, summary, configs, envinfo, errors])=>({
|
|
919
|
+
root,
|
|
920
|
+
pid,
|
|
921
|
+
hash,
|
|
922
|
+
summary,
|
|
923
|
+
configs,
|
|
924
|
+
envinfo,
|
|
925
|
+
errors
|
|
926
|
+
}));
|
|
927
|
+
case SDK.ServerAPI.API.GetClientRoutes:
|
|
928
|
+
if ('undefined' != typeof window && window?.[types_Constants.WINDOW_RSDOCTOR_TAG]) return window[types_Constants.WINDOW_RSDOCTOR_TAG].enableRoutes;
|
|
929
|
+
return this.loader.loadManifest().then((res)=>{
|
|
930
|
+
let { enableRoutes = [] } = res.client || {};
|
|
931
|
+
return enableRoutes;
|
|
932
|
+
});
|
|
933
|
+
case SDK.ServerAPI.API.GetLoaderNames:
|
|
934
|
+
return this.loader.loadData('loader').then((res)=>getLoaderNames(res || []));
|
|
935
|
+
case SDK.ServerAPI.API.GetLayers:
|
|
936
|
+
return this.loader.loadData('moduleGraph').then((res)=>{
|
|
937
|
+
let { layers } = res || {};
|
|
938
|
+
return layers;
|
|
939
|
+
});
|
|
940
|
+
case SDK.ServerAPI.API.GetLoaderChartData:
|
|
941
|
+
return this.loader.loadData('loader').then((res)=>getLoaderChartData(res || []));
|
|
942
|
+
case SDK.ServerAPI.API.GetLoaderFileTree:
|
|
943
|
+
return this.loader.loadData('loader').then((res)=>getLoaderFileTree(res || []));
|
|
944
|
+
case SDK.ServerAPI.API.GetLoaderFileDetails:
|
|
945
|
+
return this.loader.loadData('loader').then((res)=>getLoaderFileDetails(body.path, res || []));
|
|
946
|
+
case SDK.ServerAPI.API.GetLoaderFolderStatistics:
|
|
947
|
+
return this.loader.loadData('loader').then((res)=>getLoaderFolderStatistics(body.folder, res || []));
|
|
948
|
+
case SDK.ServerAPI.API.GetLoaderFileFirstInput:
|
|
949
|
+
return this.loader.loadData('loader').then((res)=>getLoaderFileFirstInput(body.file, res || []));
|
|
950
|
+
case SDK.ServerAPI.API.GetLoaderFileInputAndOutput:
|
|
951
|
+
return this.loader.loadData('loader').then((res)=>getLoaderFileFirstInput(body.file, res || []));
|
|
952
|
+
case SDK.ServerAPI.API.GetResolverFileTree:
|
|
953
|
+
return this.loader.loadData('resolver').then((res)=>getResolverFileTree(res || []));
|
|
954
|
+
case SDK.ServerAPI.API.GetResolverFileDetails:
|
|
955
|
+
return Promise.all([
|
|
956
|
+
this.loader.loadData('resolver'),
|
|
957
|
+
this.loader.loadData('moduleGraph.modules'),
|
|
958
|
+
this.loader.loadData('moduleCodeMap')
|
|
959
|
+
]).then((res)=>{
|
|
960
|
+
let resolverData = res[0], modules = res[1], moduleCodeMap = res[2];
|
|
961
|
+
return getResolverFileDetails(body.filepath, resolverData || [], modules || [], moduleCodeMap || {});
|
|
962
|
+
});
|
|
963
|
+
case SDK.ServerAPI.API.GetPluginSummary:
|
|
964
|
+
return this.loader.loadData('plugin').then((res)=>getPluginSummary(res || {}));
|
|
965
|
+
case SDK.ServerAPI.API.GetPluginData:
|
|
966
|
+
return this.loader.loadData('plugin').then((res)=>{
|
|
967
|
+
let { hooks, tapNames } = body;
|
|
968
|
+
return getPluginData(res || {}, hooks, tapNames);
|
|
969
|
+
});
|
|
970
|
+
case SDK.ServerAPI.API.GetAssetsSummary:
|
|
971
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
972
|
+
let { withFileContent = !0 } = body, { assets = [], chunks = [] } = res || {};
|
|
973
|
+
return getAssetsSummary(assets, chunks, {
|
|
974
|
+
withFileContent
|
|
975
|
+
});
|
|
976
|
+
});
|
|
977
|
+
case SDK.ServerAPI.API.GetAssetDetails:
|
|
978
|
+
return Promise.all([
|
|
979
|
+
this.loader.loadData('chunkGraph'),
|
|
980
|
+
this.loader.loadData('moduleGraph'),
|
|
981
|
+
this.loader.loadData('configs')
|
|
982
|
+
]).then((res)=>{
|
|
983
|
+
let { assetPath } = body, { isRspack, hasSourceMap } = checkSourceMapSupport(res[2] || []), { assets = [], chunks = [] } = res[0] || {}, { modules = [] } = res[1] || {};
|
|
984
|
+
return getAssetDetails(assetPath, assets, chunks, modules, isRspack || hasSourceMap ? (_module)=>!0 : ()=>!0);
|
|
985
|
+
});
|
|
986
|
+
case SDK.ServerAPI.API.GetSummaryBundles:
|
|
987
|
+
return Promise.all([
|
|
988
|
+
this.loader.loadData('chunkGraph'),
|
|
989
|
+
this.loader.loadData('moduleGraph')
|
|
990
|
+
]).then((res)=>{
|
|
991
|
+
let { assets = [], chunks = [] } = res[0] || {}, { modules = [] } = res[1] || {};
|
|
992
|
+
return getAllBundleData(assets, chunks, modules, [
|
|
993
|
+
'id',
|
|
994
|
+
'path',
|
|
995
|
+
'size',
|
|
996
|
+
'kind'
|
|
997
|
+
]);
|
|
998
|
+
});
|
|
999
|
+
case SDK.ServerAPI.API.GetChunksByModuleId:
|
|
1000
|
+
return Promise.all([
|
|
1001
|
+
this.loader.loadData('chunkGraph'),
|
|
1002
|
+
this.loader.loadData('moduleGraph')
|
|
1003
|
+
]).then((res)=>{
|
|
1004
|
+
let { moduleId } = body, { chunks = [] } = res[0] || {}, { modules = [] } = res[1] || {};
|
|
1005
|
+
return getChunksByModuleId(moduleId, modules, chunks);
|
|
1006
|
+
});
|
|
1007
|
+
case SDK.ServerAPI.API.GetModuleDetails:
|
|
1008
|
+
return Promise.all([
|
|
1009
|
+
this.loader.loadData('chunkGraph'),
|
|
1010
|
+
this.loader.loadData('moduleGraph')
|
|
1011
|
+
]).then((res)=>{
|
|
1012
|
+
let { moduleId } = body, { modules = [], dependencies = [] } = res[1] || {};
|
|
1013
|
+
return getModuleDetails(moduleId, modules, dependencies);
|
|
1014
|
+
});
|
|
1015
|
+
case SDK.ServerAPI.API.GetModulesByModuleIds:
|
|
1016
|
+
return this.loader.loadData('moduleGraph').then((res)=>{
|
|
1017
|
+
let { moduleIds } = body, { modules = [] } = res || {};
|
|
1018
|
+
return getModuleIdsByModulesIds(moduleIds, modules);
|
|
1019
|
+
});
|
|
1020
|
+
case SDK.ServerAPI.API.GetEntryPoints:
|
|
1021
|
+
return Promise.all([
|
|
1022
|
+
this.loader.loadData('chunkGraph')
|
|
1023
|
+
]).then((res)=>{
|
|
1024
|
+
let [chunkGraph] = res, { entrypoints = [] } = chunkGraph || {};
|
|
1025
|
+
return entrypoints;
|
|
1026
|
+
});
|
|
1027
|
+
case SDK.ServerAPI.API.GetModuleCodeByModuleId:
|
|
1028
|
+
return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
|
|
1029
|
+
let { moduleId } = body;
|
|
1030
|
+
return moduleCodeMap ? moduleCodeMap[moduleId] : {
|
|
1031
|
+
source: '',
|
|
1032
|
+
transformed: '',
|
|
1033
|
+
parsedSource: ''
|
|
1034
|
+
};
|
|
1035
|
+
});
|
|
1036
|
+
case SDK.ServerAPI.API.GetModuleCodeByModuleIds:
|
|
1037
|
+
return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
|
|
1038
|
+
let { moduleIds } = body, _moduleCodeData = {};
|
|
1039
|
+
return moduleCodeMap ? (moduleIds.forEach((id)=>{
|
|
1040
|
+
_moduleCodeData[id] = moduleCodeMap[id];
|
|
1041
|
+
}), _moduleCodeData) : [];
|
|
1042
|
+
});
|
|
1043
|
+
case SDK.ServerAPI.API.GetAllModuleGraph:
|
|
1044
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>moduleGraph?.modules);
|
|
1045
|
+
case SDK.ServerAPI.API.GetSearchModules:
|
|
1046
|
+
return Promise.all([
|
|
1047
|
+
this.loader.loadData('moduleGraph'),
|
|
1048
|
+
this.loader.loadData('chunkGraph')
|
|
1049
|
+
]).then((res)=>{
|
|
1050
|
+
let [moduleGraph, chunkGraph] = res, { moduleName } = body;
|
|
1051
|
+
if (!moduleName) return [];
|
|
1052
|
+
let assetMap = chunkGraph.chunks.reduce((acc, chunk)=>(chunk.assets.forEach((asset)=>{
|
|
1053
|
+
acc[chunk.id] || (acc[chunk.id] = []), acc[chunk.id].push(asset);
|
|
1054
|
+
}), acc), {}), searchedChunksMap = new Map();
|
|
1055
|
+
return moduleGraph?.modules.filter((module)=>{
|
|
1056
|
+
module.webpackId.includes(moduleName) && module.chunks.forEach((chunk)=>{
|
|
1057
|
+
searchedChunksMap.has(chunk) || (assetMap[chunk] || []).forEach((asset)=>{
|
|
1058
|
+
asset.endsWith('.js') && searchedChunksMap.set(chunk, asset);
|
|
1059
|
+
});
|
|
1060
|
+
});
|
|
1061
|
+
}), Object.fromEntries(searchedChunksMap);
|
|
1062
|
+
});
|
|
1063
|
+
case SDK.ServerAPI.API.GetSearchModuleInChunk:
|
|
1064
|
+
return Promise.all([
|
|
1065
|
+
this.loader.loadData('moduleGraph'),
|
|
1066
|
+
this.loader.loadData('root')
|
|
1067
|
+
]).then((res)=>{
|
|
1068
|
+
let [moduleGraph, root] = res, { moduleName, chunk } = body;
|
|
1069
|
+
return moduleName ? moduleGraph?.modules.filter((module)=>module.webpackId.includes(moduleName) && module.chunks.includes(chunk)).map((filteredModule)=>({
|
|
1070
|
+
id: filteredModule.id,
|
|
1071
|
+
path: filteredModule.path,
|
|
1072
|
+
relativePath: relative(root, filteredModule.path)
|
|
1073
|
+
})) : [];
|
|
1074
|
+
});
|
|
1075
|
+
case SDK.ServerAPI.API.GetAllChunkGraph:
|
|
1076
|
+
return this.loader.loadData('chunkGraph').then((chunkGraph)=>chunkGraph?.chunks);
|
|
1077
|
+
case SDK.ServerAPI.API.GetPackageRelationAlertDetails:
|
|
1078
|
+
return Promise.all([
|
|
1079
|
+
this.loader.loadData('moduleGraph'),
|
|
1080
|
+
this.loader.loadData('errors'),
|
|
1081
|
+
this.loader.loadData('root'),
|
|
1082
|
+
this.loader.loadData('moduleCodeMap')
|
|
1083
|
+
]).then((res)=>{
|
|
1084
|
+
let { id, target } = body, [moduleGraph, errors = [], root = '', moduleCodeMap] = res, { modules = [], dependencies = [] } = moduleGraph || {}, { packages = [] } = errors.find((e)=>e.id === id) || {}, { dependencies: pkgDependencies = [] } = packages.find((e)=>e.target.name === target.name && e.target.root === target.root && e.target.version === target.version) || {};
|
|
1085
|
+
return getPackageRelationAlertDetails(modules, dependencies, root, pkgDependencies, moduleCodeMap || {});
|
|
1086
|
+
});
|
|
1087
|
+
case SDK.ServerAPI.API.GetOverlayAlerts:
|
|
1088
|
+
return this.loader.loadData('errors').then((res)=>(res || []).filter((e)=>e.code === Rule.RuleMessageCodeEnumerated.Overlay));
|
|
1089
|
+
case SDK.ServerAPI.API.BundleDiffManifest:
|
|
1090
|
+
return this.loader.loadManifest();
|
|
1091
|
+
case SDK.ServerAPI.API.GetBundleDiffSummary:
|
|
1092
|
+
return Promise.all([
|
|
1093
|
+
this.loader.loadManifest(),
|
|
1094
|
+
this.loader.loadData('root'),
|
|
1095
|
+
this.loader.loadData('hash'),
|
|
1096
|
+
this.loader.loadData('errors'),
|
|
1097
|
+
this.loader.loadData('chunkGraph'),
|
|
1098
|
+
this.loader.loadData('moduleGraph'),
|
|
1099
|
+
this.loader.loadData('moduleCodeMap'),
|
|
1100
|
+
this.loader.loadData('packageGraph'),
|
|
1101
|
+
this.loader.loadData('configs')
|
|
1102
|
+
]).then(([_manifest, root = '', hash = '', errors = {}, chunkGraph = {}, moduleGraph = {}, moduleCodeMap = {}, packageGraph = {}, configs = []])=>{
|
|
1103
|
+
let outputFilename = '';
|
|
1104
|
+
return 'string' == typeof configs[0]?.config?.output?.chunkFilename && (outputFilename = configs[0]?.config.output.chunkFilename), {
|
|
1105
|
+
root,
|
|
1106
|
+
hash,
|
|
1107
|
+
errors,
|
|
1108
|
+
chunkGraph,
|
|
1109
|
+
moduleGraph,
|
|
1110
|
+
packageGraph,
|
|
1111
|
+
outputFilename,
|
|
1112
|
+
moduleCodeMap
|
|
1113
|
+
};
|
|
1114
|
+
});
|
|
1115
|
+
case SDK.ServerAPI.API.GetChunkGraph:
|
|
1116
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
1117
|
+
let { chunks = [] } = res || {};
|
|
1118
|
+
return chunks;
|
|
1119
|
+
});
|
|
1120
|
+
case SDK.ServerAPI.API.GetAllModuleGraphFilter:
|
|
1121
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>moduleGraph?.modules.map((m)=>({
|
|
1122
|
+
id: m.id,
|
|
1123
|
+
webpackId: m.webpackId,
|
|
1124
|
+
path: m.path,
|
|
1125
|
+
size: m.size,
|
|
1126
|
+
chunks: m.chunks,
|
|
1127
|
+
kind: m.kind
|
|
1128
|
+
})));
|
|
1129
|
+
case SDK.ServerAPI.API.GetModuleByName:
|
|
1130
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
|
|
1131
|
+
let { moduleName } = body, { modules = [] } = moduleGraph || {};
|
|
1132
|
+
return modules.filter((m)=>m.path.includes(moduleName)).map((m)=>({
|
|
1133
|
+
id: m.id,
|
|
1134
|
+
path: m.path
|
|
1135
|
+
})) || [];
|
|
1136
|
+
});
|
|
1137
|
+
case SDK.ServerAPI.API.GetModuleIssuerPath:
|
|
1138
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
|
|
1139
|
+
let { moduleId } = body, modules = moduleGraph?.modules || [], issuerPath = modules.find((m)=>String(m.id) === moduleId)?.issuerPath || [];
|
|
1140
|
+
return Array.isArray(issuerPath) && issuerPath.length > 0 && 'number' == typeof issuerPath[0] ? issuerPath.map((id)=>modules.find((m)=>m.id === id)?.path).filter(Boolean) : issuerPath;
|
|
1141
|
+
});
|
|
1142
|
+
case SDK.ServerAPI.API.GetPackageInfo:
|
|
1143
|
+
return this.loader.loadData('packageGraph').then((packageGraph)=>packageGraph?.packages);
|
|
1144
|
+
case SDK.ServerAPI.API.GetPackageDependency:
|
|
1145
|
+
return this.loader.loadData('packageGraph').then((packageGraph)=>packageGraph?.dependencies || []);
|
|
1146
|
+
case SDK.ServerAPI.API.GetChunkGraphAI:
|
|
1147
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
1148
|
+
let { chunks = [] } = res || {};
|
|
1149
|
+
return chunks.map(({ modules, ...rest })=>rest);
|
|
1150
|
+
});
|
|
1151
|
+
case SDK.ServerAPI.API.GetChunkByIdAI:
|
|
1152
|
+
return Promise.all([
|
|
1153
|
+
this.loader.loadData('chunkGraph'),
|
|
1154
|
+
this.loader.loadData('moduleGraph')
|
|
1155
|
+
]).then(([chunkGraph, moduleGraph])=>{
|
|
1156
|
+
let { chunks = [] } = chunkGraph || {}, { modules = [] } = moduleGraph || {}, { chunkId } = body, chunkInfo = chunks.find((c)=>c.id === chunkId);
|
|
1157
|
+
if (!chunkInfo) return null;
|
|
1158
|
+
let chunkModules = modules.filter((m)=>chunkInfo.modules.includes(m.id)).map((module)=>({
|
|
1159
|
+
id: module.id,
|
|
1160
|
+
path: module.path,
|
|
1161
|
+
size: module.size,
|
|
1162
|
+
chunks: module.chunks,
|
|
1163
|
+
kind: module.kind,
|
|
1164
|
+
issuerPath: module.issuerPath
|
|
1165
|
+
}));
|
|
1166
|
+
return chunkInfo.modulesInfo = chunkModules, chunkInfo;
|
|
1167
|
+
});
|
|
1168
|
+
case SDK.ServerAPI.API.GetDirectoriesLoaders:
|
|
1169
|
+
return Promise.all([
|
|
1170
|
+
this.loader.loadData('root'),
|
|
1171
|
+
this.loader.loadData('loader')
|
|
1172
|
+
]).then(([root, loaders])=>getDirectoriesLoaders(loaders || [], root || ''));
|
|
1173
|
+
default:
|
|
1174
|
+
throw Error(`API not implement: "${api}"`);
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
function isUndefined(value) {
|
|
1179
|
+
return void 0 === value;
|
|
1180
|
+
}
|
|
1181
|
+
function isNumber(value) {
|
|
1182
|
+
return 'number' == typeof value && !Number.isNaN(value);
|
|
1183
|
+
}
|
|
1184
|
+
function isObject(value) {
|
|
1185
|
+
return 'object' == typeof value && null !== value;
|
|
1186
|
+
}
|
|
1187
|
+
function isEmpty(value) {
|
|
1188
|
+
return null == value || Array.isArray(value) && 0 === value.length || 'object' == typeof value && 0 === Object.keys(value).length;
|
|
1189
|
+
}
|
|
1190
|
+
function last(array) {
|
|
1191
|
+
return array[array.length - 1];
|
|
1192
|
+
}
|
|
1193
|
+
function compact(array) {
|
|
1194
|
+
return array.filter((item)=>null != item || !item);
|
|
1195
|
+
}
|
|
1196
|
+
function isNil(value) {
|
|
1197
|
+
return null == value;
|
|
1198
|
+
}
|
|
1199
|
+
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);
|
|
1200
|
+
function pick(obj, keys) {
|
|
1201
|
+
let result = {};
|
|
1202
|
+
for(let i = 0; i < keys.length; i++){
|
|
1203
|
+
let key = keys[i];
|
|
1204
|
+
Object.hasOwn(obj, key) && (result[key] = obj[key]);
|
|
1205
|
+
}
|
|
1206
|
+
return result;
|
|
1207
|
+
}
|
|
1208
|
+
let PACKAGE_SLUG = /[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*/, MODULE_PATH_PACKAGES = RegExp(`(?:${/(?:node_modules|~)(?:\/\.pnpm)?/.source}/)(?:(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source}\\+)*(?:${PACKAGE_SLUG.source})(?:${/@[\w|\-|_|.]+/.source})?)(?:_(?:@${PACKAGE_SLUG.source}[/|+])?(?:${PACKAGE_SLUG.source})(?:@${PACKAGE_SLUG.source})?)*/`, 'g'), PACKAGE_PATH_NAME = /(?:(?:node_modules|~)(?:\/\.pnpm)?\/)(?:((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*\+)*)(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[\w|\-|_|.]+)?)(?:_((?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*[/|+])?(?:[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))(?:@[a-zA-Z0-9]+(?:[-|_|.]+[a-zA-Z0-9]+)*))*\//gm, getPackageMetaFromModulePath = (modulePath)=>{
|
|
1209
|
+
let paths = modulePath.match(MODULE_PATH_PACKAGES);
|
|
1210
|
+
if (!paths) return {
|
|
1211
|
+
name: '',
|
|
1212
|
+
version: ''
|
|
1213
|
+
};
|
|
1214
|
+
let names = ((data)=>{
|
|
1215
|
+
let res = [];
|
|
1216
|
+
return data.forEach((item, index)=>{
|
|
1217
|
+
data.slice(index + 1).includes(item) || res.push(item);
|
|
1218
|
+
}), res;
|
|
1219
|
+
})(paths.flatMap((packagePath)=>{
|
|
1220
|
+
let found = packagePath.matchAll(PACKAGE_PATH_NAME);
|
|
1221
|
+
return found ? compact([
|
|
1222
|
+
...found
|
|
1223
|
+
].flat()).slice(1).filter(Boolean).map((name)=>name.replace(/\+/g, '/')) : [];
|
|
1224
|
+
}));
|
|
1225
|
+
if (isEmpty(names)) return {
|
|
1226
|
+
name: '',
|
|
1227
|
+
version: ''
|
|
1228
|
+
};
|
|
1229
|
+
let name = last(names), pattern = RegExp(`(.*)(${last(paths)}).*`), path = modulePath.replace(pattern, '$1$2').replace(/\/$/, '');
|
|
1230
|
+
return {
|
|
1231
|
+
name,
|
|
1232
|
+
version: path && name && path.match(RegExp(`${name}@([\\d.]+)`))?.flat().slice(1)?.[0] || ''
|
|
1233
|
+
};
|
|
1234
|
+
};
|
|
1235
|
+
function writeMcpPort(port, builderName) {
|
|
1236
|
+
let homeDir = os.homedir(), rsdoctorDir = path_0.join(homeDir, '.cache/rsdoctor'), mcpPortFilePath = path_0.join(rsdoctorDir, 'mcp.json');
|
|
1237
|
+
fs.existsSync(rsdoctorDir) || fs.mkdirSync(rsdoctorDir, {
|
|
1238
|
+
recursive: !0
|
|
1239
|
+
});
|
|
1240
|
+
let mcpJson = {
|
|
1241
|
+
portList: {},
|
|
1242
|
+
port: 0
|
|
1243
|
+
};
|
|
1244
|
+
if (fs.existsSync(mcpPortFilePath)) try {
|
|
1245
|
+
mcpJson = JSON.parse(fs.readFileSync(mcpPortFilePath, 'utf8'));
|
|
1246
|
+
} catch (error) {
|
|
1247
|
+
rsdoctorLogger.debug('Failed to parse mcp.json', error);
|
|
1248
|
+
}
|
|
1249
|
+
mcpJson.portList || (mcpJson.portList = {}), mcpJson.portList[builderName || 'builder'] = port, mcpJson.port = port, fs.writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
|
|
1250
|
+
}
|
|
1251
|
+
function getMcpConfigPath() {
|
|
1252
|
+
let homeDir = os.homedir(), rsdoctorDir = path_0.join(homeDir, '.cache/rsdoctor');
|
|
1253
|
+
return path_0.join(rsdoctorDir, 'mcp.json');
|
|
1254
|
+
}
|
|
1255
|
+
export { alerts_namespaceObject as Alerts, algorithm_namespaceObject as Algorithm, bundle_namespaceObject as Bundle, crypto_namespaceObject as Crypto, data_namespaceObject as Data, file_namespaceObject as File, global_config_namespaceObject as GlobalConfig, graph_namespaceObject as Graph, loader_namespaceObject as Loader, lodash_namespaceObject as Lodash, manifest_namespaceObject as Manifest, package_namespaceObject as Package, plugin_namespaceObject as Plugin, resolver_namespaceObject as Resolver, rspack_namespaceObject as Rspack, summary_namespaceObject as Summary, time_namespaceObject as Time, url_namespaceObject as Url };
|