@rsdoctor/core 1.5.12 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/build-utils/build/module-graph/index.cjs +4 -18
  2. package/dist/build-utils/build/module-graph/index.d.cts +0 -2
  3. package/dist/build-utils/build/module-graph/index.d.ts +0 -2
  4. package/dist/build-utils/build/module-graph/index.js +0 -2
  5. package/dist/build-utils/build/module-graph/rspack/transform.cjs +1 -1
  6. package/dist/build-utils/build/module-graph/rspack/transform.js +1 -1
  7. package/dist/build-utils/build/module-graph/transform.cjs +2 -3
  8. package/dist/build-utils/build/module-graph/transform.d.cts +1 -2
  9. package/dist/build-utils/build/module-graph/transform.d.ts +1 -2
  10. package/dist/build-utils/build/module-graph/transform.js +2 -3
  11. package/dist/build-utils/build/utils/parseBundle.cjs +1 -1
  12. package/dist/build-utils/build/utils/parseBundle.js +1 -1
  13. package/dist/build-utils/build/utils/plugin.cjs +1 -2
  14. package/dist/build-utils/build/utils/plugin.js +1 -2
  15. package/dist/inner-plugins/constants.cjs +1 -1
  16. package/dist/inner-plugins/constants.d.cts +1 -1
  17. package/dist/inner-plugins/constants.d.ts +1 -1
  18. package/dist/inner-plugins/constants.js +1 -1
  19. package/dist/inner-plugins/plugins/bundle.cjs +1 -17
  20. package/dist/inner-plugins/plugins/bundle.js +1 -17
  21. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +3 -40
  22. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +4 -6
  23. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +4 -6
  24. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +4 -41
  25. package/dist/inner-plugins/plugins/errors.cjs +3 -3
  26. package/dist/inner-plugins/plugins/errors.d.cts +1 -1
  27. package/dist/inner-plugins/plugins/errors.d.ts +1 -1
  28. package/dist/inner-plugins/plugins/errors.js +3 -3
  29. package/dist/inner-plugins/plugins/index.cjs +2 -9
  30. package/dist/inner-plugins/plugins/index.d.cts +0 -1
  31. package/dist/inner-plugins/plugins/index.d.ts +0 -1
  32. package/dist/inner-plugins/plugins/index.js +0 -1
  33. package/dist/inner-plugins/plugins/loader.cjs +1 -1
  34. package/dist/inner-plugins/plugins/loader.js +1 -1
  35. package/dist/inner-plugins/plugins/plugins.cjs +1 -1
  36. package/dist/inner-plugins/plugins/plugins.js +1 -1
  37. package/dist/inner-plugins/plugins/progress.cjs +14 -16
  38. package/dist/inner-plugins/plugins/progress.d.cts +1 -1
  39. package/dist/inner-plugins/plugins/progress.d.ts +1 -1
  40. package/dist/inner-plugins/plugins/progress.js +14 -16
  41. package/dist/inner-plugins/plugins/resolver.d.cts +1 -2
  42. package/dist/inner-plugins/plugins/resolver.d.ts +1 -2
  43. package/dist/inner-plugins/plugins/rules.cjs +3 -3
  44. package/dist/inner-plugins/plugins/rules.js +3 -3
  45. package/dist/inner-plugins/utils/config.cjs +0 -1
  46. package/dist/inner-plugins/utils/config.d.cts +1 -1
  47. package/dist/inner-plugins/utils/config.d.ts +1 -1
  48. package/dist/inner-plugins/utils/config.js +0 -1
  49. package/dist/inner-plugins/utils/loader.cjs +2 -2
  50. package/dist/inner-plugins/utils/loader.js +2 -2
  51. package/dist/inner-plugins/utils/normalize-config.d.cts +3 -6
  52. package/dist/inner-plugins/utils/normalize-config.d.ts +3 -6
  53. package/dist/rules/rules/cjs-require/index.cjs +2 -2
  54. package/dist/rules/rules/cjs-require/index.js +2 -2
  55. package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +2 -17
  56. package/dist/rules/rules/esm-resolved-to-cjs/index.js +2 -17
  57. package/dist/rules/rules/loader-performance-optimization/index.cjs +1 -1
  58. package/dist/rules/rules/loader-performance-optimization/index.js +1 -1
  59. package/dist/rules/rules/module-mixed-chunks/index.cjs +1 -1
  60. package/dist/rules/rules/module-mixed-chunks/index.js +1 -1
  61. package/dist/rules/rules/side-effects-only-imports/index.cjs +1 -1
  62. package/dist/rules/rules/side-effects-only-imports/index.js +1 -1
  63. package/dist/types/plugin.d.cts +2 -2
  64. package/dist/types/plugin.d.ts +2 -2
  65. package/dist/types/rules.d.cts +4 -4
  66. package/dist/types/rules.d.ts +4 -4
  67. package/package.json +6 -7
  68. package/dist/build-utils/build/module-graph/treeShaking.cjs +0 -106
  69. package/dist/build-utils/build/module-graph/treeShaking.d.cts +0 -2
  70. package/dist/build-utils/build/module-graph/treeShaking.d.ts +0 -2
  71. package/dist/build-utils/build/module-graph/treeShaking.js +0 -73
  72. package/dist/build-utils/build/module-graph/webpack/transform.cjs +0 -170
  73. package/dist/build-utils/build/module-graph/webpack/transform.d.cts +0 -16
  74. package/dist/build-utils/build/module-graph/webpack/transform.d.ts +0 -16
  75. package/dist/build-utils/build/module-graph/webpack/transform.js +0 -124
  76. package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +0 -84
  77. package/dist/inner-plugins/plugins/bundleTagPlugin.d.cts +0 -6
  78. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +0 -6
  79. package/dist/inner-plugins/plugins/bundleTagPlugin.js +0 -51
@@ -8,5 +8,4 @@ export * from "./base.js";
8
8
  export * from "./bundle.js";
9
9
  export * from "./ensureModulesChunkGraph.js";
10
10
  export * from "./rules.js";
11
- export * from "./bundleTagPlugin.js";
12
11
  export * from "./resolver.js";
@@ -148,7 +148,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
148
148
  if (compiler.isChild()) return;
149
149
  compiler.options.module.rules = this.getInterceptRules(compiler, compiler.options.module.rules);
150
150
  this.sdk.addClientRoutes([
151
- types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
151
+ types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Loaders
152
152
  ]);
153
153
  } finally{
154
154
  (0, logger_namespaceObject.timeEnd)('InternalLoaderPlugin.afterPlugins');
@@ -109,7 +109,7 @@ class InternalLoaderPlugin extends InternalBasePlugin {
109
109
  if (compiler.isChild()) return;
110
110
  compiler.options.module.rules = this.getInterceptRules(compiler, compiler.options.module.rules);
111
111
  this.sdk.addClientRoutes([
112
- Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
112
+ Manifest.RsdoctorManifestClientRoutes.Loaders
113
113
  ]);
114
114
  } finally{
115
115
  timeEnd('InternalLoaderPlugin.afterPlugins');
@@ -48,7 +48,7 @@ class InternalPluginsPlugin extends external_base_cjs_namespaceObject.InternalBa
48
48
  if (compiler.isChild()) return;
49
49
  index_cjs_namespaceObject.Utils.interceptCompilerHooks(compiler, (name, hook)=>(0, external_utils_index_cjs_namespaceObject.interceptPluginHook)(this.sdk, name, hook));
50
50
  this.sdk.addClientRoutes([
51
- types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackPlugins
51
+ types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.Plugins
52
52
  ]);
53
53
  } finally{
54
54
  (0, logger_namespaceObject.timeEnd)('InternalPluginsPlugin.afterPlugins');
@@ -21,7 +21,7 @@ class InternalPluginsPlugin extends InternalBasePlugin {
21
21
  if (compiler.isChild()) return;
22
22
  Utils.interceptCompilerHooks(compiler, (name, hook)=>interceptPluginHook(this.sdk, name, hook));
23
23
  this.sdk.addClientRoutes([
24
- Manifest.RsdoctorManifestClientRoutes.WebpackPlugins
24
+ Manifest.RsdoctorManifestClientRoutes.Plugins
25
25
  ]);
26
26
  } finally{
27
27
  timeEnd('InternalPluginsPlugin.afterPlugins');
@@ -33,22 +33,20 @@ class InternalProgressPlugin extends external_base_cjs_namespaceObject.InternalB
33
33
  apply(compiler) {
34
34
  const { sdk, currentProgress } = this;
35
35
  if (compiler.webpack && compiler.webpack.ProgressPlugin) {
36
- const progress = new compiler.webpack.ProgressPlugin({
37
- handler (percentage, msg) {
38
- currentProgress.percentage = percentage;
39
- currentProgress.message = msg || '';
40
- const api = types_namespaceObject.SDK.ServerAPI.APIExtends.GetCompileProgress;
41
- try {
42
- sdk.server.sendAPIDataToClient(api, {
43
- req: {
44
- api,
45
- body: void 0
46
- },
47
- res: currentProgress
48
- });
49
- } catch (e) {
50
- logger_namespaceObject.logger.debug(e);
51
- }
36
+ const progress = new compiler.webpack.ProgressPlugin((percentage, msg)=>{
37
+ currentProgress.percentage = percentage;
38
+ currentProgress.message = msg || '';
39
+ const api = types_namespaceObject.SDK.ServerAPI.APIExtends.GetCompileProgress;
40
+ try {
41
+ sdk.server.sendAPIDataToClient(api, {
42
+ req: {
43
+ api,
44
+ body: void 0
45
+ },
46
+ res: currentProgress
47
+ });
48
+ } catch (e) {
49
+ logger_namespaceObject.logger.debug(e);
52
50
  }
53
51
  });
54
52
  progress.apply(compiler);
@@ -1,7 +1,7 @@
1
1
  import { SDK } from '@rsdoctor/types';
2
2
  import type { Plugin } from '@rsdoctor/types';
3
3
  import { InternalBasePlugin } from './base';
4
- export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'webpack'>> extends InternalBasePlugin<T> {
4
+ export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'rspack'>> extends InternalBasePlugin<T> {
5
5
  readonly name = "progress";
6
6
  protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
7
7
  apply(compiler: T): void;
@@ -1,7 +1,7 @@
1
1
  import { SDK } from '@rsdoctor/types';
2
2
  import type { Plugin } from '@rsdoctor/types';
3
3
  import { InternalBasePlugin } from './base.js';
4
- export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'webpack'>> extends InternalBasePlugin<T> {
4
+ export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'rspack'>> extends InternalBasePlugin<T> {
5
5
  readonly name = "progress";
6
6
  protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
7
7
  apply(compiler: T): void;
@@ -6,22 +6,20 @@ class InternalProgressPlugin extends InternalBasePlugin {
6
6
  apply(compiler) {
7
7
  const { sdk, currentProgress } = this;
8
8
  if (compiler.webpack && compiler.webpack.ProgressPlugin) {
9
- const progress = new compiler.webpack.ProgressPlugin({
10
- handler (percentage, msg) {
11
- currentProgress.percentage = percentage;
12
- currentProgress.message = msg || '';
13
- const api = SDK.ServerAPI.APIExtends.GetCompileProgress;
14
- try {
15
- sdk.server.sendAPIDataToClient(api, {
16
- req: {
17
- api,
18
- body: void 0
19
- },
20
- res: currentProgress
21
- });
22
- } catch (e) {
23
- logger.debug(e);
24
- }
9
+ const progress = new compiler.webpack.ProgressPlugin((percentage, msg)=>{
10
+ currentProgress.percentage = percentage;
11
+ currentProgress.message = msg || '';
12
+ const api = SDK.ServerAPI.APIExtends.GetCompileProgress;
13
+ try {
14
+ sdk.server.sendAPIDataToClient(api, {
15
+ req: {
16
+ api,
17
+ body: void 0
18
+ },
19
+ res: currentProgress
20
+ });
21
+ } catch (e) {
22
+ logger.debug(e);
25
23
  }
26
24
  });
27
25
  progress.apply(compiler);
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
2
  import { InternalBasePlugin } from './base';
3
- import type { Compiler as WebpackCompiler } from 'webpack';
4
3
  export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
4
  readonly name = "resolver";
6
5
  protected resolveDataMap: Map<string, {
@@ -9,5 +8,5 @@ export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> exten
9
8
  request: string;
10
9
  }>;
11
10
  apply(compiler: T): void;
12
- protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory | ReturnType<WebpackCompiler["createNormalModuleFactory"]>) => void;
11
+ protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory) => void;
13
12
  }
@@ -1,6 +1,5 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
2
  import { InternalBasePlugin } from './base.js';
3
- import type { Compiler as WebpackCompiler } from 'webpack';
4
3
  export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
4
  readonly name = "resolver";
6
5
  protected resolveDataMap: Map<string, {
@@ -9,5 +8,5 @@ export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> exten
9
8
  request: string;
10
9
  }>;
11
10
  apply(compiler: T): void;
12
- protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory | ReturnType<WebpackCompiler["createNormalModuleFactory"]>) => void;
11
+ protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory) => void;
13
12
  }
@@ -54,16 +54,16 @@ class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBase
54
54
  }));
55
55
  const errors = validateErrors.filter((item)=>'Error' === item.level);
56
56
  const warnings = validateErrors.filter((item)=>'Warn' === item.level);
57
- const toWebpackError = (err)=>err.toError();
57
+ const toRspackError = (err)=>err.toError();
58
58
  result.replace.forEach((item)=>{
59
59
  if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) (0, compat_namespaceObject.pull)(compilation.errors, item);
60
60
  if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) (0, compat_namespaceObject.pull)(compilation.warnings, item);
61
61
  });
62
62
  if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
63
- compilation.warnings.push(toWebpackError(err));
63
+ compilation.errors.push(toRspackError(err));
64
64
  });
65
65
  if (Array.isArray(compilation.warnings)) warnings.forEach((err)=>{
66
- compilation.warnings.push(toWebpackError(err));
66
+ compilation.warnings.push(toRspackError(err));
67
67
  });
68
68
  this.sdk.reportError(validateErrors);
69
69
  await linter.afterValidate({
@@ -27,16 +27,16 @@ class InternalRulesPlugin extends InternalBasePlugin {
27
27
  }));
28
28
  const errors = validateErrors.filter((item)=>'Error' === item.level);
29
29
  const warnings = validateErrors.filter((item)=>'Warn' === item.level);
30
- const toWebpackError = (err)=>err.toError();
30
+ const toRspackError = (err)=>err.toError();
31
31
  result.replace.forEach((item)=>{
32
32
  if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) pull(compilation.errors, item);
33
33
  if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) pull(compilation.warnings, item);
34
34
  });
35
35
  if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
36
- compilation.warnings.push(toWebpackError(err));
36
+ compilation.errors.push(toRspackError(err));
37
37
  });
38
38
  if (Array.isArray(compilation.warnings)) warnings.forEach((err)=>{
39
- compilation.warnings.push(toWebpackError(err));
39
+ compilation.warnings.push(toRspackError(err));
40
40
  });
41
41
  this.sdk.reportError(validateErrors);
42
42
  await linter.afterValidate({
@@ -61,7 +61,6 @@ function getDefaultOutput() {
61
61
  function getDefaultSupports() {
62
62
  return {
63
63
  parseBundle: true,
64
- banner: void 0,
65
64
  gzip: true
66
65
  };
67
66
  }
@@ -1,5 +1,5 @@
1
1
  import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
2
2
  import { Linter, Plugin, SDK } from '@rsdoctor/types';
3
- export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
3
+ export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorRspackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
4
4
  export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
5
5
  export declare function normalizeRspackUserOptions<Rules extends Linter.ExtendRuleData[]>(options: RsdoctorRspackPluginOptions<Rules>): RsdoctorRspackPluginOptionsNormalized<Rules>;
@@ -1,5 +1,5 @@
1
1
  import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types/index.js';
2
2
  import { Linter, Plugin, SDK } from '@rsdoctor/types';
3
- export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
3
+ export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorRspackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
4
4
  export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
5
5
  export declare function normalizeRspackUserOptions<Rules extends Linter.ExtendRuleData[]>(options: RsdoctorRspackPluginOptions<Rules>): RsdoctorRspackPluginOptionsNormalized<Rules>;
@@ -22,7 +22,6 @@ function getDefaultOutput() {
22
22
  function getDefaultSupports() {
23
23
  return {
24
24
  parseBundle: true,
25
- banner: void 0,
26
25
  gzip: true
27
26
  };
28
27
  }
@@ -191,10 +191,10 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
191
191
  }
192
192
  await Promise.all([
193
193
  common_namespaceObject.Fetch.postJSON(`${host}${types_namespaceObject.SDK.ServerAPI.API.ReportLoader}`, loaderData, 8888).catch((err)=>{
194
- logger_namespaceObject.logger.debug(`${err.message}`, '[WebpackPlugin.ReportLoader][error]');
194
+ logger_namespaceObject.logger.debug(`${err.message}`, '[RspackPlugin.ReportLoader][error]');
195
195
  }),
196
196
  common_namespaceObject.Fetch.postJSON(`${host}${types_namespaceObject.SDK.ServerAPI.API.ReportSourceMap}`, sourceMapData, 8888).catch((err)=>{
197
- logger_namespaceObject.logger.debug(`${err.message}`, '[WebpackPlugin.ReportSourceMap][error]');
197
+ logger_namespaceObject.logger.debug(`${err.message}`, '[RspackPlugin.ReportSourceMap][error]');
198
198
  })
199
199
  ]);
200
200
  return loaderData;
@@ -149,10 +149,10 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
149
149
  }
150
150
  await Promise.all([
151
151
  Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportLoader}`, loaderData, 8888).catch((err)=>{
152
- logger.debug(`${err.message}`, '[WebpackPlugin.ReportLoader][error]');
152
+ logger.debug(`${err.message}`, '[RspackPlugin.ReportLoader][error]');
153
153
  }),
154
154
  Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportSourceMap}`, sourceMapData, 8888).catch((err)=>{
155
- logger.debug(`${err.message}`, '[WebpackPlugin.ReportSourceMap][error]');
155
+ logger.debug(`${err.message}`, '[RspackPlugin.ReportSourceMap][error]');
156
156
  })
157
157
  ]);
158
158
  return loaderData;
@@ -1,6 +1,5 @@
1
1
  import { Config, Plugin, SDK } from '@rsdoctor/types';
2
2
  import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
- import { RuleSetCondition as WebpackRuleSetCondition, RuleSetConditionAbsolute as WebpackRuleSetConditionAbsolute, RuleSetRule as WebpackRuleSetRule } from 'webpack';
4
3
  /**
5
4
  * Process mode-specific configurations with priority logic
6
5
  */
@@ -22,9 +21,7 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
22
21
  * properly serialized to JSON.
23
22
  *
24
23
  * @param item - The rule set condition to make serializable. Can be:
25
- * - RspackRuleSetCondition: Rspack-specific rule conditions
26
- * - WebpackRuleSetConditionAbsolute: Webpack absolute rule conditions
27
- * - WebpackRuleSetCondition: Webpack rule conditions
24
+ * - RspackRuleSetCondition: Rspack rule conditions
28
25
  * - void: Undefined or null values
29
26
  *
30
27
  * @example
@@ -36,5 +33,5 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
36
33
  * JSON.stringify(condition); // '"/\\.js$/"'
37
34
  * ```
38
35
  */
39
- export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | WebpackRuleSetConditionAbsolute | WebpackRuleSetCondition | void): void;
40
- export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf'] | WebpackRuleSetRule['oneOf']): void;
36
+ export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | void): void;
37
+ export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf']): void;
@@ -1,6 +1,5 @@
1
1
  import { Config, Plugin, SDK } from '@rsdoctor/types';
2
2
  import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
- import { RuleSetCondition as WebpackRuleSetCondition, RuleSetConditionAbsolute as WebpackRuleSetConditionAbsolute, RuleSetRule as WebpackRuleSetRule } from 'webpack';
4
3
  /**
5
4
  * Process mode-specific configurations with priority logic
6
5
  */
@@ -22,9 +21,7 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
22
21
  * properly serialized to JSON.
23
22
  *
24
23
  * @param item - The rule set condition to make serializable. Can be:
25
- * - RspackRuleSetCondition: Rspack-specific rule conditions
26
- * - WebpackRuleSetConditionAbsolute: Webpack absolute rule conditions
27
- * - WebpackRuleSetCondition: Webpack rule conditions
24
+ * - RspackRuleSetCondition: Rspack rule conditions
28
25
  * - void: Undefined or null values
29
26
  *
30
27
  * @example
@@ -36,5 +33,5 @@ export declare function convertReportCodeTypeObject(reportCodeType: any): Config
36
33
  * JSON.stringify(condition); // '"/\\.js$/"'
37
34
  * ```
38
35
  */
39
- export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | WebpackRuleSetConditionAbsolute | WebpackRuleSetCondition | void): void;
40
- export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf'] | WebpackRuleSetRule['oneOf']): void;
36
+ export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | void): void;
37
+ export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf']): void;
@@ -57,12 +57,12 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
57
57
  issuerModule: {
58
58
  id: dep.module.id,
59
59
  path: dep.module.path,
60
- webpackId: dep.module.webpackId
60
+ identifier: dep.module.identifier
61
61
  },
62
62
  requiredModule: {
63
63
  id: requiredModule.id,
64
64
  path: requiredModule.path,
65
- webpackId: requiredModule.webpackId
65
+ identifier: requiredModule.identifier
66
66
  },
67
67
  request: dep.request
68
68
  };
@@ -30,12 +30,12 @@ const rule = defineRule(()=>({
30
30
  issuerModule: {
31
31
  id: dep.module.id,
32
32
  path: dep.module.path,
33
- webpackId: dep.module.webpackId
33
+ identifier: dep.module.identifier
34
34
  },
35
35
  requiredModule: {
36
36
  id: requiredModule.id,
37
37
  path: requiredModule.path,
38
- webpackId: requiredModule.webpackId
38
+ identifier: requiredModule.identifier
39
39
  },
40
40
  request: dep.request
41
41
  };
@@ -102,27 +102,12 @@ function matchPatternExportKey(patternKey, exportKey) {
102
102
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) return null;
103
103
  return exportKey.slice(prefix.length, exportKey.length - suffix.length);
104
104
  }
105
- function isPatternExportKey(key) {
106
- return key.indexOf('*') === key.lastIndexOf('*') && key.includes('*');
107
- }
108
- function patternKeyCompare(keyA, keyB) {
109
- const baseLengthA = keyA.includes('*') ? keyA.indexOf('*') + 1 : keyA.length;
110
- const baseLengthB = keyB.includes('*') ? keyB.indexOf('*') + 1 : keyB.length;
111
- if (baseLengthA > baseLengthB) return -1;
112
- if (baseLengthB > baseLengthA) return 1;
113
- if (!keyA.includes('*')) return 1;
114
- if (!keyB.includes('*')) return -1;
115
- if (keyA.length > keyB.length) return -1;
116
- if (keyB.length > keyA.length) return 1;
117
- return 0;
118
- }
119
105
  function resolveExportEntry(exports1, exportKey) {
120
106
  if (Object.prototype.hasOwnProperty.call(exports1, exportKey)) return {
121
107
  value: exports1[exportKey],
122
108
  wildcard: ''
123
109
  };
124
- const patternEntries = Object.entries(exports1).filter(([key])=>isPatternExportKey(key)).sort(([keyA], [keyB])=>patternKeyCompare(keyA, keyB));
125
- for (const [key, value] of patternEntries){
110
+ for (const [key, value] of Object.entries(exports1)){
126
111
  const wildcard = matchPatternExportKey(key, exportKey);
127
112
  if (null !== wildcard) return {
128
113
  value,
@@ -219,7 +204,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
219
204
  resolvedModule: {
220
205
  id: dep.dependency.id,
221
206
  path: dep.dependency.path,
222
- webpackId: dep.dependency.webpackId
207
+ identifier: dep.dependency.identifier
223
208
  },
224
209
  issuers: [
225
210
  issuer
@@ -64,27 +64,12 @@ function matchPatternExportKey(patternKey, exportKey) {
64
64
  if (!exportKey.startsWith(prefix) || !exportKey.endsWith(suffix)) return null;
65
65
  return exportKey.slice(prefix.length, exportKey.length - suffix.length);
66
66
  }
67
- function isPatternExportKey(key) {
68
- return key.indexOf('*') === key.lastIndexOf('*') && key.includes('*');
69
- }
70
- function patternKeyCompare(keyA, keyB) {
71
- const baseLengthA = keyA.includes('*') ? keyA.indexOf('*') + 1 : keyA.length;
72
- const baseLengthB = keyB.includes('*') ? keyB.indexOf('*') + 1 : keyB.length;
73
- if (baseLengthA > baseLengthB) return -1;
74
- if (baseLengthB > baseLengthA) return 1;
75
- if (!keyA.includes('*')) return 1;
76
- if (!keyB.includes('*')) return -1;
77
- if (keyA.length > keyB.length) return -1;
78
- if (keyB.length > keyA.length) return 1;
79
- return 0;
80
- }
81
67
  function resolveExportEntry(exports, exportKey) {
82
68
  if (Object.prototype.hasOwnProperty.call(exports, exportKey)) return {
83
69
  value: exports[exportKey],
84
70
  wildcard: ''
85
71
  };
86
- const patternEntries = Object.entries(exports).filter(([key])=>isPatternExportKey(key)).sort(([keyA], [keyB])=>patternKeyCompare(keyA, keyB));
87
- for (const [key, value] of patternEntries){
72
+ for (const [key, value] of Object.entries(exports)){
88
73
  const wildcard = matchPatternExportKey(key, exportKey);
89
74
  if (null !== wildcard) return {
90
75
  value,
@@ -181,7 +166,7 @@ const rule = defineRule(()=>({
181
166
  resolvedModule: {
182
167
  id: dep.dependency.id,
183
168
  path: dep.dependency.path,
184
- webpackId: dep.dependency.webpackId
169
+ identifier: dep.dependency.identifier
185
170
  },
186
171
  issuers: [
187
172
  issuer
@@ -56,7 +56,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
56
56
  const { extensions, ignore = [], threshold = 5000 } = ruleConfig;
57
57
  if (!extensions || extensions?.length === 0) return;
58
58
  if (0 === loader.length) return;
59
- const { config } = configs.find((e)=>'webpack' === e.name) || {
59
+ const { config } = configs.find((e)=>'rspack' === e.name) || {
60
60
  config: void 0
61
61
  };
62
62
  if (!config) return;
@@ -29,7 +29,7 @@ const rule = defineRule(()=>({
29
29
  const { extensions, ignore = [], threshold = 5000 } = ruleConfig;
30
30
  if (!extensions || extensions?.length === 0) return;
31
31
  if (0 === loader.length) return;
32
- const { config } = configs.find((e)=>'webpack' === e.name) || {
32
+ const { config } = configs.find((e)=>'rspack' === e.name) || {
33
33
  config: void 0
34
34
  };
35
35
  if (!config) return;
@@ -55,7 +55,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
55
55
  module: {
56
56
  id: module.id,
57
57
  path: module.path,
58
- webpackId: module.webpackId
58
+ identifier: module.identifier
59
59
  },
60
60
  initialChunks: initialChunks.map((chunk)=>({
61
61
  id: chunk.id,
@@ -28,7 +28,7 @@ const rule = defineRule(()=>({
28
28
  module: {
29
29
  id: module.id,
30
30
  path: module.path,
31
- webpackId: module.webpackId
31
+ identifier: module.identifier
32
32
  },
33
33
  initialChunks: initialChunks.map((chunk)=>({
34
34
  id: chunk.id,
@@ -88,7 +88,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
88
88
  module: {
89
89
  id: module.id,
90
90
  path: module.path,
91
- webpackId: module.webpackId
91
+ identifier: module.identifier
92
92
  },
93
93
  connections: sideEffectConnections.map((c)=>({
94
94
  originModule: c.originModule ?? module.id,
@@ -61,7 +61,7 @@ const rule = defineRule(()=>({
61
61
  module: {
62
62
  id: module.id,
63
63
  path: module.path,
64
- webpackId: module.webpackId
64
+ identifier: module.identifier
65
65
  },
66
66
  connections: sideEffectConnections.map((c)=>({
67
67
  originModule: c.originModule ?? module.id,
@@ -1,6 +1,6 @@
1
1
  import type { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
2
2
  import type { Linter, Linter as LinterType, Plugin, SDK } from '@rsdoctor/types';
3
- export interface RsdoctorMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<Plugin.RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance'>, Pick<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'stage'> {
3
+ export interface RsdoctorMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<Plugin.RsdoctorRspackPluginOptions<Rules>, 'sdkInstance'>, Pick<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'stage'> {
4
4
  /**
5
5
  * name of builder
6
6
  */
@@ -40,7 +40,7 @@ export interface RsdoctorRspackPluginExperiments {
40
40
  export interface RsdoctorRspackPluginExperimentsNormalized {
41
41
  enableNativePlugin?: NativePluginConfig;
42
42
  }
43
- export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends Plugin.RsdoctorWebpackPluginOptions<Rules> {
43
+ export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends Plugin.RsdoctorRspackPluginOptions<Rules> {
44
44
  /**
45
45
  * The experiments of the Rsdoctor Rspack plugin.
46
46
  */
@@ -1,6 +1,6 @@
1
1
  import type { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
2
2
  import type { Linter, Linter as LinterType, Plugin, SDK } from '@rsdoctor/types';
3
- export interface RsdoctorMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<Plugin.RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance'>, Pick<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'stage'> {
3
+ export interface RsdoctorMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<Plugin.RsdoctorRspackPluginOptions<Rules>, 'sdkInstance'>, Pick<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'stage'> {
4
4
  /**
5
5
  * name of builder
6
6
  */
@@ -40,7 +40,7 @@ export interface RsdoctorRspackPluginExperiments {
40
40
  export interface RsdoctorRspackPluginExperimentsNormalized {
41
41
  enableNativePlugin?: NativePluginConfig;
42
42
  }
43
- export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends Plugin.RsdoctorWebpackPluginOptions<Rules> {
43
+ export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends Plugin.RsdoctorRspackPluginOptions<Rules> {
44
44
  /**
45
45
  * The experiments of the Rsdoctor Rspack plugin.
46
46
  */
@@ -1,7 +1,7 @@
1
- import { RuleSetRule } from 'webpack';
2
- export interface Rule extends RuleSetRule {
1
+ import type { RuleSetRule } from '@rspack/core';
2
+ export type Rule = RuleSetRule & {
3
3
  /**
4
- * https://webpack.js.org/configuration/module/#ruleloaders
4
+ * The legacy `loaders` field used by rule normalizers.
5
5
  */
6
6
  loaders: RuleSetRule['use'];
7
- }
7
+ };
@@ -1,7 +1,7 @@
1
- import { RuleSetRule } from 'webpack';
2
- export interface Rule extends RuleSetRule {
1
+ import type { RuleSetRule } from '@rspack/core';
2
+ export type Rule = RuleSetRule & {
3
3
  /**
4
- * https://webpack.js.org/configuration/module/#ruleloaders
4
+ * The legacy `loaders` field used by rule normalizers.
5
5
  */
6
6
  loaders: RuleSetRule['use'];
7
- }
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "1.5.12",
3
+ "version": "2.0.0-alpha.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -94,13 +94,13 @@
94
94
  "fs-extra": "^11.1.1",
95
95
  "semver": "^7.7.4",
96
96
  "source-map": "^0.7.6",
97
- "@rsdoctor/graph": "1.5.12",
98
- "@rsdoctor/types": "1.5.12",
99
- "@rsdoctor/sdk": "1.5.12",
100
- "@rsdoctor/utils": "1.5.12"
97
+ "@rsdoctor/graph": "2.0.0-alpha.0",
98
+ "@rsdoctor/sdk": "2.0.0-alpha.0",
99
+ "@rsdoctor/types": "2.0.0-alpha.0",
100
+ "@rsdoctor/utils": "2.0.0-alpha.0"
101
101
  },
102
102
  "devDependencies": {
103
- "@rspack/core": "2.0.3",
103
+ "@rspack/core": "2.0.4",
104
104
  "@types/fs-extra": "^11.0.4",
105
105
  "@types/node": "^24.12.3",
106
106
  "@types/node-fetch": "^2.6.13",
@@ -112,7 +112,6 @@
112
112
  "ts-loader": "^9.5.7",
113
113
  "tslib": "2.8.1",
114
114
  "typescript": "^6.0.3",
115
- "webpack": "^5.105.4",
116
115
  "@scripts/test-helper": "0.1.1"
117
116
  },
118
117
  "publishConfig": {