@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.
Files changed (211) hide show
  1. package/compiled/connect/index.d.ts +90 -0
  2. package/compiled/connect/index.js +2427 -0
  3. package/compiled/connect/license +25 -0
  4. package/compiled/connect/package.json +1 -0
  5. package/compiled/filesize/index.d.ts +58 -0
  6. package/compiled/filesize/index.js +255 -0
  7. package/compiled/filesize/license +28 -0
  8. package/compiled/filesize/package.json +1 -0
  9. package/dist/{type/build → build}/envinfo.d.ts +0 -1
  10. package/dist/{type/build → build}/file/cache.d.ts +0 -1
  11. package/dist/build/file/index.d.ts +3 -0
  12. package/dist/{type/build → build}/file/sharding.d.ts +0 -1
  13. package/dist/{type/build → build}/index.d.ts +0 -1
  14. package/dist/{type/build → build}/json.d.ts +0 -1
  15. package/dist/{type/build → build}/process.d.ts +0 -1
  16. package/dist/{type/build → build}/server.d.ts +0 -1
  17. package/dist/build.cjs +1310 -0
  18. package/dist/build.js +343 -0
  19. package/dist/{type/common → common}/alerts.d.ts +0 -1
  20. package/dist/{type/common → common}/algorithm.d.ts +0 -1
  21. package/dist/{type/common → common}/bundle.d.ts +0 -1
  22. package/dist/{type/common → common}/crypto.d.ts +0 -1
  23. package/dist/{type/common → common}/data/index.d.ts +0 -1
  24. package/dist/{type/common → common}/file.d.ts +0 -1
  25. package/dist/{type/common → common}/global-config.d.ts +0 -1
  26. package/dist/{type/common → common}/graph/assets.d.ts +0 -1
  27. package/dist/{type/common → common}/graph/chunk.d.ts +0 -1
  28. package/dist/{type/common → common}/graph/dependency.d.ts +0 -1
  29. package/dist/{type/common → common}/graph/entrypoints.d.ts +0 -1
  30. package/dist/{type/common → common}/graph/index.d.ts +0 -1
  31. package/dist/{type/common → common}/graph/modules.d.ts +0 -1
  32. package/dist/{type/common → common}/index.d.ts +0 -1
  33. package/dist/{type/common → common}/loader.d.ts +0 -1
  34. package/dist/{type/common → common}/lodash.d.ts +0 -1
  35. package/dist/{type/common → common}/manifest.d.ts +0 -1
  36. package/dist/{type/common → common}/package.d.ts +0 -1
  37. package/dist/{type/common → common}/plugin.d.ts +0 -1
  38. package/dist/{type/common → common}/resolver.d.ts +0 -1
  39. package/dist/{type/common → common}/rspack.d.ts +0 -1
  40. package/dist/{type/common → common}/summary.d.ts +0 -1
  41. package/dist/{type/common → common}/time.d.ts +0 -1
  42. package/dist/{type/common → common}/url.d.ts +0 -1
  43. package/dist/common.cjs +1328 -0
  44. package/dist/common.js +1255 -0
  45. package/dist/{type/error → error}/error.d.ts +0 -1
  46. package/dist/{type/error → error}/index.d.ts +0 -1
  47. package/dist/{type/error → error}/transform.d.ts +0 -1
  48. package/dist/{type/error → error}/utils.d.ts +0 -1
  49. package/dist/error.cjs +310 -0
  50. package/dist/error.js +232 -0
  51. package/dist/logger.cjs +82 -0
  52. package/dist/{type/logger.d.ts → logger.d.ts} +0 -1
  53. package/dist/{esm/logger.mjs → logger.js} +8 -13
  54. package/dist/{type/rule-utils → rule-utils}/document/document.d.ts +0 -1
  55. package/dist/{type/rule-utils → rule-utils}/document/index.d.ts +0 -1
  56. package/dist/{type/rule-utils → rule-utils}/document/server.d.ts +0 -1
  57. package/dist/{type/rule-utils → rule-utils}/document/types.d.ts +0 -1
  58. package/dist/{type/rule-utils → rule-utils}/index.d.ts +0 -1
  59. package/dist/{type/rule-utils → rule-utils}/parser/asserts.d.ts +0 -1
  60. package/dist/{type/rule-utils → rule-utils}/parser/index.d.ts +0 -1
  61. package/dist/{type/rule-utils → rule-utils}/parser/parser.d.ts +0 -1
  62. package/dist/{type/rule-utils → rule-utils}/parser/types.d.ts +0 -1
  63. package/dist/{type/rule-utils → rule-utils}/parser/utils.d.ts +0 -1
  64. package/dist/ruleUtils.cjs +320 -0
  65. package/dist/ruleUtils.js +256 -0
  66. package/package.json +35 -39
  67. package/dist/cjs/build/envinfo.js +0 -121
  68. package/dist/cjs/build/file/cache.js +0 -76
  69. package/dist/cjs/build/file/index.js +0 -81
  70. package/dist/cjs/build/file/sharding.js +0 -96
  71. package/dist/cjs/build/index.js +0 -52
  72. package/dist/cjs/build/json.js +0 -103
  73. package/dist/cjs/build/process.js +0 -54
  74. package/dist/cjs/build/server.js +0 -158
  75. package/dist/cjs/common/alerts.js +0 -51
  76. package/dist/cjs/common/algorithm.js +0 -75
  77. package/dist/cjs/common/bundle.js +0 -62
  78. package/dist/cjs/common/crypto.js +0 -54
  79. package/dist/cjs/common/data/index.js +0 -396
  80. package/dist/cjs/common/file.js +0 -44
  81. package/dist/cjs/common/global-config.js +0 -81
  82. package/dist/cjs/common/graph/assets.js +0 -314
  83. package/dist/cjs/common/graph/chunk.js +0 -81
  84. package/dist/cjs/common/graph/dependency.js +0 -50
  85. package/dist/cjs/common/graph/entrypoints.js +0 -38
  86. package/dist/cjs/common/graph/index.js +0 -96
  87. package/dist/cjs/common/graph/modules.js +0 -133
  88. package/dist/cjs/common/index.js +0 -104
  89. package/dist/cjs/common/loader.js +0 -320
  90. package/dist/cjs/common/lodash.js +0 -93
  91. package/dist/cjs/common/manifest.js +0 -70
  92. package/dist/cjs/common/package.js +0 -96
  93. package/dist/cjs/common/plugin.js +0 -91
  94. package/dist/cjs/common/resolver.js +0 -92
  95. package/dist/cjs/common/rspack.js +0 -65
  96. package/dist/cjs/common/summary.js +0 -42
  97. package/dist/cjs/common/time.js +0 -86
  98. package/dist/cjs/common/url.js +0 -54
  99. package/dist/cjs/error/error.js +0 -199
  100. package/dist/cjs/error/index.js +0 -73
  101. package/dist/cjs/error/transform.js +0 -182
  102. package/dist/cjs/error/utils.js +0 -62
  103. package/dist/cjs/index.js +0 -40
  104. package/dist/cjs/logger.js +0 -106
  105. package/dist/cjs/rule-utils/document/document.js +0 -92
  106. package/dist/cjs/rule-utils/document/index.js +0 -78
  107. package/dist/cjs/rule-utils/document/server.js +0 -49
  108. package/dist/cjs/rule-utils/document/types.js +0 -18
  109. package/dist/cjs/rule-utils/index.js +0 -69
  110. package/dist/cjs/rule-utils/parser/asserts.js +0 -138
  111. package/dist/cjs/rule-utils/parser/index.js +0 -87
  112. package/dist/cjs/rule-utils/parser/parser.js +0 -57
  113. package/dist/cjs/rule-utils/parser/types.js +0 -41
  114. package/dist/cjs/rule-utils/parser/utils.js +0 -170
  115. package/dist/esm/build/envinfo.mjs +0 -57
  116. package/dist/esm/build/file/cache.mjs +0 -23
  117. package/dist/esm/build/file/index.mjs +0 -4
  118. package/dist/esm/build/file/sharding.mjs +0 -50
  119. package/dist/esm/build/index.mjs +0 -6
  120. package/dist/esm/build/json.mjs +0 -66
  121. package/dist/esm/build/process.mjs +0 -17
  122. package/dist/esm/build/server.mjs +0 -96
  123. package/dist/esm/common/alerts.mjs +0 -17
  124. package/dist/esm/common/algorithm.mjs +0 -32
  125. package/dist/esm/common/bundle.mjs +0 -22
  126. package/dist/esm/common/crypto.mjs +0 -17
  127. package/dist/esm/common/data/index.mjs +0 -362
  128. package/dist/esm/common/file.mjs +0 -7
  129. package/dist/esm/common/global-config.mjs +0 -32
  130. package/dist/esm/common/graph/assets.mjs +0 -238
  131. package/dist/esm/common/graph/chunk.mjs +0 -32
  132. package/dist/esm/common/graph/dependency.mjs +0 -10
  133. package/dist/esm/common/graph/entrypoints.mjs +0 -4
  134. package/dist/esm/common/graph/index.mjs +0 -5
  135. package/dist/esm/common/graph/modules.mjs +0 -78
  136. package/dist/esm/common/index.mjs +0 -19
  137. package/dist/esm/common/loader.mjs +0 -247
  138. package/dist/esm/common/lodash.mjs +0 -32
  139. package/dist/esm/common/manifest.mjs +0 -30
  140. package/dist/esm/common/package.mjs +0 -56
  141. package/dist/esm/common/plugin.mjs +0 -48
  142. package/dist/esm/common/resolver.mjs +0 -46
  143. package/dist/esm/common/rspack.mjs +0 -25
  144. package/dist/esm/common/summary.mjs +0 -8
  145. package/dist/esm/common/time.mjs +0 -43
  146. package/dist/esm/common/url.mjs +0 -14
  147. package/dist/esm/error/error.mjs +0 -154
  148. package/dist/esm/error/index.mjs +0 -3
  149. package/dist/esm/error/transform.mjs +0 -138
  150. package/dist/esm/error/utils.mjs +0 -22
  151. package/dist/esm/index.mjs +0 -3
  152. package/dist/esm/rule-utils/document/document.mjs +0 -58
  153. package/dist/esm/rule-utils/document/index.mjs +0 -3
  154. package/dist/esm/rule-utils/document/server.mjs +0 -12
  155. package/dist/esm/rule-utils/document/types.mjs +0 -0
  156. package/dist/esm/rule-utils/index.mjs +0 -2
  157. package/dist/esm/rule-utils/parser/asserts.mjs +0 -104
  158. package/dist/esm/rule-utils/parser/index.mjs +0 -4
  159. package/dist/esm/rule-utils/parser/parser.mjs +0 -23
  160. package/dist/esm/rule-utils/parser/types.mjs +0 -7
  161. package/dist/esm/rule-utils/parser/utils.mjs +0 -109
  162. package/dist/type/build/envinfo.d.ts.map +0 -1
  163. package/dist/type/build/file/cache.d.ts.map +0 -1
  164. package/dist/type/build/file/index.d.ts +0 -4
  165. package/dist/type/build/file/index.d.ts.map +0 -1
  166. package/dist/type/build/file/sharding.d.ts.map +0 -1
  167. package/dist/type/build/index.d.ts.map +0 -1
  168. package/dist/type/build/json.d.ts.map +0 -1
  169. package/dist/type/build/process.d.ts.map +0 -1
  170. package/dist/type/build/server.d.ts.map +0 -1
  171. package/dist/type/common/alerts.d.ts.map +0 -1
  172. package/dist/type/common/algorithm.d.ts.map +0 -1
  173. package/dist/type/common/bundle.d.ts.map +0 -1
  174. package/dist/type/common/crypto.d.ts.map +0 -1
  175. package/dist/type/common/data/index.d.ts.map +0 -1
  176. package/dist/type/common/file.d.ts.map +0 -1
  177. package/dist/type/common/global-config.d.ts.map +0 -1
  178. package/dist/type/common/graph/assets.d.ts.map +0 -1
  179. package/dist/type/common/graph/chunk.d.ts.map +0 -1
  180. package/dist/type/common/graph/dependency.d.ts.map +0 -1
  181. package/dist/type/common/graph/entrypoints.d.ts.map +0 -1
  182. package/dist/type/common/graph/index.d.ts.map +0 -1
  183. package/dist/type/common/graph/modules.d.ts.map +0 -1
  184. package/dist/type/common/index.d.ts.map +0 -1
  185. package/dist/type/common/loader.d.ts.map +0 -1
  186. package/dist/type/common/lodash.d.ts.map +0 -1
  187. package/dist/type/common/manifest.d.ts.map +0 -1
  188. package/dist/type/common/package.d.ts.map +0 -1
  189. package/dist/type/common/plugin.d.ts.map +0 -1
  190. package/dist/type/common/resolver.d.ts.map +0 -1
  191. package/dist/type/common/rspack.d.ts.map +0 -1
  192. package/dist/type/common/summary.d.ts.map +0 -1
  193. package/dist/type/common/time.d.ts.map +0 -1
  194. package/dist/type/common/url.d.ts.map +0 -1
  195. package/dist/type/error/error.d.ts.map +0 -1
  196. package/dist/type/error/index.d.ts.map +0 -1
  197. package/dist/type/error/transform.d.ts.map +0 -1
  198. package/dist/type/error/utils.d.ts.map +0 -1
  199. package/dist/type/index.d.ts +0 -3
  200. package/dist/type/index.d.ts.map +0 -1
  201. package/dist/type/logger.d.ts.map +0 -1
  202. package/dist/type/rule-utils/document/document.d.ts.map +0 -1
  203. package/dist/type/rule-utils/document/index.d.ts.map +0 -1
  204. package/dist/type/rule-utils/document/server.d.ts.map +0 -1
  205. package/dist/type/rule-utils/document/types.d.ts.map +0 -1
  206. package/dist/type/rule-utils/index.d.ts.map +0 -1
  207. package/dist/type/rule-utils/parser/asserts.d.ts.map +0 -1
  208. package/dist/type/rule-utils/parser/index.d.ts.map +0 -1
  209. package/dist/type/rule-utils/parser/parser.d.ts.map +0 -1
  210. package/dist/type/rule-utils/parser/types.d.ts.map +0 -1
  211. package/dist/type/rule-utils/parser/utils.d.ts.map +0 -1
@@ -1,62 +0,0 @@
1
- "use strict";
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
- parseFilesFromBundlePageUrlQuery: ()=>parseFilesFromBundlePageUrlQuery,
28
- getBundleDiffPageUrl: ()=>getBundleDiffPageUrl,
29
- getBundleDiffPageQueryString: ()=>getBundleDiffPageQueryString
30
- });
31
- const types_namespaceObject = require("@rsdoctor/types");
32
- const sep = ',';
33
- function getBundleDiffPageQueryString(files) {
34
- let qs = encodeURIComponent(files.join(sep));
35
- if (qs) qs = `?${types_namespaceObject.Client.RsdoctorClientUrlQuery.BundleDiffFiles}=${qs}`;
36
- return qs;
37
- }
38
- function getBundleDiffPageUrl(files) {
39
- let qs = getBundleDiffPageQueryString(files);
40
- if ('development' === process.env.NODE_ENV) {
41
- if ('undefined' != typeof location) {
42
- const { search = '', origin } = location;
43
- if (search) qs += `&${search.slice(1)}`;
44
- return `${origin}${qs}#${types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff}`;
45
- }
46
- }
47
- return `${qs}#${types_namespaceObject.Client.RsdoctorClientRoutes.BundleDiff}`;
48
- }
49
- function parseFilesFromBundlePageUrlQuery(queryValue) {
50
- return decodeURIComponent(queryValue).split(sep);
51
- }
52
- exports.getBundleDiffPageQueryString = __webpack_exports__.getBundleDiffPageQueryString;
53
- exports.getBundleDiffPageUrl = __webpack_exports__.getBundleDiffPageUrl;
54
- exports.parseFilesFromBundlePageUrlQuery = __webpack_exports__.parseFilesFromBundlePageUrlQuery;
55
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
56
- "getBundleDiffPageQueryString",
57
- "getBundleDiffPageUrl",
58
- "parseFilesFromBundlePageUrlQuery"
59
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
60
- Object.defineProperty(exports, '__esModule', {
61
- value: true
62
- });
@@ -1,54 +0,0 @@
1
- "use strict";
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
- decode: ()=>decode,
28
- encode: ()=>encode
29
- });
30
- const sep = '!';
31
- function encode(str) {
32
- let res = `${str.charCodeAt(0)}`;
33
- for(let i = 1; i < str.length; i++)res += `${sep}${str.charCodeAt(i)}`;
34
- return res;
35
- }
36
- function decode(str) {
37
- let res = '';
38
- let tmp = '';
39
- for(let i = 0; i < str.length; i++)if (str[i] === sep) {
40
- res += String.fromCharCode(+tmp);
41
- tmp = '';
42
- } else tmp += str[i];
43
- if (tmp) res += String.fromCharCode(+tmp);
44
- return res;
45
- }
46
- exports.decode = __webpack_exports__.decode;
47
- exports.encode = __webpack_exports__.encode;
48
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
49
- "decode",
50
- "encode"
51
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
52
- Object.defineProperty(exports, '__esModule', {
53
- value: true
54
- });
@@ -1,396 +0,0 @@
1
- "use strict";
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
28
- });
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
- const external_rspack_js_namespaceObject = require("../rspack.js");
37
- function _define_property(obj, key, value) {
38
- if (key in obj) Object.defineProperty(obj, key, {
39
- value: value,
40
- enumerable: true,
41
- configurable: true,
42
- writable: true
43
- });
44
- else obj[key] = value;
45
- return obj;
46
- }
47
- class APIDataLoader {
48
- log(...args) {
49
- console.log(`[${this.constructor.name}]`, ...args);
50
- }
51
- loadAPI(...args) {
52
- const [api, body] = args;
53
- switch(api){
54
- case types_namespaceObject.SDK.ServerAPI.API.LoadDataByKey:
55
- return this.loader.loadData(body.key);
56
- case types_namespaceObject.SDK.ServerAPI.API.GetProjectInfo:
57
- return Promise.all([
58
- this.loader.loadData('root'),
59
- this.loader.loadData('pid'),
60
- this.loader.loadData('hash'),
61
- this.loader.loadData('summary'),
62
- this.loader.loadData('configs'),
63
- this.loader.loadData('envinfo'),
64
- this.loader.loadData('errors')
65
- ]).then(([root, pid, hash, summary, configs, envinfo, errors])=>({
66
- root,
67
- pid,
68
- hash,
69
- summary,
70
- configs,
71
- envinfo,
72
- errors
73
- }));
74
- case types_namespaceObject.SDK.ServerAPI.API.GetClientRoutes:
75
- var _window;
76
- 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;
77
- return this.loader.loadManifest().then((res)=>{
78
- const { enableRoutes = [] } = res.client || {};
79
- return enableRoutes;
80
- });
81
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderNames:
82
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderNames(res || []));
83
- case types_namespaceObject.SDK.ServerAPI.API.GetLayers:
84
- return this.loader.loadData('moduleGraph').then((res)=>{
85
- const { layers } = res || {};
86
- return layers;
87
- });
88
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderChartData:
89
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderChartData(res || []));
90
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileTree:
91
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileTree(res || []));
92
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileDetails:
93
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileDetails(body.path, res || []));
94
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFolderStatistics:
95
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFolderStatistics(body.folder, res || []));
96
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileFirstInput:
97
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileFirstInput(body.file, res || []));
98
- case types_namespaceObject.SDK.ServerAPI.API.GetLoaderFileInputAndOutput:
99
- return this.loader.loadData('loader').then((res)=>external_loader_js_namespaceObject.getLoaderFileFirstInput(body.file, res || []));
100
- case types_namespaceObject.SDK.ServerAPI.API.GetResolverFileTree:
101
- return this.loader.loadData('resolver').then((res)=>external_resolver_js_namespaceObject.getResolverFileTree(res || []));
102
- case types_namespaceObject.SDK.ServerAPI.API.GetResolverFileDetails:
103
- return Promise.all([
104
- this.loader.loadData('resolver'),
105
- this.loader.loadData('moduleGraph.modules'),
106
- this.loader.loadData('moduleCodeMap')
107
- ]).then((res)=>{
108
- const resolverData = res[0];
109
- const modules = res[1];
110
- const moduleCodeMap = res[2];
111
- return external_resolver_js_namespaceObject.getResolverFileDetails(body.filepath, resolverData || [], modules || [], moduleCodeMap || {});
112
- });
113
- case types_namespaceObject.SDK.ServerAPI.API.GetPluginSummary:
114
- return this.loader.loadData('plugin').then((res)=>external_plugin_js_namespaceObject.getPluginSummary(res || {}));
115
- case types_namespaceObject.SDK.ServerAPI.API.GetPluginData:
116
- return this.loader.loadData('plugin').then((res)=>{
117
- const { hooks, tapNames } = body;
118
- return external_plugin_js_namespaceObject.getPluginData(res || {}, hooks, tapNames);
119
- });
120
- case types_namespaceObject.SDK.ServerAPI.API.GetAssetsSummary:
121
- return this.loader.loadData('chunkGraph').then((res)=>{
122
- const { withFileContent = true } = body;
123
- const { assets = [], chunks = [] } = res || {};
124
- return index_js_namespaceObject.getAssetsSummary(assets, chunks, {
125
- withFileContent
126
- });
127
- });
128
- case types_namespaceObject.SDK.ServerAPI.API.GetAssetDetails:
129
- return Promise.all([
130
- this.loader.loadData('chunkGraph'),
131
- this.loader.loadData('moduleGraph'),
132
- this.loader.loadData('configs')
133
- ]).then((res)=>{
134
- const { assetPath } = body;
135
- const configs = res[2] || [];
136
- const { isRspack, hasSourceMap } = (0, external_rspack_js_namespaceObject.checkSourceMapSupport)(configs);
137
- const { assets = [], chunks = [] } = res[0] || {};
138
- const { modules = [] } = res[1] || {};
139
- const checkModules = (module)=>{
140
- if (0 === module.size.parsedSize) return false;
141
- return true;
142
- };
143
- return index_js_namespaceObject.getAssetDetails(assetPath, assets, chunks, modules, isRspack || hasSourceMap ? checkModules : ()=>true);
144
- });
145
- case types_namespaceObject.SDK.ServerAPI.API.GetSummaryBundles:
146
- return Promise.all([
147
- this.loader.loadData('chunkGraph'),
148
- this.loader.loadData('moduleGraph')
149
- ]).then((res)=>{
150
- const { assets = [], chunks = [] } = res[0] || {};
151
- const { modules = [] } = res[1] || {};
152
- return index_js_namespaceObject.getAllBundleData(assets, chunks, modules, [
153
- 'id',
154
- 'path',
155
- 'size',
156
- 'kind'
157
- ]);
158
- });
159
- case types_namespaceObject.SDK.ServerAPI.API.GetChunksByModuleId:
160
- return Promise.all([
161
- this.loader.loadData('chunkGraph'),
162
- this.loader.loadData('moduleGraph')
163
- ]).then((res)=>{
164
- const { moduleId } = body;
165
- const { chunks = [] } = res[0] || {};
166
- const { modules = [] } = res[1] || {};
167
- return index_js_namespaceObject.getChunksByModuleId(moduleId, modules, chunks);
168
- });
169
- case types_namespaceObject.SDK.ServerAPI.API.GetModuleDetails:
170
- return Promise.all([
171
- this.loader.loadData('chunkGraph'),
172
- this.loader.loadData('moduleGraph')
173
- ]).then((res)=>{
174
- const { moduleId } = body;
175
- const { modules = [], dependencies = [] } = res[1] || {};
176
- return index_js_namespaceObject.getModuleDetails(moduleId, modules, dependencies);
177
- });
178
- case types_namespaceObject.SDK.ServerAPI.API.GetModulesByModuleIds:
179
- return this.loader.loadData('moduleGraph').then((res)=>{
180
- const { moduleIds } = body;
181
- const { modules = [] } = res || {};
182
- return index_js_namespaceObject.getModuleIdsByModulesIds(moduleIds, modules);
183
- });
184
- case types_namespaceObject.SDK.ServerAPI.API.GetEntryPoints:
185
- return Promise.all([
186
- this.loader.loadData('chunkGraph')
187
- ]).then((res)=>{
188
- const [chunkGraph] = res;
189
- const { entrypoints = [] } = chunkGraph || {};
190
- return index_js_namespaceObject.getEntryPoints(entrypoints);
191
- });
192
- case types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleId:
193
- return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
194
- const { moduleId } = body;
195
- if (moduleCodeMap) return moduleCodeMap[moduleId];
196
- return {
197
- source: '',
198
- transformed: '',
199
- parsedSource: ''
200
- };
201
- });
202
- case types_namespaceObject.SDK.ServerAPI.API.GetModuleCodeByModuleIds:
203
- return this.loader.loadData('moduleCodeMap').then((moduleCodeMap)=>{
204
- const { moduleIds } = body;
205
- const _moduleCodeData = {};
206
- if (moduleCodeMap) {
207
- moduleIds.forEach((id)=>{
208
- _moduleCodeData[id] = moduleCodeMap[id];
209
- });
210
- return _moduleCodeData;
211
- }
212
- return [];
213
- });
214
- case types_namespaceObject.SDK.ServerAPI.API.GetAllModuleGraph:
215
- return this.loader.loadData('moduleGraph').then((moduleGraph)=>null == moduleGraph ? void 0 : moduleGraph.modules);
216
- case types_namespaceObject.SDK.ServerAPI.API.GetSearchModules:
217
- return Promise.all([
218
- this.loader.loadData('moduleGraph'),
219
- this.loader.loadData('chunkGraph')
220
- ]).then((res)=>{
221
- const [moduleGraph, chunkGraph] = res;
222
- const { moduleName } = body;
223
- if (!moduleName) return [];
224
- const assetMap = chunkGraph.chunks.reduce((acc, chunk)=>{
225
- chunk.assets.forEach((asset)=>{
226
- if (!acc[chunk.id]) acc[chunk.id] = [];
227
- acc[chunk.id].push(asset);
228
- });
229
- return acc;
230
- }, {});
231
- const searchedChunksMap = new Map();
232
- null == moduleGraph || moduleGraph.modules.filter((module)=>{
233
- if (module.webpackId.includes(moduleName)) module.chunks.forEach((chunk)=>{
234
- if (searchedChunksMap.has(chunk)) return;
235
- const assets = assetMap[chunk] || [];
236
- assets.forEach((asset)=>{
237
- if (asset.endsWith('.js')) searchedChunksMap.set(chunk, asset);
238
- });
239
- });
240
- });
241
- return Object.fromEntries(searchedChunksMap);
242
- });
243
- case types_namespaceObject.SDK.ServerAPI.API.GetSearchModuleInChunk:
244
- return Promise.all([
245
- this.loader.loadData('moduleGraph'),
246
- this.loader.loadData('root')
247
- ]).then((res)=>{
248
- const [moduleGraph, root] = res;
249
- const { moduleName, chunk } = body;
250
- if (!moduleName) return [];
251
- const filteredModules = null == moduleGraph ? void 0 : moduleGraph.modules.filter((module)=>module.webpackId.includes(moduleName) && module.chunks.includes(chunk)).map((filteredModule)=>({
252
- id: filteredModule.id,
253
- path: filteredModule.path,
254
- relativePath: (0, external_path_namespaceObject.relative)(root, filteredModule.path)
255
- }));
256
- return filteredModules;
257
- });
258
- case types_namespaceObject.SDK.ServerAPI.API.GetAllChunkGraph:
259
- return this.loader.loadData('chunkGraph').then((chunkGraph)=>null == chunkGraph ? void 0 : chunkGraph.chunks);
260
- case types_namespaceObject.SDK.ServerAPI.API.GetPackageRelationAlertDetails:
261
- return Promise.all([
262
- this.loader.loadData('moduleGraph'),
263
- this.loader.loadData('errors'),
264
- this.loader.loadData('root'),
265
- this.loader.loadData('moduleCodeMap')
266
- ]).then((res)=>{
267
- const { id, target } = body;
268
- const [moduleGraph, errors = [], root = '', moduleCodeMap] = res;
269
- const { modules = [], dependencies = [] } = moduleGraph || {};
270
- const { packages = [] } = errors.find((e)=>e.id === id) || {};
271
- const { dependencies: pkgDependencies = [] } = packages.find((e)=>e.target.name === target.name && e.target.root === target.root && e.target.version === target.version) || {};
272
- return external_alerts_js_namespaceObject.getPackageRelationAlertDetails(modules, dependencies, root, pkgDependencies, moduleCodeMap || {});
273
- });
274
- case types_namespaceObject.SDK.ServerAPI.API.GetOverlayAlerts:
275
- return this.loader.loadData('errors').then((res)=>(res || []).filter((e)=>e.code === types_namespaceObject.Rule.RuleMessageCodeEnumerated.Overlay));
276
- case types_namespaceObject.SDK.ServerAPI.API.BundleDiffManifest:
277
- return this.loader.loadManifest();
278
- case types_namespaceObject.SDK.ServerAPI.API.GetBundleDiffSummary:
279
- return Promise.all([
280
- this.loader.loadManifest(),
281
- this.loader.loadData('root'),
282
- this.loader.loadData('hash'),
283
- this.loader.loadData('errors'),
284
- this.loader.loadData('chunkGraph'),
285
- this.loader.loadData('moduleGraph'),
286
- this.loader.loadData('moduleCodeMap'),
287
- this.loader.loadData('packageGraph'),
288
- this.loader.loadData('configs')
289
- ]).then(([_manifest, root = '', hash = '', errors = {}, chunkGraph = {}, moduleGraph = {}, moduleCodeMap = {}, packageGraph = {}, configs = []])=>{
290
- var _configs__config_output, _configs__config, _configs_;
291
- let outputFilename = '';
292
- 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)) {
293
- var _configs_1;
294
- outputFilename = null == (_configs_1 = configs[0]) ? void 0 : _configs_1.config.output.chunkFilename;
295
- }
296
- return {
297
- root,
298
- hash,
299
- errors,
300
- chunkGraph,
301
- moduleGraph,
302
- packageGraph,
303
- outputFilename,
304
- moduleCodeMap
305
- };
306
- });
307
- case types_namespaceObject.SDK.ServerAPI.API.GetTileReportHtml:
308
- return this.loader.loadData('otherReports').then((otherReports)=>null == otherReports ? void 0 : otherReports.tileReportHtml);
309
- case types_namespaceObject.SDK.ServerAPI.API.GetChunkGraph:
310
- return this.loader.loadData('chunkGraph').then((res)=>{
311
- const { chunks = [] } = res || {};
312
- return chunks;
313
- });
314
- case types_namespaceObject.SDK.ServerAPI.API.GetAllModuleGraphFilter:
315
- return this.loader.loadData('moduleGraph').then((moduleGraph)=>null == moduleGraph ? void 0 : moduleGraph.modules.map((m)=>({
316
- id: m.id,
317
- webpackId: m.webpackId,
318
- path: m.path,
319
- size: m.size,
320
- chunks: m.chunks,
321
- kind: m.kind
322
- })));
323
- case types_namespaceObject.SDK.ServerAPI.API.GetModuleByName:
324
- return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
325
- const { moduleName } = body;
326
- const { modules = [] } = moduleGraph || {};
327
- return modules.filter((m)=>m.path.includes(moduleName)).map((m)=>({
328
- id: m.id,
329
- path: m.path
330
- })) || [];
331
- });
332
- case types_namespaceObject.SDK.ServerAPI.API.GetModuleIssuerPath:
333
- return this.loader.loadData('moduleGraph').then((moduleGraph)=>{
334
- var _modules_find;
335
- const { moduleId } = body;
336
- const modules = (null == moduleGraph ? void 0 : moduleGraph.modules) || [];
337
- const issuerPath = (null == (_modules_find = modules.find((m)=>String(m.id) === moduleId)) ? void 0 : _modules_find.issuerPath) || [];
338
- if (Array.isArray(issuerPath) && issuerPath.length > 0 && 'number' == typeof issuerPath[0]) return issuerPath.map((id)=>{
339
- var _modules_find;
340
- return null == (_modules_find = modules.find((m)=>m.id === id)) ? void 0 : _modules_find.path;
341
- }).filter(Boolean);
342
- return issuerPath;
343
- });
344
- case types_namespaceObject.SDK.ServerAPI.API.GetPackageInfo:
345
- return this.loader.loadData('packageGraph').then((packageGraph)=>null == packageGraph ? void 0 : packageGraph.packages);
346
- case types_namespaceObject.SDK.ServerAPI.API.GetPackageDependency:
347
- return this.loader.loadData('packageGraph').then((packageGraph)=>(null == packageGraph ? void 0 : packageGraph.dependencies) || []);
348
- case types_namespaceObject.SDK.ServerAPI.API.GetChunkGraphAI:
349
- return this.loader.loadData('chunkGraph').then((res)=>{
350
- const { chunks = [] } = res || {};
351
- const filteredChunks = chunks.map(({ modules, ...rest })=>rest);
352
- return filteredChunks;
353
- });
354
- case types_namespaceObject.SDK.ServerAPI.API.GetChunkByIdAI:
355
- return Promise.all([
356
- this.loader.loadData('chunkGraph'),
357
- this.loader.loadData('moduleGraph')
358
- ]).then(([chunkGraph, moduleGraph])=>{
359
- const { chunks = [] } = chunkGraph || {};
360
- const { modules = [] } = moduleGraph || {};
361
- const { chunkId } = body;
362
- const chunkInfo = chunks.find((c)=>c.id === chunkId);
363
- if (!chunkInfo) return null;
364
- const chunkModules = modules.filter((m)=>chunkInfo.modules.includes(m.id)).map((module)=>({
365
- id: module.id,
366
- path: module.path,
367
- size: module.size,
368
- chunks: module.chunks,
369
- kind: module.kind,
370
- issuerPath: module.issuerPath
371
- }));
372
- chunkInfo.modulesInfo = chunkModules;
373
- return chunkInfo;
374
- });
375
- case types_namespaceObject.SDK.ServerAPI.API.GetDirectoriesLoaders:
376
- return Promise.all([
377
- this.loader.loadData('root'),
378
- this.loader.loadData('loader')
379
- ]).then(([root, loaders])=>external_loader_js_namespaceObject.getDirectoriesLoaders(loaders || [], root || ''));
380
- default:
381
- throw new Error(`API not implement: "${api}"`);
382
- }
383
- }
384
- constructor(loader){
385
- _define_property(this, "loader", void 0);
386
- this.loader = loader;
387
- this.loadAPI = this.loadAPI.bind(this);
388
- }
389
- }
390
- exports.APIDataLoader = __webpack_exports__.APIDataLoader;
391
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
392
- "APIDataLoader"
393
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
394
- Object.defineProperty(exports, '__esModule', {
395
- value: true
396
- });
@@ -1,44 +0,0 @@
1
- "use strict";
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
- isJsExt: ()=>isJsExt,
28
- isStyleExt: ()=>isStyleExt
29
- });
30
- function isStyleExt(path) {
31
- return /\.(c|le|sa|sc)ss(\?.*)?$/.test(path);
32
- }
33
- function isJsExt(path) {
34
- return /\.(js|ts|jsx|tsx)(\?.*)?$/.test(path);
35
- }
36
- exports.isJsExt = __webpack_exports__.isJsExt;
37
- exports.isStyleExt = __webpack_exports__.isStyleExt;
38
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
39
- "isJsExt",
40
- "isStyleExt"
41
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
42
- Object.defineProperty(exports, '__esModule', {
43
- value: true
44
- });
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- writeMcpPort: ()=>writeMcpPort,
37
- getMcpConfigPath: ()=>getMcpConfigPath
38
- });
39
- const external_fs_namespaceObject = require("fs");
40
- var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
41
- const external_path_namespaceObject = require("path");
42
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
43
- const external_os_namespaceObject = require("os");
44
- var external_os_default = /*#__PURE__*/ __webpack_require__.n(external_os_namespaceObject);
45
- const external_logger_js_namespaceObject = require("../logger.js");
46
- function writeMcpPort(port, builderName) {
47
- const homeDir = external_os_default().homedir();
48
- const rsdoctorDir = external_path_default().join(homeDir, '.cache/rsdoctor');
49
- const mcpPortFilePath = external_path_default().join(rsdoctorDir, 'mcp.json');
50
- if (!external_fs_default().existsSync(rsdoctorDir)) external_fs_default().mkdirSync(rsdoctorDir, {
51
- recursive: true
52
- });
53
- let mcpJson = {
54
- portList: {},
55
- port: 0
56
- };
57
- if (external_fs_default().existsSync(mcpPortFilePath)) try {
58
- mcpJson = JSON.parse(external_fs_default().readFileSync(mcpPortFilePath, 'utf8'));
59
- } catch (error) {
60
- external_logger_js_namespaceObject.logger.debug('Failed to parse mcp.json', error);
61
- }
62
- if (!mcpJson.portList) mcpJson.portList = {};
63
- mcpJson.portList[builderName || 'builder'] = port;
64
- mcpJson.port = port;
65
- external_fs_default().writeFileSync(mcpPortFilePath, JSON.stringify(mcpJson, null, 2), 'utf8');
66
- }
67
- function getMcpConfigPath() {
68
- const homeDir = external_os_default().homedir();
69
- const rsdoctorDir = external_path_default().join(homeDir, '.cache/rsdoctor');
70
- const mcpPortFilePath = external_path_default().join(rsdoctorDir, 'mcp.json');
71
- return mcpPortFilePath;
72
- }
73
- exports.getMcpConfigPath = __webpack_exports__.getMcpConfigPath;
74
- exports.writeMcpPort = __webpack_exports__.writeMcpPort;
75
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
76
- "getMcpConfigPath",
77
- "writeMcpPort"
78
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
79
- Object.defineProperty(exports, '__esModule', {
80
- value: true
81
- });