@rsdoctor/core 1.2.3 → 1.2.4-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.
Files changed (311) hide show
  1. package/dist/build-utils/{common/trans-utils/transStats.js → build/chunks/assetsModules.cjs} +9 -12
  2. package/dist/build-utils/build/chunks/assetsModules.d.ts +0 -1
  3. package/dist/build-utils/build/chunks/assetsModules.js +7 -39
  4. package/dist/build-utils/build/chunks/chunkTransform.cjs +39 -0
  5. package/dist/build-utils/build/chunks/chunkTransform.d.ts +0 -1
  6. package/dist/build-utils/build/chunks/chunkTransform.js +5 -37
  7. package/dist/build-utils/{common/chunks/index.js → build/chunks/index.cjs} +8 -8
  8. package/dist/build-utils/build/chunks/index.d.ts +0 -1
  9. package/dist/build-utils/build/chunks/index.js +5 -78
  10. package/dist/build-utils/build/chunks/rspack/transform.cjs +80 -0
  11. package/dist/build-utils/build/chunks/rspack/transform.d.ts +0 -1
  12. package/dist/build-utils/build/chunks/rspack/transform.js +7 -42
  13. package/dist/build-utils/{common/index.js → build/index.cjs} +14 -14
  14. package/dist/build-utils/build/index.d.ts +0 -1
  15. package/dist/build-utils/build/index.js +8 -52
  16. package/dist/build-utils/build/loader/index.cjs +69 -0
  17. package/dist/build-utils/build/loader/index.d.ts +1 -1
  18. package/dist/build-utils/build/loader/index.js +4 -60
  19. package/dist/build-utils/build/loader/probeLoader.cjs +90 -0
  20. package/dist/build-utils/build/loader/probeLoader.d.ts +0 -1
  21. package/dist/build-utils/build/loader/probeLoader.js +12 -57
  22. package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +65 -0
  23. package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +0 -1
  24. package/dist/build-utils/build/loader/probeLoaderPlugin.js +11 -43
  25. package/dist/build-utils/build/module-graph/index.cjs +87 -0
  26. package/dist/build-utils/build/module-graph/index.d.ts +0 -1
  27. package/dist/build-utils/build/module-graph/index.js +6 -87
  28. package/dist/build-utils/build/module-graph/parser.cjs +46 -0
  29. package/dist/build-utils/build/module-graph/parser.d.ts +0 -1
  30. package/dist/build-utils/build/module-graph/parser.js +7 -39
  31. package/dist/build-utils/build/module-graph/rspack/transform.cjs +110 -0
  32. package/dist/build-utils/build/module-graph/rspack/transform.d.ts +0 -1
  33. package/dist/build-utils/build/module-graph/rspack/transform.js +12 -50
  34. package/dist/build-utils/build/module-graph/transform.cjs +40 -0
  35. package/dist/build-utils/build/module-graph/transform.d.ts +0 -1
  36. package/dist/build-utils/build/module-graph/transform.js +6 -38
  37. package/dist/build-utils/build/module-graph/treeShaking.cjs +107 -0
  38. package/dist/build-utils/build/module-graph/treeShaking.d.ts +0 -1
  39. package/dist/build-utils/build/module-graph/treeShaking.js +15 -49
  40. package/dist/build-utils/build/module-graph/utils.cjs +97 -0
  41. package/dist/build-utils/build/module-graph/utils.d.ts +0 -1
  42. package/dist/build-utils/build/module-graph/utils.js +15 -50
  43. package/dist/build-utils/build/module-graph/webpack/transform.cjs +171 -0
  44. package/dist/build-utils/build/module-graph/webpack/transform.d.ts +0 -1
  45. package/dist/build-utils/build/module-graph/webpack/transform.js +31 -57
  46. package/dist/build-utils/{common/module-graph/index.js → build/utils/index.cjs} +15 -15
  47. package/dist/build-utils/build/utils/index.d.ts +0 -2
  48. package/dist/build-utils/build/utils/index.js +5 -87
  49. package/dist/build-utils/build/utils/loader.cjs +356 -0
  50. package/dist/build-utils/build/utils/loader.d.ts +1 -3
  51. package/dist/build-utils/build/utils/loader.js +44 -90
  52. package/dist/build-utils/build/utils/parseBundle.cjs +284 -0
  53. package/dist/build-utils/build/utils/parseBundle.d.ts +1 -2
  54. package/dist/build-utils/build/utils/parseBundle.js +19 -61
  55. package/dist/build-utils/build/utils/plugin.cjs +61 -0
  56. package/dist/build-utils/build/utils/plugin.d.ts +0 -1
  57. package/dist/build-utils/build/utils/plugin.js +5 -43
  58. package/dist/build-utils/index.cjs +36 -0
  59. package/dist/build-utils/index.d.ts +0 -2
  60. package/dist/build-utils/index.js +4 -40
  61. package/dist/index.cjs +85 -0
  62. package/dist/index.d.ts +0 -1
  63. package/dist/index.js +6 -85
  64. package/dist/inner-plugins/constants.cjs +64 -0
  65. package/dist/inner-plugins/constants.d.ts +0 -1
  66. package/dist/inner-plugins/constants.js +3 -47
  67. package/dist/{build-utils/common/trans-utils/index.js → inner-plugins/index.cjs} +14 -5
  68. package/dist/inner-plugins/index.d.ts +0 -1
  69. package/dist/inner-plugins/index.js +4 -69
  70. package/dist/inner-plugins/loaders/proxy.cjs +90 -0
  71. package/dist/inner-plugins/loaders/proxy.d.ts +4 -2
  72. package/dist/inner-plugins/loaders/proxy.js +19 -22
  73. package/dist/inner-plugins/plugins/base.cjs +53 -0
  74. package/dist/inner-plugins/plugins/base.d.ts +3 -5
  75. package/dist/inner-plugins/plugins/base.js +6 -38
  76. package/dist/inner-plugins/plugins/bundle.cjs +121 -0
  77. package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
  78. package/dist/inner-plugins/plugins/bundle.js +33 -49
  79. package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +93 -0
  80. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +0 -1
  81. package/dist/inner-plugins/plugins/bundleTagPlugin.js +12 -44
  82. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +166 -0
  83. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +0 -1
  84. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +42 -70
  85. package/dist/inner-plugins/plugins/errors.cjs +98 -0
  86. package/dist/inner-plugins/plugins/errors.d.ts +0 -1
  87. package/dist/inner-plugins/plugins/errors.js +20 -52
  88. package/dist/inner-plugins/plugins/index.cjs +141 -0
  89. package/dist/inner-plugins/plugins/index.d.ts +0 -1
  90. package/dist/inner-plugins/plugins/index.js +12 -141
  91. package/dist/inner-plugins/plugins/loader.cjs +155 -0
  92. package/dist/inner-plugins/plugins/loader.d.ts +0 -1
  93. package/dist/inner-plugins/plugins/loader.js +29 -57
  94. package/dist/inner-plugins/plugins/plugins.cjs +73 -0
  95. package/dist/inner-plugins/plugins/plugins.d.ts +0 -1
  96. package/dist/inner-plugins/plugins/plugins.js +18 -50
  97. package/dist/inner-plugins/plugins/progress.cjs +70 -0
  98. package/dist/inner-plugins/plugins/progress.d.ts +0 -1
  99. package/dist/inner-plugins/plugins/progress.js +9 -41
  100. package/dist/inner-plugins/plugins/rspack.cjs +117 -0
  101. package/dist/inner-plugins/plugins/rspack.d.ts +0 -1
  102. package/dist/inner-plugins/plugins/rspack.js +24 -56
  103. package/dist/inner-plugins/plugins/rules.cjs +97 -0
  104. package/dist/inner-plugins/plugins/rules.d.ts +0 -1
  105. package/dist/inner-plugins/plugins/rules.js +19 -51
  106. package/dist/inner-plugins/plugins/sourcemapTool.cjs +213 -0
  107. package/dist/inner-plugins/plugins/sourcemapTool.d.ts +0 -1
  108. package/dist/inner-plugins/plugins/sourcemapTool.js +23 -67
  109. package/dist/inner-plugins/plugins/summary.cjs +125 -0
  110. package/dist/inner-plugins/plugins/summary.d.ts +0 -1
  111. package/dist/inner-plugins/plugins/summary.js +28 -60
  112. package/dist/inner-plugins/utils/circleDetect.cjs +49 -0
  113. package/dist/inner-plugins/utils/circleDetect.d.ts +0 -1
  114. package/dist/inner-plugins/utils/circleDetect.js +3 -35
  115. package/dist/inner-plugins/utils/config.cjs +177 -0
  116. package/dist/inner-plugins/utils/config.d.ts +3 -8
  117. package/dist/inner-plugins/utils/config.js +43 -116
  118. package/dist/inner-plugins/utils/index.cjs +124 -0
  119. package/dist/inner-plugins/utils/index.d.ts +4 -1
  120. package/dist/inner-plugins/utils/index.js +9 -96
  121. package/dist/inner-plugins/utils/loader.cjs +231 -0
  122. package/dist/inner-plugins/utils/loader.d.ts +4 -4
  123. package/dist/inner-plugins/utils/loader.js +39 -97
  124. package/dist/inner-plugins/utils/normalize-config.cjs +122 -0
  125. package/dist/inner-plugins/utils/normalize-config.d.ts +40 -0
  126. package/dist/inner-plugins/utils/normalize-config.js +78 -0
  127. package/dist/inner-plugins/utils/plugin-common.cjs +73 -0
  128. package/dist/inner-plugins/utils/plugin-common.d.ts +6 -0
  129. package/dist/inner-plugins/utils/plugin-common.js +28 -0
  130. package/dist/inner-plugins/utils/plugin.cjs +107 -0
  131. package/dist/inner-plugins/utils/plugin.d.ts +2 -4
  132. package/dist/inner-plugins/utils/plugin.js +5 -40
  133. package/dist/inner-plugins/utils/sdk.cjs +55 -0
  134. package/dist/inner-plugins/utils/sdk.d.ts +8 -4
  135. package/dist/inner-plugins/utils/sdk.js +9 -42
  136. package/dist/rules/index.cjs +85 -0
  137. package/dist/rules/index.d.ts +0 -1
  138. package/dist/rules/index.js +6 -85
  139. package/dist/rules/linter.cjs +71 -0
  140. package/dist/rules/linter.d.ts +0 -1
  141. package/dist/rules/linter.js +11 -46
  142. package/dist/rules/rule.cjs +137 -0
  143. package/dist/rules/rule.d.ts +1 -2
  144. package/dist/rules/rule.js +20 -55
  145. package/dist/rules/rules/cross-chunks-package/index.cjs +73 -0
  146. package/dist/rules/rules/cross-chunks-package/index.d.ts +0 -1
  147. package/dist/rules/rules/cross-chunks-package/index.js +10 -42
  148. package/dist/rules/rules/cross-chunks-package/types.d.ts +0 -1
  149. package/dist/rules/rules/cross-chunks-package/types.js +2 -18
  150. package/dist/rules/rules/cross-chunks-package/utils.cjs +40 -0
  151. package/dist/rules/rules/cross-chunks-package/utils.d.ts +1 -2
  152. package/dist/rules/rules/cross-chunks-package/utils.js +4 -36
  153. package/dist/rules/rules/default-import-check/index.cjs +116 -0
  154. package/dist/rules/rules/default-import-check/index.d.ts +0 -1
  155. package/dist/rules/rules/default-import-check/index.js +17 -49
  156. package/dist/rules/rules/default-import-check/types.cjs +18 -0
  157. package/dist/rules/rules/default-import-check/types.d.ts +0 -1
  158. package/dist/rules/rules/default-import-check/types.js +2 -18
  159. package/dist/rules/rules/default-import-check/utils.cjs +98 -0
  160. package/dist/rules/rules/default-import-check/utils.d.ts +0 -1
  161. package/dist/rules/rules/default-import-check/utils.js +9 -53
  162. package/dist/rules/rules/duplicate-package/index.cjs +71 -0
  163. package/dist/rules/rules/duplicate-package/index.d.ts +0 -1
  164. package/dist/rules/rules/duplicate-package/index.js +15 -47
  165. package/dist/rules/rules/duplicate-package/types.cjs +60 -0
  166. package/dist/rules/rules/duplicate-package/types.d.ts +0 -1
  167. package/dist/rules/rules/duplicate-package/types.js +5 -40
  168. package/dist/rules/rules/duplicate-package/utils.cjs +84 -0
  169. package/dist/rules/rules/duplicate-package/utils.d.ts +0 -1
  170. package/dist/rules/rules/duplicate-package/utils.js +6 -51
  171. package/dist/rules/rules/ecma-version-check/index.cjs +97 -0
  172. package/dist/rules/rules/ecma-version-check/index.d.ts +0 -1
  173. package/dist/rules/rules/ecma-version-check/index.js +16 -58
  174. package/dist/rules/rules/ecma-version-check/types.cjs +18 -0
  175. package/dist/rules/rules/ecma-version-check/types.d.ts +0 -1
  176. package/dist/rules/rules/ecma-version-check/types.js +2 -18
  177. package/dist/rules/rules/ecma-version-check/utils.cjs +39 -0
  178. package/dist/rules/rules/ecma-version-check/utils.d.ts +0 -1
  179. package/dist/rules/rules/ecma-version-check/utils.js +3 -35
  180. package/dist/rules/rules/index.cjs +47 -0
  181. package/dist/rules/rules/index.d.ts +0 -1
  182. package/dist/rules/rules/index.js +13 -45
  183. package/dist/rules/rules/loader-performance-optimization/index.cjs +119 -0
  184. package/dist/rules/rules/loader-performance-optimization/index.d.ts +0 -1
  185. package/dist/rules/rules/loader-performance-optimization/index.js +14 -46
  186. package/dist/rules/rules/loader-performance-optimization/types.cjs +18 -0
  187. package/dist/rules/rules/loader-performance-optimization/types.d.ts +0 -1
  188. package/dist/rules/rules/loader-performance-optimization/types.js +2 -18
  189. package/dist/{build-utils/common/chunks/assetsContent.js → rules/rules/loader-performance-optimization/utils.cjs} +9 -10
  190. package/dist/rules/rules/loader-performance-optimization/utils.d.ts +0 -1
  191. package/dist/rules/rules/loader-performance-optimization/utils.js +3 -35
  192. package/dist/rules/utils.cjs +46 -0
  193. package/dist/rules/utils.d.ts +0 -1
  194. package/dist/rules/utils.js +6 -41
  195. package/dist/types/chunks.cjs +18 -0
  196. package/dist/types/chunks.d.ts +1 -7
  197. package/dist/types/chunks.js +2 -18
  198. package/dist/types/index.cjs +87 -0
  199. package/dist/types/index.d.ts +0 -2
  200. package/dist/types/index.js +6 -96
  201. package/dist/types/loader.cjs +18 -0
  202. package/dist/types/loader.d.ts +0 -1
  203. package/dist/types/loader.js +2 -18
  204. package/dist/types/plugin.cjs +18 -0
  205. package/dist/types/plugin.d.ts +7 -108
  206. package/dist/types/plugin.js +2 -18
  207. package/dist/types/rules.cjs +18 -0
  208. package/dist/types/rules.d.ts +0 -1
  209. package/dist/types/rules.js +2 -18
  210. package/package.json +33 -34
  211. package/dist/build-utils/build/chunks/assetsModules.d.ts.map +0 -1
  212. package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +0 -1
  213. package/dist/build-utils/build/chunks/index.d.ts.map +0 -1
  214. package/dist/build-utils/build/chunks/rspack/transform.d.ts.map +0 -1
  215. package/dist/build-utils/build/index.d.ts.map +0 -1
  216. package/dist/build-utils/build/loader/index.d.ts.map +0 -1
  217. package/dist/build-utils/build/loader/probeLoader.d.ts.map +0 -1
  218. package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts.map +0 -1
  219. package/dist/build-utils/build/module-graph/index.d.ts.map +0 -1
  220. package/dist/build-utils/build/module-graph/parser.d.ts.map +0 -1
  221. package/dist/build-utils/build/module-graph/rspack/transform.d.ts.map +0 -1
  222. package/dist/build-utils/build/module-graph/transform.d.ts.map +0 -1
  223. package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +0 -1
  224. package/dist/build-utils/build/module-graph/utils.d.ts.map +0 -1
  225. package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +0 -1
  226. package/dist/build-utils/build/utils/index.d.ts.map +0 -1
  227. package/dist/build-utils/build/utils/loader.d.ts.map +0 -1
  228. package/dist/build-utils/build/utils/parseBundle.d.ts.map +0 -1
  229. package/dist/build-utils/build/utils/plugin.d.ts.map +0 -1
  230. package/dist/build-utils/common/chunks/assetsContent.d.ts +0 -6
  231. package/dist/build-utils/common/chunks/assetsContent.d.ts.map +0 -1
  232. package/dist/build-utils/common/chunks/assetsModules.d.ts +0 -23
  233. package/dist/build-utils/common/chunks/assetsModules.d.ts.map +0 -1
  234. package/dist/build-utils/common/chunks/assetsModules.js +0 -155
  235. package/dist/build-utils/common/chunks/chunkTransform.d.ts +0 -6
  236. package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +0 -1
  237. package/dist/build-utils/common/chunks/chunkTransform.js +0 -74
  238. package/dist/build-utils/common/chunks/index.d.ts +0 -4
  239. package/dist/build-utils/common/chunks/index.d.ts.map +0 -1
  240. package/dist/build-utils/common/index.d.ts +0 -6
  241. package/dist/build-utils/common/index.d.ts.map +0 -1
  242. package/dist/build-utils/common/module-graph/compatible.d.ts +0 -9
  243. package/dist/build-utils/common/module-graph/compatible.d.ts.map +0 -1
  244. package/dist/build-utils/common/module-graph/compatible.js +0 -73
  245. package/dist/build-utils/common/module-graph/index.d.ts +0 -4
  246. package/dist/build-utils/common/module-graph/index.d.ts.map +0 -1
  247. package/dist/build-utils/common/module-graph/transform.d.ts +0 -8
  248. package/dist/build-utils/common/module-graph/transform.d.ts.map +0 -1
  249. package/dist/build-utils/common/module-graph/transform.js +0 -181
  250. package/dist/build-utils/common/module-graph/utils.d.ts +0 -14
  251. package/dist/build-utils/common/module-graph/utils.d.ts.map +0 -1
  252. package/dist/build-utils/common/module-graph/utils.js +0 -58
  253. package/dist/build-utils/common/trans-utils/index.d.ts +0 -2
  254. package/dist/build-utils/common/trans-utils/index.d.ts.map +0 -1
  255. package/dist/build-utils/common/trans-utils/transStats.d.ts +0 -11
  256. package/dist/build-utils/common/trans-utils/transStats.d.ts.map +0 -1
  257. package/dist/build-utils/common/webpack/compatible.d.ts +0 -18
  258. package/dist/build-utils/common/webpack/compatible.d.ts.map +0 -1
  259. package/dist/build-utils/common/webpack/compatible.js +0 -156
  260. package/dist/build-utils/index.d.ts.map +0 -1
  261. package/dist/index.d.ts.map +0 -1
  262. package/dist/inner-plugins/constants.d.ts.map +0 -1
  263. package/dist/inner-plugins/index.d.ts.map +0 -1
  264. package/dist/inner-plugins/loaders/proxy.d.ts.map +0 -1
  265. package/dist/inner-plugins/plugins/base.d.ts.map +0 -1
  266. package/dist/inner-plugins/plugins/bundle.d.ts.map +0 -1
  267. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +0 -1
  268. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +0 -1
  269. package/dist/inner-plugins/plugins/errors.d.ts.map +0 -1
  270. package/dist/inner-plugins/plugins/index.d.ts.map +0 -1
  271. package/dist/inner-plugins/plugins/loader.d.ts.map +0 -1
  272. package/dist/inner-plugins/plugins/plugins.d.ts.map +0 -1
  273. package/dist/inner-plugins/plugins/progress.d.ts.map +0 -1
  274. package/dist/inner-plugins/plugins/rspack.d.ts.map +0 -1
  275. package/dist/inner-plugins/plugins/rules.d.ts.map +0 -1
  276. package/dist/inner-plugins/plugins/sourcemapTool.d.ts.map +0 -1
  277. package/dist/inner-plugins/plugins/summary.d.ts.map +0 -1
  278. package/dist/inner-plugins/utils/circleDetect.d.ts.map +0 -1
  279. package/dist/inner-plugins/utils/config.d.ts.map +0 -1
  280. package/dist/inner-plugins/utils/index.d.ts.map +0 -1
  281. package/dist/inner-plugins/utils/loader.d.ts.map +0 -1
  282. package/dist/inner-plugins/utils/plugin.d.ts.map +0 -1
  283. package/dist/inner-plugins/utils/sdk.d.ts.map +0 -1
  284. package/dist/rules/index.d.ts.map +0 -1
  285. package/dist/rules/linter.d.ts.map +0 -1
  286. package/dist/rules/rule.d.ts.map +0 -1
  287. package/dist/rules/rules/cross-chunks-package/index.d.ts.map +0 -1
  288. package/dist/rules/rules/cross-chunks-package/types.d.ts.map +0 -1
  289. package/dist/rules/rules/cross-chunks-package/utils.d.ts.map +0 -1
  290. package/dist/rules/rules/default-import-check/index.d.ts.map +0 -1
  291. package/dist/rules/rules/default-import-check/types.d.ts.map +0 -1
  292. package/dist/rules/rules/default-import-check/utils.d.ts.map +0 -1
  293. package/dist/rules/rules/duplicate-package/index.d.ts.map +0 -1
  294. package/dist/rules/rules/duplicate-package/types.d.ts.map +0 -1
  295. package/dist/rules/rules/duplicate-package/utils.d.ts.map +0 -1
  296. package/dist/rules/rules/ecma-version-check/index.d.ts.map +0 -1
  297. package/dist/rules/rules/ecma-version-check/types.d.ts.map +0 -1
  298. package/dist/rules/rules/ecma-version-check/utils.d.ts.map +0 -1
  299. package/dist/rules/rules/index.d.ts.map +0 -1
  300. package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +0 -1
  301. package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +0 -1
  302. package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +0 -1
  303. package/dist/rules/utils.d.ts.map +0 -1
  304. package/dist/types/chunks.d.ts.map +0 -1
  305. package/dist/types/index.d.ts.map +0 -1
  306. package/dist/types/loader.d.ts.map +0 -1
  307. package/dist/types/plugin.d.ts.map +0 -1
  308. package/dist/types/rules.d.ts.map +0 -1
  309. package/dist/types/webpack.d.ts +0 -15
  310. package/dist/types/webpack.d.ts.map +0 -1
  311. /package/dist/{types/webpack.js → rules/rules/cross-chunks-package/types.cjs} +0 -0
@@ -1,44 +1,18 @@
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
- InternalSummaryPlugin: ()=>InternalSummaryPlugin
28
- });
29
- const common_namespaceObject = require("@rsdoctor/utils/common");
30
- const external_lodash_namespaceObject = require("lodash");
31
- const external_base_js_namespaceObject = require("./base.js");
32
- const logger_namespaceObject = require("@rsdoctor/utils/logger");
33
- class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBasePlugin {
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { Summary } from "@rsdoctor/utils/common";
4
+ import { minBy, sumBy } from "lodash-es";
5
+ import { InternalBasePlugin } from "./base.js";
6
+ import { time, timeEnd } from "@rsdoctor/utils/logger";
7
+ class InternalSummaryPlugin extends InternalBasePlugin {
34
8
  apply(compiler) {
35
- (0, logger_namespaceObject.time)('InternalSummaryPlugin.apply');
9
+ time('InternalSummaryPlugin.apply');
36
10
  try {
37
11
  compiler.hooks.beforeCompile.tapPromise(this.tapPostOptions, this.beforeCompile);
38
12
  compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.afterCompile);
39
13
  compiler.hooks.done.tapPromise(this.tapPostOptions, this.done.bind(this, compiler));
40
14
  } finally{
41
- (0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.apply');
15
+ timeEnd('InternalSummaryPlugin.apply');
42
16
  }
43
17
  }
44
18
  mark(key, type) {
@@ -68,33 +42,33 @@ class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBas
68
42
  }
69
43
  constructor(...args){
70
44
  super(...args), this.name = 'summary', this.times = new Map(), this.preTimes = new Map(), this.postTimes = new Map(), this.beforeCompile = async ()=>{
71
- (0, logger_namespaceObject.time)('InternalSummaryPlugin.beforeCompile');
45
+ time('InternalSummaryPlugin.beforeCompile');
72
46
  try {
73
- if (!this.times.has(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap)) {
47
+ if (!this.times.has(Summary.SummaryCostsDataName.Bootstrap)) {
74
48
  const costs = Math.floor(1000 * process.uptime());
75
49
  const startAt = Date.now() - costs;
76
- this.report(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap, startAt);
77
- this.mark(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap, 'post');
50
+ this.report(Summary.SummaryCostsDataName.Bootstrap, startAt);
51
+ this.mark(Summary.SummaryCostsDataName.Bootstrap, 'post');
78
52
  }
79
53
  } finally{
80
- (0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.beforeCompile');
54
+ timeEnd('InternalSummaryPlugin.beforeCompile');
81
55
  }
82
56
  }, this.afterCompile = async (compilation)=>{
83
- (0, logger_namespaceObject.time)('InternalSummaryPlugin.afterCompile');
57
+ time('InternalSummaryPlugin.afterCompile');
84
58
  try {
85
- if (!this.times.has(common_namespaceObject.Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
86
- const start = this.postTimes.get(common_namespaceObject.Summary.SummaryCostsDataName.Bootstrap);
87
- this.report(common_namespaceObject.Summary.SummaryCostsDataName.Compile, start);
88
- this.mark(common_namespaceObject.Summary.SummaryCostsDataName.Compile, 'post');
59
+ if (!this.times.has(Summary.SummaryCostsDataName.Compile) && !compilation.compiler.isChild()) {
60
+ const start = this.postTimes.get(Summary.SummaryCostsDataName.Bootstrap);
61
+ this.report(Summary.SummaryCostsDataName.Compile, start);
62
+ this.mark(Summary.SummaryCostsDataName.Compile, 'post');
89
63
  }
90
64
  } finally{
91
- (0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.afterCompile');
65
+ timeEnd('InternalSummaryPlugin.afterCompile');
92
66
  }
93
67
  }, this.done = async (compiler)=>{
94
- (0, logger_namespaceObject.time)('InternalSummaryPlugin.done');
68
+ time('InternalSummaryPlugin.done');
95
69
  try {
96
- const start = this.postTimes.get(common_namespaceObject.Summary.SummaryCostsDataName.Compile);
97
- this.report(common_namespaceObject.Summary.SummaryCostsDataName.Done, start);
70
+ const start = this.postTimes.get(Summary.SummaryCostsDataName.Compile);
71
+ this.report(Summary.SummaryCostsDataName.Done, start);
98
72
  if (false !== compiler.options.optimization.minimize) {
99
73
  const pluginData = this.sdk.getStoreData().plugin;
100
74
  const minifyHookData = [
@@ -103,23 +77,17 @@ class InternalSummaryPlugin extends external_base_js_namespaceObject.InternalBas
103
77
  minifyHookData.length && this.sdk.reportSummaryData({
104
78
  costs: [
105
79
  {
106
- name: common_namespaceObject.Summary.SummaryCostsDataName.Minify,
107
- startAt: (0, external_lodash_namespaceObject.minBy)(minifyHookData, (e)=>e.startAt).startAt,
108
- costs: (0, external_lodash_namespaceObject.sumBy)(minifyHookData, (e)=>e.costs)
80
+ name: Summary.SummaryCostsDataName.Minify,
81
+ startAt: minBy(minifyHookData, (e)=>e.startAt).startAt,
82
+ costs: sumBy(minifyHookData, (e)=>e.costs)
109
83
  }
110
84
  ]
111
85
  });
112
86
  }
113
87
  } finally{
114
- (0, logger_namespaceObject.timeEnd)('InternalSummaryPlugin.done');
88
+ timeEnd('InternalSummaryPlugin.done');
115
89
  }
116
90
  };
117
91
  }
118
92
  }
119
- exports.InternalSummaryPlugin = __webpack_exports__.InternalSummaryPlugin;
120
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
121
- "InternalSummaryPlugin"
122
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
123
- Object.defineProperty(exports, '__esModule', {
124
- value: true
125
- });
93
+ export { InternalSummaryPlugin };
@@ -0,0 +1,49 @@
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
+ checkCirclePath: ()=>checkCirclePath
28
+ });
29
+ const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
30
+ const idx = record.slice(0, record.length - 1).findIndex((v)=>v.ref === obj);
31
+ if (-1 !== idx) {
32
+ const key = record.map((v)=>v.prop);
33
+ if (res.indexOf(key) < 0) return void res.push(key);
34
+ }
35
+ if ('object' == typeof obj && null !== obj && level < maxLevel) for (const [k, v] of Object.entries(obj))checkCirclePath(v, [
36
+ ...record,
37
+ {
38
+ prop: k,
39
+ ref: v
40
+ }
41
+ ], res, level + 1);
42
+ };
43
+ exports.checkCirclePath = __webpack_exports__.checkCirclePath;
44
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
45
+ "checkCirclePath"
46
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
47
+ Object.defineProperty(exports, '__esModule', {
48
+ value: true
49
+ });
@@ -2,4 +2,3 @@ export declare const checkCirclePath: (obj: any, record: {
2
2
  prop: string;
3
3
  ref: unknown;
4
4
  }[], res: string[][], level: number, maxLevel?: number) => void;
5
- //# sourceMappingURL=circleDetect.d.ts.map
@@ -1,31 +1,5 @@
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
- checkCirclePath: ()=>checkCirclePath
28
- });
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
29
3
  const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
30
4
  const idx = record.slice(0, record.length - 1).findIndex((v)=>v.ref === obj);
31
5
  if (-1 !== idx) {
@@ -40,10 +14,4 @@ const checkCirclePath = (obj, record, res, level, maxLevel = 3)=>{
40
14
  }
41
15
  ], res, level + 1);
42
16
  };
43
- exports.checkCirclePath = __webpack_exports__.checkCirclePath;
44
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
45
- "checkCirclePath"
46
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
47
- Object.defineProperty(exports, '__esModule', {
48
- value: true
49
- });
17
+ export { checkCirclePath };
@@ -0,0 +1,177 @@
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
+ normalizeUserConfig: ()=>normalizeUserConfig,
37
+ normalizeReportType: ()=>normalizeReportType,
38
+ normalizeRspackUserOptions: ()=>normalizeRspackUserOptions
39
+ });
40
+ const types_namespaceObject = require("@rsdoctor/types");
41
+ const logger_namespaceObject = require("@rsdoctor/utils/logger");
42
+ const external_assert_namespaceObject = require("assert");
43
+ var external_assert_default = /*#__PURE__*/ __webpack_require__.n(external_assert_namespaceObject);
44
+ const external_normalize_config_cjs_namespaceObject = require("./normalize-config.cjs");
45
+ function defaultBoolean(v, dft) {
46
+ return 'boolean' == typeof v ? v : dft;
47
+ }
48
+ function getDefaultOutput() {
49
+ return {
50
+ mode: void 0,
51
+ reportCodeType: {
52
+ noModuleSource: false,
53
+ noAssetsAndModuleSource: false,
54
+ noCode: false
55
+ },
56
+ options: void 0,
57
+ reportDir: '',
58
+ compressData: void 0
59
+ };
60
+ }
61
+ function getDefaultSupports() {
62
+ return {
63
+ parseBundle: true,
64
+ banner: void 0,
65
+ gzip: true
66
+ };
67
+ }
68
+ function normalizeFeatures(features, mode) {
69
+ if (Array.isArray(features)) return {
70
+ loader: features.includes('loader'),
71
+ plugins: features.includes('plugins'),
72
+ resolver: features.includes('resolver'),
73
+ bundle: features.includes('bundle'),
74
+ treeShaking: features.includes('treeShaking'),
75
+ lite: features.includes('lite') || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
76
+ };
77
+ return {
78
+ loader: defaultBoolean(features.loader, true),
79
+ plugins: defaultBoolean(features.plugins, true),
80
+ resolver: defaultBoolean(features.resolver, false),
81
+ bundle: defaultBoolean(features.bundle, true),
82
+ treeShaking: defaultBoolean(features.treeShaking, false),
83
+ lite: defaultBoolean(features.lite, false) || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
84
+ };
85
+ }
86
+ function normalizeLinter(linter) {
87
+ return {
88
+ rules: {},
89
+ extends: [],
90
+ level: 'Error',
91
+ ...linter
92
+ };
93
+ }
94
+ function isValidMode(mode) {
95
+ return 'string' == typeof mode && [
96
+ 'brief',
97
+ 'normal',
98
+ 'lite'
99
+ ].includes(mode);
100
+ }
101
+ function normalizeUserConfig(config = {}) {
102
+ const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
103
+ serverUrls: true
104
+ }, mode, brief } = config;
105
+ external_assert_default()('object' == typeof linter);
106
+ external_assert_default()('object' == typeof features || Array.isArray(features));
107
+ external_assert_default()('object' == typeof loaderInterceptorOptions);
108
+ external_assert_default()('boolean' == typeof disableClientServer);
109
+ let finalMode = ('mode' in output && isValidMode(output.mode) ? 'lite' === output.mode ? types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.normal] : output.mode : void 0) || mode || types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.normal];
110
+ if (mode) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
111
+ const _features = normalizeFeatures(features, finalMode);
112
+ const _linter = normalizeLinter(linter);
113
+ if (_features.lite || finalMode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("Lite features will be deprecated in a future version. Please use 'output: { reportCodeType: { noAssetsAndModuleSource: true }}' instead."));
114
+ const { finalBrief, finalNormalOptions } = (0, external_normalize_config_cjs_namespaceObject.processModeConfigurations)(finalMode, output, brief);
115
+ if (_features.lite && finalMode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) finalMode = types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite];
116
+ const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, finalMode) : normalizeReportType(getDefaultOutput().reportCodeType, finalMode);
117
+ const res = {
118
+ linter: _linter,
119
+ features: _features,
120
+ loaderInterceptorOptions: {
121
+ skipLoaders: Array.isArray(loaderInterceptorOptions.skipLoaders) ? loaderInterceptorOptions.skipLoaders : []
122
+ },
123
+ disableClientServer,
124
+ sdkInstance,
125
+ output: {
126
+ mode: finalMode,
127
+ options: 'brief' === finalMode ? finalBrief : finalNormalOptions,
128
+ reportCodeType,
129
+ reportDir: output.reportDir || ''
130
+ },
131
+ innerClientPath,
132
+ supports,
133
+ port,
134
+ printLog
135
+ };
136
+ if (void 0 !== output.compressData) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("The 'compressData' configuration will be deprecated in a future version."));
137
+ return res;
138
+ }
139
+ const normalizeReportType = (reportCodeType, mode)=>{
140
+ const convertedReportCodeType = 'object' == typeof reportCodeType ? (0, external_normalize_config_cjs_namespaceObject.convertReportCodeTypeObject)(reportCodeType) : reportCodeType;
141
+ if ('noCode' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoCode;
142
+ if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) return types_namespaceObject.SDK.ToDataType.NoCode;
143
+ if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
144
+ if ('noAssetsAndModuleSource' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
145
+ if ('noModuleSource' === convertedReportCodeType) return types_namespaceObject.SDK.ToDataType.NoSource;
146
+ return types_namespaceObject.SDK.ToDataType.Normal;
147
+ };
148
+ function normalizeRspackUserOptions(options) {
149
+ var _options_experiments, _options_experiments1;
150
+ const config = normalizeUserConfig(options);
151
+ config.experiments ??= {
152
+ enableNativePlugin: {
153
+ moduleGraph: false,
154
+ chunkGraph: false
155
+ }
156
+ };
157
+ if ('boolean' == typeof (null == (_options_experiments = options.experiments) ? void 0 : _options_experiments.enableNativePlugin) && (null == (_options_experiments1 = options.experiments) ? void 0 : _options_experiments1.enableNativePlugin) === true) config.experiments.enableNativePlugin = {
158
+ moduleGraph: true,
159
+ chunkGraph: true
160
+ };
161
+ else config.experiments.enableNativePlugin = {
162
+ moduleGraph: false,
163
+ chunkGraph: false
164
+ };
165
+ return config;
166
+ }
167
+ exports.normalizeReportType = __webpack_exports__.normalizeReportType;
168
+ exports.normalizeRspackUserOptions = __webpack_exports__.normalizeRspackUserOptions;
169
+ exports.normalizeUserConfig = __webpack_exports__.normalizeUserConfig;
170
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
171
+ "normalizeReportType",
172
+ "normalizeRspackUserOptions",
173
+ "normalizeUserConfig"
174
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
175
+ Object.defineProperty(exports, '__esModule', {
176
+ value: true
177
+ });
@@ -1,10 +1,5 @@
1
+ import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
1
2
  import { Linter, Plugin, SDK } from '@rsdoctor/types';
2
- import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
- import { RuleSetCondition as WebpackRuleSetCondition, RuleSetConditionAbsolute as WebpackRuleSetConditionAbsolute, RuleSetRule as WebpackRuleSetRule } from 'webpack';
4
- import { RsdoctorWebpackPluginOptions, RsdoctorPluginOptionsNormalized, IReportCodeType, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
5
- export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: RsdoctorWebpackPluginOptions<Rules>): RsdoctorPluginOptionsNormalized<Rules>;
6
- export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | WebpackRuleSetConditionAbsolute | WebpackRuleSetCondition | void): void;
7
- export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf'] | WebpackRuleSetRule['oneOf']): void;
8
- export declare const normalizeReportType: (reportCodeType: IReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
3
+ export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
4
+ export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
9
5
  export declare function normalizeRspackUserOptions<Rules extends Linter.ExtendRuleData[]>(options: RsdoctorRspackPluginOptions<Rules>): RsdoctorRspackPluginOptionsNormalized<Rules>;
10
- //# sourceMappingURL=config.d.ts.map
@@ -1,60 +1,23 @@
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
- normalizeUserConfig: ()=>normalizeUserConfig,
37
- makeRuleSetSerializable: ()=>makeRuleSetSerializable,
38
- makeRulesSerializable: ()=>makeRulesSerializable,
39
- normalizeReportType: ()=>normalizeReportType,
40
- normalizeRspackUserOptions: ()=>normalizeRspackUserOptions
41
- });
42
- const types_namespaceObject = require("@rsdoctor/types");
43
- const external_assert_namespaceObject = require("assert");
44
- var external_assert_default = /*#__PURE__*/ __webpack_require__.n(external_assert_namespaceObject);
45
- const logger_namespaceObject = require("@rsdoctor/utils/logger");
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { SDK } from "@rsdoctor/types";
4
+ import { chalk, logger } from "@rsdoctor/utils/logger";
5
+ import assert from "assert";
6
+ import { convertReportCodeTypeObject, processModeConfigurations } from "./normalize-config.js";
46
7
  function defaultBoolean(v, dft) {
47
8
  return 'boolean' == typeof v ? v : dft;
48
9
  }
49
10
  function getDefaultOutput() {
50
11
  return {
12
+ mode: void 0,
51
13
  reportCodeType: {
52
14
  noModuleSource: false,
53
15
  noAssetsAndModuleSource: false,
54
16
  noCode: false
55
17
  },
18
+ options: void 0,
56
19
  reportDir: '',
57
- compressData: true
20
+ compressData: void 0
58
21
  };
59
22
  }
60
23
  function getDefaultSupports() {
@@ -71,7 +34,7 @@ function normalizeFeatures(features, mode) {
71
34
  resolver: features.includes('resolver'),
72
35
  bundle: features.includes('bundle'),
73
36
  treeShaking: features.includes('treeShaking'),
74
- lite: features.includes('lite') || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
37
+ lite: features.includes('lite') || mode === SDK.IMode[SDK.IMode.lite]
75
38
  };
76
39
  return {
77
40
  loader: defaultBoolean(features.loader, true),
@@ -79,7 +42,7 @@ function normalizeFeatures(features, mode) {
79
42
  resolver: defaultBoolean(features.resolver, false),
80
43
  bundle: defaultBoolean(features.bundle, true),
81
44
  treeShaking: defaultBoolean(features.treeShaking, false),
82
- lite: defaultBoolean(features.lite, false) || mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]
45
+ lite: defaultBoolean(features.lite, false) || mode === SDK.IMode[SDK.IMode.lite]
83
46
  };
84
47
  }
85
48
  function normalizeLinter(linter) {
@@ -90,23 +53,29 @@ function normalizeLinter(linter) {
90
53
  ...linter
91
54
  };
92
55
  }
56
+ function isValidMode(mode) {
57
+ return 'string' == typeof mode && [
58
+ 'brief',
59
+ 'normal',
60
+ 'lite'
61
+ ].includes(mode);
62
+ }
93
63
  function normalizeUserConfig(config = {}) {
94
64
  const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer = false, sdkInstance, innerClientPath = '', output = getDefaultOutput(), supports = getDefaultSupports(), port, printLog = {
95
65
  serverUrls: true
96
- }, mode = 'normal', brief = {
97
- reportHtmlDir: void 0,
98
- reportHtmlName: void 0,
99
- writeDataJson: false
100
- } } = config;
101
- external_assert_default()('object' == typeof linter);
102
- external_assert_default()('object' == typeof features || Array.isArray(features));
103
- external_assert_default()('object' == typeof loaderInterceptorOptions);
104
- external_assert_default()('boolean' == typeof disableClientServer);
105
- const _features = normalizeFeatures(features, mode);
66
+ }, mode, brief } = config;
67
+ assert('object' == typeof linter);
68
+ assert('object' == typeof features || Array.isArray(features));
69
+ assert('object' == typeof loaderInterceptorOptions);
70
+ assert('boolean' == typeof disableClientServer);
71
+ let finalMode = ('mode' in output && isValidMode(output.mode) ? 'lite' === output.mode ? SDK.IMode[SDK.IMode.normal] : output.mode : void 0) || mode || SDK.IMode[SDK.IMode.normal];
72
+ if (mode) logger.info(chalk.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
73
+ const _features = normalizeFeatures(features, finalMode);
106
74
  const _linter = normalizeLinter(linter);
107
- let _mode = mode;
108
- if (_features.lite && _mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) _mode = types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite];
109
- const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, _mode) : normalizeReportType(getDefaultOutput().reportCodeType, _mode);
75
+ if (_features.lite || finalMode === SDK.IMode[SDK.IMode.lite]) logger.info(chalk.yellow("Lite features will be deprecated in a future version. Please use 'output: { reportCodeType: { noAssetsAndModuleSource: true }}' instead."));
76
+ const { finalBrief, finalNormalOptions } = processModeConfigurations(finalMode, output, brief);
77
+ if (_features.lite && finalMode !== SDK.IMode[SDK.IMode.brief]) finalMode = SDK.IMode[SDK.IMode.lite];
78
+ const reportCodeType = output.reportCodeType ? normalizeReportType(output.reportCodeType, finalMode) : normalizeReportType(getDefaultOutput().reportCodeType, finalMode);
110
79
  const res = {
111
80
  linter: _linter,
112
81
  features: _features,
@@ -116,55 +85,27 @@ function normalizeUserConfig(config = {}) {
116
85
  disableClientServer,
117
86
  sdkInstance,
118
87
  output: {
88
+ mode: finalMode,
89
+ options: 'brief' === finalMode ? finalBrief : finalNormalOptions,
119
90
  reportCodeType,
120
- reportDir: output.reportDir || '',
121
- compressData: void 0 !== output.compressData ? output.compressData : true
91
+ reportDir: output.reportDir || ''
122
92
  },
123
93
  innerClientPath,
124
94
  supports,
125
95
  port,
126
- printLog,
127
- mode,
128
- brief
96
+ printLog
129
97
  };
130
- if (false === res.output.compressData && (!output.reportCodeType || !output.reportCodeType.noAssetsAndModuleSource)) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow("[RSDOCTOR]: When you use compressData: false, it is recommended to set output.reportCodeType to { noAssetsAndModuleSource: true }."));
98
+ if (void 0 !== output.compressData) logger.info(chalk.yellow("The 'compressData' configuration will be deprecated in a future version."));
131
99
  return res;
132
100
  }
133
- function makeRuleSetSerializable(item) {
134
- if (!item) return;
135
- if (item instanceof RegExp) item.toJSON = item.toString;
136
- else if (Array.isArray(item)) item.forEach((i)=>makeRuleSetSerializable(i));
137
- else if ('object' == typeof item) {
138
- makeRuleSetSerializable(item.and);
139
- makeRuleSetSerializable(item.or);
140
- makeRuleSetSerializable(item.not);
141
- }
142
- }
143
- function makeRulesSerializable(rules) {
144
- if (!Array.isArray(rules)) return;
145
- if (!rules.length) return;
146
- rules.forEach((rule)=>{
147
- if (!rule) return;
148
- makeRuleSetSerializable(rule.test);
149
- makeRuleSetSerializable(rule.resourceQuery);
150
- makeRuleSetSerializable(rule.resource);
151
- makeRuleSetSerializable(rule.resourceFragment);
152
- makeRuleSetSerializable(rule.scheme);
153
- makeRuleSetSerializable(rule.issuer);
154
- if ('issuerLayer' in rule) makeRuleSetSerializable(rule.issuerLayer);
155
- makeRuleSetSerializable(rule.include);
156
- makeRuleSetSerializable(rule.exclude);
157
- if (rule.oneOf) makeRulesSerializable(rule.oneOf);
158
- if ('rules' in rule && rule.rules) makeRulesSerializable(rule.rules);
159
- });
160
- }
161
101
  const normalizeReportType = (reportCodeType, mode)=>{
162
- if (reportCodeType.noCode) return types_namespaceObject.SDK.ToDataType.NoCode;
163
- if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) return types_namespaceObject.SDK.ToDataType.NoCode;
164
- if (mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.lite]) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
165
- if (reportCodeType.noAssetsAndModuleSource) return types_namespaceObject.SDK.ToDataType.NoSourceAndAssets;
166
- if (reportCodeType.noModuleSource) return types_namespaceObject.SDK.ToDataType.NoSource;
167
- return types_namespaceObject.SDK.ToDataType.Normal;
102
+ const convertedReportCodeType = 'object' == typeof reportCodeType ? convertReportCodeTypeObject(reportCodeType) : reportCodeType;
103
+ if ('noCode' === convertedReportCodeType) return SDK.ToDataType.NoCode;
104
+ if (mode === SDK.IMode[SDK.IMode.brief]) return SDK.ToDataType.NoCode;
105
+ if (mode === SDK.IMode[SDK.IMode.lite]) return SDK.ToDataType.NoSourceAndAssets;
106
+ if ('noAssetsAndModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSourceAndAssets;
107
+ if ('noModuleSource' === convertedReportCodeType) return SDK.ToDataType.NoSource;
108
+ return SDK.ToDataType.Normal;
168
109
  };
169
110
  function normalizeRspackUserOptions(options) {
170
111
  var _options_experiments, _options_experiments1;
@@ -185,18 +126,4 @@ function normalizeRspackUserOptions(options) {
185
126
  };
186
127
  return config;
187
128
  }
188
- exports.makeRuleSetSerializable = __webpack_exports__.makeRuleSetSerializable;
189
- exports.makeRulesSerializable = __webpack_exports__.makeRulesSerializable;
190
- exports.normalizeReportType = __webpack_exports__.normalizeReportType;
191
- exports.normalizeRspackUserOptions = __webpack_exports__.normalizeRspackUserOptions;
192
- exports.normalizeUserConfig = __webpack_exports__.normalizeUserConfig;
193
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
194
- "makeRuleSetSerializable",
195
- "makeRulesSerializable",
196
- "normalizeReportType",
197
- "normalizeRspackUserOptions",
198
- "normalizeUserConfig"
199
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
200
- Object.defineProperty(exports, '__esModule', {
201
- value: true
202
- });
129
+ export { normalizeReportType, normalizeRspackUserOptions, normalizeUserConfig };