@rsdoctor/utils 1.1.10 → 1.2.0-beta.1
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/cjs/build/envinfo.js +107 -95
- package/dist/cjs/build/file/cache.js +65 -56
- package/dist/cjs/build/file/index.js +78 -41
- package/dist/cjs/build/file/sharding.js +90 -78
- package/dist/cjs/build/index.js +49 -47
- package/dist/cjs/build/json.js +91 -98
- package/dist/cjs/build/process.js +47 -42
- package/dist/cjs/build/server.js +110 -87
- package/dist/cjs/common/alerts.js +46 -44
- package/dist/cjs/common/algorithm.js +63 -54
- package/dist/cjs/common/bundle.js +52 -46
- package/dist/cjs/common/crypto.js +47 -46
- package/dist/cjs/common/data/index.js +381 -455
- package/dist/cjs/common/file.js +44 -0
- package/dist/cjs/common/global-config.js +72 -64
- package/dist/cjs/common/graph/assets.js +274 -308
- package/dist/cjs/common/graph/chunk.js +66 -63
- package/dist/cjs/common/graph/dependency.js +42 -32
- package/dist/cjs/common/graph/entrypoints.js +33 -25
- package/dist/cjs/common/graph/index.js +93 -27
- package/dist/cjs/common/graph/modules.js +113 -98
- package/dist/cjs/common/index.js +101 -83
- package/dist/cjs/common/loader.js +277 -273
- package/dist/cjs/common/lodash.js +73 -62
- package/dist/cjs/common/manifest.js +57 -59
- package/dist/cjs/common/package.js +79 -80
- package/dist/cjs/common/plugin.js +78 -73
- package/dist/cjs/common/resolver.js +79 -69
- package/dist/cjs/common/rspack.js +43 -34
- package/dist/cjs/common/summary.js +39 -31
- package/dist/cjs/common/time.js +73 -78
- package/dist/cjs/common/url.js +44 -36
- package/dist/cjs/error/error.js +183 -220
- package/dist/cjs/error/index.js +70 -28
- package/dist/cjs/error/transform.js +150 -143
- package/dist/cjs/error/utils.js +54 -58
- package/dist/cjs/index.js +37 -38
- package/dist/cjs/logger.js +99 -73
- package/dist/cjs/rule-utils/document/document.js +83 -82
- package/dist/cjs/rule-utils/document/index.js +75 -23
- package/dist/cjs/rule-utils/document/server.js +42 -35
- package/dist/cjs/rule-utils/document/types.js +17 -15
- package/dist/cjs/rule-utils/index.js +66 -21
- package/dist/cjs/rule-utils/parser/asserts.js +129 -147
- package/dist/cjs/rule-utils/parser/index.js +84 -25
- package/dist/cjs/rule-utils/parser/parser.js +50 -85
- package/dist/cjs/rule-utils/parser/types.js +38 -30
- package/dist/cjs/rule-utils/parser/utils.js +141 -168
- package/dist/esm/build/envinfo.mjs +57 -0
- package/dist/esm/build/file/cache.mjs +23 -0
- package/dist/esm/build/file/index.mjs +4 -0
- package/dist/esm/build/file/sharding.mjs +50 -0
- package/dist/esm/build/index.mjs +6 -0
- package/dist/esm/build/json.mjs +66 -0
- package/dist/esm/build/process.mjs +17 -0
- package/dist/esm/build/server.mjs +96 -0
- package/dist/esm/common/alerts.mjs +17 -0
- package/dist/esm/common/algorithm.mjs +32 -0
- package/dist/esm/common/bundle.mjs +22 -0
- package/dist/esm/common/crypto.mjs +17 -0
- package/dist/esm/common/data/index.mjs +354 -0
- package/dist/esm/common/file.mjs +7 -0
- package/dist/esm/common/global-config.mjs +32 -0
- package/dist/esm/common/graph/assets.mjs +238 -0
- package/dist/esm/common/graph/chunk.mjs +32 -0
- package/dist/esm/common/graph/dependency.mjs +10 -0
- package/dist/esm/common/graph/entrypoints.mjs +4 -0
- package/dist/esm/common/graph/index.mjs +5 -0
- package/dist/esm/common/graph/modules.mjs +78 -0
- package/dist/esm/common/index.mjs +19 -0
- package/dist/esm/common/loader.mjs +247 -0
- package/dist/esm/common/lodash.mjs +32 -0
- package/dist/esm/common/manifest.mjs +30 -0
- package/dist/esm/common/package.mjs +56 -0
- package/dist/esm/common/plugin.mjs +48 -0
- package/dist/esm/common/resolver.mjs +46 -0
- package/dist/esm/common/rspack.mjs +9 -0
- package/dist/esm/common/summary.mjs +8 -0
- package/dist/esm/common/time.mjs +43 -0
- package/dist/esm/common/url.mjs +14 -0
- package/dist/esm/error/error.mjs +154 -0
- package/dist/esm/error/index.mjs +3 -0
- package/dist/esm/error/transform.mjs +138 -0
- package/dist/esm/error/utils.mjs +22 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/logger.mjs +50 -0
- package/dist/esm/rule-utils/document/document.mjs +58 -0
- package/dist/esm/rule-utils/document/index.mjs +3 -0
- package/dist/esm/rule-utils/document/server.mjs +12 -0
- package/dist/esm/rule-utils/index.mjs +2 -0
- package/dist/esm/rule-utils/parser/asserts.mjs +104 -0
- package/dist/esm/rule-utils/parser/index.mjs +4 -0
- package/dist/esm/rule-utils/parser/parser.mjs +23 -0
- package/dist/esm/rule-utils/parser/types.mjs +7 -0
- package/dist/esm/rule-utils/parser/utils.mjs +109 -0
- package/dist/type/common/file.d.ts +3 -0
- package/dist/type/common/file.d.ts.map +1 -0
- package/dist/type/common/graph/modules.d.ts +1 -1
- package/dist/type/common/graph/modules.d.ts.map +1 -1
- package/dist/type/common/index.d.ts +1 -0
- package/dist/type/common/index.d.ts.map +1 -1
- package/dist/type/logger.d.ts +3 -1
- package/dist/type/logger.d.ts.map +1 -1
- package/package.json +13 -12
- package/dist/esm/build/envinfo.js +0 -75
- package/dist/esm/build/file/cache.js +0 -30
- package/dist/esm/build/file/index.js +0 -7
- package/dist/esm/build/file/sharding.js +0 -50
- package/dist/esm/build/index.js +0 -12
- package/dist/esm/build/json.js +0 -85
- package/dist/esm/build/process.js +0 -24
- package/dist/esm/build/server.js +0 -96
- package/dist/esm/common/alerts.js +0 -25
- package/dist/esm/common/algorithm.js +0 -39
- package/dist/esm/common/bundle.js +0 -30
- package/dist/esm/common/crypto.js +0 -28
- package/dist/esm/common/data/index.js +0 -428
- package/dist/esm/common/global-config.js +0 -38
- package/dist/esm/common/graph/assets.js +0 -310
- package/dist/esm/common/graph/chunk.js +0 -49
- package/dist/esm/common/graph/dependency.js +0 -14
- package/dist/esm/common/graph/entrypoints.js +0 -6
- package/dist/esm/common/graph/index.js +0 -5
- package/dist/esm/common/graph/modules.js +0 -90
- package/dist/esm/common/index.js +0 -36
- package/dist/esm/common/loader.js +0 -279
- package/dist/esm/common/lodash.js +0 -49
- package/dist/esm/common/manifest.js +0 -46
- package/dist/esm/common/package.js +0 -71
- package/dist/esm/common/plugin.js +0 -59
- package/dist/esm/common/resolver.js +0 -54
- package/dist/esm/common/rspack.js +0 -12
- package/dist/esm/common/summary.js +0 -10
- package/dist/esm/common/time.js +0 -64
- package/dist/esm/common/url.js +0 -20
- package/dist/esm/error/error.js +0 -202
- package/dist/esm/error/index.js +0 -5
- package/dist/esm/error/transform.js +0 -141
- package/dist/esm/error/utils.js +0 -40
- package/dist/esm/index.js +0 -6
- package/dist/esm/logger.js +0 -44
- package/dist/esm/rule-utils/document/document.js +0 -67
- package/dist/esm/rule-utils/document/index.js +0 -3
- package/dist/esm/rule-utils/document/server.js +0 -17
- package/dist/esm/rule-utils/index.js +0 -2
- package/dist/esm/rule-utils/parser/asserts.js +0 -132
- package/dist/esm/rule-utils/parser/index.js +0 -4
- package/dist/esm/rule-utils/parser/parser.js +0 -58
- package/dist/esm/rule-utils/parser/types.js +0 -9
- package/dist/esm/rule-utils/parser/utils.js +0 -164
- /package/dist/esm/rule-utils/document/{types.js → types.mjs} +0 -0
|
@@ -1,462 +1,388 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var data_exports = {};
|
|
30
|
-
__export(data_exports, {
|
|
31
|
-
APIDataLoader: () => APIDataLoader
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
APIDataLoader: ()=>APIDataLoader
|
|
32
28
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
|
+
const external_loader_js_namespaceObject = require("../loader.js");
|
|
31
|
+
const external_resolver_js_namespaceObject = require("../resolver.js");
|
|
32
|
+
const external_plugin_js_namespaceObject = require("../plugin.js");
|
|
33
|
+
const index_js_namespaceObject = require("../graph/index.js");
|
|
34
|
+
const external_alerts_js_namespaceObject = require("../alerts.js");
|
|
35
|
+
const external_path_namespaceObject = require("path");
|
|
36
|
+
function _define_property(obj, key, value) {
|
|
37
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
38
|
+
value: value,
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true
|
|
42
|
+
});
|
|
43
|
+
else obj[key] = value;
|
|
44
|
+
return obj;
|
|
45
|
+
}
|
|
41
46
|
class APIDataLoader {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return enableRoutes;
|
|
75
|
-
});
|
|
76
|
-
case import_types.SDK.ServerAPI.API.GetLoaderNames:
|
|
77
|
-
return this.loader.loadData("loader").then((res) => {
|
|
78
|
-
return Loader.getLoaderNames(res || []);
|
|
79
|
-
});
|
|
80
|
-
case import_types.SDK.ServerAPI.API.GetLayers:
|
|
81
|
-
return this.loader.loadData("moduleGraph").then((res) => {
|
|
82
|
-
const { layers } = res || {};
|
|
83
|
-
return layers;
|
|
84
|
-
});
|
|
85
|
-
case import_types.SDK.ServerAPI.API.GetLoaderChartData:
|
|
86
|
-
return this.loader.loadData("loader").then((res) => {
|
|
87
|
-
return Loader.getLoaderChartData(res || []);
|
|
88
|
-
});
|
|
89
|
-
case import_types.SDK.ServerAPI.API.GetLoaderFileTree:
|
|
90
|
-
return this.loader.loadData("loader").then((res) => {
|
|
91
|
-
return Loader.getLoaderFileTree(res || []);
|
|
92
|
-
});
|
|
93
|
-
case import_types.SDK.ServerAPI.API.GetLoaderFileDetails:
|
|
94
|
-
return this.loader.loadData("loader").then((res) => {
|
|
95
|
-
return Loader.getLoaderFileDetails(
|
|
96
|
-
body.path,
|
|
97
|
-
res || []
|
|
98
|
-
);
|
|
99
|
-
});
|
|
100
|
-
case import_types.SDK.ServerAPI.API.GetLoaderFolderStatistics:
|
|
101
|
-
return this.loader.loadData("loader").then((res) => {
|
|
102
|
-
return Loader.getLoaderFolderStatistics(
|
|
103
|
-
body.folder,
|
|
104
|
-
res || []
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
case import_types.SDK.ServerAPI.API.GetLoaderFileFirstInput:
|
|
108
|
-
return this.loader.loadData("loader").then((res) => {
|
|
109
|
-
return Loader.getLoaderFileFirstInput(
|
|
110
|
-
body.file,
|
|
111
|
-
res || []
|
|
112
|
-
);
|
|
113
|
-
});
|
|
114
|
-
case import_types.SDK.ServerAPI.API.GetLoaderFileInputAndOutput:
|
|
115
|
-
return this.loader.loadData("loader").then((res) => {
|
|
116
|
-
return Loader.getLoaderFileFirstInput(
|
|
117
|
-
body.file,
|
|
118
|
-
res || []
|
|
119
|
-
);
|
|
120
|
-
});
|
|
121
|
-
case import_types.SDK.ServerAPI.API.GetResolverFileTree:
|
|
122
|
-
return this.loader.loadData("resolver").then((res) => {
|
|
123
|
-
return Resolver.getResolverFileTree(res || []);
|
|
124
|
-
});
|
|
125
|
-
case import_types.SDK.ServerAPI.API.GetResolverFileDetails:
|
|
126
|
-
return Promise.all([
|
|
127
|
-
this.loader.loadData("resolver"),
|
|
128
|
-
this.loader.loadData("moduleGraph.modules"),
|
|
129
|
-
this.loader.loadData("moduleCodeMap")
|
|
130
|
-
]).then((res) => {
|
|
131
|
-
const resolverData = res[0];
|
|
132
|
-
const modules = res[1];
|
|
133
|
-
const moduleCodeMap = res[2];
|
|
134
|
-
return Resolver.getResolverFileDetails(
|
|
135
|
-
body.filepath,
|
|
136
|
-
resolverData || [],
|
|
137
|
-
modules || [],
|
|
138
|
-
moduleCodeMap || {}
|
|
139
|
-
);
|
|
140
|
-
});
|
|
141
|
-
case import_types.SDK.ServerAPI.API.GetPluginSummary:
|
|
142
|
-
return this.loader.loadData("plugin").then((res) => {
|
|
143
|
-
return Plugin.getPluginSummary(res || {});
|
|
144
|
-
});
|
|
145
|
-
case import_types.SDK.ServerAPI.API.GetPluginData:
|
|
146
|
-
return this.loader.loadData("plugin").then((res) => {
|
|
147
|
-
const { hooks, tapNames } = body;
|
|
148
|
-
return Plugin.getPluginData(res || {}, hooks, tapNames);
|
|
149
|
-
});
|
|
150
|
-
case import_types.SDK.ServerAPI.API.GetAssetsSummary:
|
|
151
|
-
return this.loader.loadData("chunkGraph").then((res) => {
|
|
152
|
-
const { withFileContent = true } = body;
|
|
153
|
-
const { assets = [], chunks = [] } = res || {};
|
|
154
|
-
return Graph.getAssetsSummary(assets, chunks, {
|
|
155
|
-
withFileContent
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
case import_types.SDK.ServerAPI.API.GetAssetDetails:
|
|
159
|
-
return Promise.all([
|
|
160
|
-
this.loader.loadData("chunkGraph"),
|
|
161
|
-
this.loader.loadData("moduleGraph")
|
|
162
|
-
]).then((res) => {
|
|
163
|
-
const { assetPath } = body;
|
|
164
|
-
const { assets = [], chunks = [] } = res[0] || {};
|
|
165
|
-
const { modules = [] } = res[1] || {};
|
|
166
|
-
return Graph.getAssetDetails(assetPath, assets, chunks, modules);
|
|
167
|
-
});
|
|
168
|
-
case import_types.SDK.ServerAPI.API.GetSummaryBundles:
|
|
169
|
-
return Promise.all([
|
|
170
|
-
this.loader.loadData("chunkGraph"),
|
|
171
|
-
this.loader.loadData("moduleGraph")
|
|
172
|
-
]).then((res) => {
|
|
173
|
-
const { assets = [], chunks = [] } = res[0] || {};
|
|
174
|
-
const { modules = [] } = res[1] || {};
|
|
175
|
-
return Graph.getAllBundleData(assets, chunks, modules, [
|
|
176
|
-
"id",
|
|
177
|
-
"path",
|
|
178
|
-
"size",
|
|
179
|
-
"kind"
|
|
180
|
-
]);
|
|
181
|
-
});
|
|
182
|
-
case import_types.SDK.ServerAPI.API.GetChunksByModuleId:
|
|
183
|
-
return Promise.all([
|
|
184
|
-
this.loader.loadData("chunkGraph"),
|
|
185
|
-
this.loader.loadData("moduleGraph")
|
|
186
|
-
]).then((res) => {
|
|
187
|
-
const { moduleId } = body;
|
|
188
|
-
const { chunks = [] } = res[0] || {};
|
|
189
|
-
const { modules = [] } = res[1] || {};
|
|
190
|
-
return Graph.getChunksByModuleId(moduleId, modules, chunks);
|
|
191
|
-
});
|
|
192
|
-
case import_types.SDK.ServerAPI.API.GetModuleDetails:
|
|
193
|
-
return Promise.all([
|
|
194
|
-
this.loader.loadData("chunkGraph"),
|
|
195
|
-
this.loader.loadData("moduleGraph")
|
|
196
|
-
]).then((res) => {
|
|
197
|
-
const { moduleId } = body;
|
|
198
|
-
const { modules = [], dependencies = [] } = res[1] || {};
|
|
199
|
-
return Graph.getModuleDetails(moduleId, modules, dependencies);
|
|
200
|
-
});
|
|
201
|
-
case import_types.SDK.ServerAPI.API.GetModulesByModuleIds:
|
|
202
|
-
return this.loader.loadData("moduleGraph").then((res) => {
|
|
203
|
-
const { moduleIds } = body;
|
|
204
|
-
const { modules = [] } = res || {};
|
|
205
|
-
return Graph.getModuleIdsByModulesIds(moduleIds, modules);
|
|
206
|
-
});
|
|
207
|
-
case import_types.SDK.ServerAPI.API.GetEntryPoints:
|
|
208
|
-
return Promise.all([this.loader.loadData("chunkGraph")]).then((res) => {
|
|
209
|
-
const [chunkGraph] = res;
|
|
210
|
-
const { entrypoints = [] } = chunkGraph || {};
|
|
211
|
-
return Graph.getEntryPoints(entrypoints);
|
|
212
|
-
});
|
|
213
|
-
case import_types.SDK.ServerAPI.API.GetModuleCodeByModuleId:
|
|
214
|
-
return this.loader.loadData("moduleCodeMap").then((moduleCodeMap) => {
|
|
215
|
-
const { moduleId } = body;
|
|
216
|
-
if (moduleCodeMap) {
|
|
217
|
-
return moduleCodeMap[moduleId];
|
|
218
|
-
}
|
|
219
|
-
return { source: "", transformed: "", parsedSource: "" };
|
|
220
|
-
});
|
|
221
|
-
case import_types.SDK.ServerAPI.API.GetModuleCodeByModuleIds:
|
|
222
|
-
return this.loader.loadData("moduleCodeMap").then((moduleCodeMap) => {
|
|
223
|
-
const { moduleIds } = body;
|
|
224
|
-
const _moduleCodeData = {};
|
|
225
|
-
if (moduleCodeMap) {
|
|
226
|
-
moduleIds.forEach((id) => {
|
|
227
|
-
_moduleCodeData[id] = moduleCodeMap[id];
|
|
228
|
-
});
|
|
229
|
-
return _moduleCodeData;
|
|
230
|
-
}
|
|
231
|
-
return [];
|
|
232
|
-
});
|
|
233
|
-
case import_types.SDK.ServerAPI.API.GetAllModuleGraph:
|
|
234
|
-
return this.loader.loadData("moduleGraph").then((moduleGraph) => {
|
|
235
|
-
return moduleGraph?.modules;
|
|
236
|
-
});
|
|
237
|
-
case import_types.SDK.ServerAPI.API.GetSearchModules:
|
|
238
|
-
return Promise.all([
|
|
239
|
-
this.loader.loadData("moduleGraph"),
|
|
240
|
-
this.loader.loadData("chunkGraph")
|
|
241
|
-
]).then((res) => {
|
|
242
|
-
const [moduleGraph, chunkGraph] = res;
|
|
243
|
-
const { moduleName } = body;
|
|
244
|
-
if (!moduleName)
|
|
245
|
-
return [];
|
|
246
|
-
const assetMap = chunkGraph.chunks.reduce(
|
|
247
|
-
(acc, chunk) => {
|
|
248
|
-
chunk.assets.forEach((asset) => {
|
|
249
|
-
if (!acc[chunk.id]) {
|
|
250
|
-
acc[chunk.id] = [];
|
|
251
|
-
}
|
|
252
|
-
acc[chunk.id].push(asset);
|
|
253
|
-
});
|
|
254
|
-
return acc;
|
|
255
|
-
},
|
|
256
|
-
{}
|
|
257
|
-
);
|
|
258
|
-
const searchedChunksMap = /* @__PURE__ */ new Map();
|
|
259
|
-
moduleGraph?.modules.filter((module2) => {
|
|
260
|
-
if (module2.webpackId.includes(moduleName)) {
|
|
261
|
-
module2.chunks.forEach((chunk) => {
|
|
262
|
-
if (searchedChunksMap.has(chunk)) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
const assets = assetMap[chunk] || [];
|
|
266
|
-
assets.forEach((asset) => {
|
|
267
|
-
if (asset.endsWith(".js")) {
|
|
268
|
-
searchedChunksMap.set(chunk, asset);
|
|
269
|
-
}
|
|
47
|
+
log(...args) {
|
|
48
|
+
console.log(`[${this.constructor.name}]`, ...args);
|
|
49
|
+
}
|
|
50
|
+
loadAPI(...args) {
|
|
51
|
+
const [api, body] = args;
|
|
52
|
+
switch(api){
|
|
53
|
+
case types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey:
|
|
54
|
+
return this.loader.loadData(body.key);
|
|
55
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo:
|
|
56
|
+
return Promise.all([
|
|
57
|
+
this.loader.loadData('root'),
|
|
58
|
+
this.loader.loadData('pid'),
|
|
59
|
+
this.loader.loadData('hash'),
|
|
60
|
+
this.loader.loadData('summary'),
|
|
61
|
+
this.loader.loadData('configs'),
|
|
62
|
+
this.loader.loadData('envinfo'),
|
|
63
|
+
this.loader.loadData('errors')
|
|
64
|
+
]).then(([root, pid, hash, summary, configs, envinfo, errors])=>({
|
|
65
|
+
root,
|
|
66
|
+
pid,
|
|
67
|
+
hash,
|
|
68
|
+
summary,
|
|
69
|
+
configs,
|
|
70
|
+
envinfo,
|
|
71
|
+
errors
|
|
72
|
+
}));
|
|
73
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes:
|
|
74
|
+
var _window;
|
|
75
|
+
if ('undefined' != typeof window && (null == (_window = window) ? void 0 : _window[types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG])) return window[types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG].enableRoutes;
|
|
76
|
+
return this.loader.loadManifest().then((res)=>{
|
|
77
|
+
const { enableRoutes = [] } = res.client || {};
|
|
78
|
+
return enableRoutes;
|
|
270
79
|
});
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
80
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames:
|
|
81
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderNames(res || []));
|
|
82
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLayers:
|
|
83
|
+
return this.loader.loadData('moduleGraph').then((res)=>{
|
|
84
|
+
const { layers } = res || {};
|
|
85
|
+
return layers;
|
|
86
|
+
});
|
|
87
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData:
|
|
88
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderChartData(res || []));
|
|
89
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree:
|
|
90
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileTree(res || []));
|
|
91
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails:
|
|
92
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileDetails(body.path, res || []));
|
|
93
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics:
|
|
94
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFolderStatistics(body.folder, res || []));
|
|
95
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput:
|
|
96
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileFirstInput(body.file, res || []));
|
|
97
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput:
|
|
98
|
+
return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileFirstInput(body.file, res || []));
|
|
99
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree:
|
|
100
|
+
return this.loader.loadData('resolver').then((res)=>external_resolver_js_namespaceObject.getResolverFileTree(res || []));
|
|
101
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails:
|
|
102
|
+
return Promise.all([
|
|
103
|
+
this.loader.loadData('resolver'),
|
|
104
|
+
this.loader.loadData('moduleGraph.modules'),
|
|
105
|
+
this.loader.loadData('moduleCodeMap')
|
|
106
|
+
]).then((res)=>{
|
|
107
|
+
const resolverData = res[0];
|
|
108
|
+
const modules = res[1];
|
|
109
|
+
const moduleCodeMap = res[2];
|
|
110
|
+
return external_resolver_js_namespaceObject.getResolverFileDetails(body.filepath, resolverData || [], modules || [], moduleCodeMap || {});
|
|
111
|
+
});
|
|
112
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary:
|
|
113
|
+
return this.loader.loadData('plugin').then((res)=>external_plugin_js_namespaceObject.getPluginSummary(res || {}));
|
|
114
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetPluginData:
|
|
115
|
+
return this.loader.loadData('plugin').then((res)=>{
|
|
116
|
+
const { hooks, tapNames } = body;
|
|
117
|
+
return external_plugin_js_namespaceObject.getPluginData(res || {}, hooks, tapNames);
|
|
118
|
+
});
|
|
119
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary:
|
|
120
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
121
|
+
const { withFileContent = true } = body;
|
|
122
|
+
const { assets = [], chunks = [] } = res || {};
|
|
123
|
+
return index_js_namespaceObject.getAssetsSummary(assets, chunks, {
|
|
124
|
+
withFileContent
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails:
|
|
128
|
+
return Promise.all([
|
|
129
|
+
this.loader.loadData('chunkGraph'),
|
|
130
|
+
this.loader.loadData('moduleGraph')
|
|
131
|
+
]).then((res)=>{
|
|
132
|
+
const { assetPath } = body;
|
|
133
|
+
const { assets = [], chunks = [] } = res[0] || {};
|
|
134
|
+
const { modules = [] } = res[1] || {};
|
|
135
|
+
return index_js_namespaceObject.getAssetDetails(assetPath, assets, chunks, modules);
|
|
136
|
+
});
|
|
137
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetSummaryBundles:
|
|
138
|
+
return Promise.all([
|
|
139
|
+
this.loader.loadData('chunkGraph'),
|
|
140
|
+
this.loader.loadData('moduleGraph')
|
|
141
|
+
]).then((res)=>{
|
|
142
|
+
const { assets = [], chunks = [] } = res[0] || {};
|
|
143
|
+
const { modules = [] } = res[1] || {};
|
|
144
|
+
return index_js_namespaceObject.getAllBundleData(assets, chunks, modules, [
|
|
145
|
+
'id',
|
|
146
|
+
'path',
|
|
147
|
+
'size',
|
|
148
|
+
'kind'
|
|
149
|
+
]);
|
|
150
|
+
});
|
|
151
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId:
|
|
152
|
+
return Promise.all([
|
|
153
|
+
this.loader.loadData('chunkGraph'),
|
|
154
|
+
this.loader.loadData('moduleGraph')
|
|
155
|
+
]).then((res)=>{
|
|
156
|
+
const { moduleId } = body;
|
|
157
|
+
const { chunks = [] } = res[0] || {};
|
|
158
|
+
const { modules = [] } = res[1] || {};
|
|
159
|
+
return index_js_namespaceObject.getChunksByModuleId(moduleId, modules, chunks);
|
|
160
|
+
});
|
|
161
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails:
|
|
162
|
+
return Promise.all([
|
|
163
|
+
this.loader.loadData('chunkGraph'),
|
|
164
|
+
this.loader.loadData('moduleGraph')
|
|
165
|
+
]).then((res)=>{
|
|
166
|
+
const { moduleId } = body;
|
|
167
|
+
const { modules = [], dependencies = [] } = res[1] || {};
|
|
168
|
+
return index_js_namespaceObject.getModuleDetails(moduleId, modules, dependencies);
|
|
169
|
+
});
|
|
170
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds:
|
|
171
|
+
return this.loader.loadData('moduleGraph').then((res)=>{
|
|
172
|
+
const { moduleIds } = body;
|
|
173
|
+
const { modules = [] } = res || {};
|
|
174
|
+
return index_js_namespaceObject.getModuleIdsByModulesIds(moduleIds, modules);
|
|
175
|
+
});
|
|
176
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints:
|
|
177
|
+
return Promise.all([
|
|
178
|
+
this.loader.loadData('chunkGraph')
|
|
179
|
+
]).then((res)=>{
|
|
180
|
+
const [chunkGraph] = res;
|
|
181
|
+
const { entrypoints = [] } = chunkGraph || {};
|
|
182
|
+
return index_js_namespaceObject.getEntryPoints(entrypoints);
|
|
183
|
+
});
|
|
184
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId:
|
|
185
|
+
return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
|
|
186
|
+
const { moduleId } = body;
|
|
187
|
+
if (moduleCodeMap) return moduleCodeMap[moduleId];
|
|
188
|
+
return {
|
|
189
|
+
source: '',
|
|
190
|
+
transformed: '',
|
|
191
|
+
parsedSource: ''
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds:
|
|
195
|
+
return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
|
|
196
|
+
const { moduleIds } = body;
|
|
197
|
+
const _moduleCodeData = {};
|
|
198
|
+
if (moduleCodeMap) {
|
|
199
|
+
moduleIds.forEach((id)=>{
|
|
200
|
+
_moduleCodeData[id] = moduleCodeMap[id];
|
|
201
|
+
});
|
|
202
|
+
return _moduleCodeData;
|
|
203
|
+
}
|
|
204
|
+
return [];
|
|
205
|
+
});
|
|
206
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetAllModuleGraph:
|
|
207
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>null == moduleGraph ? void 0 : moduleGraph.modules);
|
|
208
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetSearchModules:
|
|
209
|
+
return Promise.all([
|
|
210
|
+
this.loader.loadData('moduleGraph'),
|
|
211
|
+
this.loader.loadData('chunkGraph')
|
|
212
|
+
]).then((res)=>{
|
|
213
|
+
const [moduleGraph, chunkGraph] = res;
|
|
214
|
+
const { moduleName } = body;
|
|
215
|
+
if (!moduleName) return [];
|
|
216
|
+
const assetMap = chunkGraph.chunks.reduce((acc, chunk)=>{
|
|
217
|
+
chunk.assets.forEach((asset)=>{
|
|
218
|
+
if (!acc[chunk.id]) acc[chunk.id] = [];
|
|
219
|
+
acc[chunk.id].push(asset);
|
|
220
|
+
});
|
|
221
|
+
return acc;
|
|
222
|
+
}, {});
|
|
223
|
+
const searchedChunksMap = new Map();
|
|
224
|
+
null == moduleGraph || moduleGraph.modules.filter((module)=>{
|
|
225
|
+
if (module.webpackId.includes(moduleName)) module.chunks.forEach((chunk)=>{
|
|
226
|
+
if (searchedChunksMap.has(chunk)) return;
|
|
227
|
+
const assets = assetMap[chunk] || [];
|
|
228
|
+
assets.forEach((asset)=>{
|
|
229
|
+
if (asset.endsWith('.js')) searchedChunksMap.set(chunk, asset);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
return Object.fromEntries(searchedChunksMap);
|
|
234
|
+
});
|
|
235
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetSearchModuleInChunk:
|
|
236
|
+
return Promise.all([
|
|
237
|
+
this.loader.loadData('moduleGraph'),
|
|
238
|
+
this.loader.loadData('root')
|
|
239
|
+
]).then((res)=>{
|
|
240
|
+
const [moduleGraph, root] = res;
|
|
241
|
+
const { moduleName, chunk } = body;
|
|
242
|
+
if (!moduleName) return [];
|
|
243
|
+
const filteredModules = null == moduleGraph ? void 0 : moduleGraph.modules.filter((module)=>module.webpackId.includes(moduleName) && module.chunks.includes(chunk)).map((filteredModule)=>({
|
|
244
|
+
id: filteredModule.id,
|
|
245
|
+
path: filteredModule.path,
|
|
246
|
+
relativePath: (0, external_path_namespaceObject.relative)(root, filteredModule.path)
|
|
247
|
+
}));
|
|
248
|
+
return filteredModules;
|
|
249
|
+
});
|
|
250
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetAllChunkGraph:
|
|
251
|
+
return this.loader.loadData('chunkGraph').then((chunkGraph)=>null == chunkGraph ? void 0 : chunkGraph.chunks);
|
|
252
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails:
|
|
253
|
+
return Promise.all([
|
|
254
|
+
this.loader.loadData('moduleGraph'),
|
|
255
|
+
this.loader.loadData('errors'),
|
|
256
|
+
this.loader.loadData('root'),
|
|
257
|
+
this.loader.loadData('moduleCodeMap')
|
|
258
|
+
]).then((res)=>{
|
|
259
|
+
const { id, target } = body;
|
|
260
|
+
const [moduleGraph, errors = [], root = '', moduleCodeMap] = res;
|
|
261
|
+
const { modules = [], dependencies = [] } = moduleGraph || {};
|
|
262
|
+
const { packages = [] } = errors.find((e)=>e.id === id) || {};
|
|
263
|
+
const { dependencies: pkgDependencies = [] } = packages.find((e)=>e.target.name === target.name && e.target.root === target.root && e.target.version === target.version) || {};
|
|
264
|
+
return external_alerts_js_namespaceObject.getPackageRelationAlertDetails(modules, dependencies, root, pkgDependencies, moduleCodeMap || {});
|
|
265
|
+
});
|
|
266
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetOverlayAlerts:
|
|
267
|
+
return this.loader.loadData('errors').then((res)=>(res || []).filter((e)=>e.code === types_namespaceObject.Rule.RuleMessageCodeEnumerated.Overlay));
|
|
268
|
+
case types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest:
|
|
269
|
+
return this.loader.loadManifest();
|
|
270
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetBundleDiffSummary:
|
|
271
|
+
return Promise.all([
|
|
272
|
+
this.loader.loadManifest(),
|
|
273
|
+
this.loader.loadData('root'),
|
|
274
|
+
this.loader.loadData('hash'),
|
|
275
|
+
this.loader.loadData('errors'),
|
|
276
|
+
this.loader.loadData('chunkGraph'),
|
|
277
|
+
this.loader.loadData('moduleGraph'),
|
|
278
|
+
this.loader.loadData('moduleCodeMap'),
|
|
279
|
+
this.loader.loadData('packageGraph'),
|
|
280
|
+
this.loader.loadData('configs')
|
|
281
|
+
]).then(([_manifest, root = '', hash = '', errors = {}, chunkGraph = {}, moduleGraph = {}, moduleCodeMap = {}, packageGraph = {}, configs = []])=>{
|
|
282
|
+
var _configs__config_output, _configs__config, _configs_;
|
|
283
|
+
let outputFilename = '';
|
|
284
|
+
if ('string' == typeof (null == (_configs_ = configs[0]) ? void 0 : null == (_configs__config = _configs_.config) ? void 0 : null == (_configs__config_output = _configs__config.output) ? void 0 : _configs__config_output.chunkFilename)) {
|
|
285
|
+
var _configs_1;
|
|
286
|
+
outputFilename = null == (_configs_1 = configs[0]) ? void 0 : _configs_1.config.output.chunkFilename;
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
root,
|
|
290
|
+
hash,
|
|
291
|
+
errors,
|
|
292
|
+
chunkGraph,
|
|
293
|
+
moduleGraph,
|
|
294
|
+
packageGraph,
|
|
295
|
+
outputFilename,
|
|
296
|
+
moduleCodeMap
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetTileReportHtml:
|
|
300
|
+
return this.loader.loadData('otherReports').then((otherReports)=>null == otherReports ? void 0 : otherReports.tileReportHtml);
|
|
301
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetChunkGraph:
|
|
302
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
303
|
+
const { chunks = [] } = res || {};
|
|
304
|
+
return chunks;
|
|
305
|
+
});
|
|
306
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetAllModuleGraphFilter:
|
|
307
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>null == moduleGraph ? void 0 : moduleGraph.modules.map((m)=>({
|
|
308
|
+
id: m.id,
|
|
309
|
+
webpackId: m.webpackId,
|
|
310
|
+
path: m.path,
|
|
311
|
+
size: m.size,
|
|
312
|
+
chunks: m.chunks,
|
|
313
|
+
kind: m.kind
|
|
314
|
+
})));
|
|
315
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModuleByName:
|
|
316
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
|
|
317
|
+
const { moduleName } = body;
|
|
318
|
+
const { modules = [] } = moduleGraph || {};
|
|
319
|
+
return modules.filter((m)=>m.path.includes(moduleName)).map((m)=>({
|
|
320
|
+
id: m.id,
|
|
321
|
+
path: m.path
|
|
322
|
+
})) || [];
|
|
323
|
+
});
|
|
324
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetModuleIssuerPath:
|
|
325
|
+
return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
|
|
326
|
+
var _modules_find;
|
|
327
|
+
const { moduleId } = body;
|
|
328
|
+
const modules = (null == moduleGraph ? void 0 : moduleGraph.modules) || [];
|
|
329
|
+
const issuerPath = (null == (_modules_find = modules.find((m)=>String(m.id) === moduleId)) ? void 0 : _modules_find.issuerPath) || [];
|
|
330
|
+
if (Array.isArray(issuerPath) && issuerPath.length > 0 && 'number' == typeof issuerPath[0]) return issuerPath.map((id)=>{
|
|
331
|
+
var _modules_find;
|
|
332
|
+
return null == (_modules_find = modules.find((m)=>m.id === id)) ? void 0 : _modules_find.path;
|
|
333
|
+
}).filter(Boolean);
|
|
334
|
+
return issuerPath;
|
|
335
|
+
});
|
|
336
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetPackageInfo:
|
|
337
|
+
return this.loader.loadData('packageGraph').then((packageGraph)=>null == packageGraph ? void 0 : packageGraph.packages);
|
|
338
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetPackageDependency:
|
|
339
|
+
return this.loader.loadData('packageGraph').then((packageGraph)=>(null == packageGraph ? void 0 : packageGraph.dependencies) || []);
|
|
340
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetChunkGraphAI:
|
|
341
|
+
return this.loader.loadData('chunkGraph').then((res)=>{
|
|
342
|
+
const { chunks = [] } = res || {};
|
|
343
|
+
const filteredChunks = chunks.map(({ modules, ...rest })=>rest);
|
|
344
|
+
return filteredChunks;
|
|
345
|
+
});
|
|
346
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetChunkByIdAI:
|
|
347
|
+
return Promise.all([
|
|
348
|
+
this.loader.loadData('chunkGraph'),
|
|
349
|
+
this.loader.loadData('moduleGraph')
|
|
350
|
+
]).then(([chunkGraph, moduleGraph])=>{
|
|
351
|
+
const { chunks = [] } = chunkGraph || {};
|
|
352
|
+
const { modules = [] } = moduleGraph || {};
|
|
353
|
+
const { chunkId } = body;
|
|
354
|
+
const chunkInfo = chunks.find((c)=>c.id === chunkId);
|
|
355
|
+
if (!chunkInfo) return null;
|
|
356
|
+
const chunkModules = modules.filter((m)=>chunkInfo.modules.includes(m.id)).map((module)=>({
|
|
357
|
+
id: module.id,
|
|
358
|
+
path: module.path,
|
|
359
|
+
size: module.size,
|
|
360
|
+
chunks: module.chunks,
|
|
361
|
+
kind: module.kind,
|
|
362
|
+
issuerPath: module.issuerPath
|
|
363
|
+
}));
|
|
364
|
+
chunkInfo.modulesInfo = chunkModules;
|
|
365
|
+
return chunkInfo;
|
|
366
|
+
});
|
|
367
|
+
case types_namespaceObject.SDK.ServerAPI.API.GetDirectoriesLoaders:
|
|
368
|
+
return Promise.all([
|
|
369
|
+
this.loader.loadData('root'),
|
|
370
|
+
this.loader.loadData('loader')
|
|
371
|
+
]).then(([root, loaders])=>external_loader_js_namespaceObject.getDirectoriesLoaders(loaders || [], root || ''));
|
|
372
|
+
default:
|
|
373
|
+
throw new Error(`API not implement: "${api}"`);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
constructor(loader){
|
|
377
|
+
_define_property(this, "loader", void 0);
|
|
378
|
+
this.loader = loader;
|
|
379
|
+
this.loadAPI = this.loadAPI.bind(this);
|
|
456
380
|
}
|
|
457
|
-
}
|
|
458
381
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
382
|
+
exports.APIDataLoader = __webpack_exports__.APIDataLoader;
|
|
383
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
384
|
+
"APIDataLoader"
|
|
385
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
386
|
+
Object.defineProperty(exports, '__esModule', {
|
|
387
|
+
value: true
|
|
462
388
|
});
|