@rsdoctor/core 1.5.9 → 1.5.11
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.
- package/dist/build-utils/build/chunks/assetsModules.d.cts +17 -0
- package/dist/build-utils/build/chunks/chunkTransform.d.cts +4 -0
- package/dist/build-utils/build/chunks/index.d.cts +3 -0
- package/dist/build-utils/build/chunks/rspack/transform.cjs +2 -2
- package/dist/build-utils/build/chunks/rspack/transform.d.cts +13 -0
- package/dist/build-utils/build/index.cjs +3 -3
- package/dist/build-utils/build/index.d.cts +5 -0
- package/dist/build-utils/build/loader/index.d.cts +2 -0
- package/dist/build-utils/build/loader/probeLoader.cjs +2 -2
- package/dist/build-utils/build/loader/probeLoader.d.cts +4 -0
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.cts +5 -0
- package/dist/build-utils/build/module-graph/index.d.cts +4 -0
- package/dist/build-utils/build/module-graph/parser.d.cts +2 -0
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +2 -2
- package/dist/build-utils/build/module-graph/rspack/transform.d.cts +26 -0
- package/dist/build-utils/build/module-graph/transform.d.cts +4 -0
- package/dist/build-utils/build/module-graph/treeShaking.d.cts +2 -0
- package/dist/build-utils/build/module-graph/utils.cjs +2 -2
- package/dist/build-utils/build/module-graph/utils.d.cts +3 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.cts +16 -0
- package/dist/build-utils/build/utils/index.d.cts +3 -0
- package/dist/build-utils/build/utils/loader.cjs +6 -6
- package/dist/build-utils/build/utils/loader.d.cts +20 -0
- package/dist/build-utils/build/utils/loader.js +1 -1
- package/dist/build-utils/build/utils/parseBundle.d.cts +12 -0
- package/dist/build-utils/build/utils/plugin.cjs +2 -2
- package/dist/build-utils/build/utils/plugin.d.cts +5 -0
- package/dist/build-utils/index.d.cts +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/inner-plugins/constants.d.cts +6 -0
- package/dist/inner-plugins/index.d.cts +2 -0
- package/dist/inner-plugins/loaders/proxy.cjs +2 -2
- package/dist/inner-plugins/loaders/proxy.d.cts +7 -0
- package/dist/inner-plugins/plugins/base.d.cts +12 -0
- package/dist/inner-plugins/plugins/bundle.d.cts +15 -0
- package/dist/inner-plugins/plugins/bundleTagPlugin.d.cts +6 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +4 -4
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +36 -0
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +2 -2
- package/dist/inner-plugins/plugins/errors.d.cts +11 -0
- package/dist/inner-plugins/plugins/index.d.cts +11 -0
- package/dist/inner-plugins/plugins/loader.d.cts +10 -0
- package/dist/inner-plugins/plugins/plugins.d.cts +8 -0
- package/dist/inner-plugins/plugins/progress.d.cts +8 -0
- package/dist/inner-plugins/plugins/resolver.d.cts +13 -0
- package/dist/inner-plugins/plugins/rspack.d.cts +4 -0
- package/dist/inner-plugins/plugins/rules.d.cts +8 -0
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +2 -2
- package/dist/inner-plugins/plugins/sourcemapTool.d.cts +52 -0
- package/dist/inner-plugins/plugins/summary.cjs +1 -1
- package/dist/inner-plugins/plugins/summary.d.cts +14 -0
- package/dist/inner-plugins/plugins/summary.js +1 -1
- package/dist/inner-plugins/utils/circleDetect.d.cts +4 -0
- package/dist/inner-plugins/utils/config.cjs +23 -4
- package/dist/inner-plugins/utils/config.d.cts +5 -0
- package/dist/inner-plugins/utils/config.js +21 -2
- package/dist/inner-plugins/utils/index.d.cts +9 -0
- package/dist/inner-plugins/utils/loader.cjs +4 -4
- package/dist/inner-plugins/utils/loader.d.cts +13 -0
- package/dist/inner-plugins/utils/normalize-config.d.cts +40 -0
- package/dist/inner-plugins/utils/plugin-common.cjs +2 -2
- package/dist/inner-plugins/utils/plugin-common.d.cts +11 -0
- package/dist/inner-plugins/utils/plugin.d.cts +4 -0
- package/dist/inner-plugins/utils/sdk.d.cts +8 -0
- package/dist/rules/index.d.cts +3 -0
- package/dist/rules/linter.d.cts +9 -0
- package/dist/rules/rule.cjs +2 -2
- package/dist/rules/rule.d.cts +27 -0
- package/dist/rules/rules/cjs-require/index.d.cts +4 -0
- package/dist/rules/rules/cjs-require/types.d.cts +7 -0
- package/dist/rules/rules/cross-chunks-package/index.d.cts +4 -0
- package/dist/rules/rules/cross-chunks-package/types.d.cts +3 -0
- package/dist/rules/rules/cross-chunks-package/utils.d.cts +1 -0
- package/dist/rules/rules/default-import-check/index.d.cts +4 -0
- package/dist/rules/rules/default-import-check/types.d.cts +4 -0
- package/dist/rules/rules/default-import-check/utils.cjs +4 -4
- package/dist/rules/rules/default-import-check/utils.d.cts +10 -0
- package/dist/rules/rules/duplicate-package/index.d.cts +4 -0
- package/dist/rules/rules/duplicate-package/types.d.cts +24 -0
- package/dist/rules/rules/duplicate-package/utils.d.cts +3 -0
- package/dist/rules/rules/ecma-version-check/index.d.cts +4 -0
- package/dist/rules/rules/ecma-version-check/types.d.cts +3 -0
- package/dist/rules/rules/ecma-version-check/utils.d.cts +2 -0
- package/dist/rules/rules/esm-resolved-to-cjs/index.d.cts +4 -0
- package/dist/rules/rules/esm-resolved-to-cjs/types.d.cts +8 -0
- package/dist/rules/rules/index.d.cts +1 -0
- package/dist/rules/rules/loader-performance-optimization/index.d.cts +4 -0
- package/dist/rules/rules/loader-performance-optimization/types.d.cts +22 -0
- package/dist/rules/rules/loader-performance-optimization/utils.d.cts +1 -0
- package/dist/rules/rules/module-mixed-chunks/index.d.cts +4 -0
- package/dist/rules/rules/module-mixed-chunks/types.d.cts +3 -0
- package/dist/rules/rules/side-effects-only-imports/index.d.cts +4 -0
- package/dist/rules/rules/side-effects-only-imports/types.d.cts +9 -0
- package/dist/rules/utils.cjs +2 -2
- package/dist/rules/utils.d.cts +3 -0
- package/dist/types/chunks.d.cts +6 -0
- package/dist/types/index.d.cts +4 -0
- package/dist/types/loader.d.cts +19 -0
- package/dist/types/plugin.d.cts +51 -0
- package/dist/types/rules.d.cts +7 -0
- package/package.json +46 -21
|
@@ -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
|
|
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
|
|
76
|
+
if (minifyHookData.length) this.sdk.reportSummaryData({
|
|
77
77
|
costs: [
|
|
78
78
|
{
|
|
79
79
|
name: Summary.SummaryCostsDataName.Minify,
|
|
@@ -33,9 +33,9 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
normalizeUserConfig: ()=>normalizeUserConfig,
|
|
37
36
|
normalizeReportType: ()=>normalizeReportType,
|
|
38
|
-
normalizeRspackUserOptions: ()=>normalizeRspackUserOptions
|
|
37
|
+
normalizeRspackUserOptions: ()=>normalizeRspackUserOptions,
|
|
38
|
+
normalizeUserConfig: ()=>normalizeUserConfig
|
|
39
39
|
});
|
|
40
40
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
41
41
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -65,6 +65,9 @@ function getDefaultSupports() {
|
|
|
65
65
|
gzip: true
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
+
function isJsonOutputEnv(value) {
|
|
69
|
+
return 'json' === value;
|
|
70
|
+
}
|
|
68
71
|
function normalizeFeatures(features, mode) {
|
|
69
72
|
if (Array.isArray(features)) return {
|
|
70
73
|
loader: features.includes('loader'),
|
|
@@ -99,9 +102,25 @@ function isValidMode(mode) {
|
|
|
99
102
|
].includes(mode);
|
|
100
103
|
}
|
|
101
104
|
function normalizeUserConfig(config = {}) {
|
|
102
|
-
const
|
|
105
|
+
const userOutput = config.output;
|
|
106
|
+
const defaultOutput = getDefaultOutput();
|
|
107
|
+
const outputConfig = isJsonOutputEnv(process.env.RSDOCTOR_OUTPUT) ? {
|
|
108
|
+
reportDir: userOutput?.reportDir,
|
|
109
|
+
compressData: userOutput?.compressData,
|
|
110
|
+
mode: 'brief',
|
|
111
|
+
options: {
|
|
112
|
+
type: [
|
|
113
|
+
'json'
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
} : userOutput ?? defaultOutput;
|
|
117
|
+
const normalizedConfig = {
|
|
118
|
+
...config,
|
|
119
|
+
output: outputConfig
|
|
120
|
+
};
|
|
121
|
+
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = outputConfig, supports = getDefaultSupports(), port, printLog = {
|
|
103
122
|
serverUrls: true
|
|
104
|
-
}, mode, brief } =
|
|
123
|
+
}, mode, brief } = normalizedConfig;
|
|
105
124
|
const disableClientServer = 'true' === process.env.RSTEST ? false : process.env.CI ? true : userDisableClientServer;
|
|
106
125
|
external_assert_default()('object' == typeof linter);
|
|
107
126
|
external_assert_default()('object' == typeof features || Array.isArray(features));
|
|
@@ -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>;
|
|
@@ -26,6 +26,9 @@ function getDefaultSupports() {
|
|
|
26
26
|
gzip: true
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
function isJsonOutputEnv(value) {
|
|
30
|
+
return 'json' === value;
|
|
31
|
+
}
|
|
29
32
|
function normalizeFeatures(features, mode) {
|
|
30
33
|
if (Array.isArray(features)) return {
|
|
31
34
|
loader: features.includes('loader'),
|
|
@@ -60,9 +63,25 @@ function isValidMode(mode) {
|
|
|
60
63
|
].includes(mode);
|
|
61
64
|
}
|
|
62
65
|
function normalizeUserConfig(config = {}) {
|
|
63
|
-
const
|
|
66
|
+
const userOutput = config.output;
|
|
67
|
+
const defaultOutput = getDefaultOutput();
|
|
68
|
+
const outputConfig = isJsonOutputEnv(process.env.RSDOCTOR_OUTPUT) ? {
|
|
69
|
+
reportDir: userOutput?.reportDir,
|
|
70
|
+
compressData: userOutput?.compressData,
|
|
71
|
+
mode: 'brief',
|
|
72
|
+
options: {
|
|
73
|
+
type: [
|
|
74
|
+
'json'
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
} : userOutput ?? defaultOutput;
|
|
78
|
+
const normalizedConfig = {
|
|
79
|
+
...config,
|
|
80
|
+
output: outputConfig
|
|
81
|
+
};
|
|
82
|
+
const { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = false, sdkInstance, innerClientPath = '', output = outputConfig, supports = getDefaultSupports(), port, printLog = {
|
|
64
83
|
serverUrls: true
|
|
65
|
-
}, mode, brief } =
|
|
84
|
+
}, mode, brief } = normalizedConfig;
|
|
66
85
|
const disableClientServer = 'true' === process.env.RSTEST ? false : process.env.CI ? true : userDisableClientServer;
|
|
67
86
|
assert('object' == typeof linter);
|
|
68
87
|
assert('object' == typeof features || Array.isArray(features));
|
|
@@ -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';
|
|
@@ -33,12 +33,12 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
|
|
36
|
+
getInternalLoaderOptions: ()=>getInternalLoaderOptions,
|
|
37
37
|
getLoaderOptionsWithoutInternalKeys: ()=>getLoaderOptionsWithoutInternalKeys,
|
|
38
|
-
|
|
38
|
+
getOriginLoaderModule: ()=>getOriginLoaderModule,
|
|
39
|
+
interceptLoader: ()=>interceptLoader,
|
|
39
40
|
reportLoader: ()=>reportLoader,
|
|
40
|
-
|
|
41
|
-
getOriginLoaderModule: ()=>getOriginLoaderModule
|
|
41
|
+
shouldSkipLoader: ()=>shouldSkipLoader
|
|
42
42
|
});
|
|
43
43
|
const resolver_namespaceObject = require("@rspack/resolver");
|
|
44
44
|
const compat_namespaceObject = require("es-toolkit/compat");
|
|
@@ -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;
|
|
@@ -33,9 +33,9 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
handleBriefModeReport: ()=>handleBriefModeReport,
|
|
36
37
|
processCompilerConfig: ()=>processCompilerConfig,
|
|
37
|
-
safeCloneDeep: ()=>safeCloneDeep
|
|
38
|
-
handleBriefModeReport: ()=>handleBriefModeReport
|
|
38
|
+
safeCloneDeep: ()=>safeCloneDeep
|
|
39
39
|
});
|
|
40
40
|
const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
41
41
|
const plugins_namespaceObject = require("@rsdoctor/core/plugins");
|
|
@@ -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,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
|
+
}
|
package/dist/rules/rule.cjs
CHANGED
|
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Rule: ()=>Rule,
|
|
28
|
+
defineRule: ()=>defineRule
|
|
29
29
|
});
|
|
30
30
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
31
31
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
@@ -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 @@
|
|
|
1
|
+
export declare function getErrorMsgForDupPckChunks(chunks: string[], pkgName: string): string;
|
|
@@ -24,11 +24,11 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
hasSameLeftInAssignStatement: ()=>hasSameLeftInAssignStatement,
|
|
28
|
-
getSourceRangeFromTransformedOffset: ()=>getSourceRangeFromTransformedOffset,
|
|
29
27
|
getDefaultImportByRequest: ()=>getDefaultImportByRequest,
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
getFixData: ()=>getFixData,
|
|
29
|
+
getSourceRangeFromTransformedOffset: ()=>getSourceRangeFromTransformedOffset,
|
|
30
|
+
hasSameLeftInAssignStatement: ()=>hasSameLeftInAssignStatement,
|
|
31
|
+
importDeclarationToString: ()=>importDeclarationToString
|
|
32
32
|
});
|
|
33
33
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
34
34
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
@@ -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,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 @@
|
|
|
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,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;
|
package/dist/rules/utils.cjs
CHANGED
|
@@ -24,8 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
noop: ()=>noop,
|
|
28
|
+
toSeverity: ()=>toSeverity
|
|
29
29
|
});
|
|
30
30
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
31
31
|
function toSeverity(input, defaultLevel) {
|