@rsdoctor/core 1.5.9 → 1.5.10

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 (86) hide show
  1. package/dist/build-utils/build/chunks/assetsModules.d.cts +17 -0
  2. package/dist/build-utils/build/chunks/chunkTransform.d.cts +4 -0
  3. package/dist/build-utils/build/chunks/index.d.cts +3 -0
  4. package/dist/build-utils/build/chunks/rspack/transform.d.cts +13 -0
  5. package/dist/build-utils/build/index.d.cts +5 -0
  6. package/dist/build-utils/build/loader/index.d.cts +2 -0
  7. package/dist/build-utils/build/loader/probeLoader.d.cts +4 -0
  8. package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +5 -0
  9. package/dist/build-utils/build/module-graph/index.d.cts +4 -0
  10. package/dist/build-utils/build/module-graph/parser.d.cts +2 -0
  11. package/dist/build-utils/build/module-graph/rspack/transform.d.cts +26 -0
  12. package/dist/build-utils/build/module-graph/transform.d.cts +4 -0
  13. package/dist/build-utils/build/module-graph/treeShaking.d.cts +2 -0
  14. package/dist/build-utils/build/module-graph/utils.d.cts +3 -0
  15. package/dist/build-utils/build/module-graph/webpack/transform.d.cts +16 -0
  16. package/dist/build-utils/build/utils/index.d.cts +3 -0
  17. package/dist/build-utils/build/utils/loader.cjs +1 -1
  18. package/dist/build-utils/build/utils/loader.d.cts +20 -0
  19. package/dist/build-utils/build/utils/loader.js +1 -1
  20. package/dist/build-utils/build/utils/parseBundle.d.cts +12 -0
  21. package/dist/build-utils/build/utils/plugin.d.cts +5 -0
  22. package/dist/build-utils/index.d.cts +1 -0
  23. package/dist/index.d.cts +3 -0
  24. package/dist/inner-plugins/constants.d.cts +6 -0
  25. package/dist/inner-plugins/index.d.cts +2 -0
  26. package/dist/inner-plugins/loaders/proxy.d.cts +7 -0
  27. package/dist/inner-plugins/plugins/base.d.cts +12 -0
  28. package/dist/inner-plugins/plugins/bundle.d.cts +15 -0
  29. package/dist/inner-plugins/plugins/bundleTagPlugin.d.cts +6 -0
  30. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +2 -2
  31. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +36 -0
  32. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +2 -2
  33. package/dist/inner-plugins/plugins/errors.d.cts +11 -0
  34. package/dist/inner-plugins/plugins/index.d.cts +11 -0
  35. package/dist/inner-plugins/plugins/loader.d.cts +10 -0
  36. package/dist/inner-plugins/plugins/plugins.d.cts +8 -0
  37. package/dist/inner-plugins/plugins/progress.d.cts +8 -0
  38. package/dist/inner-plugins/plugins/resolver.d.cts +13 -0
  39. package/dist/inner-plugins/plugins/rspack.d.cts +4 -0
  40. package/dist/inner-plugins/plugins/rules.d.cts +8 -0
  41. package/dist/inner-plugins/plugins/sourcemapTool.d.cts +52 -0
  42. package/dist/inner-plugins/plugins/summary.cjs +1 -1
  43. package/dist/inner-plugins/plugins/summary.d.cts +14 -0
  44. package/dist/inner-plugins/plugins/summary.js +1 -1
  45. package/dist/inner-plugins/utils/circleDetect.d.cts +4 -0
  46. package/dist/inner-plugins/utils/config.d.cts +5 -0
  47. package/dist/inner-plugins/utils/index.d.cts +9 -0
  48. package/dist/inner-plugins/utils/loader.d.cts +13 -0
  49. package/dist/inner-plugins/utils/normalize-config.d.cts +40 -0
  50. package/dist/inner-plugins/utils/plugin-common.d.cts +11 -0
  51. package/dist/inner-plugins/utils/plugin.d.cts +4 -0
  52. package/dist/inner-plugins/utils/sdk.d.cts +8 -0
  53. package/dist/rules/index.d.cts +3 -0
  54. package/dist/rules/linter.d.cts +9 -0
  55. package/dist/rules/rule.d.cts +27 -0
  56. package/dist/rules/rules/cjs-require/index.d.cts +4 -0
  57. package/dist/rules/rules/cjs-require/types.d.cts +7 -0
  58. package/dist/rules/rules/cross-chunks-package/index.d.cts +4 -0
  59. package/dist/rules/rules/cross-chunks-package/types.d.cts +3 -0
  60. package/dist/rules/rules/cross-chunks-package/utils.d.cts +1 -0
  61. package/dist/rules/rules/default-import-check/index.d.cts +4 -0
  62. package/dist/rules/rules/default-import-check/types.d.cts +4 -0
  63. package/dist/rules/rules/default-import-check/utils.d.cts +10 -0
  64. package/dist/rules/rules/duplicate-package/index.d.cts +4 -0
  65. package/dist/rules/rules/duplicate-package/types.d.cts +24 -0
  66. package/dist/rules/rules/duplicate-package/utils.d.cts +3 -0
  67. package/dist/rules/rules/ecma-version-check/index.d.cts +4 -0
  68. package/dist/rules/rules/ecma-version-check/types.d.cts +3 -0
  69. package/dist/rules/rules/ecma-version-check/utils.d.cts +2 -0
  70. package/dist/rules/rules/esm-resolved-to-cjs/index.d.cts +4 -0
  71. package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +8 -0
  72. package/dist/rules/rules/index.d.cts +1 -0
  73. package/dist/rules/rules/loader-performance-optimization/index.d.cts +4 -0
  74. package/dist/rules/rules/loader-performance-optimization/types.d.cts +22 -0
  75. package/dist/rules/rules/loader-performance-optimization/utils.d.cts +1 -0
  76. package/dist/rules/rules/module-mixed-chunks/index.d.cts +4 -0
  77. package/dist/rules/rules/module-mixed-chunks/types.d.cts +3 -0
  78. package/dist/rules/rules/side-effects-only-imports/index.d.cts +4 -0
  79. package/dist/rules/rules/side-effects-only-imports/types.d.cts +9 -0
  80. package/dist/rules/utils.d.cts +3 -0
  81. package/dist/types/chunks.d.cts +6 -0
  82. package/dist/types/index.d.cts +4 -0
  83. package/dist/types/loader.d.cts +19 -0
  84. package/dist/types/plugin.d.cts +51 -0
  85. package/dist/types/rules.d.cts +7 -0
  86. package/package.json +46 -21
@@ -0,0 +1,17 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ /**
3
+ * Collects module size data from bundle assets, using source maps when available
4
+ * and falling back to AST parsing for assets without source maps.
5
+ *
6
+ * @param moduleGraph - The module graph instance
7
+ * @param chunkGraph - The chunk graph instance
8
+ * @param bundleDir - Directory containing the bundle assets
9
+ * @param sourceMapSets - Map of module paths to their source code (from source maps)
10
+ * @param hasParseBundle - Whether to enable AST parsing fallback
11
+ * @param assetsWithoutSourceMap - Optional set of asset paths that don't have source maps.
12
+ * When provided, these assets will be parsed using AST parsing instead of source map data.
13
+ * This is used as a fallback mechanism when source maps are unavailable for specific assets.
14
+ * If not provided and no source maps exist (sourceMapSets is empty), all assets will be parsed via AST.
15
+ * @returns Promise that resolves when module data collection is complete
16
+ */
17
+ export declare function getAssetsModulesData(moduleGraph: SDK.ModuleGraphInstance, chunkGraph: SDK.ChunkGraphInstance, bundleDir: string, sourceMapSets: Map<string, string>, hasParseBundle?: boolean, assetsWithoutSourceMap?: Set<string>): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ export declare function chunkTransform(assetMap: Map<string, {
3
+ content: string;
4
+ }>, bundleStats: Plugin.StatsCompilation): import("@rsdoctor/graph").ChunkGraph;
@@ -0,0 +1,3 @@
1
+ export * from './assetsModules';
2
+ export * from './chunkTransform';
3
+ export * from './rspack/transform';
@@ -0,0 +1,13 @@
1
+ import { Plugin, SDK } from '@rsdoctor/types';
2
+ /**
3
+ * Patch native chunk graph data from Rspack into ChunkGraph instance
4
+ * @param cg The ChunkGraph instance to be patched
5
+ * @param rawChunkGraph Raw chunk graph data from Rspack native plugin
6
+ */
7
+ export declare function patchNativeChunkGraph(cg: SDK.ChunkGraphInstance, rawChunkGraph: Plugin.RspackNativeChunkGraph): void;
8
+ /**
9
+ * Patch native assets data from Rspack into ChunkGraph instance
10
+ * @param cg The ChunkGraph instance to be patched
11
+ * @param rawAssetPatch Raw assets patch data from Rspack native plugin
12
+ */
13
+ export declare function patchNativeAssets(cg: SDK.ChunkGraphInstance, rawAssetPatch: Plugin.RspackNativeAssetPatch): void;
@@ -0,0 +1,5 @@
1
+ export * as Chunks from './chunks';
2
+ export * as Utils from './utils';
3
+ export * as Loader from './loader';
4
+ export * as Types from '../../types';
5
+ export * as ModuleGraph from './module-graph';
@@ -0,0 +1,2 @@
1
+ export * from './probeLoaderPlugin';
2
+ export * from './probeLoader';
@@ -0,0 +1,4 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import type { LoaderDefinitionFunction } from '@rspack/core';
3
+ export declare const loaderModule: Plugin.LoaderDefinition<Parameters<LoaderDefinitionFunction>, {}>;
4
+ export default loaderModule;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ export declare class ProbeLoaderPlugin {
3
+ apply(compiler: Plugin.BaseCompiler): void;
4
+ private addProbeLoader;
5
+ }
@@ -0,0 +1,4 @@
1
+ export * from './webpack/transform';
2
+ export * from './transform';
3
+ export * from './treeShaking';
4
+ export * from './rspack/transform';
@@ -0,0 +1,2 @@
1
+ import { Node } from '@rsdoctor/utils/ruleUtils';
2
+ export declare function hasSetEsModuleStatement(program: Node.Program): boolean;
@@ -0,0 +1,26 @@
1
+ import { Plugin, SDK } from '@rsdoctor/types';
2
+ /**
3
+ * Patch native module graph data from Rspack into ModuleGraph instance
4
+ * @param mg The ModuleGraph instance to be patched
5
+ * @param cg The ChunkGraph instance to be patched
6
+ * @param rawModuleGraph Raw module graph data from Rspack native plugin
7
+ */
8
+ export declare function patchNativeModuleGraph(mg: SDK.ModuleGraphInstance, cg: SDK.ChunkGraphInstance, rawModuleGraph: Plugin.RspackNativeModuleGraph): void;
9
+ /**
10
+ * Patch native ids data from Rspack into ModuleGraph instance
11
+ * @param mg The ModuleGraph instance to be patched
12
+ * @param rawModuleIdsPatch Raw ids patch data from Rspack native plugin
13
+ */
14
+ export declare function patchNativeModuleIds(mg: SDK.ModuleGraphInstance, rawModuleIdsPatch: Plugin.RspackNativeModuleIdsPatch): void;
15
+ /**
16
+ * Patch native sources data from Rspack into ModuleGraph instance
17
+ * @param mg The ModuleGraph instance to be patched
18
+ * @param rawModuleIdsPatch Raw sources patch data from Rspack native plugin
19
+ */
20
+ export declare function patchNativeModuleSources(mg: SDK.ModuleGraphInstance, rawModuleSourcesPatch: Plugin.RspackNativeModuleSourcePatch): void;
21
+ /**
22
+ * Extract and store code snippets for side effect locations
23
+ * This should be called after module sources have been set
24
+ * @param mg The ModuleGraph instance with modules and side effect locations
25
+ */
26
+ export declare function extractSideEffectCodes(mg: SDK.ModuleGraphInstance): void;
@@ -0,0 +1,4 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { TransformContext } from '.';
3
+ import { SDK } from '@rsdoctor/types';
4
+ export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
@@ -0,0 +1,2 @@
1
+ import type { SDK, Plugin } from '@rsdoctor/types';
2
+ export declare function appendTreeShaking(moduleGraph: SDK.ModuleGraphInstance, compilation: Plugin.BaseCompilation): SDK.ModuleGraphInstance;
@@ -0,0 +1,3 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ export declare function getExportIdentifierStatement(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
3
+ export declare function getDeclarationIdentifier(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
@@ -0,0 +1,16 @@
1
+ import type { SourceMapConsumer } from 'source-map';
2
+ import * as Webpack from 'webpack';
3
+ import * as Rspack from '@rspack/core';
4
+ import { Node } from '@rsdoctor/utils/ruleUtils';
5
+ import { Plugin, SDK } from '@rsdoctor/types';
6
+ export interface TransformContext {
7
+ astCache?: Map<Webpack.NormalModule, Node.Program>;
8
+ packagePathMap?: Map<string, string>;
9
+ getSourceMap?(module: string): Promise<SourceMapConsumer | undefined>;
10
+ }
11
+ /**
12
+ * Get the type of dependencies between modules.
13
+ * This property can determine what runtime webpack has added to the modules.
14
+ */
15
+ export declare function getModuleExportsType(module: Webpack.NormalModule | Rspack.NormalModule, moduleGraph?: Webpack.ModuleGraph, strict?: boolean): SDK.DependencyBuildMeta['exportsType'];
16
+ export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: SDK.ModuleGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
@@ -0,0 +1,3 @@
1
+ export * from './loader';
2
+ export * from './plugin';
3
+ export * from './parseBundle';
@@ -139,7 +139,7 @@ var __webpack_exports__ = {};
139
139
  const newRule = {
140
140
  ...rule,
141
141
  use: (...args)=>{
142
- const rules = funcUse.apply(null, args);
142
+ const rules = funcUse(...args);
143
143
  return mapEachRules(rules, callback);
144
144
  }
145
145
  };
@@ -0,0 +1,20 @@
1
+ import type { Common, Plugin } from '@rsdoctor/types';
2
+ export declare function parsePathQueryFragment(str: string): {
3
+ path: string;
4
+ query: string;
5
+ fragment: string;
6
+ };
7
+ export declare function loadLoaderModule(loaderPath: string, cwd?: string): {
8
+ default: Plugin.LoaderDefinition<Common.PlainObject, {}>;
9
+ pitch: Plugin.PitchLoaderDefinitionFunction;
10
+ raw: boolean | void;
11
+ };
12
+ export declare function extractLoaderName(loaderPath: string, cwd?: string): string;
13
+ export declare function mapEachRules<T extends Plugin.BuildRuleSetRule>(rules: T[], callback: (rule: T) => T): T[];
14
+ export declare function isESMLoader(r: Plugin.BuildRuleSetRule): boolean;
15
+ export declare function getLoaderNameMatch(r: Plugin.BuildRuleSetRule, loaderName: string, strict?: boolean): boolean;
16
+ export declare function addProbeLoader2Rules<T extends Plugin.BuildRuleSetRule>(rules: T[], compiler: Plugin.BaseCompiler, fn: (r: Plugin.BuildRuleSetRule) => boolean): T[];
17
+ export declare function createLoaderContextTrap(this: Plugin.LoaderContext<Common.PlainObject>, final: (err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Plugin.SourceMapInput) => void): Plugin.LoaderContext<Common.PlainObject<any>>;
18
+ export declare function parseQuery(query: string): {
19
+ [k: string]: string;
20
+ };
@@ -84,7 +84,7 @@ function mapEachRules(rules, callback) {
84
84
  const newRule = {
85
85
  ...rule,
86
86
  use: (...args)=>{
87
- const rules = funcUse.apply(null, args);
87
+ const rules = funcUse(...args);
88
88
  return mapEachRules(rules, callback);
89
89
  }
90
90
  };
@@ -0,0 +1,12 @@
1
+ import type { ParseBundle } from '@rsdoctor/graph';
2
+ /**
3
+ * The following code is based on
4
+ * https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/44bd8d0f9aa3b098e271af220096ea70cc44bc9e/src/parseUtils.js#L10
5
+ *
6
+ *
7
+ * MIT Licensed
8
+ * Author th0r
9
+ * Copyright JS Foundation and other contributors.
10
+ * https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/44bd8d0f9aa3b098e271af220096ea70cc44bc9e/LICENSE
11
+ */
12
+ export declare const parseBundle: ParseBundle;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ export type IHook = Plugin.BaseCompiler['hooks'][keyof Plugin.BaseCompiler['hooks']];
3
+ export declare function shouldInterceptPluginHook<T extends IHook>(hook: T): boolean;
4
+ export declare function interceptCompilerHooks(compiler: Plugin.BaseCompiler, interceptor: (name: string, hook: IHook, scope: 'compiler') => void): void;
5
+ export declare function interceptCompilationHooks(compilation: Plugin.BaseCompilation, interceptor: (name: string, hook: IHook, scope: 'compilation') => void): void;
@@ -0,0 +1 @@
1
+ export * as Build from './build';
@@ -0,0 +1,3 @@
1
+ export * from './build-utils';
2
+ export * as InnerPlugins from './inner-plugins';
3
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ import type { Tap } from 'tapable';
2
+ export declare const pluginTapName = "RsdoctorWebpackPlugin";
3
+ export declare const pluginTapPostOptions: Tap;
4
+ export declare const pluginTapPreOptions: Tap;
5
+ export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
6
+ export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
@@ -0,0 +1,2 @@
1
+ export * from './plugins';
2
+ export * from './utils';
@@ -0,0 +1,7 @@
1
+ import type { Plugin as PluginType } from '@rsdoctor/types';
2
+ import { Plugin } from '@rsdoctor/types';
3
+ import type { ProxyLoaderOptions } from '../../types';
4
+ declare const loaderModule: Plugin.LoaderDefinition<ProxyLoaderOptions, {}>;
5
+ export declare const pitch: (this: PluginType.LoaderContext<ProxyLoaderOptions>) => string | void | Buffer<ArrayBufferLike> | Promise<string | Buffer<ArrayBufferLike>>;
6
+ export declare const raw = true;
7
+ export default loaderModule;
@@ -0,0 +1,12 @@
1
+ import type { Linter, Plugin, SDK } from '@rsdoctor/types';
2
+ import type { InternalPlugin, RsdoctorPluginInstance } from '../../types';
3
+ export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler> implements InternalPlugin<T, Linter.ExtendRuleData[]> {
4
+ readonly scheduler: RsdoctorPluginInstance<T, Linter.ExtendRuleData[]>;
5
+ abstract name: string;
6
+ constructor(scheduler: RsdoctorPluginInstance<T, Linter.ExtendRuleData[]>);
7
+ abstract apply(compiler: T): void;
8
+ get options(): Plugin.RsdoctorPluginOptionsNormalized<Linter.ExtendRuleData<any, string>[]>;
9
+ get sdk(): SDK.RsdoctorBuilderSDKInstance;
10
+ get tapPostOptions(): import("tapable").Tap;
11
+ get tapPreOptions(): import("tapable").Tap;
12
+ }
@@ -0,0 +1,15 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalBundlePlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "bundle";
5
+ map: Map<string, {
6
+ content: string;
7
+ }>;
8
+ apply(compiler: T): void;
9
+ changeDevtoolModuleFilename(compiler: Plugin.BaseCompiler): void;
10
+ ensureAssetContent(name: string): {
11
+ content: string;
12
+ };
13
+ thisCompilation: (compilation: Plugin.BaseCompilation) => void;
14
+ done: () => Promise<void>;
15
+ }
@@ -0,0 +1,6 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalBundleTagPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "bundleTag";
5
+ apply(compiler: Plugin.BaseCompiler): void;
6
+ }
@@ -111,7 +111,7 @@ async function doneHandler(_stats, _this, context, compiler) {
111
111
  await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
112
112
  logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
113
113
  logger_namespaceObject.logger.debug('reportModuleGraph start');
114
- _this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
114
+ if (_this.modulesGraph) await _this.sdk.reportModuleGraph(_this.modulesGraph);
115
115
  logger_namespaceObject.logger.debug('reportModuleGraph done');
116
116
  logger_namespaceObject.logger.debug('reportChunkGraph start');
117
117
  await _this.sdk.reportChunkGraph(_this.chunkGraph);
@@ -122,7 +122,7 @@ async function doneHandler(_stats, _this, context, compiler) {
122
122
  const ensureDevtools = (compiler)=>{
123
123
  const devtool = compiler.options.devtool;
124
124
  if ('string' == typeof devtool && /eval/i.test(devtool)) {
125
- hasConsole || logger_namespaceObject.logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
125
+ if (!hasConsole) logger_namespaceObject.logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
126
126
  hasConsole = true;
127
127
  return false;
128
128
  }
@@ -0,0 +1,36 @@
1
+ import { RsdoctorPluginInstance } from '../../types';
2
+ import { Linter, Plugin } from '@rsdoctor/types';
3
+ /**
4
+ * Represents a mapping item from a source map.
5
+ */
6
+ export interface MappingItem {
7
+ source: string | null;
8
+ generatedLine: number;
9
+ generatedColumn: number;
10
+ originalLine: number | null;
11
+ originalColumn: number | null;
12
+ name: string | null;
13
+ }
14
+ /**
15
+ * Main function to generate ModuleGraph and ChunkGraph from stats and Webpack module APIs.
16
+ * Sets up hooks to process stats, generate graphs, handle tree shaking, and collect source maps.
17
+ * @param compiler - The Webpack or Rspack compiler instance.
18
+ * @param _this - The Rsdoctor plugin instance.
19
+ */
20
+ export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
21
+ /**
22
+ * Checks if source map processing is enabled and supported by the current compiler configuration.
23
+ * Warns if eval-based source maps are used (unsupported).
24
+ * @param compiler - The Webpack or Rspack compiler instance.
25
+ * @returns true if source maps are enabled and supported, false otherwise.
26
+ */
27
+ export declare const ensureDevtools: (compiler: Plugin.BaseCompiler) => boolean;
28
+ /**
29
+ * Calculates namespace and source map filename regex for source map resolution.
30
+ * @param compiler - The Webpack or Rspack compiler instance.
31
+ * @returns An object containing namespace and sourceMapFilenameRegex.
32
+ */
33
+ export declare function calculateNamespaceAndRegex(compiler: Plugin.BaseCompiler): {
34
+ namespace: string;
35
+ sourceMapFilenameRegex: RegExp;
36
+ };
@@ -82,7 +82,7 @@ async function doneHandler(_stats, _this, context, compiler) {
82
82
  await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
83
83
  logger.debug(`${Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
84
84
  logger.debug('reportModuleGraph start');
85
- _this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
85
+ if (_this.modulesGraph) await _this.sdk.reportModuleGraph(_this.modulesGraph);
86
86
  logger.debug('reportModuleGraph done');
87
87
  logger.debug('reportChunkGraph start');
88
88
  await _this.sdk.reportChunkGraph(_this.chunkGraph);
@@ -93,7 +93,7 @@ async function doneHandler(_stats, _this, context, compiler) {
93
93
  const ensureDevtools = (compiler)=>{
94
94
  const devtool = compiler.options.devtool;
95
95
  if ('string' == typeof devtool && /eval/i.test(devtool)) {
96
- hasConsole || logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
96
+ if (!hasConsole) logger.warn('SourceMap with eval is not supported. Please use other sourcemap options.');
97
97
  hasConsole = true;
98
98
  return false;
99
99
  }
@@ -0,0 +1,11 @@
1
+ import { Rule, Err, Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ import { DevToolError } from '@rsdoctor/utils/error';
4
+ export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
+ readonly name = "error-reporter";
6
+ apply(compiler: T): void;
7
+ done: (stats: Plugin.BaseStats) => Promise<void>;
8
+ handleWebpackError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
9
+ reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
10
+ reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
11
+ }
@@ -0,0 +1,11 @@
1
+ export * from './loader';
2
+ export * from './plugins';
3
+ export * from './errors';
4
+ export * from './progress';
5
+ export * from './summary';
6
+ export * from './base';
7
+ export * from './bundle';
8
+ export * from './ensureModulesChunkGraph';
9
+ export * from './rules';
10
+ export * from './bundleTagPlugin';
11
+ export * from './resolver';
@@ -0,0 +1,10 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "loader";
5
+ readonly internalLoaderPath: string;
6
+ apply(compiler: T): void;
7
+ afterPlugins: (compiler: T) => void;
8
+ compilation(compiler: T, compilation: Plugin.BaseCompilation): void;
9
+ getInterceptRules(compiler: T, rules: Plugin.BuildRuleSetRules): Plugin.BuildRuleSetRule[];
10
+ }
@@ -0,0 +1,8 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "plugins";
5
+ apply(compiler: Plugin.BaseCompiler): void;
6
+ afterPlugins: (compiler: Plugin.BaseCompiler) => void;
7
+ compilation: (compilation: Plugin.BaseCompilation) => void;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { SDK } from '@rsdoctor/types';
2
+ import type { Plugin } from '@rsdoctor/types';
3
+ import { InternalBasePlugin } from './base';
4
+ export declare class InternalProgressPlugin<T extends Plugin.BaseCompilerType<'webpack'>> extends InternalBasePlugin<T> {
5
+ readonly name = "progress";
6
+ protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgress>;
7
+ apply(compiler: T): void;
8
+ }
@@ -0,0 +1,13 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ import type { Compiler as WebpackCompiler } from 'webpack';
4
+ export declare class InternalResolverPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
+ readonly name = "resolver";
6
+ protected resolveDataMap: Map<string, {
7
+ startAt: number;
8
+ startHRTime: [number, number];
9
+ request: string;
10
+ }>;
11
+ apply(compiler: T): void;
12
+ protected handleNormalModuleFactory: (normalModuleFactory: Plugin.RspackNormalModuleFactory | ReturnType<WebpackCompiler["createNormalModuleFactory"]>) => void;
13
+ }
@@ -0,0 +1,4 @@
1
+ import { Linter, Plugin } from '@rsdoctor/types';
2
+ import type { experiments } from '@rspack/core';
3
+ import { RsdoctorPluginInstance } from '../../types';
4
+ export declare function applyRspackNativePlugin(compiler: Plugin.BaseCompiler, plugin: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, RsdoctorRspackPlugin: typeof experiments.RsdoctorPlugin): void;
@@ -0,0 +1,8 @@
1
+ import { InternalBasePlugin } from './base';
2
+ import { Plugin } from '@rsdoctor/types';
3
+ export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
4
+ readonly name = "rules";
5
+ apply(compiler: Plugin.BaseCompiler): void;
6
+ done: (stats: Plugin.BaseStats) => Promise<void>;
7
+ protected lint(compilation: Plugin.BaseCompilation): Promise<void>;
8
+ }
@@ -0,0 +1,52 @@
1
+ import { RsdoctorPluginInstance } from '../../types';
2
+ import { Linter, Plugin } from '@rsdoctor/types';
3
+ export declare const UNASSIGNED = "[unassigned]";
4
+ /**
5
+ * Options for handling source map assets.
6
+ * @param compilation - The current compilation object.
7
+ * @param pluginInstance - The Rsdoctor plugin instance.
8
+ * @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
9
+ * @param namespace - Optional namespace for resolving sources.
10
+ */
11
+ interface SourceMapAssetOptions {
12
+ compilation: Plugin.BaseCompilation;
13
+ pluginInstance: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData<any, string>[]>;
14
+ sourceMapFilenameRegex: RegExp;
15
+ namespace?: string;
16
+ }
17
+ /**
18
+ * Binds a context cache to a source path resolver.
19
+ * @param context - The base context directory.
20
+ * @param namespace - Optional namespace for resolving sources.
21
+ * @param cache - The cache map to store resolved paths.
22
+ * @param sourceMapDir - The directory containing source maps.
23
+ * @param sourceRoot - The source root directory.
24
+ * @returns A function that resolves source paths based on the given context.
25
+ */
26
+ export declare function bindContextCache(context: string, namespace?: string, cache?: Map<string, string>, sourceMapDir?: string, sourceRoot?: string): (source: string, sourceMapFilenameRegex?: RegExp) => string;
27
+ /**
28
+ * Collects and processes source map information for a given asset.
29
+ * Groups mappings by line, sorts them, and reconstructs the original source code segments.
30
+ * @param map - The raw source map object.
31
+ * @param assetLinesCodeList - The code lines of the asset.
32
+ * @param _compilation - The current compilation object.
33
+ * @param _this - The Rsdoctor plugin instance.
34
+ * @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
35
+ * @param namespace - Optional namespace for resolving sources.
36
+ */
37
+ export declare function collectSourceMaps(map: any, assetLinesCodeList: string[], _compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, sourceMapFilenameRegex?: RegExp, namespace?: string, skipSources?: Set<string>, sourceMapPath?: string): Promise<void>;
38
+ /**
39
+ * Handles the afterEmit event for assets to collect source map information.
40
+ * @param compilation - The current compilation object.
41
+ * @param _this - The Rsdoctor plugin instance.
42
+ * @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
43
+ * @param namespace - Optional namespace for resolving sources.
44
+ */
45
+ export declare function handleAfterEmitAssets(compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData<any, string>[]>, sourceMapFilenameRegex?: RegExp, namespace?: string): Promise<void>;
46
+ /**
47
+ * Handles the emit event for assets to collect source map information.
48
+ * @param options - The options for handling source map assets.
49
+ * @returns A promise that resolves when the source map information is collected.
50
+ */
51
+ export declare function handleEmitAssets(options: SourceMapAssetOptions): Promise<void>;
52
+ export {};
@@ -100,7 +100,7 @@ class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBa
100
100
  const minifyHookData = [
101
101
  ...pluginData.processAssets || []
102
102
  ];
103
- minifyHookData.length && this.sdk.reportSummaryData({
103
+ if (minifyHookData.length) this.sdk.reportSummaryData({
104
104
  costs: [
105
105
  {
106
106
  name: common_namespaceObject.Summary.SummaryCostsDataName.Minify,
@@ -0,0 +1,14 @@
1
+ import type { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "summary";
5
+ private times;
6
+ private preTimes;
7
+ private postTimes;
8
+ apply(compiler: T): void;
9
+ private mark;
10
+ beforeCompile: () => Promise<void>;
11
+ afterCompile: (compilation: Plugin.BaseCompilation) => Promise<void>;
12
+ done: (compiler: T) => Promise<void>;
13
+ private report;
14
+ }
@@ -73,7 +73,7 @@ class InternalSummaryPlugin extends InternalBasePlugin {
73
73
  const minifyHookData = [
74
74
  ...pluginData.processAssets || []
75
75
  ];
76
- minifyHookData.length && this.sdk.reportSummaryData({
76
+ if (minifyHookData.length) this.sdk.reportSummaryData({
77
77
  costs: [
78
78
  {
79
79
  name: Summary.SummaryCostsDataName.Minify,
@@ -0,0 +1,4 @@
1
+ export declare const checkCirclePath: (obj: any, record: {
2
+ prop: string;
3
+ ref: unknown;
4
+ }[], res: string[][], level: number, maxLevel?: number) => void;
@@ -0,0 +1,5 @@
1
+ import { RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../../types';
2
+ import { Linter, Plugin, SDK } from '@rsdoctor/types';
3
+ export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorWebpackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
4
+ export declare const normalizeReportType: (reportCodeType: Plugin.IReportCodeType | Plugin.NewReportCodeType, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
5
+ export declare function normalizeRspackUserOptions<Rules extends Linter.ExtendRuleData[]>(options: RsdoctorRspackPluginOptions<Rules>): RsdoctorRspackPluginOptionsNormalized<Rules>;
@@ -0,0 +1,9 @@
1
+ export * from './loader';
2
+ export * from './plugin';
3
+ export * from './sdk';
4
+ export * from './config';
5
+ export * from './circleDetect';
6
+ export * from './plugin-common';
7
+ export * from './normalize-config';
8
+ export * from './plugin-common';
9
+ export * from './normalize-config';
@@ -0,0 +1,13 @@
1
+ import { Loader } from '@rsdoctor/utils/common';
2
+ import { SDK, Plugin } from '@rsdoctor/types';
3
+ import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types';
4
+ import { Utils as BuildUtils } from '../../build-utils/build';
5
+ export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
6
+ export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): Omit<ProxyLoaderOptions, typeof Loader.LoaderInternalPropertyName>;
7
+ export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
8
+ export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
9
+ export type CompatibleResolve = Omit<Plugin.Configuration['resolve'], 'mainFields'> & {
10
+ mainFields?: string[];
11
+ };
12
+ export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, cwd?: string, resolveLoader?: CompatibleResolve): T[];
13
+ export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Plugin.SourceMapInput): Promise<SDK.LoaderData>;
@@ -0,0 +1,40 @@
1
+ import { Config, Plugin, SDK } from '@rsdoctor/types';
2
+ import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
+ import { RuleSetCondition as WebpackRuleSetCondition, RuleSetConditionAbsolute as WebpackRuleSetConditionAbsolute, RuleSetRule as WebpackRuleSetRule } from 'webpack';
4
+ /**
5
+ * Process mode-specific configurations with priority logic
6
+ */
7
+ export declare function processModeConfigurations(finalMode: keyof typeof SDK.IMode, output: Config.IOutput<'brief' | 'normal'>, brief: Config.BriefConfig | undefined): {
8
+ finalBrief: {};
9
+ finalNormalOptions: Config.NormalModeOptions;
10
+ };
11
+ /**
12
+ * Process brief mode configuration with priority logic
13
+ * Priority: output.options.briefOptions > output.brief > default
14
+ */
15
+ export declare function processBriefHtmlModeConfig(output: Config.BriefModeConfig, brief: Config.BriefConfig | undefined): Config.BriefModeOptions;
16
+ /**
17
+ * Convert reportCodeType object to NewReportCodeType enum value
18
+ */
19
+ export declare function convertReportCodeTypeObject(reportCodeType: any): Config.NewReportCodeType | undefined;
20
+ /**
21
+ * This function recursively processes rule set conditions to ensure they can be
22
+ * properly serialized to JSON.
23
+ *
24
+ * @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
28
+ * - void: Undefined or null values
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const condition = /\.js$/;
33
+ * JSON.stringify(condition); // Error: Converting circular structure to JSON
34
+ *
35
+ * makeRuleSetSerializable(condition);
36
+ * JSON.stringify(condition); // '"/\\.js$/"'
37
+ * ```
38
+ */
39
+ export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | WebpackRuleSetConditionAbsolute | WebpackRuleSetCondition | void): void;
40
+ export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf'] | WebpackRuleSetRule['oneOf']): void;
@@ -0,0 +1,11 @@
1
+ import type { Configuration } from '@rspack/core';
2
+ /**
3
+ * Safe cloneDeep implementation that skips read-only properties (getters without setters)
4
+ * to avoid errors when cloning objects like AppContext that have read-only properties
5
+ */
6
+ export declare function safeCloneDeep<T>(value: T, visited?: WeakMap<WeakKey, any>): T;
7
+ /**
8
+ * Process compiler configuration to make it serializable
9
+ */
10
+ export declare function processCompilerConfig(config: any): Configuration;
11
+ export declare function handleBriefModeReport(sdk: any, options: any, disableClientServer: boolean): Promise<void>;
@@ -0,0 +1,4 @@
1
+ import type { SDK } from '@rsdoctor/types';
2
+ import { IHook } from '../../build-utils/build/utils';
3
+ export declare function reportPluginData(sdk: SDK.RsdoctorBuilderSDKInstance, hook: string, tapName: string, start: number, type: SDK.PluginHookData['type'], _res: unknown, err?: Error): void;
4
+ export declare function interceptPluginHook(sdk: SDK.RsdoctorBuilderSDKInstance, name: string, hook: IHook): void;
@@ -0,0 +1,8 @@
1
+ import { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
2
+ import { SDK } from '@rsdoctor/types';
3
+ declare global {
4
+ var __rsdoctor_sdks__: SDK.RsdoctorBuilderSDKInstance[] | undefined;
5
+ var __rsdoctor_sdk__: SDK.RsdoctorBuilderSDKInstance | undefined;
6
+ }
7
+ export declare function setSDK(t: SDK.RsdoctorBuilderSDKInstance): void;
8
+ export declare function getSDK(builderName?: string): RsdoctorPrimarySDK | SDK.RsdoctorBuilderSDKInstance | undefined;
@@ -0,0 +1,3 @@
1
+ export * from './linter';
2
+ export * from './rule';
3
+ export { rules } from './rules';
@@ -0,0 +1,9 @@
1
+ import { Linter as LinterType, SDK } from '@rsdoctor/types';
2
+ export { LinterType };
3
+ export declare class Linter<Rules extends LinterType.ExtendRuleData[]> {
4
+ private rules;
5
+ constructor({ rules, extends: extendRules, level, }?: LinterType.Options<Rules>);
6
+ private getRules;
7
+ validate(context: SDK.RuntimeContext): Promise<LinterType.ValidateResult>;
8
+ afterValidate(context: LinterType.InternalRuleCheckerContextForCheckEnd): Promise<void>;
9
+ }
@@ -0,0 +1,27 @@
1
+ import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/types';
2
+ import { LinterType } from './linter';
3
+ type DefaultRuleConfig = Linter.DefaultRuleConfig;
4
+ export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta<Config> {
5
+ static from<C>(data: Linter.ExtendRuleData<C>): Rule<C>;
6
+ readonly meta: Linter.RuleMeta<Config>;
7
+ private check;
8
+ /**
9
+ * execute when check end
10
+ */
11
+ private onCheckEnd;
12
+ private _severity;
13
+ private _config?;
14
+ constructor(data: Linter.RuleData<Config>);
15
+ get code(): RuleTypes.RuleMessageCode;
16
+ get title(): string;
17
+ get severity(): Linter.Severity;
18
+ get config(): Config | undefined;
19
+ get category(): "compile" | "bundle" | RuleTypes.RuleMessageCategory | "emo";
20
+ setOption(opt: Linter.RuleConfigItem): void;
21
+ match(level: Linter.Severity): boolean;
22
+ validate(context: SDK.RuntimeContext): Promise<Linter.ValidateResult>;
23
+ afterValidate({ hooks, validateResult, data, }: LinterType.InternalRuleCheckerContextForCheckEnd<Config>): Promise<void>;
24
+ }
25
+ export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.ExtendRuleConstructor<Title, T>): Linter.ExtendRuleData<T, Title>;
26
+ export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.RuleConstructor<Title, T>): Linter.RuleData<T, Title>;
27
+ export {};
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import type { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "cjs-require">;
@@ -0,0 +1,7 @@
1
+ export interface Config {
2
+ /**
3
+ * Module path patterns to ignore (applied to both issuer and required module paths).
4
+ * Defaults to [].
5
+ */
6
+ ignore: string[];
7
+ }
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "cross-chunks-package">;
@@ -0,0 +1,3 @@
1
+ export interface Config {
2
+ ignore: string[];
3
+ }
@@ -0,0 +1 @@
1
+ export declare function getErrorMsgForDupPckChunks(chunks: string[], pkgName: string): string;
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import type { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "default-import-check">;
@@ -0,0 +1,4 @@
1
+ export interface Config {
2
+ /** Packages that need to be ignored */
3
+ ignore: string[];
4
+ }
@@ -0,0 +1,10 @@
1
+ import { Node, Range } from '@rsdoctor/utils/ruleUtils';
2
+ import type { SDK, Linter } from '@rsdoctor/types';
3
+ export declare function getDefaultImportByRequest(node: Node.Program, request: string): Node.ImportDeclaration | undefined;
4
+ /**
5
+ * Determine that it contains the same left value assignment expression in the enumeration.
6
+ */
7
+ export declare function hasSameLeftInAssignStatement(node: Node.Program, compare: Node.SyntaxNode[]): Node.Pattern | undefined;
8
+ export declare function importDeclarationToString(node: Node.ImportDeclaration): string;
9
+ export declare function getFixData(module: SDK.ModuleInstance, node: Node.ImportDeclaration, originalRange: Range): Linter.FixData;
10
+ export declare function getSourceRangeFromTransformedOffset(module: SDK.ModuleInstance, node: Node.SyntaxNode): Linter.ReportDocument | undefined;
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import * as duplicatePackageTypes from './types';
3
+ export type { Config, CheckVersion } from './types';
4
+ export declare const rule: Linter.RuleData<duplicatePackageTypes.Config, "duplicate-package">;
@@ -0,0 +1,24 @@
1
+ export declare enum CheckVersion {
2
+ null = 0,
3
+ prerelease = 1,
4
+ prepatch = 16,
5
+ patch = 256,
6
+ preminor = 4096,
7
+ minor = 65536,
8
+ premajor = 1048576,
9
+ major = 16777216
10
+ }
11
+ export declare enum CheckVersionMap {
12
+ null = 0,
13
+ prerelease = 1,
14
+ prepatch = 17,
15
+ patch = 273,
16
+ preminor = 4369,
17
+ minor = 69905,
18
+ premajor = 1118481,
19
+ major = 17895697
20
+ }
21
+ export interface Config {
22
+ checkVersion: keyof typeof CheckVersion;
23
+ ignore: string[];
24
+ }
@@ -0,0 +1,3 @@
1
+ import type { SDK, Rule } from '@rsdoctor/types';
2
+ export declare function getErrorMsg(packages: SDK.PackageInstance[], root: string): string;
3
+ export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
@@ -0,0 +1,4 @@
1
+ import { Config } from './types';
2
+ import { Linter } from '@rsdoctor/types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "ecma-version-check">;
@@ -0,0 +1,3 @@
1
+ import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
2
+ export interface Config extends PluginCheckSyntaxOptions {
3
+ }
@@ -0,0 +1,2 @@
1
+ import type { ECMAVersion } from '@rsdoctor/utils/ruleUtils';
2
+ export declare function getVersionNumber(ECMAString: ECMAVersion): number | undefined;
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import type { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "esm-resolved-to-cjs">;
@@ -0,0 +1,8 @@
1
+ export interface Config {
2
+ /**
3
+ * Package name patterns to ignore (substring match against the import request).
4
+ * @example ['my-legacy-pkg', '@internal/']
5
+ * @default []
6
+ */
7
+ ignore: string[];
8
+ }
@@ -0,0 +1 @@
1
+ export declare const rules: (import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package").Config, "duplicate-package"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./default-import-check").Config, "default-import-check"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization").Config, "loader-performance-optimization"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check").Config, "ecma-version-check"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./cross-chunks-package").Config, "cross-chunks-package"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./module-mixed-chunks").Config, "module-mixed-chunks"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./side-effects-only-imports").Config, "tree-shaking-side-effects-only"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./cjs-require").Config, "cjs-require"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./esm-resolved-to-cjs").Config, "esm-resolved-to-cjs">)[];
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "loader-performance-optimization">;
@@ -0,0 +1,22 @@
1
+ import type { SDK } from '@rsdoctor/types';
2
+ export interface Config {
3
+ /**
4
+ * loaders which should be ignore.
5
+ */
6
+ ignore?: (string | RegExp)[];
7
+ /**
8
+ * threshold which the loader total costs.
9
+ * @unit millisecond
10
+ * @default 5000
11
+ */
12
+ threshold?: number;
13
+ /**
14
+ * the file extensions which will be match in rule check.
15
+ * @default ["js", "css", "jpg", "jpeg", "png", "gif", "webp", "svg"]
16
+ */
17
+ extensions?: (string | RegExp)[];
18
+ }
19
+ export interface LoaderMapValue extends SDK.LoaderTransformData {
20
+ __resource__: SDK.ResourceData;
21
+ __costs__: number;
22
+ }
@@ -0,0 +1 @@
1
+ export declare function match(str: string, patterns: (string | RegExp)[]): boolean;
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "module-mixed-chunks">;
@@ -0,0 +1,3 @@
1
+ export interface Config {
2
+ ignore: string[];
3
+ }
@@ -0,0 +1,4 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ import type { Config } from './types';
3
+ export type { Config } from './types';
4
+ export declare const rule: Linter.RuleData<Config, "tree-shaking-side-effects-only">;
@@ -0,0 +1,9 @@
1
+ export interface Config {
2
+ /** Module path patterns to ignore */
3
+ ignore: string[];
4
+ /**
5
+ * Module path patterns to include when the module is under node_modules.
6
+ * Example: ['react', '@babel/runtime']
7
+ */
8
+ include: string[];
9
+ }
@@ -0,0 +1,3 @@
1
+ import { Linter } from '@rsdoctor/types';
2
+ export declare function toSeverity(input: Linter.SeverityInput, defaultLevel: Linter.Severity): Linter.Severity;
3
+ export declare function noop(): void;
@@ -0,0 +1,6 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ export type AssetsModules = {
3
+ label?: string;
4
+ isAsset?: boolean;
5
+ modules?: Plugin.StatsModule[];
6
+ };
@@ -0,0 +1,4 @@
1
+ export * from './chunks';
2
+ export * from './rules';
3
+ export * from './loader';
4
+ export * from './plugin';
@@ -0,0 +1,19 @@
1
+ import { Loader } from '@rsdoctor/utils/common';
2
+ export interface ProxyLoaderInternalOptions {
3
+ cwd: string;
4
+ /**
5
+ * the url host of http server(which used to collect data).
6
+ */
7
+ host: string;
8
+ /**
9
+ * correct loader path.
10
+ */
11
+ loader: string;
12
+ /** include the loader option */
13
+ hasOptions: boolean;
14
+ skipLoaders: string[];
15
+ }
16
+ export interface ProxyLoaderOptions {
17
+ [key: string]: any;
18
+ [Loader.LoaderInternalPropertyName]: ProxyLoaderInternalOptions;
19
+ }
@@ -0,0 +1,51 @@
1
+ import type { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
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'> {
4
+ /**
5
+ * name of builder
6
+ */
7
+ name?: string;
8
+ }
9
+ export interface BasePluginInstance<T extends Plugin.BaseCompiler> {
10
+ apply: (compiler: T) => void;
11
+ [k: string]: any;
12
+ }
13
+ export interface InternalPlugin<T extends Plugin.BaseCompiler, Rules extends LinterType.ExtendRuleData[] = []> extends BasePluginInstance<T> {
14
+ readonly name: string;
15
+ readonly scheduler: RsdoctorPluginInstance<T, Rules>;
16
+ }
17
+ export interface RsdoctorPluginInstance<T extends Plugin.BaseCompiler, Rules extends LinterType.ExtendRuleData[] = []> extends BasePluginInstance<T> {
18
+ readonly name: string;
19
+ readonly options: Plugin.RsdoctorPluginOptionsNormalized<Rules>;
20
+ readonly sdk: SDK.RsdoctorBuilderSDKInstance;
21
+ readonly isRsdoctorPlugin: boolean;
22
+ _modulesGraphApplied?: boolean;
23
+ chunkGraph?: SDK.ChunkGraphInstance;
24
+ modulesGraph: SDK.ModuleGraphInstance;
25
+ ensureModulesChunksGraphApplied(compiler: T): void;
26
+ }
27
+ export interface RsdoctorRspackPluginInstance<Rules extends LinterType.ExtendRuleData[] = []> extends RsdoctorPluginInstance<Plugin.BaseCompilerType<'rspack'>, Rules> {
28
+ }
29
+ export interface NativePluginConfig {
30
+ moduleGraph?: boolean;
31
+ chunkGraph?: boolean;
32
+ }
33
+ export interface RsdoctorRspackPluginExperiments {
34
+ /**
35
+ * Whether to enable the native plugin to improve the performance.
36
+ * @default true
37
+ */
38
+ enableNativePlugin?: boolean;
39
+ }
40
+ export interface RsdoctorRspackPluginExperimentsNormalized {
41
+ enableNativePlugin?: NativePluginConfig;
42
+ }
43
+ export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends Plugin.RsdoctorWebpackPluginOptions<Rules> {
44
+ /**
45
+ * The experiments of the Rsdoctor Rspack plugin.
46
+ */
47
+ experiments?: RsdoctorRspackPluginExperiments;
48
+ }
49
+ export type RsdoctorRspackPluginOptionsNormalized<Rules extends Linter.ExtendRuleData[]> = Plugin.RsdoctorPluginOptionsNormalized<Rules> & {
50
+ experiments?: RsdoctorRspackPluginExperimentsNormalized;
51
+ };
@@ -0,0 +1,7 @@
1
+ import { RuleSetRule } from 'webpack';
2
+ export interface Rule extends RuleSetRule {
3
+ /**
4
+ * https://webpack.js.org/configuration/module/#ruleloaders
5
+ */
6
+ loaders: RuleSetRule['use'];
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "1.5.9",
3
+ "version": "1.5.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -16,29 +16,54 @@
16
16
  "type": "module",
17
17
  "exports": {
18
18
  ".": {
19
- "types": "./dist/index.d.ts",
20
- "import": "./dist/index.js",
21
- "default": "./dist/index.cjs"
19
+ "import": {
20
+ "types": "./dist/index.d.ts",
21
+ "default": "./dist/index.js"
22
+ },
23
+ "require": {
24
+ "types": "./dist/index.d.cts",
25
+ "default": "./dist/index.cjs"
26
+ }
22
27
  },
23
28
  "./build-utils": {
24
- "types": "./dist/build-utils/build/index.d.ts",
25
- "import": "./dist/build-utils/build/index.js",
26
- "default": "./dist/build-utils/build/index.cjs"
29
+ "import": {
30
+ "types": "./dist/build-utils/build/index.d.ts",
31
+ "default": "./dist/build-utils/build/index.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/build-utils/build/index.d.cts",
35
+ "default": "./dist/build-utils/build/index.cjs"
36
+ }
27
37
  },
28
38
  "./plugins": {
29
- "types": "./dist/inner-plugins/index.d.ts",
30
- "import": "./dist/inner-plugins/index.js",
31
- "default": "./dist/inner-plugins/index.cjs"
39
+ "import": {
40
+ "types": "./dist/inner-plugins/index.d.ts",
41
+ "default": "./dist/inner-plugins/index.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/inner-plugins/index.d.cts",
45
+ "default": "./dist/inner-plugins/index.cjs"
46
+ }
32
47
  },
33
48
  "./rules": {
34
- "types": "./dist/rules/index.d.ts",
35
- "import": "./dist/rules/index.js",
36
- "default": "./dist/rules/index.cjs"
49
+ "import": {
50
+ "types": "./dist/rules/index.d.ts",
51
+ "default": "./dist/rules/index.js"
52
+ },
53
+ "require": {
54
+ "types": "./dist/rules/index.d.cts",
55
+ "default": "./dist/rules/index.cjs"
56
+ }
37
57
  },
38
58
  "./types": {
39
- "types": "./dist/types/index.d.ts",
40
- "import": "./dist/types/index.js",
41
- "default": "./dist/types/index.cjs"
59
+ "import": {
60
+ "types": "./dist/types/index.d.ts",
61
+ "default": "./dist/types/index.js"
62
+ },
63
+ "require": {
64
+ "types": "./dist/types/index.d.cts",
65
+ "default": "./dist/types/index.cjs"
66
+ }
42
67
  }
43
68
  },
44
69
  "typesVersions": {
@@ -69,13 +94,13 @@
69
94
  "fs-extra": "^11.1.1",
70
95
  "semver": "^7.7.4",
71
96
  "source-map": "^0.7.6",
72
- "@rsdoctor/graph": "1.5.9",
73
- "@rsdoctor/sdk": "1.5.9",
74
- "@rsdoctor/types": "1.5.9",
75
- "@rsdoctor/utils": "1.5.9"
97
+ "@rsdoctor/graph": "1.5.10",
98
+ "@rsdoctor/utils": "1.5.10",
99
+ "@rsdoctor/sdk": "1.5.10",
100
+ "@rsdoctor/types": "1.5.10"
76
101
  },
77
102
  "devDependencies": {
78
- "@rspack/core": "2.0.0-rc.1",
103
+ "@rspack/core": "2.0.0",
79
104
  "@types/fs-extra": "^11.0.4",
80
105
  "@types/node": "^22.8.1",
81
106
  "@types/node-fetch": "^2.6.13",