@rsdoctor/core 2.0.0-alpha.0 → 2.0.0-alpha.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 (393) hide show
  1. package/dist/build-utils/build/chunks/assetsModules.d.ts +1 -1
  2. package/dist/build-utils/build/chunks/assetsModules.js +1 -1
  3. package/dist/build-utils/build/chunks/index.d.ts +0 -1
  4. package/dist/build-utils/build/chunks/index.js +0 -1
  5. package/dist/build-utils/build/chunks/rspack/transform.d.ts +1 -1
  6. package/dist/build-utils/build/chunks/rspack/transform.js +1 -1
  7. package/dist/build-utils/build/envinfo.d.ts +13 -0
  8. package/dist/build-utils/build/envinfo.js +60 -0
  9. package/dist/build-utils/build/file/cache.d.ts +5 -0
  10. package/dist/build-utils/build/file/cache.js +24 -0
  11. package/dist/build-utils/build/file/index.d.ts +3 -0
  12. package/dist/build-utils/build/file/index.js +5 -0
  13. package/dist/build-utils/build/file/sharding.d.ts +21 -0
  14. package/dist/build-utils/build/file/sharding.js +38 -0
  15. package/dist/build-utils/build/index.d.ts +5 -0
  16. package/dist/build-utils/build/index.js +11 -6
  17. package/dist/build-utils/build/json.d.ts +3 -0
  18. package/dist/build-utils/build/json.js +67 -0
  19. package/dist/build-utils/build/loader/probeLoader.d.ts +2 -2
  20. package/dist/build-utils/build/loader/probeLoader.js +4 -4
  21. package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -1
  22. package/dist/build-utils/build/loader/probeLoaderPlugin.js +1 -1
  23. package/dist/build-utils/build/module-graph/index.d.ts +0 -1
  24. package/dist/build-utils/build/module-graph/index.js +0 -1
  25. package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
  26. package/dist/build-utils/build/module-graph/parser.js +1 -1
  27. package/dist/build-utils/build/module-graph/rspack/transform.d.ts +1 -1
  28. package/dist/build-utils/build/module-graph/rspack/transform.js +6 -4
  29. package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
  30. package/dist/build-utils/build/module-graph/utils.js +5 -4
  31. package/dist/build-utils/build/process.d.ts +2 -0
  32. package/dist/build-utils/build/process.js +18 -0
  33. package/dist/build-utils/build/server.d.ts +15 -0
  34. package/dist/build-utils/build/server.js +107 -0
  35. package/dist/build-utils/build/utils/loader.d.ts +2 -2
  36. package/dist/build-utils/build/utils/loader.js +10 -19
  37. package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
  38. package/dist/build-utils/build/utils/parseBundle.js +6 -8
  39. package/dist/build-utils/build/utils/plugin.d.ts +1 -1
  40. package/dist/build-utils/index.d.ts +10 -0
  41. package/dist/build-utils/index.js +12 -2
  42. package/dist/collection.d.ts +1 -0
  43. package/dist/collection.js +2 -0
  44. package/dist/common/file.d.ts +2 -0
  45. package/dist/common/file.js +8 -0
  46. package/dist/common/global-config.d.ts +21 -0
  47. package/dist/common/global-config.js +33 -0
  48. package/dist/common/index.d.ts +4 -0
  49. package/dist/common/index.js +6 -0
  50. package/dist/common-browser.d.ts +1 -0
  51. package/dist/common-browser.js +2 -0
  52. package/dist/error/error.d.ts +35 -0
  53. package/dist/error/error.js +143 -0
  54. package/dist/error/index.d.ts +2 -0
  55. package/dist/error/index.js +3 -0
  56. package/dist/error/transform.d.ts +3 -0
  57. package/dist/error/transform.js +138 -0
  58. package/dist/error/utils.d.ts +4 -0
  59. package/dist/error/utils.js +23 -0
  60. package/dist/graph/index.d.ts +1 -0
  61. package/dist/graph/index.js +2 -0
  62. package/dist/index.d.ts +2 -0
  63. package/dist/index.js +4 -2
  64. package/dist/inner-plugins/loaders/proxy.d.ts +4 -4
  65. package/dist/inner-plugins/plugins/base.d.ts +1 -1
  66. package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
  67. package/dist/inner-plugins/plugins/bundle.js +3 -3
  68. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +3 -3
  69. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +11 -39
  70. package/dist/inner-plugins/plugins/errors.d.ts +2 -2
  71. package/dist/inner-plugins/plugins/errors.js +3 -3
  72. package/dist/inner-plugins/plugins/loader.d.ts +1 -1
  73. package/dist/inner-plugins/plugins/loader.js +7 -19
  74. package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
  75. package/dist/inner-plugins/plugins/plugins.js +2 -2
  76. package/dist/inner-plugins/plugins/progress.d.ts +2 -2
  77. package/dist/inner-plugins/plugins/progress.js +2 -2
  78. package/dist/inner-plugins/plugins/resolver.d.ts +1 -1
  79. package/dist/inner-plugins/plugins/resolver.js +2 -2
  80. package/dist/inner-plugins/plugins/rspack.d.ts +8 -3
  81. package/dist/inner-plugins/plugins/rspack.js +18 -4
  82. package/dist/inner-plugins/plugins/rules.d.ts +1 -1
  83. package/dist/inner-plugins/plugins/rules.js +3 -3
  84. package/dist/inner-plugins/plugins/sourcemapTool.d.ts +2 -2
  85. package/dist/inner-plugins/plugins/sourcemapTool.js +2 -2
  86. package/dist/inner-plugins/plugins/summary.d.ts +1 -1
  87. package/dist/inner-plugins/plugins/summary.js +3 -3
  88. package/dist/inner-plugins/utils/config.d.ts +2 -3
  89. package/dist/inner-plugins/utils/config.js +16 -17
  90. package/dist/inner-plugins/utils/loader.d.ts +4 -7
  91. package/dist/inner-plugins/utils/loader.js +8 -34
  92. package/dist/inner-plugins/utils/normalize-config.d.ts +1 -1
  93. package/dist/inner-plugins/utils/openBrowser.d.ts +1 -0
  94. package/dist/inner-plugins/utils/openBrowser.js +55 -0
  95. package/dist/inner-plugins/utils/plugin-common.js +4 -4
  96. package/dist/inner-plugins/utils/plugin.d.ts +1 -1
  97. package/dist/inner-plugins/utils/plugin.js +1 -1
  98. package/dist/inner-plugins/utils/sdk.d.ts +2 -3
  99. package/dist/inner-plugins/utils/sdk.js +2 -2
  100. package/dist/logger.d.ts +9 -0
  101. package/dist/logger.js +51 -0
  102. package/dist/{inner-plugins/constants.d.cts → rspack-plugin/constants.d.ts} +3 -0
  103. package/dist/rspack-plugin/constants.js +23 -0
  104. package/dist/rspack-plugin/index.d.ts +2 -0
  105. package/dist/rspack-plugin/index.js +3 -0
  106. package/dist/rspack-plugin/multiple.d.ts +8 -0
  107. package/dist/rspack-plugin/multiple.js +39 -0
  108. package/dist/rspack-plugin/plugin.d.ts +25 -0
  109. package/dist/rspack-plugin/plugin.js +133 -0
  110. package/dist/rule-utils/document/document.d.ts +16 -0
  111. package/dist/rule-utils/document/document.js +46 -0
  112. package/dist/rule-utils/document/index.d.ts +3 -0
  113. package/dist/rule-utils/document/index.js +4 -0
  114. package/dist/rule-utils/document/server.d.ts +4 -0
  115. package/dist/rule-utils/document/server.js +13 -0
  116. package/dist/rule-utils/document/types.d.ts +31 -0
  117. package/dist/rule-utils/index.d.ts +2 -0
  118. package/dist/rule-utils/index.js +3 -0
  119. package/dist/rule-utils/parser/asserts.d.ts +81 -0
  120. package/dist/rule-utils/parser/asserts.js +105 -0
  121. package/dist/rule-utils/parser/index.d.ts +4 -0
  122. package/dist/rule-utils/parser/index.js +5 -0
  123. package/dist/rule-utils/parser/parser.d.ts +118 -0
  124. package/dist/rule-utils/parser/parser.js +24 -0
  125. package/dist/rule-utils/parser/types.d.ts +30 -0
  126. package/dist/rule-utils/parser/types.js +8 -0
  127. package/dist/rule-utils/parser/utils.d.ts +30 -0
  128. package/dist/rule-utils/parser/utils.js +106 -0
  129. package/dist/rules/linter.d.ts +1 -1
  130. package/dist/rules/linter.js +1 -1
  131. package/dist/rules/rule.d.ts +2 -2
  132. package/dist/rules/rule.js +2 -2
  133. package/dist/rules/rules/cjs-require/index.d.ts +1 -1
  134. package/dist/rules/rules/cjs-require/index.js +1 -1
  135. package/dist/rules/rules/cross-chunks-package/index.d.ts +1 -1
  136. package/dist/rules/rules/cross-chunks-package/index.js +2 -2
  137. package/dist/rules/rules/default-import-check/index.d.ts +1 -1
  138. package/dist/rules/rules/default-import-check/index.js +2 -2
  139. package/dist/rules/rules/default-import-check/utils.d.ts +2 -2
  140. package/dist/rules/rules/default-import-check/utils.js +2 -2
  141. package/dist/rules/rules/duplicate-package/index.d.ts +3 -3
  142. package/dist/rules/rules/duplicate-package/index.js +3 -3
  143. package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
  144. package/dist/rules/rules/ecma-version-check/index.d.ts +3 -2
  145. package/dist/rules/rules/ecma-version-check/index.js +1 -1
  146. package/dist/rules/rules/ecma-version-check/types.d.ts +1 -2
  147. package/dist/rules/rules/ecma-version-check/utils.d.ts +1 -1
  148. package/dist/rules/rules/esm-resolved-to-cjs/index.d.ts +1 -1
  149. package/dist/rules/rules/esm-resolved-to-cjs/index.js +1 -1
  150. package/dist/rules/rules/index.d.ts +1 -1
  151. package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
  152. package/dist/rules/rules/loader-performance-optimization/index.js +2 -2
  153. package/dist/rules/rules/loader-performance-optimization/types.d.ts +1 -1
  154. package/dist/rules/rules/module-mixed-chunks/index.d.ts +1 -1
  155. package/dist/rules/rules/module-mixed-chunks/index.js +1 -1
  156. package/dist/rules/rules/side-effects-only-imports/index.d.ts +1 -1
  157. package/dist/rules/rules/side-effects-only-imports/index.js +1 -1
  158. package/dist/rules/utils.d.ts +1 -1
  159. package/dist/rules/utils.js +1 -1
  160. package/dist/sdk/index.d.ts +2 -0
  161. package/dist/sdk/index.js +3 -0
  162. package/dist/sdk/multiple/controller.d.ts +12 -0
  163. package/dist/sdk/multiple/controller.js +42 -0
  164. package/dist/sdk/multiple/index.d.ts +2 -0
  165. package/dist/sdk/multiple/index.js +3 -0
  166. package/dist/sdk/multiple/primary.d.ts +32 -0
  167. package/dist/sdk/multiple/primary.js +64 -0
  168. package/dist/sdk/multiple/server.d.ts +7 -0
  169. package/dist/sdk/multiple/server.js +14 -0
  170. package/dist/sdk/sdk/core.d.ts +33 -0
  171. package/dist/sdk/sdk/core.js +163 -0
  172. package/dist/sdk/sdk/index.d.ts +52 -0
  173. package/dist/sdk/sdk/index.js +435 -0
  174. package/dist/sdk/sdk/types.d.ts +26 -0
  175. package/dist/sdk/sdk/types.js +1 -0
  176. package/dist/sdk/server/apis/alerts.d.ts +5 -0
  177. package/dist/sdk/server/apis/alerts.js +30 -0
  178. package/dist/sdk/server/apis/base.d.ts +11 -0
  179. package/dist/sdk/server/apis/base.js +22 -0
  180. package/dist/sdk/server/apis/bundle-diff.d.ts +6 -0
  181. package/dist/sdk/server/apis/bundle-diff.js +51 -0
  182. package/dist/sdk/server/apis/data.d.ts +6 -0
  183. package/dist/sdk/server/apis/data.js +44 -0
  184. package/dist/sdk/server/apis/fs.d.ts +5 -0
  185. package/dist/sdk/server/apis/fs.js +28 -0
  186. package/dist/sdk/server/apis/graph.d.ts +12 -0
  187. package/dist/sdk/server/apis/graph.js +116 -0
  188. package/dist/sdk/server/apis/index.d.ts +10 -0
  189. package/dist/sdk/server/apis/index.js +11 -0
  190. package/dist/sdk/server/apis/loader.d.ts +15 -0
  191. package/dist/sdk/server/apis/loader.js +120 -0
  192. package/dist/sdk/server/apis/plugin.d.ts +6 -0
  193. package/dist/sdk/server/apis/plugin.js +39 -0
  194. package/dist/sdk/server/apis/project.d.ts +8 -0
  195. package/dist/sdk/server/apis/project.js +59 -0
  196. package/dist/sdk/server/apis/renderer.d.ts +6 -0
  197. package/dist/sdk/server/apis/renderer.js +33 -0
  198. package/dist/sdk/server/apis/resolver.d.ts +6 -0
  199. package/dist/sdk/server/apis/resolver.js +38 -0
  200. package/dist/sdk/server/client.d.ts +3 -0
  201. package/dist/sdk/server/client.js +8 -0
  202. package/dist/sdk/server/fakeServer.d.ts +9 -0
  203. package/dist/sdk/server/fakeServer.js +12 -0
  204. package/dist/sdk/server/index.d.ts +44 -0
  205. package/dist/sdk/server/index.js +292 -0
  206. package/dist/sdk/server/json-body.d.ts +6 -0
  207. package/dist/sdk/server/json-body.js +150 -0
  208. package/dist/sdk/server/router.d.ts +24 -0
  209. package/dist/sdk/server/router.js +83 -0
  210. package/dist/sdk/server/security.d.ts +5 -0
  211. package/dist/sdk/server/security.js +47 -0
  212. package/dist/sdk/server/socket/api.d.ts +15 -0
  213. package/dist/sdk/server/socket/api.js +22 -0
  214. package/dist/sdk/server/socket/index.d.ts +48 -0
  215. package/dist/sdk/server/socket/index.js +166 -0
  216. package/dist/sdk/server/utils.d.ts +6 -0
  217. package/dist/sdk/server/utils.js +19 -0
  218. package/dist/sdk/utils/base.d.ts +1 -0
  219. package/dist/sdk/utils/base.js +22 -0
  220. package/dist/sdk/utils/constant.d.ts +1 -0
  221. package/dist/sdk/utils/constant.js +4 -0
  222. package/dist/sdk/utils/index.d.ts +3 -0
  223. package/dist/sdk/utils/index.js +4 -0
  224. package/dist/sdk/utils/openBrowser.d.ts +4 -0
  225. package/dist/sdk/utils/openBrowser.js +53 -0
  226. package/dist/sdk/utils/upload.d.ts +2 -0
  227. package/dist/sdk/utils/upload.js +6 -0
  228. package/dist/sdk.d.ts +1 -0
  229. package/dist/sdk.js +2 -0
  230. package/dist/types/index.d.ts +0 -1
  231. package/dist/types/index.js +0 -1
  232. package/dist/types/loader.d.ts +1 -1
  233. package/dist/types/plugin.d.ts +7 -28
  234. package/package.json +127 -58
  235. package/static/openChrome.applescript +95 -0
  236. package/dist/build-utils/build/chunks/assetsModules.cjs +0 -42
  237. package/dist/build-utils/build/chunks/assetsModules.d.cts +0 -17
  238. package/dist/build-utils/build/chunks/chunkTransform.cjs +0 -39
  239. package/dist/build-utils/build/chunks/chunkTransform.d.cts +0 -4
  240. package/dist/build-utils/build/chunks/chunkTransform.d.ts +0 -4
  241. package/dist/build-utils/build/chunks/chunkTransform.js +0 -6
  242. package/dist/build-utils/build/chunks/index.cjs +0 -72
  243. package/dist/build-utils/build/chunks/index.d.cts +0 -3
  244. package/dist/build-utils/build/chunks/rspack/transform.cjs +0 -80
  245. package/dist/build-utils/build/chunks/rspack/transform.d.cts +0 -13
  246. package/dist/build-utils/build/index.cjs +0 -52
  247. package/dist/build-utils/build/index.d.cts +0 -5
  248. package/dist/build-utils/build/loader/index.cjs +0 -65
  249. package/dist/build-utils/build/loader/index.d.cts +0 -2
  250. package/dist/build-utils/build/loader/probeLoader.cjs +0 -89
  251. package/dist/build-utils/build/loader/probeLoader.d.cts +0 -4
  252. package/dist/build-utils/build/loader/probeLoaderPlugin.cjs +0 -65
  253. package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +0 -5
  254. package/dist/build-utils/build/module-graph/index.cjs +0 -65
  255. package/dist/build-utils/build/module-graph/index.d.cts +0 -2
  256. package/dist/build-utils/build/module-graph/parser.cjs +0 -46
  257. package/dist/build-utils/build/module-graph/parser.d.cts +0 -2
  258. package/dist/build-utils/build/module-graph/rspack/transform.cjs +0 -151
  259. package/dist/build-utils/build/module-graph/rspack/transform.d.cts +0 -26
  260. package/dist/build-utils/build/module-graph/transform.cjs +0 -39
  261. package/dist/build-utils/build/module-graph/transform.d.cts +0 -3
  262. package/dist/build-utils/build/module-graph/transform.d.ts +0 -3
  263. package/dist/build-utils/build/module-graph/transform.js +0 -6
  264. package/dist/build-utils/build/module-graph/utils.cjs +0 -95
  265. package/dist/build-utils/build/module-graph/utils.d.cts +0 -3
  266. package/dist/build-utils/build/utils/index.cjs +0 -72
  267. package/dist/build-utils/build/utils/index.d.cts +0 -3
  268. package/dist/build-utils/build/utils/loader.cjs +0 -354
  269. package/dist/build-utils/build/utils/loader.d.cts +0 -20
  270. package/dist/build-utils/build/utils/parseBundle.cjs +0 -283
  271. package/dist/build-utils/build/utils/parseBundle.d.cts +0 -12
  272. package/dist/build-utils/build/utils/plugin.cjs +0 -60
  273. package/dist/build-utils/build/utils/plugin.d.cts +0 -5
  274. package/dist/build-utils/index.cjs +0 -36
  275. package/dist/build-utils/index.d.cts +0 -1
  276. package/dist/index.cjs +0 -81
  277. package/dist/index.d.cts +0 -3
  278. package/dist/inner-plugins/constants.cjs +0 -64
  279. package/dist/inner-plugins/index.cjs +0 -65
  280. package/dist/inner-plugins/index.d.cts +0 -2
  281. package/dist/inner-plugins/loaders/proxy.cjs +0 -104
  282. package/dist/inner-plugins/loaders/proxy.d.cts +0 -7
  283. package/dist/inner-plugins/plugins/base.cjs +0 -53
  284. package/dist/inner-plugins/plugins/base.d.cts +0 -12
  285. package/dist/inner-plugins/plugins/bundle.cjs +0 -96
  286. package/dist/inner-plugins/plugins/bundle.d.cts +0 -15
  287. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +0 -141
  288. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +0 -34
  289. package/dist/inner-plugins/plugins/errors.cjs +0 -98
  290. package/dist/inner-plugins/plugins/errors.d.cts +0 -11
  291. package/dist/inner-plugins/plugins/index.cjs +0 -121
  292. package/dist/inner-plugins/plugins/index.d.cts +0 -10
  293. package/dist/inner-plugins/plugins/loader.cjs +0 -165
  294. package/dist/inner-plugins/plugins/loader.d.cts +0 -10
  295. package/dist/inner-plugins/plugins/plugins.cjs +0 -73
  296. package/dist/inner-plugins/plugins/plugins.d.cts +0 -8
  297. package/dist/inner-plugins/plugins/progress.cjs +0 -68
  298. package/dist/inner-plugins/plugins/progress.d.cts +0 -8
  299. package/dist/inner-plugins/plugins/resolver.cjs +0 -90
  300. package/dist/inner-plugins/plugins/resolver.d.cts +0 -12
  301. package/dist/inner-plugins/plugins/rspack.cjs +0 -118
  302. package/dist/inner-plugins/plugins/rspack.d.cts +0 -4
  303. package/dist/inner-plugins/plugins/rules.cjs +0 -97
  304. package/dist/inner-plugins/plugins/rules.d.cts +0 -8
  305. package/dist/inner-plugins/plugins/sourcemapTool.cjs +0 -275
  306. package/dist/inner-plugins/plugins/sourcemapTool.d.cts +0 -52
  307. package/dist/inner-plugins/plugins/summary.cjs +0 -125
  308. package/dist/inner-plugins/plugins/summary.d.cts +0 -14
  309. package/dist/inner-plugins/utils/circleDetect.cjs +0 -49
  310. package/dist/inner-plugins/utils/circleDetect.d.cts +0 -4
  311. package/dist/inner-plugins/utils/config.cjs +0 -191
  312. package/dist/inner-plugins/utils/config.d.cts +0 -5
  313. package/dist/inner-plugins/utils/index.cjs +0 -106
  314. package/dist/inner-plugins/utils/index.d.cts +0 -9
  315. package/dist/inner-plugins/utils/loader.cjs +0 -218
  316. package/dist/inner-plugins/utils/loader.d.cts +0 -13
  317. package/dist/inner-plugins/utils/normalize-config.cjs +0 -122
  318. package/dist/inner-plugins/utils/normalize-config.d.cts +0 -37
  319. package/dist/inner-plugins/utils/plugin-common.cjs +0 -143
  320. package/dist/inner-plugins/utils/plugin-common.d.cts +0 -11
  321. package/dist/inner-plugins/utils/plugin.cjs +0 -106
  322. package/dist/inner-plugins/utils/plugin.d.cts +0 -4
  323. package/dist/inner-plugins/utils/sdk.cjs +0 -55
  324. package/dist/inner-plugins/utils/sdk.d.cts +0 -8
  325. package/dist/rslib-runtime.js +0 -19
  326. package/dist/rules/index.cjs +0 -81
  327. package/dist/rules/index.d.cts +0 -3
  328. package/dist/rules/linter.cjs +0 -72
  329. package/dist/rules/linter.d.cts +0 -9
  330. package/dist/rules/rule.cjs +0 -137
  331. package/dist/rules/rule.d.cts +0 -27
  332. package/dist/rules/rules/cjs-require/index.cjs +0 -83
  333. package/dist/rules/rules/cjs-require/index.d.cts +0 -4
  334. package/dist/rules/rules/cjs-require/types.cjs +0 -18
  335. package/dist/rules/rules/cjs-require/types.d.cts +0 -7
  336. package/dist/rules/rules/cross-chunks-package/index.cjs +0 -74
  337. package/dist/rules/rules/cross-chunks-package/index.d.cts +0 -4
  338. package/dist/rules/rules/cross-chunks-package/types.cjs +0 -18
  339. package/dist/rules/rules/cross-chunks-package/types.d.cts +0 -3
  340. package/dist/rules/rules/cross-chunks-package/utils.cjs +0 -40
  341. package/dist/rules/rules/cross-chunks-package/utils.d.cts +0 -1
  342. package/dist/rules/rules/default-import-check/index.cjs +0 -116
  343. package/dist/rules/rules/default-import-check/index.d.cts +0 -4
  344. package/dist/rules/rules/default-import-check/types.cjs +0 -18
  345. package/dist/rules/rules/default-import-check/types.d.cts +0 -4
  346. package/dist/rules/rules/default-import-check/utils.cjs +0 -97
  347. package/dist/rules/rules/default-import-check/utils.d.cts +0 -10
  348. package/dist/rules/rules/duplicate-package/index.cjs +0 -72
  349. package/dist/rules/rules/duplicate-package/index.d.cts +0 -4
  350. package/dist/rules/rules/duplicate-package/types.cjs +0 -60
  351. package/dist/rules/rules/duplicate-package/types.d.cts +0 -24
  352. package/dist/rules/rules/duplicate-package/utils.cjs +0 -84
  353. package/dist/rules/rules/duplicate-package/utils.d.cts +0 -3
  354. package/dist/rules/rules/ecma-version-check/index.cjs +0 -96
  355. package/dist/rules/rules/ecma-version-check/index.d.cts +0 -4
  356. package/dist/rules/rules/ecma-version-check/types.cjs +0 -18
  357. package/dist/rules/rules/ecma-version-check/types.d.cts +0 -3
  358. package/dist/rules/rules/ecma-version-check/utils.cjs +0 -39
  359. package/dist/rules/rules/ecma-version-check/utils.d.cts +0 -2
  360. package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +0 -237
  361. package/dist/rules/rules/esm-resolved-to-cjs/index.d.cts +0 -4
  362. package/dist/rules/rules/esm-resolved-to-cjs/types.cjs +0 -18
  363. package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +0 -8
  364. package/dist/rules/rules/index.cjs +0 -55
  365. package/dist/rules/rules/index.d.cts +0 -2
  366. package/dist/rules/rules/loader-performance-optimization/index.cjs +0 -119
  367. package/dist/rules/rules/loader-performance-optimization/index.d.cts +0 -4
  368. package/dist/rules/rules/loader-performance-optimization/types.cjs +0 -18
  369. package/dist/rules/rules/loader-performance-optimization/types.d.cts +0 -22
  370. package/dist/rules/rules/loader-performance-optimization/utils.cjs +0 -43
  371. package/dist/rules/rules/loader-performance-optimization/utils.d.cts +0 -1
  372. package/dist/rules/rules/module-mixed-chunks/index.cjs +0 -85
  373. package/dist/rules/rules/module-mixed-chunks/index.d.cts +0 -4
  374. package/dist/rules/rules/module-mixed-chunks/types.cjs +0 -18
  375. package/dist/rules/rules/module-mixed-chunks/types.d.cts +0 -3
  376. package/dist/rules/rules/side-effects-only-imports/index.cjs +0 -114
  377. package/dist/rules/rules/side-effects-only-imports/index.d.cts +0 -4
  378. package/dist/rules/rules/side-effects-only-imports/types.cjs +0 -18
  379. package/dist/rules/rules/side-effects-only-imports/types.d.cts +0 -9
  380. package/dist/rules/utils.cjs +0 -46
  381. package/dist/rules/utils.d.cts +0 -3
  382. package/dist/types/chunks.cjs +0 -18
  383. package/dist/types/chunks.d.cts +0 -6
  384. package/dist/types/chunks.d.ts +0 -6
  385. package/dist/types/index.cjs +0 -79
  386. package/dist/types/index.d.cts +0 -4
  387. package/dist/types/loader.cjs +0 -18
  388. package/dist/types/loader.d.cts +0 -19
  389. package/dist/types/plugin.cjs +0 -18
  390. package/dist/types/plugin.d.cts +0 -51
  391. package/dist/types/rules.cjs +0 -18
  392. package/dist/types/rules.d.cts +0 -7
  393. /package/dist/{types/chunks.js → rule-utils/document/types.js} +0 -0
@@ -0,0 +1,435 @@
1
+ import "node:module";
2
+ import node_fs from "node:fs";
3
+ import fs_extra from "fs-extra";
4
+ import path_0 from "path";
5
+ import { createRequire } from "module";
6
+ import { DevToolError } from "../../error/index.js";
7
+ import { Constants, SDK } from "@rsdoctor/shared/types";
8
+ import { SourceMapConsumer } from "source-map";
9
+ import { ChunkGraph, ModuleGraph, PackageGraph } from "../../graph/index.js";
10
+ import { logger } from "../../logger.js";
11
+ import { RsdoctorServer } from "../server/index.js";
12
+ import { RsdoctorFakeServer } from "../server/fakeServer.js";
13
+ import { SDKCore } from "./core.js";
14
+ import { Algorithm, Lodash, decycle } from "../../common/index.js";
15
+ import { findRoot } from "../utils/index.js";
16
+ export * from "../utils/openBrowser.js";
17
+ export * from "../utils/base.js";
18
+ const sdk_require = createRequire(import.meta.url);
19
+ class RsdoctorSDK extends SDKCore {
20
+ async bootstrap() {
21
+ logger.debug(`${Date.now()}`, '[RsdoctorSDK][bootstrap start]');
22
+ if (this.server) await this.server.bootstrap();
23
+ await super.bootstrap();
24
+ logger.debug(`${Date.now()} ${this.server.origin}`, '[RsdoctorSDK][bootstrap end]');
25
+ }
26
+ async dispose() {
27
+ logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose start]');
28
+ if (this.server) await this.server.dispose();
29
+ await super.dispose();
30
+ logger.debug(`${Date.now()}`, '[RsdoctorSDK][dispose end]');
31
+ }
32
+ async applyErrorFix(id) {
33
+ const { _errors: errors } = this;
34
+ const error = errors.find((err)=>err.id === id);
35
+ if (!error || !error.path || !error.fixData || error.fixData.isFixed) return;
36
+ const { path: filePath, fixData } = error;
37
+ const sameFileErrors = errors.filter((item)=>item.path === filePath && item !== error);
38
+ let content = (await node_fs.promises.readFile(filePath, 'utf-8')).toString();
39
+ const startTxt = content.substring(0, fixData.start);
40
+ const endTxt = content.substring(fixData.end, content.length);
41
+ const offset = (fixData.newText ?? '').length - (fixData.end - fixData.start);
42
+ content = startTxt + fixData.newText + endTxt;
43
+ for (const other of sameFileErrors){
44
+ const { fixData: otherFixData } = other;
45
+ if (otherFixData) {
46
+ if (otherFixData.start >= fixData.end) {
47
+ otherFixData.start += offset;
48
+ otherFixData.end += offset;
49
+ }
50
+ }
51
+ }
52
+ await node_fs.promises.writeFile(filePath, content);
53
+ }
54
+ clear() {
55
+ this._errors = [];
56
+ this._loader = [];
57
+ this._resolver = [];
58
+ this._plugin = {};
59
+ this._moduleGraph = new ModuleGraph();
60
+ this._chunkGraph = new ChunkGraph();
61
+ }
62
+ clearSourceMapCache() {
63
+ this._rawSourceMapCache = new Map();
64
+ this._sourceMap = new Map();
65
+ }
66
+ async getSourceMap(file) {
67
+ const { _sourceMap: sourceMap, _rawSourceMapCache: rawMap } = this;
68
+ if (sourceMap.has(file)) return sourceMap.get(file);
69
+ const rawData = rawMap.get(file);
70
+ if (!rawData || rawData.version < 0 || !rawData.sourcesContent?.[0] || !rawData.mappings) return Promise.resolve(void 0);
71
+ try {
72
+ const result = await new SourceMapConsumer(rawData);
73
+ sourceMap.set(file, result);
74
+ return result;
75
+ } catch {
76
+ return Promise.resolve(void 0);
77
+ }
78
+ }
79
+ reportSourceMap(data) {
80
+ this._rawSourceMapCache.set(data.file, data);
81
+ }
82
+ reportConfiguration(config) {
83
+ config.root ??= this.root;
84
+ this._configs.push(config);
85
+ this.onDataReport();
86
+ }
87
+ reportError(errors) {
88
+ errors.forEach((item)=>{
89
+ this._errors.push(DevToolError.from(item, {
90
+ code: this.name
91
+ }));
92
+ });
93
+ this.onDataReport();
94
+ }
95
+ reportLoader(data) {
96
+ data.forEach((item)=>{
97
+ if (this.extraConfig?.mode === SDK.IMode[SDK.IMode.brief]) item.loaders.forEach((_loader)=>{
98
+ _loader.input = void 0;
99
+ _loader.result = void 0;
100
+ });
101
+ let match = this._loader.find((e)=>e.resource.path === item.resource.path);
102
+ if (match) match.loaders.push(...item.loaders);
103
+ else {
104
+ match = item;
105
+ this._loader.push(item);
106
+ }
107
+ match.loaders.sort((a, b)=>{
108
+ if (a.startAt !== b.startAt) return a.startAt - b.startAt;
109
+ if (a.isPitch) {
110
+ if (b.isPitch) return a.loaderIndex - b.loaderIndex;
111
+ return -1;
112
+ }
113
+ if (b.isPitch) return 1;
114
+ return b.loaderIndex - a.loaderIndex;
115
+ });
116
+ });
117
+ this.onDataReport();
118
+ }
119
+ reportLoaderStartOrEnd(data) {
120
+ const _builtinLoader = data.loaders[0];
121
+ if (_builtinLoader.startAt) this._loaderStart.push(data);
122
+ else if (_builtinLoader.endAt) {
123
+ const matchLoaderStart = this._loaderStart.find((e)=>e.resource.path === data.resource.path && e.loaders[0].loader === _builtinLoader.loader);
124
+ if (matchLoaderStart) {
125
+ matchLoaderStart.loaders[0].result = _builtinLoader.result;
126
+ matchLoaderStart.loaders[0].endAt = _builtinLoader.endAt;
127
+ this.reportLoader([
128
+ matchLoaderStart
129
+ ]);
130
+ }
131
+ }
132
+ }
133
+ reportResolver(data) {
134
+ data.forEach((item)=>this._resolver.push(item));
135
+ this.onDataReport();
136
+ }
137
+ reportPlugin(data) {
138
+ Object.keys(data).forEach((hook)=>{
139
+ if (this._plugin[hook]) data[hook].forEach((item)=>{
140
+ this._plugin[hook].push(item || void 0);
141
+ });
142
+ else this._plugin[hook] = data[hook];
143
+ });
144
+ this.onDataReport();
145
+ }
146
+ reportModuleGraph(data) {
147
+ logger.debug(`data size: ${data.size()}`, '[SDK.reportModuleGraph][start]');
148
+ this._moduleGraph.fromInstance(data);
149
+ this.createPackageGraph();
150
+ this.onDataReport();
151
+ logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK reportModuleGraph][end]');
152
+ }
153
+ reportPackageGraph(data) {
154
+ logger.debug('[SDK.reportPackageGraph][start]');
155
+ if (!this._packageGraph) this._packageGraph = data;
156
+ this.onDataReport();
157
+ logger.debug(`sdk._packageGraph size: ${this._packageGraph.getPackages().length}`, '[SDK reportPackageGraph][end]');
158
+ }
159
+ reportChunkGraph(data) {
160
+ this._chunkGraph.addAsset(...data.getAssets());
161
+ this._chunkGraph.addChunk(...data.getChunks());
162
+ this._chunkGraph.addEntryPoint(...data.getEntryPoints());
163
+ this.onDataReport();
164
+ }
165
+ reportSummaryData(part) {
166
+ const keys = [
167
+ 'costs'
168
+ ];
169
+ for (const key of keys){
170
+ const v = part[key];
171
+ if (v) if ('object' == typeof v) if (Array.isArray(v)) this._summary[key] = [
172
+ ...this._summary[key] || [],
173
+ ...v
174
+ ];
175
+ else this._summary[key] = {
176
+ ...this._summary[key] || {},
177
+ ...v
178
+ };
179
+ else this._summary[key] = v;
180
+ }
181
+ this.onDataReport();
182
+ }
183
+ createPackageGraph() {
184
+ logger.debug(`sdk._moduleGraph size: ${this._moduleGraph.size()}`, '[SDK.createPackageGraph][start]');
185
+ if (!this._packageGraph) {
186
+ const pkgGraph = PackageGraph.fromModuleGraph(this._moduleGraph, this.root, (path)=>{
187
+ try {
188
+ const exists = node_fs.existsSync(path);
189
+ if (exists) {
190
+ const res = fs_extra.readJsonSync(path);
191
+ return res;
192
+ }
193
+ } catch (error) {
194
+ const { message, stack } = error;
195
+ logger.debug(()=>`sdk.createPackageGraph error, path: ${path}, error message: ${stack || message}`, '[SDK.createPackageGraph][error]');
196
+ }
197
+ });
198
+ this._packageGraph = pkgGraph;
199
+ logger.debug(`sdk._packageGraph packages: ${this._packageGraph.getPackages().length}`, '[SDK.createPackageGraph][end]');
200
+ }
201
+ }
202
+ async writeStore(options) {
203
+ logger.debug("sdk.writeStore has run.", '[SDK.writeStore][end]');
204
+ let htmlPath = '';
205
+ if (this.extraConfig?.mode === SDK.IMode[SDK.IMode.brief]) {
206
+ const clientHtmlPath = this.extraConfig.innerClientPath ? this.extraConfig.innerClientPath : sdk_require.resolve('@rsdoctor/client');
207
+ if (this.extraConfig?.brief?.type?.includes('json')) {
208
+ const data = this.getStoreData();
209
+ const clientRoutes = this.getClientRoutes();
210
+ const jsonData = {
211
+ data,
212
+ clientRoutes
213
+ };
214
+ node_fs.mkdirSync(this.outputDir, {
215
+ recursive: true
216
+ });
217
+ node_fs.writeFileSync(path_0.resolve(this.outputDir, this.extraConfig.brief.jsonOptions?.fileName ?? 'rsdoctor-data.json'), JSON.stringify(jsonData));
218
+ }
219
+ if (this.extraConfig.brief?.type?.includes('html')) htmlPath = this.inlineScriptsAndStyles(clientHtmlPath);
220
+ return htmlPath;
221
+ }
222
+ return this.saveManifest(this.getStoreData(), options || {});
223
+ }
224
+ getStoreData() {
225
+ const ctx = this;
226
+ const briefOptions = this.extraConfig?.brief;
227
+ const sections = briefOptions?.jsonOptions?.sections;
228
+ const isJsonType = briefOptions?.type?.includes('json');
229
+ return {
230
+ get hash () {
231
+ return ctx.hash;
232
+ },
233
+ get root () {
234
+ return ctx.root;
235
+ },
236
+ get envinfo () {
237
+ return ctx._envinfo;
238
+ },
239
+ get pid () {
240
+ return ctx.pid;
241
+ },
242
+ get errors () {
243
+ if (isJsonType && sections && !sections.rules) return [];
244
+ return ctx._errors.map((err)=>err.toData());
245
+ },
246
+ get configs () {
247
+ return ctx._configs.slice();
248
+ },
249
+ get summary () {
250
+ return {
251
+ ...ctx._summary
252
+ };
253
+ },
254
+ get resolver () {
255
+ return ctx._resolver.slice();
256
+ },
257
+ get loader () {
258
+ return ctx._loader.slice();
259
+ },
260
+ get moduleGraph () {
261
+ if (isJsonType && sections && !sections.moduleGraph) return {
262
+ dependencies: [],
263
+ modules: [],
264
+ moduleGraphModules: [],
265
+ exports: [],
266
+ sideEffects: [],
267
+ variables: [],
268
+ layers: []
269
+ };
270
+ return ctx._moduleGraph.toData({
271
+ contextPath: ctx._configs?.[0]?.config?.context || '',
272
+ briefOptions
273
+ });
274
+ },
275
+ get chunkGraph () {
276
+ if (isJsonType && sections && !sections.chunkGraph) return {
277
+ assets: [],
278
+ chunks: [],
279
+ entrypoints: []
280
+ };
281
+ return ctx._chunkGraph.toData(ctx.type);
282
+ },
283
+ get moduleCodeMap () {
284
+ if (ctx.extraConfig?.mode === SDK.IMode[SDK.IMode.brief]) return {};
285
+ return ctx._moduleGraph.toCodeData(ctx.type);
286
+ },
287
+ get plugin () {
288
+ return {
289
+ ...ctx._plugin
290
+ };
291
+ },
292
+ get packageGraph () {
293
+ return ctx._packageGraph ? ctx._packageGraph.toData() : {
294
+ packages: [],
295
+ dependencies: []
296
+ };
297
+ },
298
+ get treeShaking () {
299
+ if (ctx.extraConfig?.mode === SDK.IMode[SDK.IMode.brief]) return;
300
+ if (!ctx.extraConfig?.features?.treeShaking) return;
301
+ return ctx._moduleGraph.toTreeShakingData();
302
+ },
303
+ get otherReports () {
304
+ return {
305
+ treemapReportHtml: ''
306
+ };
307
+ }
308
+ };
309
+ }
310
+ getManifestData() {
311
+ const dataValue = this.getStoreData();
312
+ const data = {
313
+ client: {
314
+ enableRoutes: this.getClientRoutes()
315
+ },
316
+ data: Object.keys(dataValue).reduce((t, e)=>{
317
+ const _e = e;
318
+ if (dataValue[_e] && 'object' == typeof dataValue[_e]) t[e] = [
319
+ `${this.server.origin}${SDK.ServerAPI.API.LoadDataByKey}/${e}`
320
+ ];
321
+ else t[e] = dataValue[_e];
322
+ return t;
323
+ }, {}),
324
+ __LOCAL__SERVER__: true,
325
+ __SOCKET__PORT__: this.server.socketUrl.port.toString(),
326
+ __SOCKET__URL__: this.server.socketUrl.socketUrl
327
+ };
328
+ return data;
329
+ }
330
+ getRuleContext(_options) {
331
+ this.createPackageGraph();
332
+ return {
333
+ root: this.root,
334
+ errors: this._errors.slice(),
335
+ configs: this._configs.slice(),
336
+ moduleGraph: this._moduleGraph,
337
+ chunkGraph: this._chunkGraph,
338
+ packageGraph: this._packageGraph,
339
+ loader: this._loader.slice(),
340
+ otherReports: {
341
+ treemapReportHtml: ''
342
+ }
343
+ };
344
+ }
345
+ onDataReport() {
346
+ this.server.broadcast();
347
+ }
348
+ addRsdoctorDataToHTML(storeData, htmlContent) {
349
+ let compressTextScripts = `<script>window.${Constants.WINDOW_RSDOCTOR_TAG}={}</script>`;
350
+ for (const key of Object.keys(storeData)){
351
+ const data = storeData[key];
352
+ const jsonStrFn = ()=>{
353
+ try {
354
+ if ('configs' === key) return JSON.stringify(decycle(data));
355
+ return JSON.stringify(data);
356
+ } catch (error) {
357
+ console.error(error);
358
+ return '';
359
+ }
360
+ };
361
+ const compressText = Algorithm.compressText(jsonStrFn());
362
+ compressTextScripts = `${compressTextScripts} <script>window.${Constants.WINDOW_RSDOCTOR_TAG}.${key}=${JSON.stringify(compressText)}</script>`;
363
+ }
364
+ compressTextScripts = `${compressTextScripts} <script>window.${Constants.WINDOW_RSDOCTOR_TAG}.enableRoutes=${JSON.stringify(this.getClientRoutes())}</script>`;
365
+ htmlContent = htmlContent.replace('<body>', `<body>${compressTextScripts}`);
366
+ return htmlContent;
367
+ }
368
+ inlineScriptsAndStyles(htmlFilePath) {
369
+ function inlineScripts(basePath, scripts) {
370
+ return scripts.map((src)=>{
371
+ const scriptPath = resolveFilePath(basePath, src);
372
+ try {
373
+ const scriptContent = node_fs.readFileSync(scriptPath, 'utf-8');
374
+ return `<script>${scriptContent}</script>`;
375
+ } catch (error) {
376
+ console.error(`Could not read script at ${scriptPath}:`, error);
377
+ return '';
378
+ }
379
+ }).join('');
380
+ }
381
+ function resolveFilePath(basePath, filePath) {
382
+ if (filePath.startsWith('/')) return path_0.resolve(basePath, filePath.slice(1));
383
+ return path_0.resolve(basePath, filePath);
384
+ }
385
+ function inlineCss(basePath, cssFiles) {
386
+ return cssFiles.map((href)=>{
387
+ const cssPath = resolveFilePath(basePath, href);
388
+ try {
389
+ const cssContent = node_fs.readFileSync(cssPath, 'utf-8');
390
+ return `<style>${cssContent}</style>`;
391
+ } catch (error) {
392
+ console.error(`Could not read CSS at ${cssPath}:`, error);
393
+ return '';
394
+ }
395
+ }).join('');
396
+ }
397
+ let htmlContent = node_fs.readFileSync(htmlFilePath, 'utf-8');
398
+ const basePath = path_0.dirname(htmlFilePath);
399
+ const scriptSrcs = Array.from(htmlContent.matchAll(/<script\s+(?:defer="defer"|defer)\s+src=["'](.+?)["']><\/script>/g), (m)=>m[1]);
400
+ const cssHrefs = Array.from(htmlContent.matchAll(/<link\s+href=["'](.+?)["']\s+rel="stylesheet">/g), (m)=>m[1]);
401
+ htmlContent = htmlContent.replace(/<script\s+.*?src=["'].*?["']><\/script>/g, '');
402
+ htmlContent = htmlContent.replace(/<link\s+.*?rel=["']stylesheet["'].*?>/g, '');
403
+ const inlinedScripts = inlineScripts(basePath, scriptSrcs);
404
+ const inlinedCss = inlineCss(basePath, cssHrefs);
405
+ const index = htmlContent.indexOf('</body>');
406
+ htmlContent = htmlContent.slice(0, index) + inlinedCss + inlinedScripts + htmlContent.slice(index);
407
+ htmlContent = this.addRsdoctorDataToHTML(this.getStoreData(), htmlContent);
408
+ const outputFilePath = path_0.resolve(this.outputDir, this.extraConfig?.brief?.htmlOptions?.reportHtmlName || 'rsdoctor-report.html');
409
+ node_fs.mkdirSync(path_0.dirname(outputFilePath), {
410
+ recursive: true
411
+ });
412
+ node_fs.writeFileSync(outputFilePath, htmlContent, {
413
+ encoding: 'utf-8',
414
+ flag: 'w'
415
+ });
416
+ return outputFilePath;
417
+ }
418
+ constructor(options){
419
+ super(options), this._summary = {
420
+ costs: []
421
+ }, this._configs = [], this._errors = [], this._loader = [], this._loaderStart = [], this._resolver = [], this._plugin = {}, this._moduleGraph = new ModuleGraph(), this._chunkGraph = new ChunkGraph(), this._rawSourceMapCache = new Map(), this._sourceMap = new Map();
422
+ const serverConfig = options.config?.server;
423
+ const port = serverConfig?.port ?? options.port;
424
+ this.server = options.config?.noServer ? new RsdoctorFakeServer(this, port) : new RsdoctorServer(this, port, {
425
+ innerClientPath: options.config?.innerClientPath || '',
426
+ printServerUrl: options.config?.printLog?.serverUrls,
427
+ cors: serverConfig?.cors
428
+ });
429
+ this.type = Lodash.isNumber(options.type) ? options.type : SDK.ToDataType.Normal;
430
+ this.extraConfig = options.config;
431
+ this.root = findRoot() ?? '';
432
+ }
433
+ }
434
+ export { resolveClientDiffHtmlPath } from "../server/client.js";
435
+ export { RsdoctorSDK };
@@ -0,0 +1,26 @@
1
+ import { SDK } from '@rsdoctor/shared/types';
2
+ export interface DataWithUrl {
3
+ name: string;
4
+ files: {
5
+ path: string;
6
+ basename: string;
7
+ content: Buffer;
8
+ }[] | string;
9
+ }
10
+ export interface RsdoctorSDKOptions {
11
+ name: string;
12
+ root: string;
13
+ }
14
+ /**
15
+ * sdk options for builder.
16
+ */
17
+ export interface RsdoctorBuilderSDK extends RsdoctorSDKOptions {
18
+ type?: SDK.ToDataType;
19
+ /**
20
+ * port for client server
21
+ */
22
+ port?: number;
23
+ config?: SDK.SDKOptionsType;
24
+ }
25
+ export type RsdoctorRspackSDKOptions = RsdoctorBuilderSDK;
26
+ export type RsdoctorEMOSDKOptions = RsdoctorSDKOptions;
@@ -0,0 +1 @@
1
+ import "node:module";
@@ -0,0 +1,5 @@
1
+ import { SDK } from '@rsdoctor/shared/types';
2
+ import { BaseAPI } from './base.js';
3
+ export declare class AlertsAPI extends BaseAPI {
4
+ getPackageRelationAlertDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>>;
5
+ }
@@ -0,0 +1,30 @@
1
+ import "node:module";
2
+ import { SDK } from "@rsdoctor/shared/types";
3
+ import { BaseAPI } from "./base.js";
4
+ import { Router } from "../router.js";
5
+ function _ts_decorate(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ function _ts_metadata(k, v) {
12
+ if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
+ }
14
+ class AlertsAPI extends BaseAPI {
15
+ async getPackageRelationAlertDetails() {
16
+ const { req } = this.ctx;
17
+ const { id, target } = req.body;
18
+ return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetPackageRelationAlertDetails, {
19
+ id,
20
+ target
21
+ });
22
+ }
23
+ }
24
+ _ts_decorate([
25
+ Router.post(SDK.ServerAPI.API.GetPackageRelationAlertDetails),
26
+ _ts_metadata("design:type", Function),
27
+ _ts_metadata("design:paramtypes", []),
28
+ _ts_metadata("design:returntype", Promise)
29
+ ], AlertsAPI.prototype, "getPackageRelationAlertDetails", null);
30
+ export { AlertsAPI };
@@ -0,0 +1,11 @@
1
+ import { Data } from '../../../common/index.js';
2
+ import { Manifest, SDK } from '@rsdoctor/shared/types';
3
+ export declare class BaseAPI implements Manifest.ManifestDataLoader {
4
+ [key: string | symbol]: any;
5
+ readonly ctx: SDK.ServerAPI.APIContext;
6
+ protected dataLoader: Data.APIDataLoader;
7
+ constructor(sdk: SDK.RsdoctorSDKInstance, server: SDK.RsdoctorServerInstance);
8
+ loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
9
+ loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
10
+ loadData(key: string): Promise<void>;
11
+ }
@@ -0,0 +1,22 @@
1
+ import "node:module";
2
+ import { Data } from "../../../common/index.js";
3
+ class BaseAPI {
4
+ async loadManifest() {
5
+ return this.ctx.sdk.getManifestData();
6
+ }
7
+ async loadData(key) {
8
+ const data = this.ctx.sdk.getStoreData();
9
+ const sep = '.';
10
+ let res = data[key];
11
+ if (key.includes(sep)) res = key.split(sep).reduce((t, k)=>t[k], data);
12
+ return res;
13
+ }
14
+ constructor(sdk, server){
15
+ this.ctx = {
16
+ sdk,
17
+ server
18
+ };
19
+ this.dataLoader = new Data.APIDataLoader(this);
20
+ }
21
+ }
22
+ export { BaseAPI };
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/shared/types';
2
+ import { BaseAPI } from './base.js';
3
+ export declare class BundleDiffAPI extends BaseAPI {
4
+ getBundleDiffSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetBundleDiffSummary>>;
5
+ bundleDiffManifest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.BundleDiffManifest>>;
6
+ }
@@ -0,0 +1,51 @@
1
+ import "node:module";
2
+ import { SDK } from "@rsdoctor/shared/types";
3
+ import { BaseAPI } from "./base.js";
4
+ import { Router } from "../router.js";
5
+ function _ts_decorate(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ function _ts_metadata(k, v) {
12
+ if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
+ }
14
+ class BundleDiffAPI extends BaseAPI {
15
+ async getBundleDiffSummary() {
16
+ const { sdk } = this.ctx;
17
+ const { root, hash, errors, chunkGraph, moduleGraph, packageGraph, configs, moduleCodeMap, cloudManifestUrl } = sdk.getStoreData();
18
+ let outputFilename = '';
19
+ if ('string' == typeof configs?.[0]?.config?.output?.filename) outputFilename = configs?.[0]?.config?.output?.filename;
20
+ return {
21
+ root,
22
+ hash,
23
+ errors,
24
+ chunkGraph,
25
+ moduleGraph,
26
+ packageGraph,
27
+ outputFilename,
28
+ moduleCodeMap,
29
+ cloudManifestUrl
30
+ };
31
+ }
32
+ async bundleDiffManifest() {
33
+ const { sdk } = this.ctx;
34
+ const data = sdk.getStoreData();
35
+ return data;
36
+ }
37
+ }
38
+ _ts_decorate([
39
+ Router.get(SDK.ServerAPI.API.GetBundleDiffSummary),
40
+ Router.post(SDK.ServerAPI.API.GetBundleDiffSummary),
41
+ _ts_metadata("design:type", Function),
42
+ _ts_metadata("design:paramtypes", []),
43
+ _ts_metadata("design:returntype", Promise)
44
+ ], BundleDiffAPI.prototype, "getBundleDiffSummary", null);
45
+ _ts_decorate([
46
+ Router.get(SDK.ServerAPI.API.BundleDiffManifest),
47
+ _ts_metadata("design:type", Function),
48
+ _ts_metadata("design:paramtypes", []),
49
+ _ts_metadata("design:returntype", Promise)
50
+ ], BundleDiffAPI.prototype, "bundleDiffManifest", null);
51
+ export { BundleDiffAPI };
@@ -0,0 +1,6 @@
1
+ import { SDK } from '@rsdoctor/shared/types';
2
+ import { BaseAPI } from './base.js';
3
+ export declare class DataAPI extends BaseAPI {
4
+ loadDataByKey(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.LoadDataByKey>>;
5
+ sendMessageToClient(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.SendAPIDataToClient>>;
6
+ }
@@ -0,0 +1,44 @@
1
+ import "node:module";
2
+ import { SDK } from "@rsdoctor/shared/types";
3
+ import { BaseAPI } from "./base.js";
4
+ import { Router } from "../router.js";
5
+ function _ts_decorate(decorators, target, key, desc) {
6
+ var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
8
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
10
+ }
11
+ function _ts_metadata(k, v) {
12
+ if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
13
+ }
14
+ class DataAPI extends BaseAPI {
15
+ async loadDataByKey() {
16
+ const { req } = this.ctx;
17
+ const { url } = req;
18
+ let { key } = req.body;
19
+ if (!key && url) {
20
+ const uri = new URL(url, 'http://127.0.0.1');
21
+ key = uri.pathname.replace(/^\//, '');
22
+ }
23
+ const data = await this.loadData(key);
24
+ return data;
25
+ }
26
+ async sendMessageToClient() {
27
+ const { req, server } = this.ctx;
28
+ const { api, data } = req.body;
29
+ await server.sendAPIDataToClient(api, data);
30
+ }
31
+ }
32
+ _ts_decorate([
33
+ Router.post(SDK.ServerAPI.API.LoadDataByKey),
34
+ _ts_metadata("design:type", Function),
35
+ _ts_metadata("design:paramtypes", []),
36
+ _ts_metadata("design:returntype", Promise)
37
+ ], DataAPI.prototype, "loadDataByKey", null);
38
+ _ts_decorate([
39
+ Router.post(SDK.ServerAPI.API.SendAPIDataToClient),
40
+ _ts_metadata("design:type", Function),
41
+ _ts_metadata("design:paramtypes", []),
42
+ _ts_metadata("design:returntype", Promise)
43
+ ], DataAPI.prototype, "sendMessageToClient", null);
44
+ export { DataAPI };
@@ -0,0 +1,5 @@
1
+ import { SDK } from '@rsdoctor/shared/types';
2
+ import { BaseAPI } from './base.js';
3
+ export declare class FileSystemAPI extends BaseAPI {
4
+ applyErrorFix(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ApplyErrorFix>>;
5
+ }