@rsdoctor/types 1.5.8 → 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 (64) hide show
  1. package/dist/babel.d.cts +13 -0
  2. package/dist/client.d.cts +164 -0
  3. package/dist/common.d.cts +26 -0
  4. package/dist/config.d.cts +75 -0
  5. package/dist/constants.d.cts +19 -0
  6. package/dist/emo.d.cts +28 -0
  7. package/dist/error.d.cts +137 -0
  8. package/dist/esbuild.d.cts +30 -0
  9. package/dist/index.d.cts +15 -0
  10. package/dist/linter/diagnostic.d.cts +48 -0
  11. package/dist/linter/index.d.cts +2 -0
  12. package/dist/linter/rule.d.cts +105 -0
  13. package/dist/logger.d.cts +9 -0
  14. package/dist/manifest.d.cts +68 -0
  15. package/dist/modules.d.cts +7 -0
  16. package/dist/plugin/baseCompiler.d.cts +33 -0
  17. package/dist/plugin/baseLoader.d.cts +78 -0
  18. package/dist/plugin/baseStats.d.cts +139 -0
  19. package/dist/plugin/index.d.cts +7 -0
  20. package/dist/plugin/internal-rules.d.cts +4 -0
  21. package/dist/plugin/plugin.d.cts +159 -0
  22. package/dist/plugin/rspack.d.cts +37 -0
  23. package/dist/plugin/webpack.d.cts +13 -0
  24. package/dist/rule/code/E1001.d.cts +3 -0
  25. package/dist/rule/code/E1002.d.cts +3 -0
  26. package/dist/rule/code/E1003.d.cts +3 -0
  27. package/dist/rule/code/E1004.d.cts +3 -0
  28. package/dist/rule/code/E1005.d.cts +3 -0
  29. package/dist/rule/code/E1006.d.cts +3 -0
  30. package/dist/rule/code/E1007.d.cts +3 -0
  31. package/dist/rule/code/E1008.d.cts +3 -0
  32. package/dist/rule/code/E1009.d.cts +3 -0
  33. package/dist/rule/code/index.d.cts +33 -0
  34. package/dist/rule/code/type.d.cts +27 -0
  35. package/dist/rule/data.d.cts +217 -0
  36. package/dist/rule/index.d.cts +2 -0
  37. package/dist/sdk/chunk.d.cts +142 -0
  38. package/dist/sdk/config.d.cts +12 -0
  39. package/dist/sdk/context.d.cts +23 -0
  40. package/dist/sdk/envinfo.d.cts +19 -0
  41. package/dist/sdk/hooks.d.cts +14 -0
  42. package/dist/sdk/index.d.cts +16 -0
  43. package/dist/sdk/instance.d.cts +110 -0
  44. package/dist/sdk/loader.d.cts +70 -0
  45. package/dist/sdk/module.d.cts +405 -0
  46. package/dist/sdk/package.d.cts +124 -0
  47. package/dist/sdk/plugin.d.cts +21 -0
  48. package/dist/sdk/process.d.cts +10 -0
  49. package/dist/sdk/resolver.d.cts +52 -0
  50. package/dist/sdk/result.d.cts +42 -0
  51. package/dist/sdk/server/apis/alerts.d.cts +30 -0
  52. package/dist/sdk/server/apis/graph.d.cts +49 -0
  53. package/dist/sdk/server/apis/index.d.cts +189 -0
  54. package/dist/sdk/server/apis/loader.d.cts +53 -0
  55. package/dist/sdk/server/apis/pagination.d.cts +11 -0
  56. package/dist/sdk/server/apis/plugin.d.cts +19 -0
  57. package/dist/sdk/server/apis/project.d.cts +18 -0
  58. package/dist/sdk/server/apis/resolver.d.cts +18 -0
  59. package/dist/sdk/server/index.d.cts +24 -0
  60. package/dist/sdk/statement.d.cts +178 -0
  61. package/dist/sdk/summary.d.cts +18 -0
  62. package/dist/sdk/treeShaking.d.cts +152 -0
  63. package/dist/thirdparty.d.cts +2 -0
  64. package/package.json +10 -5
@@ -0,0 +1,68 @@
1
+ import { PlainObject, ObjectPropertyNames } from './common';
2
+ import { StoreData } from './sdk';
3
+ export interface RsdoctorManifest {
4
+ client: RsdoctorManifestClient;
5
+ /**
6
+ * manifest url in tos, used by inner-rsdoctor.
7
+ */
8
+ cloudManifestUrl?: string;
9
+ /**
10
+ * manifest data shareding file urls in tos, used by inner-rsdoctor.
11
+ */
12
+ cloudData?: Record<keyof RsdoctorManifestData, string[] | string>;
13
+ data: RsdoctorManifestData;
14
+ /** current build name */
15
+ name?: string;
16
+ /**
17
+ * multiple build info
18
+ */
19
+ series?: RsdoctorManifestSeriesData[];
20
+ }
21
+ export interface RsdoctorManifestSeriesData {
22
+ name: string;
23
+ path: string;
24
+ stage: number;
25
+ origin?: string;
26
+ }
27
+ export interface RsdoctorManifestWithShardingFiles extends Omit<RsdoctorManifest, 'data'> {
28
+ data: Record<keyof RsdoctorManifestData, string[] | string>;
29
+ /**
30
+ * manifest data shareding file urls in tos, used by inner-rsdoctor.
31
+ */
32
+ cloudData?: Record<keyof RsdoctorManifestData, string[] | string>;
33
+ /**
34
+ * local server will proxy the manifest content and inject `__LOCAL__SERVER__: true`
35
+ */
36
+ __LOCAL__SERVER__?: boolean;
37
+ __SOCKET__PORT__?: string;
38
+ __SOCKET__URL__?: string;
39
+ }
40
+ export interface RsdoctorManifestClient {
41
+ enableRoutes: RsdoctorManifestClientRoutes[];
42
+ }
43
+ export interface RsdoctorManifestData extends StoreData {
44
+ }
45
+ export declare enum RsdoctorManifestClientRoutes {
46
+ Overall = "Overall",
47
+ WebpackLoaders = "Compile.WebpackLoaders",
48
+ ModuleResolve = "Compile.ModuleResolve",
49
+ WebpackPlugins = "Compile.WebpackPlugins",
50
+ BundleSize = "Bundle.BundleSize",
51
+ ModuleGraph = "Bundle.ModuleGraph",
52
+ TreeShaking = "Bundle.TreeShaking"
53
+ }
54
+ export declare enum RsdoctorManifestClientConstant {
55
+ WindowPropertyForManifestUrl = "__DEVTOOLS_MANIFEST_URL__"
56
+ }
57
+ export type RsdoctorManifestObjectKeys = NonNullable<ObjectPropertyNames<RsdoctorManifestData>>;
58
+ export type RsdoctorManifestRootKeys = keyof RsdoctorManifestData;
59
+ export type RsdoctorManifestMappingKeys = {
60
+ [K in RsdoctorManifestObjectKeys]: RsdoctorManifestData[K] extends PlainObject ? RsdoctorManifestData[K] extends Array<unknown> ? never : string extends keyof RsdoctorManifestData[K] ? never : keyof RsdoctorManifestData[K] extends string ? `${K}.${keyof RsdoctorManifestData[K]}` : never : never;
61
+ }[RsdoctorManifestObjectKeys] | RsdoctorManifestRootKeys;
62
+ export type InferManifestDataValue<T> = T extends `${infer Scope}.${infer Child}` ? Scope extends RsdoctorManifestObjectKeys ? Child extends keyof RsdoctorManifestData[Scope] ? RsdoctorManifestData[Scope][Child] : never : never : T extends RsdoctorManifestRootKeys ? RsdoctorManifestData[T] : never;
63
+ export interface ManifestDataLoader {
64
+ loadManifest(): Promise<RsdoctorManifest | RsdoctorManifestWithShardingFiles>;
65
+ loadData: {
66
+ <T extends RsdoctorManifestMappingKeys>(key: T): Promise<void | InferManifestDataValue<T>>;
67
+ };
68
+ }
@@ -0,0 +1,7 @@
1
+ import { StatsModule } from './plugin/baseStats';
2
+ export type ChunkModuleMap = {
3
+ isAsset: boolean;
4
+ label: string;
5
+ modules: StatsModule[];
6
+ };
7
+ export type Modules = Record<string | number, ChunkModuleMap>;
@@ -0,0 +1,33 @@
1
+ import type { Compiler, Compilation, Stats, StatsError, RuleSetRule } from 'webpack';
2
+ import type { Compiler as RspackCompiler, Compilation as RspackCompilation, Stats as RspackStats, RuleSetRule as RspackRuleSetRule, MultiCompiler } from '@rspack/core';
3
+ type RspackCompilerWrapper = RspackCompiler & Pick<MultiCompiler, keyof Omit<MultiCompiler, 'hooks' | 'options' | 'isChild'>>;
4
+ type RspackStatsWrapper = any extends RspackStats ? never : RspackStats;
5
+ type RspackRuleSetRuleWrapper = any extends RspackRuleSetRule ? never : RspackRuleSetRule;
6
+ export type BaseCompilerType<T extends 'rspack' | 'webpack' = 'webpack'> = T extends 'rspack' ? RspackCompilerWrapper : Compiler;
7
+ export type BaseCompiler = BaseCompilerType | BaseCompilerType<'rspack'>;
8
+ export type BaseCompilationType<T extends 'rspack' | 'webpack' = 'webpack'> = T extends 'rspack' ? Compilation : RspackCompilation;
9
+ export type BaseCompilation = BaseCompilationType | BaseCompilationType<'rspack'>;
10
+ export type BaseStats = Stats | RspackStatsWrapper;
11
+ export interface JsStatsError {
12
+ message: string;
13
+ formatted?: string;
14
+ title?: string;
15
+ }
16
+ export interface JsStatsWarning extends JsRspackError {
17
+ message: string;
18
+ formatted?: string;
19
+ }
20
+ export interface JsRspackError {
21
+ name?: string;
22
+ message: string;
23
+ moduleIdentifier?: string;
24
+ loc?: string;
25
+ file?: string;
26
+ stack?: string;
27
+ hideStack?: boolean;
28
+ }
29
+ export type BuildError = JsStatsError | StatsError;
30
+ export type BuildWarning = JsStatsWarning | StatsError;
31
+ export type BuildRuleSetRules = (false | '' | 0 | RuleSetRule | '...' | null | undefined)[];
32
+ export type BuildRuleSetRule = RuleSetRule | RspackRuleSetRuleWrapper;
33
+ export {};
@@ -0,0 +1,78 @@
1
+ import type { RuleSetRule as WebpackRuleSetRule, Configuration as WebpackConfiguration } from 'webpack';
2
+ import type { Configuration as RspackConfiguration, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
+ export interface SourceMap {
4
+ version: number;
5
+ sources: string[];
6
+ mappings: string;
7
+ file?: string;
8
+ sourceRoot?: string;
9
+ sourcesContent?: string[];
10
+ names?: string[];
11
+ }
12
+ type RspackConfigurationWrapper = any extends RspackConfiguration ? never : RspackConfiguration;
13
+ type RspackRuleSetRuleWrapper = any extends RspackRuleSetRule ? never : RspackRuleSetRule;
14
+ export type RuleSetRule = RspackRuleSetRuleWrapper | WebpackRuleSetRule;
15
+ export type Configuration = WebpackConfiguration | RspackConfigurationWrapper;
16
+ declare interface AdditionalData {
17
+ [index: string]: any;
18
+ webpackAST: object;
19
+ }
20
+ export interface LoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> {
21
+ (this: LoaderContext<OptionsType> & ContextAdditions, content: string, sourceMap?: string | SourceMap): string | void | Buffer | Promise<string | Buffer>;
22
+ }
23
+ export interface LoaderContext<OptionsType = {}> {
24
+ _module?: {
25
+ layer: string;
26
+ };
27
+ _compilation?: {
28
+ name: string;
29
+ };
30
+ getOptions(schema?: any): OptionsType;
31
+ /**
32
+ * Make this loader result cacheable. By default it's cacheable.
33
+ * A cacheable loader must have a deterministic result, when inputs and dependencies haven't changed.
34
+ * This means the loader shouldn't have other dependencies than specified with this.addDependency.
35
+ * Most loaders are deterministic and cacheable.
36
+ */
37
+ cacheable(flag?: boolean): void;
38
+ callback: (err?: null | Error, content?: string | Buffer, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => void;
39
+ /**
40
+ * The resource path.
41
+ * In the example: "/abc/resource.js"
42
+ */
43
+ resourcePath: string;
44
+ query: string | OptionsType;
45
+ /**
46
+ * The resource query string.
47
+ * Example: "?query"
48
+ */
49
+ resourceQuery: string;
50
+ /**
51
+ * The resource fragment.
52
+ * Example: "#frag"
53
+ */
54
+ resourceFragment: string;
55
+ /**
56
+ * The resource inclusive query and fragment.
57
+ * Example: "/abc/resource.js?query#frag"
58
+ */
59
+ resource: string;
60
+ async(): (err?: Error | null, content?: string | Buffer, sourceMap?: string | SourceMap, additionalData?: AdditionalData) => void;
61
+ /**
62
+ * Target of compilation.
63
+ * Example: "web"
64
+ */
65
+ target: string;
66
+ loaderIndex: number;
67
+ }
68
+ export declare interface PitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> {
69
+ (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object): string | void | Buffer | Promise<string | Buffer>;
70
+ }
71
+ export interface RspackPitchLoaderDefinitionFunction<OptionsType = {}, ContextAdditions = {}> {
72
+ (this: LoaderContext<OptionsType> & ContextAdditions, remainingRequest: string, previousRequest: string, data: object): string | void | Buffer | Promise<string | Buffer>;
73
+ }
74
+ export type LoaderDefinition<T, R> = LoaderDefinitionFunction<T, R> & {
75
+ raw?: false;
76
+ pitch?: PitchLoaderDefinitionFunction<T> | RspackPitchLoaderDefinitionFunction<T>;
77
+ };
78
+ export {};
@@ -0,0 +1,139 @@
1
+ import { BaseCompilation } from './baseCompiler';
2
+ interface StatsOptionsObj {
3
+ all?: boolean;
4
+ preset?: 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings';
5
+ assets?: boolean;
6
+ chunks?: boolean;
7
+ modules?: boolean;
8
+ entrypoints?: boolean;
9
+ warnings?: boolean;
10
+ warningsCount?: boolean;
11
+ errors?: boolean;
12
+ errorsCount?: boolean;
13
+ colors?: boolean;
14
+ chunkModules?: boolean;
15
+ hash?: boolean;
16
+ ids?: boolean;
17
+ orphanModules?: boolean;
18
+ runtimeModules?: boolean;
19
+ cachedModules?: boolean;
20
+ nestedModules?: boolean;
21
+ optimizationBailout?: boolean;
22
+ /** Rspack not support below opts */
23
+ cachedAssets?: boolean;
24
+ groupAssetsByInfo?: boolean;
25
+ groupAssetsByPath?: boolean;
26
+ groupAssetsByChunk?: boolean;
27
+ groupAssetsByExtension?: boolean;
28
+ groupAssetsByEmitStatus?: boolean;
29
+ }
30
+ /** webpack not support boolean or string */
31
+ type StatsOptions = StatsOptionsObj;
32
+ interface StatsAssetInfo {
33
+ development?: boolean;
34
+ }
35
+ export interface StatsAsset {
36
+ type: string;
37
+ name: string;
38
+ size: number;
39
+ chunks?: (string | number)[];
40
+ chunkNames?: Array<string | number>;
41
+ info: StatsAssetInfo;
42
+ }
43
+ interface StatsError {
44
+ message: string;
45
+ formatted?: string;
46
+ }
47
+ type KnownStatsModuleIssuer = {
48
+ identifier?: string;
49
+ name?: string;
50
+ id?: string | number | null;
51
+ moduleId?: string | number | null;
52
+ };
53
+ export interface StatsModule {
54
+ type?: string;
55
+ moduleType?: string;
56
+ identifier?: string;
57
+ moduleIdentifier?: string;
58
+ name?: string;
59
+ moduleName?: string;
60
+ id?: string | number;
61
+ chunks?: Array<string | number>;
62
+ size?: number;
63
+ issuer?: string;
64
+ issuerName?: string;
65
+ assets?: Array<string | number>;
66
+ reasons?: Array<StatsModuleReason>;
67
+ source?: string | Buffer;
68
+ orphanModules?: Array<StatsModule>;
69
+ runtimeModules?: Array<StatsModule>;
70
+ cachedModules?: Array<StatsModule>;
71
+ nestedModules?: Array<StatsModule>;
72
+ nameForCondition?: string;
73
+ depth?: number | string;
74
+ loc?: string;
75
+ modules?: StatsModule[];
76
+ layer?: string;
77
+ issuerPath?: Record<string, any>[] | KnownStatsModuleIssuer[];
78
+ optimizationBailout?: string[];
79
+ }
80
+ export interface StatsModuleReason {
81
+ moduleIdentifier?: string;
82
+ moduleName?: string;
83
+ moduleId?: string | number;
84
+ type?: string;
85
+ userRequest?: string;
86
+ children?: StatsModuleReason[];
87
+ loc?: string;
88
+ }
89
+ export interface JSStatsChunkGroup {
90
+ name?: string;
91
+ assets?: {
92
+ name: string;
93
+ size?: number;
94
+ }[];
95
+ chunks?: (string | number)[];
96
+ assetsSize?: number;
97
+ }
98
+ export type StatsChunkGroup = JSStatsChunkGroup;
99
+ export interface StatsCompilation {
100
+ version?: string;
101
+ /** rspack version */
102
+ rspackVersion?: string;
103
+ name?: string;
104
+ hash?: string;
105
+ time?: number;
106
+ builtAt?: number;
107
+ publicPath?: string;
108
+ assetsByChunkName?: Record<string, string[]>;
109
+ filteredModules?: number;
110
+ assets?: Array<StatsAsset>;
111
+ modules?: Array<StatsModule>;
112
+ chunks?: Array<StatsChunk>;
113
+ entrypoints?: Record<string, StatsChunkGroup>;
114
+ children?: StatsCompilation[];
115
+ errors?: Array<StatsError>;
116
+ errorsCount?: number;
117
+ warnings?: Array<StatsError>;
118
+ warningsCount?: number;
119
+ outputPath?: string;
120
+ }
121
+ interface StatsChunk {
122
+ type?: string;
123
+ files?: Array<string>;
124
+ id?: string | number;
125
+ entry: boolean;
126
+ initial: boolean;
127
+ names?: Array<string>;
128
+ size: number;
129
+ modules?: Array<StatsModule>;
130
+ }
131
+ export declare class Stats {
132
+ constructor(statsJson: any);
133
+ compilation: BaseCompilation;
134
+ hasErrors(): boolean;
135
+ hasWarnings(): boolean;
136
+ toJson(opts?: StatsOptions): StatsCompilation;
137
+ toString(opts?: StatsOptions): string;
138
+ }
139
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './baseCompiler';
2
+ export * from './baseStats';
3
+ export * from './plugin';
4
+ export * from './baseLoader';
5
+ export * from './rspack';
6
+ export * from './internal-rules';
7
+ export * from './webpack';
@@ -0,0 +1,4 @@
1
+ import { Linter } from '../index';
2
+ export type InternalRules = Linter.RuleData[];
3
+ export type InternalRuleId = 'E1001' | 'E1002' | 'E1003' | 'E1004' | 'E1005' | 'E1006' | 'E1007';
4
+ export type InternalRuleName = 'duplicate-package' | 'cross-chunks-package' | 'default-import-check' | 'ecma-version-check' | 'loader-performance-optimization' | 'module-mixed-chunks' | 'tree-shaking-side-effects-only';
@@ -0,0 +1,159 @@
1
+ import { Common, Config, Linter as LinterType, SDK } from '..';
2
+ import { InternalRules } from './internal-rules';
3
+ export interface RsdoctorWebpackPluginFeatures {
4
+ /**
5
+ * turn off it if you need not to analyze the executions of webpack loaders.
6
+ * @default true
7
+ */
8
+ loader?: boolean;
9
+ /**
10
+ * turn off it if you need not to analyze the executions of webpack plugins.
11
+ * @default true
12
+ */
13
+ plugins?: boolean;
14
+ /**
15
+ * turn off it if you need not to analyze the executions of resolver.
16
+ * @default false
17
+ */
18
+ resolver?: boolean;
19
+ /**
20
+ * turn off it if you need not to analyze the output bundle.
21
+ * @default true
22
+ */
23
+ bundle?: boolean;
24
+ /**
25
+ * turn off it if you need not to analyze the result of tree shaking.
26
+ * @default false
27
+ */
28
+ treeShaking?: boolean;
29
+ /**
30
+ * turn on it if you just use lite mode. This mode do not have source codes.
31
+ * @default false
32
+ */
33
+ lite?: boolean;
34
+ }
35
+ export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'output' | 'supports' | 'port' | 'brief' | 'mode'>> {
36
+ features: Common.DeepRequired<RsdoctorWebpackPluginFeatures>;
37
+ linter: Required<LinterType.Options<Rules, InternalRules>>;
38
+ sdkInstance?: SDK.RsdoctorBuilderSDKInstance;
39
+ output: {
40
+ mode: keyof typeof SDK.IMode;
41
+ reportCodeType: SDK.ToDataType;
42
+ reportDir: string;
43
+ options: Config.BriefModeOptions | Config.NormalModeOptions;
44
+ };
45
+ port?: number;
46
+ supports: ISupport;
47
+ }
48
+ interface ISupport {
49
+ banner?: boolean;
50
+ parseBundle?: boolean;
51
+ generateTileGraph?: boolean;
52
+ gzip?: boolean;
53
+ }
54
+ interface OutputBaseConfig {
55
+ /**
56
+ * The directory where the report files will be output.
57
+ */
58
+ reportDir?: string;
59
+ /**
60
+ * Control the Rsdoctor reporter codes records.
61
+ */
62
+ reportCodeType?: IReportCodeType | undefined | NewReportCodeType;
63
+ /**
64
+ * @deprecated
65
+ * Configure whether to compress data.
66
+ * @default false
67
+ *
68
+ */
69
+ compressData?: boolean;
70
+ }
71
+ export type IReportCodeType = {
72
+ noModuleSource?: boolean;
73
+ noAssetsAndModuleSource?: boolean;
74
+ noCode?: boolean;
75
+ };
76
+ export type NewReportCodeType = 'noModuleSource' | 'noAssetsAndModuleSource' | 'noCode';
77
+ export interface RsdoctorWebpackPluginOptions<Rules extends LinterType.ExtendRuleData[]> {
78
+ /** Checker configuration */
79
+ linter?: LinterType.Options<Rules, InternalRules>;
80
+ /**
81
+ * the switch for the Rsdoctor features.
82
+ */
83
+ features?: RsdoctorWebpackPluginFeatures | Array<keyof RsdoctorWebpackPluginFeatures>;
84
+ /**
85
+ * @deprecated Use `output.mode` instead, if you're using `lite` mode, please use `output.reportCodeType: 'noCode' or 'noAssetsAndModuleSource'` instead.
86
+ * Rsdoctor mode option:
87
+ * - normal: Refers to the normal mode.
88
+ * - brief: Refers to the brief mode, which only displays the results of the duration analysis and build artifact analysis
89
+ * and does not display any part of the code.
90
+ */
91
+ mode?: 'brief' | 'normal' | 'lite';
92
+ /**
93
+ * configuration of the interceptor for webpack loaders. TODO: delete this options.
94
+ * @description worked when the `features.loader === true`.
95
+ */
96
+ loaderInterceptorOptions?: {
97
+ /**
98
+ * loaders which you want to skip it (will not report the target loader data when webpack compile).
99
+ */
100
+ skipLoaders?: string[];
101
+ };
102
+ /**
103
+ * turn on it if you don't need to see profile in browser.
104
+ * @default false
105
+ */
106
+ disableClientServer?: boolean;
107
+ /**
108
+ * sdk instance of outside.
109
+ */
110
+ sdkInstance?: SDK.RsdoctorBuilderSDKInstance;
111
+ /**
112
+ * Whether to turn on some characteristic analysis capabilities, such as: the support for the BannerPlugin.
113
+ */
114
+ supports?: ISupport;
115
+ /**
116
+ * The port of the Rsdoctor server.
117
+ */
118
+ port?: number;
119
+ /**
120
+ * Options to control the log printing.
121
+ */
122
+ printLog?: SDK.IPrintLog;
123
+ /**
124
+ * @deprecated Use `output.options.htmlOptions` instead.
125
+ * Please use the output.options to set the brief options, BriefModeOptions.
126
+ * Options to control brief mode reports.
127
+ */
128
+ brief?: Config.BriefConfig;
129
+ /**
130
+ * The name of inner rsdoctor's client package, used by inner-rsdoctor.
131
+ * @default false
132
+ */
133
+ innerClientPath?: string;
134
+ output?: Config.IOutput<'brief' | 'normal'>;
135
+ }
136
+ type ReportCodeTypeByMode<T extends 'brief' | 'normal'> = T extends 'brief' ? undefined | 'noCode' | {
137
+ noCode?: boolean;
138
+ } : T extends 'normal' ? IReportCodeType | undefined | NewReportCodeType : IReportCodeType | undefined | NewReportCodeType;
139
+ export interface NormalModeOptions {
140
+ type?: never;
141
+ }
142
+ interface NormalModeConfig extends Omit<OutputBaseConfig, 'reportCodeType' | 'mode'> {
143
+ mode?: 'normal';
144
+ reportCodeType?: ReportCodeTypeByMode<'normal'>;
145
+ options?: NormalModeOptions;
146
+ }
147
+ export interface BriefModeOptions {
148
+ /** Output type, supports HTML and JSON */
149
+ type?: Array<'html'>;
150
+ /** HTML output related configuration */
151
+ htmlOptions?: Config.BriefConfig;
152
+ }
153
+ export interface BriefModeConfig extends Omit<OutputBaseConfig, 'reportCodeType' | 'mode'> {
154
+ mode?: 'brief';
155
+ reportCodeType?: ReportCodeTypeByMode<'brief'>;
156
+ options?: BriefModeOptions;
157
+ }
158
+ export type IOutput<T extends 'brief' | 'normal' | undefined = undefined> = T extends 'brief' ? BriefModeConfig : T extends 'normal' ? NormalModeConfig : BriefModeConfig | NormalModeConfig | OutputBaseConfig;
159
+ export {};
@@ -0,0 +1,37 @@
1
+ import type { RsdoctorPluginData, NormalModuleFactory, LoaderDefinitionFunction, ModuleGraph, Dependency } from '@rspack/core';
2
+ export type RspackNormalModuleFactory = NormalModuleFactory;
3
+ export type RspackNativeAsset = RsdoctorPluginData.RsdoctorAsset;
4
+ export type RspackNativeChunkGraph = RsdoctorPluginData.RsdoctorChunkGraph;
5
+ export type RspackNativeModuleGraph = RsdoctorPluginData.RsdoctorModuleGraph;
6
+ export type RspackNativeChunk = RsdoctorPluginData.RsdoctorChunk;
7
+ export type RspackNativeModule = RsdoctorPluginData.RsdoctorModule;
8
+ export type RspackNativeSideEffect = RsdoctorPluginData.RsdoctorSideEffect;
9
+ export type RspackNativeExportInfo = RsdoctorPluginData.RsdoctorExportInfo;
10
+ export type RspackNativeVariable = RsdoctorPluginData.RsdoctorVariable;
11
+ export type RspackNativeDependency = RsdoctorPluginData.RsdoctorDependency;
12
+ export type RspackNativeEntrypoint = RsdoctorPluginData.RsdoctorEntrypoint;
13
+ export type RspackNativeStatement = RsdoctorPluginData.RsdoctorStatement;
14
+ export type RspackNativeSourceRange = RsdoctorPluginData.RsdoctorSourceRange;
15
+ export type RspackNativeSourcePosition = RsdoctorPluginData.RsdoctorSourcePosition;
16
+ export type RspackNativeModuleGraphModule = RsdoctorPluginData.RsdoctorModuleGraphModule;
17
+ export type RspackNativeAssetPatch = RsdoctorPluginData.RsdoctorAssetPatch;
18
+ export type RspackNativeModuleIdsPatch = RsdoctorPluginData.RsdoctorModuleIdsPatch;
19
+ export type RspackNativeChunkModules = RsdoctorPluginData.RsdoctorChunkModules;
20
+ export type RspackNativeModuleOriginalSource = RsdoctorPluginData.RsdoctorModuleOriginalSource;
21
+ export type RspackNativeModuleSourcePatch = RsdoctorPluginData.RsdoctorModuleSourcesPatch;
22
+ import rspack from '@rspack/core';
23
+ export type RspackExportsExperiments = typeof rspack.experiments;
24
+ export type RspackSourceMapInput = Parameters<LoaderDefinitionFunction>[1];
25
+ export type RspackEntryPoint = boolean | 'auto';
26
+ export interface RspackExportInfo {
27
+ used: boolean;
28
+ provideInfo: boolean | null | undefined;
29
+ useInfo: boolean | null | undefined;
30
+ canMangle: boolean;
31
+ }
32
+ export type RspackExportsInfo = ReturnType<ModuleGraph['getExportsInfo']>;
33
+ export interface RspackHarmonyImportSpecifierDependency extends Dependency {
34
+ getIds(graph: ModuleGraph): string[];
35
+ name: string;
36
+ userRequest: string;
37
+ }
@@ -0,0 +1,13 @@
1
+ import { Compiler, Compilation, LoaderDefinitionFunction, ModuleGraph, Dependency } from 'webpack';
2
+ type GetMapValue<M extends Map<any, any>> = M extends Map<string, infer V> ? V : never;
3
+ export type NormalModuleFactory = ReturnType<Compiler['createNormalModuleFactory']>;
4
+ export type SourceMapInput = Parameters<LoaderDefinitionFunction>[1];
5
+ export type EntryPoint = GetMapValue<Compilation['entrypoints']>;
6
+ export type ExportInfo = ReturnType<ModuleGraph['getExportInfo']>;
7
+ export type ExportsInfo = ReturnType<ModuleGraph['getExportsInfo']>;
8
+ export interface HarmonyImportSpecifierDependency extends Dependency {
9
+ getIds(graph: ModuleGraph): string[];
10
+ name: string;
11
+ userRequest: string;
12
+ }
13
+ export {};
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1001";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1002";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1003";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1004";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1005";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1006";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1007";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1008";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type';
2
+ export declare const code = "E1009";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,33 @@
1
+ import { RuleMessage } from './type';
2
+ import * as E1001 from './E1001';
3
+ import * as E1002 from './E1002';
4
+ import * as E1003 from './E1003';
5
+ import * as E1004 from './E1004';
6
+ import * as E1005 from './E1005';
7
+ import * as E1006 from './E1006';
8
+ import * as E1007 from './E1007';
9
+ import * as E1008 from './E1008';
10
+ import * as E1009 from './E1009';
11
+ export type RuleErrorCodes = {
12
+ [E1001.code]: typeof E1001;
13
+ [E1002.code]: typeof E1002;
14
+ [E1003.code]: typeof E1003;
15
+ [E1004.code]: typeof E1004;
16
+ [E1005.code]: typeof E1005;
17
+ [E1006.code]: typeof E1006;
18
+ [E1007.code]: typeof E1007;
19
+ [E1008.code]: typeof E1008;
20
+ [E1009.code]: typeof E1009;
21
+ };
22
+ /**
23
+ * The format is E + "4 digits".
24
+ * - The first number represents the category:
25
+ * - 1 for Webpack build related indexes
26
+ * - ...
27
+ * - The rest of the numbers can be increased by adding zeros
28
+ */
29
+ export declare const RuleErrorMap: Record<keyof RuleErrorCodes, RuleMessage>;
30
+ export declare enum RsdoctorRuleClientConstant {
31
+ UrlQueryForErrorCode = "code"
32
+ }
33
+ export * from './type';
@@ -0,0 +1,27 @@
1
+ import { RuleErrorCodes } from '.';
2
+ /**
3
+ * only defined the code which can be enumerated
4
+ */
5
+ export declare enum RuleMessageCodeEnumerated {
6
+ /**
7
+ * others tools / frameworks errors, such as PIA
8
+ */
9
+ Extend = "EXTEND",
10
+ /**
11
+ * errors show in the overlay at the client, such as Webpack compile errors in development
12
+ */
13
+ Overlay = "OVERLAY"
14
+ }
15
+ export type RuleMessageCode = keyof RuleErrorCodes | `${RuleMessageCodeEnumerated}` | RuleMessageCodeEnumerated;
16
+ export declare enum RuleMessageCategory {
17
+ Compile = "compile",
18
+ Bundle = "bundle",
19
+ EMO = "emo"
20
+ }
21
+ export interface RuleMessage {
22
+ code: RuleMessageCode;
23
+ title: string;
24
+ type: 'text' | 'markdown';
25
+ category: `${RuleMessageCategory}` | RuleMessageCategory;
26
+ description: string;
27
+ }