@rsdoctor/core 0.1.1 → 0.1.2
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.ts +2 -2
- package/dist/build-utils/build/chunks/chunkTransform.d.ts +2 -2
- package/dist/build-utils/build/chunks/generateTileGraph.d.ts +5 -5
- package/dist/build-utils/build/chunks/generateTileGraph.js +3 -9
- package/dist/build-utils/build/chunks/index.d.ts +1 -1
- package/dist/build-utils/build/index.d.ts +1 -1
- package/dist/build-utils/build/module-graph/index.d.ts +1 -1
- package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
- package/dist/build-utils/build/module-graph/transform.d.ts +1 -1
- package/dist/build-utils/build/module-graph/treeShaking.d.ts +1 -1
- package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts +4 -4
- package/dist/build-utils/build/utils/index.d.ts +1 -1
- package/dist/build-utils/build/utils/loader.d.ts +7 -7
- package/dist/build-utils/build/utils/parseBundle.d.ts +2 -2
- package/dist/build-utils/build/utils/plugin.d.ts +1 -1
- package/dist/build-utils/common/chunks/assetsContent.d.ts +2 -2
- package/dist/build-utils/common/chunks/assetsModules.d.ts +8 -8
- package/dist/build-utils/common/chunks/chunkTransform.d.ts +2 -2
- package/dist/build-utils/common/chunks/index.d.ts +1 -1
- package/dist/build-utils/common/index.d.ts +1 -1
- package/dist/build-utils/common/module-graph/compatible.d.ts +1 -1
- package/dist/build-utils/common/module-graph/index.d.ts +1 -1
- package/dist/build-utils/common/module-graph/transform.d.ts +1 -4
- package/dist/build-utils/common/module-graph/utils.d.ts +3 -5
- package/dist/build-utils/common/trans-utils/index.d.ts +1 -1
- package/dist/build-utils/common/trans-utils/transStats.d.ts +3 -3
- package/dist/build-utils/common/webpack/compatible.d.ts +2 -2
- package/dist/build-utils/index.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/inner-plugins/constants.d.ts +1 -1
- package/dist/inner-plugins/index.d.ts +1 -1
- package/dist/inner-plugins/loaders/proxy.d.ts +2 -2
- package/dist/inner-plugins/plugins/base.d.ts +10 -10
- package/dist/inner-plugins/plugins/bundle.d.ts +11 -11
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +2 -2
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +9 -8
- package/dist/inner-plugins/plugins/errors.d.ts +7 -7
- package/dist/inner-plugins/plugins/index.d.ts +1 -1
- package/dist/inner-plugins/plugins/loader.d.ts +7 -7
- package/dist/inner-plugins/plugins/plugins.d.ts +5 -5
- package/dist/inner-plugins/plugins/progress.d.ts +4 -4
- package/dist/inner-plugins/plugins/rules.d.ts +5 -5
- package/dist/inner-plugins/plugins/summary.d.ts +11 -11
- package/dist/inner-plugins/utils/circleDetect.d.ts +3 -3
- package/dist/inner-plugins/utils/config.d.ts +2 -2
- package/dist/inner-plugins/utils/index.d.ts +1 -1
- package/dist/inner-plugins/utils/loader.d.ts +3 -3
- package/dist/inner-plugins/utils/plugin.d.ts +1 -1
- package/dist/inner-plugins/utils/sdk.d.ts +1 -1
- package/dist/rules/index.d.ts +1 -1
- package/dist/rules/linter.d.ts +6 -10
- package/dist/rules/rule.d.ts +20 -24
- package/dist/rules/rules/default-import-check/index.d.ts +1 -1
- package/dist/rules/rules/default-import-check/types.d.ts +3 -3
- package/dist/rules/rules/default-import-check/utils.d.ts +1 -1
- package/dist/rules/rules/duplicate-package/index.d.ts +1 -1
- package/dist/rules/rules/duplicate-package/types.d.ts +19 -19
- package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/index.d.ts +1 -1
- package/dist/rules/rules/ecma-version-check/types.d.ts +5 -5
- package/dist/rules/rules/ecma-version-check/utils.d.ts +1 -1
- package/dist/rules/rules/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
- package/dist/rules/rules/loader-performance-optimization/types.d.ts +18 -18
- package/dist/rules/rules/loader-performance-optimization/utils.d.ts +1 -1
- package/dist/rules/utils.d.ts +1 -1
- package/dist/types/chunks.d.ts +7 -7
- package/dist/types/index.d.ts +1 -1
- package/dist/types/loader.d.ts +15 -15
- package/dist/types/plugin.d.ts +58 -57
- package/dist/types/rules.d.ts +5 -5
- package/dist/types/webpack.d.ts +4 -4
- package/package.json +6 -6
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { ParsedModuleSizeData } from
|
|
3
|
-
export declare function getAssetsModulesData(bundleStats: Plugin.StatsCompilation, bundleDir: string): Promise<ParsedModuleSizeData | null>;
|
|
2
|
+
import { ParsedModuleSizeData } from '../../common/chunks';
|
|
3
|
+
export declare function getAssetsModulesData(bundleStats: Plugin.StatsCompilation, bundleDir: string): Promise<ParsedModuleSizeData | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
export declare function chunkTransform(assetMap: Map<string, {
|
|
3
|
-
|
|
4
|
-
}>, bundleStats: Plugin.StatsCompilation): import("@rsdoctor/graph").ChunkGraph;
|
|
3
|
+
content: string;
|
|
4
|
+
}>, bundleStats: Plugin.StatsCompilation): import("@rsdoctor/graph").ChunkGraph;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
export declare const TileGraphReportName = "rsdoctor-tile-graph.html";
|
|
3
3
|
type IGenerateReportOpts = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
reportFilename: string;
|
|
5
|
+
reportTitle?: string;
|
|
6
|
+
bundleDir?: string;
|
|
7
|
+
openBrowser?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function generateTileGraph(bundleStats: Plugin.BaseStats, opts: IGenerateReportOpts, buildOutputPath: string): Promise<string | null>;
|
|
10
|
-
export {};
|
|
10
|
+
export {};
|
|
@@ -33,10 +33,8 @@ __export(generateTileGraph_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(generateTileGraph_exports);
|
|
35
35
|
var import_path = __toESM(require("path"));
|
|
36
|
-
var import_fs = __toESM(require("fs"));
|
|
37
36
|
var import_logger = require("@rsdoctor/utils/logger");
|
|
38
37
|
var import_viewer = require("webpack-bundle-analyzer/lib/viewer");
|
|
39
|
-
var import_constants = require("@rsdoctor/types/dist/constants");
|
|
40
38
|
const TileGraphReportName = "rsdoctor-tile-graph.html";
|
|
41
39
|
async function generateJSONReportUtil(bundleStats, opts) {
|
|
42
40
|
await (0, import_viewer.generateReport)(bundleStats, {
|
|
@@ -47,24 +45,20 @@ async function generateJSONReportUtil(bundleStats, opts) {
|
|
|
47
45
|
info: () => {
|
|
48
46
|
},
|
|
49
47
|
error: (e) => {
|
|
50
|
-
|
|
48
|
+
import_logger.logger.info(`webpack-bundle-analyzer generateReport has error ${e}`);
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
async function generateTileGraph(bundleStats, opts, buildOutputPath) {
|
|
56
54
|
try {
|
|
57
|
-
const tileReportHtmlDir = import_path.default.join(buildOutputPath, import_constants.RsdoctorOutputFolder);
|
|
58
|
-
if (!import_fs.default.existsSync(tileReportHtmlDir)) {
|
|
59
|
-
import_fs.default.mkdirSync(tileReportHtmlDir);
|
|
60
|
-
}
|
|
61
55
|
const { reportFilename } = opts;
|
|
62
56
|
await generateJSONReportUtil(bundleStats, {
|
|
63
57
|
...opts,
|
|
64
58
|
openBrowser: false,
|
|
65
|
-
bundleDir:
|
|
59
|
+
bundleDir: buildOutputPath
|
|
66
60
|
});
|
|
67
|
-
return import_path.default.join(
|
|
61
|
+
return import_path.default.join(buildOutputPath, `${reportFilename}`);
|
|
68
62
|
} catch (e) {
|
|
69
63
|
(0, import_logger.debug)(() => `Generate webpack-bundle-analyzer tile graph has error:${e}`);
|
|
70
64
|
return null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Node } from '@rsdoctor/utils/ruleUtils';
|
|
2
|
-
export declare function hasSetEsModuleStatement(program: Node.Program): boolean;
|
|
2
|
+
export declare function hasSetEsModuleStatement(program: Node.Program): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
import { TransformContext } from '.';
|
|
3
3
|
import { ChunkGraph } from '@rsdoctor/graph';
|
|
4
|
-
export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<import("@rsdoctor/graph").ModuleGraph>;
|
|
4
|
+
export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<import("@rsdoctor/graph").ModuleGraph>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ModuleGraph } from '@rsdoctor/graph';
|
|
2
2
|
import type { Compilation } from 'webpack';
|
|
3
|
-
export declare function appendTreeShaking(moduleGraph: ModuleGraph, compilation: Compilation): ModuleGraph;
|
|
3
|
+
export declare function appendTreeShaking(moduleGraph: ModuleGraph, compilation: Compilation): ModuleGraph;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as SDK from '@rsdoctor/graph';
|
|
2
2
|
export declare function getExportIdentifierStatement(name: string, module: SDK.Module): SDK.Statement | undefined;
|
|
3
|
-
export declare function getDeclarationIdentifier(name: string, module: SDK.Module): SDK.Statement | undefined;
|
|
3
|
+
export declare function getDeclarationIdentifier(name: string, module: SDK.Module): SDK.Statement | undefined;
|
|
@@ -4,8 +4,8 @@ import { Node } from '@rsdoctor/utils/ruleUtils';
|
|
|
4
4
|
import { Plugin } from '@rsdoctor/types';
|
|
5
5
|
import { ModuleGraph } from '@rsdoctor/graph';
|
|
6
6
|
export interface TransformContext {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
astCache?: Map<Webpack.NormalModule, Node.Program>;
|
|
8
|
+
packagePathMap?: Map<string, string>;
|
|
9
|
+
getSourceMap?(module: string): Promise<SourceMapConsumer | undefined>;
|
|
10
10
|
}
|
|
11
|
-
export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: ModuleGraph, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<ModuleGraph>;
|
|
11
|
+
export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: ModuleGraph, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<ModuleGraph>;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import type { Common, Plugin } from '@rsdoctor/types';
|
|
3
3
|
import { SourceMapInput as WebpackSourceMapInput } from '../../../types';
|
|
4
4
|
export declare function parsePathQueryFragment(str: string): {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
path: string;
|
|
6
|
+
query: string;
|
|
7
|
+
fragment: string;
|
|
8
8
|
};
|
|
9
9
|
export declare function loadLoaderModule(loaderPath: string, cwd?: string): {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
default: Plugin.LoaderDefinition<Common.PlainObject, {}>;
|
|
11
|
+
pitch: Plugin.PitchLoaderDefinitionFunction;
|
|
12
|
+
raw: boolean | void;
|
|
13
13
|
};
|
|
14
14
|
export declare function getLoaderOptions<T>(loaderContext: Plugin.LoaderContext<T>): T;
|
|
15
15
|
export declare function extractLoaderName(loaderPath: string, cwd?: string): string;
|
|
16
16
|
export declare function mapEachRules<T extends Plugin.BuildRuleSetRule>(rules: T[], callback: (rule: T) => T): T[];
|
|
17
17
|
export declare function changeBuiltinLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderName: string, appendRules: (rule: T, index: number) => T): T[];
|
|
18
|
-
export declare function createLoaderContextTrap(this: Plugin.LoaderContext<Common.PlainObject>, final: (err: Error | null | undefined, res: string | Buffer | null, sourceMap?: WebpackSourceMapInput) => void): Plugin.LoaderContext<Common.PlainObject<any>>;
|
|
18
|
+
export declare function createLoaderContextTrap(this: Plugin.LoaderContext<Common.PlainObject>, final: (err: Error | null | undefined, res: string | Buffer | null, sourceMap?: WebpackSourceMapInput) => void): Plugin.LoaderContext<Common.PlainObject<any>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParseBundle } from
|
|
1
|
+
import { ParseBundle } from '../../../types';
|
|
2
2
|
/**
|
|
3
3
|
* The following code is based on
|
|
4
4
|
* https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/44bd8d0f9aa3b098e271af220096ea70cc44bc9e/src/parseUtils.js#L10
|
|
@@ -9,4 +9,4 @@ import { ParseBundle } from "../../../types";
|
|
|
9
9
|
* Copyright JS Foundation and other contributors.
|
|
10
10
|
* https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/44bd8d0f9aa3b098e271af220096ea70cc44bc9e/LICENSE
|
|
11
11
|
*/
|
|
12
|
-
export declare const parseBundle: ParseBundle;
|
|
12
|
+
export declare const parseBundle: ParseBundle;
|
|
@@ -2,4 +2,4 @@ import type { Hook } from 'tapable';
|
|
|
2
2
|
import { Plugin } from '@rsdoctor/types';
|
|
3
3
|
export declare function shouldInterceptPluginHook<T extends Hook<any, any>>(hook: T): boolean;
|
|
4
4
|
export declare function interceptCompilerHooks(compiler: Plugin.BaseCompiler, interceptor: (name: string, hook: Hook<any, any>, scope: 'compiler') => void): void;
|
|
5
|
-
export declare function interceptCompilationHooks(compilation: Plugin.BaseCompilation, interceptor: (name: string, hook: Hook<any, any>, scope: 'compilation') => void): void;
|
|
5
|
+
export declare function interceptCompilationHooks(compilation: Plugin.BaseCompilation, interceptor: (name: string, hook: Hook<any, any>, scope: 'compilation') => void): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
import type { ModuleGraph } from '@rsdoctor/graph';
|
|
3
|
-
import { ParseBundle } from
|
|
3
|
+
import { ParseBundle } from '../../../types';
|
|
4
4
|
export type ParsedModuleSizeData = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
[x: string]: {
|
|
6
|
+
size: number;
|
|
7
|
+
sizeConvert: string;
|
|
8
|
+
content: string;
|
|
9
|
+
};
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* The following code is modified based on
|
|
@@ -18,6 +18,6 @@ export type ParsedModuleSizeData = {
|
|
|
18
18
|
* https://github.com/webpack-contrib/webpack-bundle-analyzer/blob/44bd8d0f9aa3b098e271af220096ea70cc44bc9e/LICENSE
|
|
19
19
|
*/
|
|
20
20
|
export declare function getAssetsModulesData(bundleStats: Plugin.StatsCompilation, bundleDir: string, opts: {
|
|
21
|
-
|
|
21
|
+
parseBundle?: ParseBundle;
|
|
22
22
|
}): Promise<ParsedModuleSizeData | null>;
|
|
23
|
-
export declare function transformAssetsModulesData(parsedModulesData: ParsedModuleSizeData, moduleGraph: ModuleGraph): void;
|
|
23
|
+
export declare function transformAssetsModulesData(parsedModulesData: ParsedModuleSizeData, moduleGraph: ModuleGraph): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChunkGraph } from '@rsdoctor/graph';
|
|
2
2
|
import { Plugin } from '@rsdoctor/types';
|
|
3
3
|
export declare function chunkTransform(assetMap: Map<string, {
|
|
4
|
-
|
|
5
|
-
}>, bundleStats: Plugin.StatsCompilation): ChunkGraph;
|
|
4
|
+
content: string;
|
|
5
|
+
}>, bundleStats: Plugin.StatsCompilation): ChunkGraph;
|
|
@@ -6,4 +6,4 @@ import { Plugin, SDK } from '@rsdoctor/types';
|
|
|
6
6
|
* @link https://github.com/webpack/webpack/blob/main/lib/formatLocation.js#L30-L66
|
|
7
7
|
*/
|
|
8
8
|
export declare function getPositionByStatsLocation(loc: string): SDK.SourceRange | undefined;
|
|
9
|
-
export declare function isWebpack5orRspack(compilation: Plugin.BaseCompilation): Boolean;
|
|
9
|
+
export declare function isWebpack5orRspack(compilation: Plugin.BaseCompilation): Boolean;
|
|
@@ -4,7 +4,4 @@ export declare function getModulesFromArray(modules: Plugin.StatsModule[], colle
|
|
|
4
4
|
/**
|
|
5
5
|
* this function can run in browser & node.
|
|
6
6
|
*/
|
|
7
|
-
export declare function getModuleGraphByStats({
|
|
8
|
-
modules,
|
|
9
|
-
chunks
|
|
10
|
-
}: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph): ModuleGraph;
|
|
7
|
+
export declare function getModuleGraphByStats({ modules, chunks }: Plugin.StatsCompilation, root: string, chunkGraph: ChunkGraph): ModuleGraph;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { SDK } from '@rsdoctor/types';
|
|
2
2
|
import type { ModuleGraph } from '@rsdoctor/graph';
|
|
3
3
|
interface DependencyData {
|
|
4
|
-
|
|
4
|
+
type?: string;
|
|
5
5
|
}
|
|
6
6
|
/** Determine whether it is the import statement itself */
|
|
7
|
-
export declare function isImportDependency({
|
|
8
|
-
type
|
|
9
|
-
}: DependencyData): boolean;
|
|
7
|
+
export declare function isImportDependency({ type }: DependencyData): boolean;
|
|
10
8
|
export declare function getImportKind(dep: DependencyData): SDK.DependencyKind;
|
|
11
9
|
/**
|
|
12
10
|
* Remove the css module without connection
|
|
@@ -14,4 +12,4 @@ export declare function getImportKind(dep: DependencyData): SDK.DependencyKind;
|
|
|
14
12
|
*/
|
|
15
13
|
export declare function removeNoImportStyle(graph: ModuleGraph): void;
|
|
16
14
|
export declare function isStyleExt(path: string): boolean;
|
|
17
|
-
export {};
|
|
15
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './transStats';
|
|
1
|
+
export * from './transStats';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChunkGraph } from '@rsdoctor/graph';
|
|
2
2
|
import { Plugin } from '@rsdoctor/types';
|
|
3
3
|
export declare function transStats(json: Plugin.StatsCompilation): Promise<{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}>;
|
|
4
|
+
chunkGraph: ChunkGraph;
|
|
5
|
+
moduleGraph: import("@rsdoctor/graph").ModuleGraph;
|
|
6
|
+
}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SDK } from '@rsdoctor/types';
|
|
2
2
|
import { ModuleGraph as SdkModuleGraph, Module as SdkModule, Statement } from '@rsdoctor/graph';
|
|
3
3
|
import { Compilation, Dependency, ExternalModule, Module, ModuleGraph, NormalModule } from 'webpack';
|
|
4
|
-
import type { EntryPoint, ExportInfo } from
|
|
4
|
+
import type { EntryPoint, ExportInfo } from '../../../types/index';
|
|
5
5
|
export declare function isNormalModule(mod: Module): mod is NormalModule;
|
|
6
6
|
export declare function getWebpackModuleId(mod: Module): string;
|
|
7
7
|
export declare function getWebpackModulePath(mod: NormalModule): string;
|
|
@@ -23,4 +23,4 @@ export declare function getExportDependency(info: ExportInfo, module: NormalModu
|
|
|
23
23
|
export declare function getSdkDependencyByWebpackDependency(dep: Dependency, module: NormalModule, graph: SdkModuleGraph): import("@rsdoctor/graph").Dependency | undefined;
|
|
24
24
|
export declare function getExportStatement(info: ExportInfo, normalModule: NormalModule, graph: SdkModuleGraph): Statement | undefined;
|
|
25
25
|
export declare function getLastExportInfo(info: ExportInfo, webpackGraph: ModuleGraph): ExportInfo | undefined;
|
|
26
|
-
export declare function getAllModules(compilation: Compilation): NormalModule[];
|
|
26
|
+
export declare function getAllModules(compilation: Compilation): NormalModule[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * as Build from './build';
|
|
2
|
-
export * as Common from './common';
|
|
2
|
+
export * as Common from './common';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export declare const pluginTapName = "RsdoctorWebpackPlugin";
|
|
|
3
3
|
export declare const pluginTapPostOptions: Tap;
|
|
4
4
|
export declare const pluginTapPreOptions: Tap;
|
|
5
5
|
export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
|
|
6
|
-
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
6
|
+
export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './plugins';
|
|
2
|
-
export * from './utils';
|
|
2
|
+
export * from './utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
|
-
import type { ProxyLoaderOptions } from
|
|
2
|
+
import type { ProxyLoaderOptions } from '../../types';
|
|
3
3
|
declare const loaderModule: Plugin.LoaderDefinition<ProxyLoaderOptions, {}>;
|
|
4
|
-
export = loaderModule;
|
|
4
|
+
export = loaderModule;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
|
|
2
2
|
import type { Linter, Plugin } from '@rsdoctor/types';
|
|
3
|
-
import type { InternalPlugin, RsdoctorPluginInstance } from
|
|
3
|
+
import type { InternalPlugin, RsdoctorPluginInstance } from '../../types';
|
|
4
4
|
export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler> implements InternalPlugin<T, Linter.ExtendRuleData[]> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
readonly scheduler: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>;
|
|
6
|
+
abstract name: string;
|
|
7
|
+
constructor(scheduler: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>);
|
|
8
|
+
abstract apply(compiler: T): void;
|
|
9
|
+
get options(): import("@/types").RsdoctorPluginOptionsNormalized<Linter.ExtendRuleData<any, string>[]>;
|
|
10
|
+
get sdk(): RsdoctorWebpackSDK;
|
|
11
|
+
get tapPostOptions(): import("tapable").Tap;
|
|
12
|
+
get tapPreOptions(): import("tapable").Tap;
|
|
13
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
import { InternalBasePlugin } from './base';
|
|
3
3
|
export declare class InternalBundlePlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
4
|
+
readonly name = "bundle";
|
|
5
|
+
map: Map<string, {
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
apply(compiler: T): void;
|
|
9
|
+
ensureAssetContent(name: string): {
|
|
10
|
+
content: string;
|
|
11
|
+
};
|
|
12
|
+
thisCompilation: (compilation: Plugin.BaseCompilation) => void;
|
|
13
|
+
done: () => Promise<void>;
|
|
14
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { RsdoctorPluginInstance } from '../../types';
|
|
1
2
|
import { Linter, Plugin } from '@rsdoctor/types';
|
|
2
|
-
import { RsdoctorPluginInstance } from "../../types";
|
|
3
3
|
/**
|
|
4
4
|
* @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
|
|
5
5
|
* @param {Compiler} compiler
|
|
6
6
|
* @return {*}
|
|
7
7
|
* @memberof RsdoctorWebpackPlugin
|
|
8
8
|
*/
|
|
9
|
-
export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
|
|
9
|
+
export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
|
|
@@ -31,11 +31,13 @@ __export(ensureModulesChunkGraph_exports, {
|
|
|
31
31
|
ensureModulesChunksGraphFn: () => ensureModulesChunksGraphFn
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(ensureModulesChunkGraph_exports);
|
|
34
|
-
var
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_types2 = require("@rsdoctor/types");
|
|
35
36
|
var import_build = require("@rsdoctor/utils/build");
|
|
37
|
+
var import_logger = require("@rsdoctor/utils/logger");
|
|
38
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
36
39
|
var import_build2 = require("../../build-utils/build");
|
|
37
40
|
var import_common = require("../../build-utils/common");
|
|
38
|
-
var import_fs_extra = __toESM(require("fs-extra"));
|
|
39
41
|
var import_constants = require("../constants");
|
|
40
42
|
const ensureModulesChunksGraphFn = (compiler, _this) => {
|
|
41
43
|
if (_this._modulesGraphApplied)
|
|
@@ -64,18 +66,17 @@ const ensureModulesChunksGraphFn = (compiler, _this) => {
|
|
|
64
66
|
context
|
|
65
67
|
);
|
|
66
68
|
(0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After Generate ModuleGraph]");
|
|
67
|
-
await getModulesInfosByStats(
|
|
68
|
-
compiler,
|
|
69
|
-
statsJson,
|
|
70
|
-
_this.modulesGraph
|
|
71
|
-
);
|
|
69
|
+
await getModulesInfosByStats(compiler, statsJson, _this.modulesGraph);
|
|
72
70
|
(0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After Transform ModuleGraph]");
|
|
73
71
|
_this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
|
|
74
72
|
await _this.sdk.reportChunkGraph(_this.chunkGraph);
|
|
75
73
|
const reportFilePath = await import_build2.Chunks.generateTileGraph(
|
|
76
74
|
statsJson,
|
|
77
75
|
{
|
|
78
|
-
reportFilename:
|
|
76
|
+
reportFilename: import_path.default.join(
|
|
77
|
+
import_types2.Constants.RsdoctorOutputFolder,
|
|
78
|
+
import_build2.Chunks.TileGraphReportName
|
|
79
|
+
),
|
|
79
80
|
reportTitle: "bundle-analyzer"
|
|
80
81
|
},
|
|
81
82
|
compiler.outputPath
|
|
@@ -2,10 +2,10 @@ import { Rule, Err, Plugin } from '@rsdoctor/types';
|
|
|
2
2
|
import { InternalBasePlugin } from './base';
|
|
3
3
|
import { DevToolError } from '@rsdoctor/utils/error';
|
|
4
4
|
export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
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
|
+
}
|
|
@@ -2,10 +2,10 @@ import { Plugin } from '@rsdoctor/types';
|
|
|
2
2
|
import { RuleSetRule } from 'webpack';
|
|
3
3
|
import { InternalBasePlugin } from './base';
|
|
4
4
|
export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
5
|
+
readonly name = "loader";
|
|
6
|
+
readonly internalLoaderPath: string;
|
|
7
|
+
apply(compiler: T): void;
|
|
8
|
+
afterPlugins: (compiler: Plugin.BaseCompiler) => void;
|
|
9
|
+
compilation(compiler: Plugin.BaseCompiler, compilation: Plugin.BaseCompilation): void;
|
|
10
|
+
getInterceptRules(compiler: Plugin.BaseCompiler, rules: RuleSetRule[]): RuleSetRule[];
|
|
11
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Plugin } from '@rsdoctor/types';
|
|
2
2
|
import { InternalBasePlugin } from './base';
|
|
3
3
|
export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
4
|
+
readonly name = "plugins";
|
|
5
|
+
apply(compiler: T): void;
|
|
6
|
+
afterPlugins: (compiler: Plugin.BaseCompiler) => void;
|
|
7
|
+
compilation: (compilation: Plugin.BaseCompilation) => void;
|
|
8
|
+
}
|
|
@@ -2,7 +2,7 @@ import { SDK } from '@rsdoctor/types';
|
|
|
2
2
|
import type { Plugin } from '@rsdoctor/types';
|
|
3
3
|
import { InternalBasePlugin } from './base';
|
|
4
4
|
export declare class InternalProgressPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
5
|
+
readonly name = "progress";
|
|
6
|
+
protected currentProgress: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.APIExtends.GetCompileProgess>;
|
|
7
|
+
apply(compiler: T): void;
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InternalBasePlugin } from '../plugins';
|
|
2
2
|
import { Plugin } from '@rsdoctor/types';
|
|
3
3
|
export declare class InternalRulesPlugin extends InternalBasePlugin<Plugin.BaseCompiler> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
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
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Plugin } from '@rsdoctor/types';
|
|
2
2
|
import { InternalBasePlugin } from './base';
|
|
3
3
|
export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const checkCirclePath: (obj: any, record: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}[], res: string[][], level: number, maxLevel?: number) => void;
|
|
2
|
+
prop: string;
|
|
3
|
+
ref: unknown;
|
|
4
|
+
}[], res: string[][], level: number, maxLevel?: number) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Linter, Plugin } from '@rsdoctor/types';
|
|
2
2
|
import { RuleSetCondition as RspackRuleSetCondition } from '@rspack/core';
|
|
3
3
|
import { RuleSetCondition, RuleSetConditionAbsolute, RuleSetRule } from 'webpack';
|
|
4
|
-
import { RsdoctorWebpackPluginOptions, RsdoctorPluginOptionsNormalized } from
|
|
4
|
+
import { RsdoctorWebpackPluginOptions, RsdoctorPluginOptionsNormalized } from '../../types';
|
|
5
5
|
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: RsdoctorWebpackPluginOptions<Rules>): RsdoctorPluginOptionsNormalized<Rules>;
|
|
6
6
|
export declare function makeRuleSetSerializable(item: RuleSetConditionAbsolute | RuleSetCondition | RspackRuleSetCondition | void): void;
|
|
7
|
-
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RuleSetRule['oneOf']): void;
|
|
7
|
+
export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RuleSetRule['oneOf']): void;
|