@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,105 @@
1
+ import "node:module";
2
+ import { Lodash } from "../../common/index.js";
3
+ function isSyntaxNode(node) {
4
+ return Lodash.isObject(node) && 'type' in node;
5
+ }
6
+ function assertCreator(type) {
7
+ return (node)=>isSyntaxNode(node) && node.type === type;
8
+ }
9
+ const asserts = {
10
+ isProgram: assertCreator('Program'),
11
+ isEmptyStatement: assertCreator('EmptyStatement'),
12
+ isBlockStatement: assertCreator('BlockStatement'),
13
+ isStaticBlock: assertCreator('StaticBlock'),
14
+ isExpressionStatement: assertCreator('ExpressionStatement'),
15
+ isIfStatement: assertCreator('IfStatement'),
16
+ isLabeledStatement: assertCreator('LabeledStatement'),
17
+ isBreakStatement: assertCreator('BreakStatement'),
18
+ isContinueStatement: assertCreator('ContinueStatement'),
19
+ isWithStatement: assertCreator('WithStatement'),
20
+ isSwitchStatement: assertCreator('SwitchStatement'),
21
+ isReturnStatement: assertCreator('ReturnStatement'),
22
+ isThrowStatement: assertCreator('ThrowStatement'),
23
+ isTryStatement: assertCreator('TryStatement'),
24
+ isWhileStatement: assertCreator('WhileStatement'),
25
+ isDoWhileStatement: assertCreator('DoWhileStatement'),
26
+ isForStatement: assertCreator('ForStatement'),
27
+ isForInStatement: assertCreator('ForInStatement'),
28
+ isForOfStatement: assertCreator('ForOfStatement'),
29
+ isDebuggerStatement: assertCreator('DebuggerStatement'),
30
+ isFunctionDeclaration: assertCreator('FunctionDeclaration'),
31
+ isVariableDeclaration: assertCreator('VariableDeclaration'),
32
+ isVariableDeclarator: assertCreator('VariableDeclarator'),
33
+ isChainExpression: assertCreator('ChainExpression'),
34
+ isThisExpression: assertCreator('ThisExpression'),
35
+ isArrayExpression: assertCreator('ArrayExpression'),
36
+ isObjectExpression: assertCreator('ObjectExpression'),
37
+ isPrivateIdentifier: assertCreator('PrivateIdentifier'),
38
+ isProperty: assertCreator('Property'),
39
+ isPropertyDefinition: assertCreator('PropertyDefinition'),
40
+ isFunctionExpression: assertCreator('FunctionExpression'),
41
+ isSequenceExpression: assertCreator('SequenceExpression'),
42
+ isUnaryExpression: assertCreator('UnaryExpression'),
43
+ isBinaryExpression: assertCreator('BinaryExpression'),
44
+ isAssignmentExpression: assertCreator('AssignmentExpression'),
45
+ isUpdateExpression: assertCreator('UpdateExpression'),
46
+ isLogicalExpression: assertCreator('LogicalExpression'),
47
+ isConditionalExpression: assertCreator('ConditionalExpression'),
48
+ isNewExpression: assertCreator('NewExpression'),
49
+ isSwitchCase: assertCreator('SwitchCase'),
50
+ isCatchClause: assertCreator('CatchClause'),
51
+ isIdentifier: assertCreator('Identifier'),
52
+ isLiteral: assertCreator('Literal'),
53
+ isSuper: assertCreator('Super'),
54
+ isSpreadElement: assertCreator('SpreadElement'),
55
+ isArrowFunctionExpression: assertCreator('ArrowFunctionExpression'),
56
+ isYieldExpression: assertCreator('YieldExpression'),
57
+ isTemplateLiteral: assertCreator('TemplateLiteral'),
58
+ isTaggedTemplateExpression: assertCreator('TaggedTemplateExpression'),
59
+ isTemplateElement: assertCreator('TemplateElement'),
60
+ isObjectPattern: assertCreator('ObjectPattern'),
61
+ isArrayPattern: assertCreator('ArrayPattern'),
62
+ isRestElement: assertCreator('RestElement'),
63
+ isAssignmentPattern: assertCreator('AssignmentPattern'),
64
+ isClassBody: assertCreator('ClassBody'),
65
+ isClassDeclaration: assertCreator('ClassDeclaration'),
66
+ isClassExpression: assertCreator('ClassExpression'),
67
+ isMetaProperty: assertCreator('MetaProperty'),
68
+ isImportDeclaration: assertCreator('ImportDeclaration'),
69
+ isImportSpecifier: assertCreator('ImportSpecifier'),
70
+ isImportExpression: assertCreator('ImportExpression'),
71
+ isImportDefaultSpecifier: assertCreator('ImportDefaultSpecifier'),
72
+ isImportNamespaceSpecifier: assertCreator('ImportNamespaceSpecifier'),
73
+ isExportNamedDeclaration: assertCreator('ExportNamedDeclaration'),
74
+ isExportSpecifier: assertCreator('ExportSpecifier'),
75
+ isExportDefaultDeclaration: assertCreator('ExportDefaultDeclaration'),
76
+ isExportAllDeclaration: assertCreator('ExportAllDeclaration'),
77
+ isAwaitExpression: assertCreator('AwaitExpression'),
78
+ isMethodDefinition: assertCreator('MethodDefinition'),
79
+ isMemberExpression: assertCreator('MemberExpression'),
80
+ isComment (node) {
81
+ return isSyntaxNode(node) && ('Line' === node.type || 'Block' === node.type);
82
+ },
83
+ isDirective (node) {
84
+ return asserts.isExpressionStatement(node) && 'directive' in node;
85
+ },
86
+ isSimpleCallExpression (node) {
87
+ return isSyntaxNode(node) && 'CallExpression' === node.type;
88
+ },
89
+ isAssignmentProperty (node) {
90
+ return asserts.isProperty(node) && 'init' === node.kind;
91
+ },
92
+ isSimpleLiteral (node) {
93
+ return asserts.isLiteral(node) && !asserts.isRegExpLiteral(node) && !asserts.isBigIntLiteral(node);
94
+ },
95
+ isRegExpLiteral (node) {
96
+ return asserts.isLiteral(node) && 'regex' in node;
97
+ },
98
+ isBigIntLiteral (node) {
99
+ return asserts.isLiteral(node) && 'bigint' in node;
100
+ },
101
+ isExportStatement (node) {
102
+ return asserts.isExportAllDeclaration(node) || asserts.isExportDefaultDeclaration(node) || asserts.isExportNamedDeclaration(node);
103
+ }
104
+ };
105
+ export { asserts };
@@ -0,0 +1,4 @@
1
+ export * from './asserts.js';
2
+ export * from './parser.js';
3
+ export * from './utils.js';
4
+ export * from './types.js';
@@ -0,0 +1,5 @@
1
+ import "node:module";
2
+ export * from "./asserts.js";
3
+ export * from "./parser.js";
4
+ export * from "./utils.js";
5
+ export * from "./types.js";
@@ -0,0 +1,118 @@
1
+ import { Parser as AcornParser, Options, Position } from 'acorn';
2
+ import * as walk from 'acorn-walk';
3
+ import * as utils from './utils.js';
4
+ import type { Node } from './types.js';
5
+ export type { Options as ParseOptions } from 'acorn';
6
+ export interface ParseError extends Error {
7
+ loc?: Position;
8
+ pos: number;
9
+ raisedAt: number;
10
+ }
11
+ export declare const parser: {
12
+ /** AST iterator */
13
+ walk: typeof walk;
14
+ /**
15
+ * Compile code
16
+ * - Output root node is `Node.Program`
17
+ */
18
+ parse: (input: string, options: Options) => Node.Program;
19
+ /**
20
+ * Compile the next first expression
21
+ * - The output root node is `Node.ExpressionStatement`
22
+ */
23
+ parseExpressionAt: (input: string, pos: number, options: Options) => Node.ExpressionStatement;
24
+ /**
25
+ * add plugins for acorn
26
+ */
27
+ extend(...args: Parameters<typeof AcornParser.extend>): typeof AcornParser;
28
+ /** Set of assertions */
29
+ asserts: {
30
+ readonly isProgram: (node: unknown) => node is Node.Program;
31
+ readonly isEmptyStatement: (node: unknown) => node is Node.EmptyStatement;
32
+ readonly isBlockStatement: (node: unknown) => node is Node.BlockStatement;
33
+ readonly isStaticBlock: (node: unknown) => node is Node.StaticBlock;
34
+ readonly isExpressionStatement: (node: unknown) => node is Node.ExpressionStatement;
35
+ readonly isIfStatement: (node: unknown) => node is Node.IfStatement;
36
+ readonly isLabeledStatement: (node: unknown) => node is Node.LabeledStatement;
37
+ readonly isBreakStatement: (node: unknown) => node is Node.BreakStatement;
38
+ readonly isContinueStatement: (node: unknown) => node is Node.ContinueStatement;
39
+ readonly isWithStatement: (node: unknown) => node is Node.WithStatement;
40
+ readonly isSwitchStatement: (node: unknown) => node is Node.SwitchStatement;
41
+ readonly isReturnStatement: (node: unknown) => node is Node.ReturnStatement;
42
+ readonly isThrowStatement: (node: unknown) => node is Node.ThrowStatement;
43
+ readonly isTryStatement: (node: unknown) => node is Node.TryStatement;
44
+ readonly isWhileStatement: (node: unknown) => node is Node.WhileStatement;
45
+ readonly isDoWhileStatement: (node: unknown) => node is Node.DoWhileStatement;
46
+ readonly isForStatement: (node: unknown) => node is Node.ForStatement;
47
+ readonly isForInStatement: (node: unknown) => node is Node.ForInStatement;
48
+ readonly isForOfStatement: (node: unknown) => node is Node.ForOfStatement;
49
+ readonly isDebuggerStatement: (node: unknown) => node is Node.DebuggerStatement;
50
+ readonly isFunctionDeclaration: (node: unknown) => node is Node.FunctionDeclaration;
51
+ readonly isVariableDeclaration: (node: unknown) => node is Node.VariableDeclaration;
52
+ readonly isVariableDeclarator: (node: unknown) => node is Node.VariableDeclarator;
53
+ readonly isChainExpression: (node: unknown) => node is Node.ChainExpression;
54
+ readonly isThisExpression: (node: unknown) => node is Node.ThisExpression;
55
+ readonly isArrayExpression: (node: unknown) => node is Node.ArrayExpression;
56
+ readonly isObjectExpression: (node: unknown) => node is Node.ObjectExpression;
57
+ readonly isPrivateIdentifier: (node: unknown) => node is Node.PrivateIdentifier;
58
+ readonly isProperty: (node: unknown) => node is Node.Property;
59
+ readonly isPropertyDefinition: (node: unknown) => node is Node.PropertyDefinition;
60
+ readonly isFunctionExpression: (node: unknown) => node is Node.FunctionExpression;
61
+ readonly isSequenceExpression: (node: unknown) => node is Node.SequenceExpression;
62
+ readonly isUnaryExpression: (node: unknown) => node is Node.UnaryExpression;
63
+ readonly isBinaryExpression: (node: unknown) => node is Node.BinaryExpression;
64
+ readonly isAssignmentExpression: (node: unknown) => node is Node.AssignmentExpression;
65
+ readonly isUpdateExpression: (node: unknown) => node is Node.UpdateExpression;
66
+ readonly isLogicalExpression: (node: unknown) => node is Node.LogicalExpression;
67
+ readonly isConditionalExpression: (node: unknown) => node is Node.ConditionalExpression;
68
+ readonly isNewExpression: (node: unknown) => node is Node.NewExpression;
69
+ readonly isSwitchCase: (node: unknown) => node is Node.SwitchCase;
70
+ readonly isCatchClause: (node: unknown) => node is Node.CatchClause;
71
+ readonly isIdentifier: (node: unknown) => node is Node.Identifier;
72
+ readonly isLiteral: (node: unknown) => node is Node.Literal;
73
+ readonly isSuper: (node: unknown) => node is Node.Super;
74
+ readonly isSpreadElement: (node: unknown) => node is Node.SpreadElement;
75
+ readonly isArrowFunctionExpression: (node: unknown) => node is Node.ArrowFunctionExpression;
76
+ readonly isYieldExpression: (node: unknown) => node is Node.YieldExpression;
77
+ readonly isTemplateLiteral: (node: unknown) => node is Node.TemplateLiteral;
78
+ readonly isTaggedTemplateExpression: (node: unknown) => node is Node.TaggedTemplateExpression;
79
+ readonly isTemplateElement: (node: unknown) => node is Node.TemplateElement;
80
+ readonly isObjectPattern: (node: unknown) => node is Node.ObjectPattern;
81
+ readonly isArrayPattern: (node: unknown) => node is Node.ArrayPattern;
82
+ readonly isRestElement: (node: unknown) => node is Node.RestElement;
83
+ readonly isAssignmentPattern: (node: unknown) => node is Node.AssignmentPattern;
84
+ readonly isClassBody: (node: unknown) => node is Node.ClassBody;
85
+ readonly isClassDeclaration: (node: unknown) => node is Node.ClassDeclaration;
86
+ readonly isClassExpression: (node: unknown) => node is Node.ClassExpression;
87
+ readonly isMetaProperty: (node: unknown) => node is Node.MetaProperty;
88
+ readonly isImportDeclaration: (node: unknown) => node is Node.ImportDeclaration;
89
+ readonly isImportSpecifier: (node: unknown) => node is Node.ImportSpecifier;
90
+ readonly isImportExpression: (node: unknown) => node is Node.ImportExpression;
91
+ readonly isImportDefaultSpecifier: (node: unknown) => node is Node.ImportDefaultSpecifier;
92
+ readonly isImportNamespaceSpecifier: (node: unknown) => node is Node.ImportNamespaceSpecifier;
93
+ readonly isExportNamedDeclaration: (node: unknown) => node is Node.ExportNamedDeclaration;
94
+ readonly isExportSpecifier: (node: unknown) => node is Node.ExportSpecifier;
95
+ readonly isExportDefaultDeclaration: (node: unknown) => node is Node.ExportDefaultDeclaration;
96
+ readonly isExportAllDeclaration: (node: unknown) => node is Node.ExportAllDeclaration;
97
+ readonly isAwaitExpression: (node: unknown) => node is Node.AwaitExpression;
98
+ readonly isMethodDefinition: (node: unknown) => node is Node.MethodDefinition;
99
+ readonly isMemberExpression: (node: unknown) => node is Node.MemberExpression;
100
+ readonly isComment: (node: unknown) => node is Node.Comment;
101
+ readonly isDirective: (node: unknown) => node is Node.Directive;
102
+ readonly isSimpleCallExpression: (node: unknown) => node is Node.SimpleCallExpression;
103
+ readonly isAssignmentProperty: (node: unknown) => node is Node.AssignmentProperty;
104
+ readonly isSimpleLiteral: (node: unknown) => node is Node.SimpleLiteral;
105
+ readonly isRegExpLiteral: (node: unknown) => node is Node.RegExpLiteral;
106
+ readonly isBigIntLiteral: (node: unknown) => node is Node.BigIntLiteral;
107
+ readonly isExportStatement: (node: unknown) => node is Node.ExportStatement;
108
+ };
109
+ utils: typeof utils;
110
+ /**
111
+ * @internal
112
+ * parser for internal packages
113
+ */
114
+ internal: {
115
+ parse: (input: string, options: Options) => Node.Program;
116
+ parseExpressionAt: (input: string, pos: number, options: Options) => Node.ExpressionStatement;
117
+ };
118
+ };
@@ -0,0 +1,24 @@
1
+ import "node:module";
2
+ import { Parser } from "acorn";
3
+ import { importAttributes } from "acorn-import-attributes";
4
+ import * as __rspack_external_acorn_walk_1e4235a7 from "acorn-walk";
5
+ import { asserts } from "./asserts.js";
6
+ import * as __rspack_external__utils_js_a9c81ddd from "./utils.js";
7
+ const acornParserInternal = Parser.extend(importAttributes);
8
+ let acornParserExport = Parser.extend(importAttributes);
9
+ const parser = {
10
+ walk: __rspack_external_acorn_walk_1e4235a7,
11
+ parse: (input, options)=>acornParserExport.parse(input, options),
12
+ parseExpressionAt: (input, pos, options)=>acornParserExport.parseExpressionAt(input, pos, options),
13
+ extend (...args) {
14
+ acornParserExport = acornParserExport.extend(...args);
15
+ return acornParserExport;
16
+ },
17
+ asserts: asserts,
18
+ utils: __rspack_external__utils_js_a9c81ddd,
19
+ internal: {
20
+ parse: (input, options)=>acornParserInternal.parse(input, options),
21
+ parseExpressionAt: (input, pos, options)=>acornParserInternal.parseExpressionAt(input, pos, options)
22
+ }
23
+ };
24
+ export { parser };
@@ -0,0 +1,30 @@
1
+ import type * as Node from 'estree';
2
+ export type { Node };
3
+ export declare enum ECMAVersion {
4
+ ES5 = "ES5",
5
+ ES6 = "ES6",
6
+ ES7P = "ES7+"
7
+ }
8
+ /**
9
+ * estree supplement type
10
+ * Mainly to match the node type of acorn
11
+ * The main reason for not using the type of acorn directly is that the node type described by acorn itself is too simple
12
+ */
13
+ declare module 'estree' {
14
+ interface BaseNode {
15
+ start: number;
16
+ end: number;
17
+ loc?: SourceLocation | undefined;
18
+ }
19
+ interface Position {
20
+ offset: number;
21
+ }
22
+ /** all syntax nodes */
23
+ type SyntaxNode = Node.Comment | Node.Program | Node.Directive | Node.EmptyStatement | Node.BlockStatement | Node.StaticBlock | Node.ExpressionStatement | Node.IfStatement | Node.LabeledStatement | Node.BreakStatement | Node.ContinueStatement | Node.WithStatement | Node.SwitchStatement | Node.ReturnStatement | Node.ThrowStatement | Node.TryStatement | Node.WhileStatement | Node.DoWhileStatement | Node.ForStatement | Node.ForInStatement | Node.DebuggerStatement | Node.FunctionDeclaration | Node.VariableDeclaration | Node.VariableDeclarator | Node.ChainExpression | Node.ThisExpression | Node.ArrayExpression | Node.ObjectExpression | Node.PrivateIdentifier | Node.Property | Node.PropertyDefinition | Node.FunctionExpression | Node.SequenceExpression | Node.UnaryExpression | Node.BinaryExpression | Node.AssignmentExpression | Node.UpdateExpression | Node.LogicalExpression | Node.ConditionalExpression | Node.SimpleCallExpression | Node.NewExpression | Node.MemberExpression | Node.SwitchCase | Node.CatchClause | Node.Identifier | Node.SimpleLiteral | Node.RegExpLiteral | Node.BigIntLiteral | Node.ForOfStatement | Node.Super | Node.SpreadElement | Node.ArrowFunctionExpression | Node.YieldExpression | Node.TemplateLiteral | Node.TaggedTemplateExpression | Node.TemplateElement | Node.AssignmentProperty | Node.ObjectPattern | Node.ArrayPattern | Node.RestElement | Node.AssignmentPattern | Node.ClassBody | Node.MethodDefinition | Node.ClassDeclaration | Node.ClassExpression | Node.MetaProperty | Node.ImportDeclaration | Node.ImportSpecifier | Node.ImportExpression | Node.ImportDefaultSpecifier | Node.ImportNamespaceSpecifier | Node.ExportNamedDeclaration | Node.ExportSpecifier | Node.ExportDefaultDeclaration | Node.ExportAllDeclaration | Node.AwaitExpression;
24
+ /** all operators */
25
+ type SyntaxOperator = Node.UnaryOperator | Node.BinaryOperator | Node.LogicalOperator | Node.AssignmentOperator | Node.UpdateOperator;
26
+ /** Block-scoped statement */
27
+ type BlockScopeStatement = Node.StaticBlock | Node.BlockStatement | Node.ForInStatement | Node.ForOfStatement | Node.ForStatement | Node.CatchClause | Node.SwitchStatement;
28
+ /** Export statement */
29
+ type ExportStatement = Node.ExportAllDeclaration | Node.ExportDefaultDeclaration | Node.ExportNamedDeclaration;
30
+ }
@@ -0,0 +1,8 @@
1
+ import "node:module";
2
+ var types_ECMAVersion = /*#__PURE__*/ function(ECMAVersion) {
3
+ ECMAVersion["ES5"] = "ES5";
4
+ ECMAVersion["ES6"] = "ES6";
5
+ ECMAVersion["ES7P"] = "ES7+";
6
+ return ECMAVersion;
7
+ }({});
8
+ export { types_ECMAVersion as ECMAVersion };
@@ -0,0 +1,30 @@
1
+ import { ecmaVersion } from 'acorn';
2
+ import { Node, ECMAVersion } from './types.js';
3
+ /**
4
+ * Is the node semantics the same?
5
+ * @deprecated
6
+ * - Recursively compare whether the content of the node itself is the same
7
+ * - Ignore comments, positions, string symbols (single and double quotation marks)
8
+ * - String templates and string addition will be considered different
9
+ */
10
+ export declare function isSameSemantics(node1: Node.SyntaxNode, node2: Node.SyntaxNode): boolean;
11
+ /**
12
+ * Get all default reference statements
13
+ */
14
+ export declare function getDefaultImports(node: Node.Program): Node.ImportDeclaration[];
15
+ /** Get the literal in the text. */
16
+ export declare function getIdentifierInPattern(name: string, node: Node.Pattern): Node.Identifier | undefined;
17
+ /** Get the variable declaration statement identifier. */
18
+ export declare function getIdentifierInDeclaration(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
19
+ /** Get the reference declaration statement identifier. */
20
+ export declare function getIdentifierInImport(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
21
+ /** Get the export statement identifier. */
22
+ export declare function getIdentifierInExport(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
23
+ /** Determine that it can be resolved using the specified ECMA version */
24
+ export declare function canParse(code: string, ecmaVersion: ecmaVersion): boolean;
25
+ /** Determine whether it is all ES5 version code. */
26
+ export declare function isES5(code: string): boolean;
27
+ /** Determine whether it is all ES6 version code. */
28
+ export declare function isES6(code: string): boolean;
29
+ /** Detect ECMA version. */
30
+ export declare function detectECMAVersion(code: string): ECMAVersion;
@@ -0,0 +1,106 @@
1
+ import "node:module";
2
+ import { parse } from "acorn";
3
+ import { ECMAVersion } from "./types.js";
4
+ import { asserts } from "./asserts.js";
5
+ function isSameSemantics(node1, node2) {
6
+ if (node1.type !== node2.type) return false;
7
+ switch(node1.type){
8
+ case 'CallExpression':
9
+ {
10
+ const next = node2;
11
+ return node1.arguments.length === next.arguments.length && Boolean(node1.optional) === Boolean(next.optional) && isSameSemantics(node1.callee, next.callee) && node1.arguments.every((node, i)=>isSameSemantics(node, next.arguments[i]));
12
+ }
13
+ case 'MemberExpression':
14
+ {
15
+ const next = node2;
16
+ return node1.computed === next.computed && Boolean(node1.optional) === Boolean(next.optional) && isSameSemantics(node1.object, next.object) && isSameSemantics(node1.property, next.property);
17
+ }
18
+ case 'Identifier':
19
+ return node1.name === node2.name;
20
+ case 'Literal':
21
+ if (asserts.isSimpleLiteral(node1) && asserts.isSimpleLiteral(node2)) return node1.value === node2.value;
22
+ return node1.raw === node2.raw;
23
+ case 'ObjectExpression':
24
+ {
25
+ const next = node2;
26
+ return node1.properties.length === next.properties.length && node1.properties.every((prop, i)=>isSameSemantics(prop, next.properties[i]));
27
+ }
28
+ case 'Property':
29
+ {
30
+ const next = node2;
31
+ return node1.computed === next.computed && node1.kind === next.kind && node1.method === next.method && isSameSemantics(node1.key, next.key) && isSameSemantics(node1.value, next.value);
32
+ }
33
+ default:
34
+ throw new Error(`Unknown node type: ${node1.type}`);
35
+ }
36
+ }
37
+ function getDefaultImports(node) {
38
+ return node.body.filter((statement)=>{
39
+ if ('ImportDeclaration' !== statement.type) return false;
40
+ const specifier = statement?.specifiers?.[0];
41
+ if (specifier?.type === 'ImportDefaultSpecifier') return true;
42
+ return false;
43
+ });
44
+ }
45
+ function getIdentifierInPattern(name, node) {
46
+ if (asserts.isIdentifier(node) && node.name === name) return node;
47
+ if (asserts.isObjectPattern(node)) for (const prop of node.properties){
48
+ if (asserts.isAssignmentProperty(prop)) return getIdentifierInPattern(name, prop.value);
49
+ if (asserts.isRestElement(prop)) return getIdentifierInPattern(name, prop);
50
+ }
51
+ if (asserts.isArrayPattern(node)) {
52
+ for (const el of node.elements)if (el) {
53
+ const result = getIdentifierInPattern(name, el);
54
+ if (result) return result;
55
+ }
56
+ }
57
+ if (asserts.isRestElement(node)) return getIdentifierInPattern(name, node.argument);
58
+ if (asserts.isAssignmentPattern(node)) return getIdentifierInPattern(name, node.left);
59
+ }
60
+ function getIdentifierInDeclaration(name, node) {
61
+ function getId(node) {
62
+ return asserts.isIdentifier(node.id) && node.id.name === name ? node.id : void 0;
63
+ }
64
+ if (asserts.isFunctionDeclaration(node)) return getId(node);
65
+ if (asserts.isClassDeclaration(node)) return getId(node);
66
+ if (asserts.isVariableDeclaration(node)) return node.declarations.find((item)=>getIdentifierInPattern(name, item.id))?.id;
67
+ }
68
+ function getIdentifierInImport(name, node) {
69
+ if (asserts.isImportDeclaration(node)) {
70
+ for (const specifier of node.specifiers ?? [])if (specifier.local.name === name) return specifier.local;
71
+ }
72
+ }
73
+ function getIdentifierInExport(name, node) {
74
+ if (asserts.isExportNamedDeclaration(node)) {
75
+ if (node.declaration) return getIdentifierInDeclaration(name, node.declaration);
76
+ for (const specifier of node.specifiers ?? [])if (specifier.exported.name === name) return specifier.exported;
77
+ }
78
+ if (asserts.isExportAllDeclaration(node) && node.exported) {
79
+ if (node.exported.name === name) return node.exported;
80
+ }
81
+ }
82
+ function canParse(code, ecmaVersion) {
83
+ try {
84
+ parse(code, {
85
+ ecmaVersion,
86
+ sourceType: 'number' == typeof ecmaVersion && ecmaVersion <= 5 ? "script" : 'module'
87
+ });
88
+ return true;
89
+ } catch {
90
+ return false;
91
+ }
92
+ }
93
+ function isES5(code) {
94
+ return canParse(code, 5);
95
+ }
96
+ function isES6(code) {
97
+ return canParse(code, 6);
98
+ }
99
+ function detectECMAVersion(code) {
100
+ if (isES6(code)) {
101
+ if (isES5(code)) return ECMAVersion.ES5;
102
+ return ECMAVersion.ES6;
103
+ }
104
+ return ECMAVersion.ES7P;
105
+ }
106
+ export { canParse, detectECMAVersion, getDefaultImports, getIdentifierInDeclaration, getIdentifierInExport, getIdentifierInImport, getIdentifierInPattern, isES5, isES6, isSameSemantics };
@@ -1,4 +1,4 @@
1
- import { Linter as LinterType, SDK } from '@rsdoctor/types';
1
+ import { Linter as LinterType, SDK } from '@rsdoctor/shared/types';
2
2
  export { LinterType };
3
3
  export declare class Linter<Rules extends LinterType.ExtendRuleData[]> {
4
4
  private rules;
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- import { Linter } from "@rsdoctor/types";
2
+ import { Linter } from "@rsdoctor/shared/types";
3
3
  import { Rule } from "./rule.js";
4
4
  import { rules as index_js_rules } from "./rules/index.js";
5
5
  import { toSeverity } from "./utils.js";
@@ -1,4 +1,4 @@
1
- import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/types';
1
+ import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/shared/types';
2
2
  import { LinterType } from './linter.js';
3
3
  type DefaultRuleConfig = Linter.DefaultRuleConfig;
4
4
  export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta<Config> {
@@ -16,7 +16,7 @@ export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta
16
16
  get title(): string;
17
17
  get severity(): Linter.Severity;
18
18
  get config(): Config | undefined;
19
- get category(): "compile" | "bundle" | RuleTypes.RuleMessageCategory | "emo";
19
+ get category(): "bundle" | "compile" | "emo" | RuleTypes.RuleMessageCategory;
20
20
  setOption(opt: Linter.RuleConfigItem): void;
21
21
  match(level: Linter.Severity): boolean;
22
22
  validate(context: SDK.RuntimeContext): Promise<Linter.ValidateResult>;
@@ -1,6 +1,6 @@
1
1
  import "node:module";
2
- import { Linter, Rule } from "@rsdoctor/types";
3
- import { Lodash } from "@rsdoctor/utils/common";
2
+ import { Linter, Rule } from "@rsdoctor/shared/types";
3
+ import { Lodash } from "../common/index.js";
4
4
  import { noop, toSeverity } from "./utils.js";
5
5
  class rule_Rule {
6
6
  static from(data) {
@@ -1,4 +1,4 @@
1
- import { Linter } from '@rsdoctor/types';
1
+ import { Linter } from '@rsdoctor/shared/types';
2
2
  import type { Config } from './types.js';
3
3
  export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "cjs-require">;
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- import { Linter } from "@rsdoctor/types";
2
+ import { Linter } from "@rsdoctor/shared/types";
3
3
  import { defineRule } from "../../rule.js";
4
4
  const title = 'cjs-require';
5
5
  const CJS_REQUIRE_TYPE = 'cjs require';
@@ -1,4 +1,4 @@
1
- import { Linter } from '@rsdoctor/types';
1
+ import { Linter } from '@rsdoctor/shared/types';
2
2
  import { Config } from './types.js';
3
3
  export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "cross-chunks-package">;
@@ -1,8 +1,8 @@
1
1
  import "node:module";
2
- import { Linter } from "@rsdoctor/types";
2
+ import { Linter } from "@rsdoctor/shared/types";
3
3
  import { defineRule } from "../../rule.js";
4
4
  import { getErrorMsgForDupPckChunks } from "./utils.js";
5
- import { uniq } from "es-toolkit/compat";
5
+ import { uniq } from "../../../collection.js";
6
6
  const title = 'cross-chunks-package';
7
7
  const rule = defineRule(()=>({
8
8
  meta: {
@@ -1,4 +1,4 @@
1
- import { Linter } from '@rsdoctor/types';
1
+ import { Linter } from '@rsdoctor/shared/types';
2
2
  import type { Config } from './types.js';
3
3
  export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "default-import-check">;
@@ -1,7 +1,7 @@
1
1
  import "node:module";
2
2
  import { builtinModules } from "module";
3
- import { Linter } from "@rsdoctor/types";
4
- import { getDocument, parser } from "@rsdoctor/utils/ruleUtils";
3
+ import { Linter } from "@rsdoctor/shared/types";
4
+ import { getDocument, parser } from "../../../rule-utils/index.js";
5
5
  import { getDefaultImportByRequest, getFixData, getSourceRangeFromTransformedOffset, hasSameLeftInAssignStatement } from "./utils.js";
6
6
  import { defineRule } from "../../rule.js";
7
7
  const title = 'default-import-check';
@@ -1,5 +1,5 @@
1
- import { Node, Range } from '@rsdoctor/utils/ruleUtils';
2
- import type { SDK, Linter } from '@rsdoctor/types';
1
+ import { Node, Range } from '../../../rule-utils/index.js';
2
+ import type { SDK, Linter } from '@rsdoctor/shared/types';
3
3
  export declare function getDefaultImportByRequest(node: Node.Program, request: string): Node.ImportDeclaration | undefined;
4
4
  /**
5
5
  * Determine that it contains the same left value assignment expression in the enumeration.
@@ -1,6 +1,6 @@
1
1
  import "node:module";
2
- import { getDocument, parser } from "@rsdoctor/utils/ruleUtils";
3
- import { Lodash } from "@rsdoctor/utils/common";
2
+ import { getDocument, parser } from "../../../rule-utils/index.js";
3
+ import { Lodash } from "../../../common/index.js";
4
4
  function getDefaultImportByRequest(node, request) {
5
5
  return parser.utils.getDefaultImports(node).find((decl)=>decl.source.value === request);
6
6
  }
@@ -1,4 +1,4 @@
1
- import { Linter } from '@rsdoctor/types';
2
- import * as duplicatePackageTypes from './types.js';
1
+ import { Linter } from '@rsdoctor/shared/types';
2
+ import type { Config } from './types.js';
3
3
  export type { Config, CheckVersion } from './types.js';
4
- export declare const rule: Linter.RuleData<duplicatePackageTypes.Config, "duplicate-package">;
4
+ export declare const rule: Linter.RuleData<Config, "duplicate-package">;
@@ -1,11 +1,11 @@
1
1
  import "node:module";
2
- import { Linter } from "@rsdoctor/types";
2
+ import { Linter } from "@rsdoctor/shared/types";
3
3
  import { diff, gt } from "semver";
4
4
  import { getErrorDetail, getErrorMsg } from "./utils.js";
5
5
  import { defineRule } from "../../rule.js";
6
- import * as __rspack_external__types_js_7eec16d2 from "./types.js";
6
+ import * as __rspack_external__types_js_b06c0ce5 from "./types.js";
7
7
  const title = 'duplicate-package';
8
- const { CheckVersionMap: CheckVersionMap } = __rspack_external__types_js_7eec16d2;
8
+ const { CheckVersionMap: CheckVersionMap } = __rspack_external__types_js_b06c0ce5;
9
9
  const rule = defineRule(()=>({
10
10
  meta: {
11
11
  code: 'E1001',
@@ -1,3 +1,3 @@
1
- import type { SDK, Rule } from '@rsdoctor/types';
1
+ import type { SDK, Rule } from '@rsdoctor/shared/types';
2
2
  export declare function getErrorMsg(packages: SDK.PackageInstance[], root: string): string;
3
3
  export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
@@ -1,4 +1,5 @@
1
1
  import { Config } from './types.js';
2
- import { Linter } from '@rsdoctor/types';
2
+ import { Linter } from '@rsdoctor/shared/types';
3
3
  export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "ecma-version-check">;
4
+ declare const title = "ecma-version-check";
5
+ export declare const rule: Linter.RuleData<Config, typeof title>;
@@ -3,7 +3,7 @@ import path from "path";
3
3
  import { CheckSyntax } from "@rsbuild/plugin-check-syntax";
4
4
  import { loadConfig } from "browserslist-load-config";
5
5
  import { defineRule } from "../../rule.js";
6
- import { Linter } from "@rsdoctor/types";
6
+ import { Linter } from "@rsdoctor/shared/types";
7
7
  const title = 'ecma-version-check';
8
8
  const rule = defineRule(()=>({
9
9
  meta: {
@@ -1,3 +1,2 @@
1
1
  import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
2
- export interface Config extends PluginCheckSyntaxOptions {
3
- }
2
+ export type Config = PluginCheckSyntaxOptions;
@@ -1,2 +1,2 @@
1
- import type { ECMAVersion } from '@rsdoctor/utils/ruleUtils';
1
+ import type { ECMAVersion } from '../../../rule-utils/index.js';
2
2
  export declare function getVersionNumber(ECMAString: ECMAVersion): number | undefined;
@@ -1,4 +1,4 @@
1
- import { Linter } from '@rsdoctor/types';
1
+ import { Linter } from '@rsdoctor/shared/types';
2
2
  import type { Config } from './types.js';
3
3
  export type { Config } from './types.js';
4
4
  export declare const rule: Linter.RuleData<Config, "esm-resolved-to-cjs">;
@@ -1,7 +1,7 @@
1
1
  import "node:module";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
- import { Linter, SDK } from "@rsdoctor/types";
4
+ import { Linter, SDK } from "@rsdoctor/shared/types";
5
5
  import { defineRule } from "../../rule.js";
6
6
  const title = 'esm-resolved-to-cjs';
7
7
  function normalizePathForCompare(filePath) {