@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,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>;
|
|
@@ -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
|
+
patchNativeAssets: ()=>patchNativeAssets,
|
|
28
|
+
patchNativeChunkGraph: ()=>patchNativeChunkGraph
|
|
29
29
|
});
|
|
30
30
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
31
31
|
function patchNativeChunkGraph(cg, rawChunkGraph) {
|
|
@@ -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;
|
|
@@ -25,10 +25,10 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
Chunks: ()=>index_cjs_namespaceObject,
|
|
28
|
-
Types: ()=>external_types_index_cjs_namespaceObject,
|
|
29
|
-
Utils: ()=>external_utils_index_cjs_namespaceObject,
|
|
30
28
|
Loader: ()=>external_loader_index_cjs_namespaceObject,
|
|
31
|
-
ModuleGraph: ()=>external_module_graph_index_cjs_namespaceObject
|
|
29
|
+
ModuleGraph: ()=>external_module_graph_index_cjs_namespaceObject,
|
|
30
|
+
Types: ()=>external_types_index_cjs_namespaceObject,
|
|
31
|
+
Utils: ()=>external_utils_index_cjs_namespaceObject
|
|
32
32
|
});
|
|
33
33
|
const index_cjs_namespaceObject = require("./chunks/index.cjs");
|
|
34
34
|
const external_utils_index_cjs_namespaceObject = require("./utils/index.cjs");
|
|
@@ -33,8 +33,8 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
default: ()=>probeLoader,
|
|
37
|
+
loaderModule: ()=>loaderModule
|
|
38
38
|
});
|
|
39
39
|
const external_index_cjs_namespaceObject = require("../../index.cjs");
|
|
40
40
|
const index_cjs_namespaceObject = require("../../../inner-plugins/index.cjs");
|
|
@@ -25,9 +25,9 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
extractSideEffectCodes: ()=>extractSideEffectCodes,
|
|
28
|
-
|
|
28
|
+
patchNativeModuleGraph: ()=>patchNativeModuleGraph,
|
|
29
29
|
patchNativeModuleIds: ()=>patchNativeModuleIds,
|
|
30
|
-
|
|
30
|
+
patchNativeModuleSources: ()=>patchNativeModuleSources
|
|
31
31
|
});
|
|
32
32
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
33
33
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
@@ -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>;
|
|
@@ -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
|
+
getDeclarationIdentifier: ()=>getDeclarationIdentifier,
|
|
28
|
+
getExportIdentifierStatement: ()=>getExportIdentifierStatement
|
|
29
29
|
});
|
|
30
30
|
const compat_namespaceObject = require("es-toolkit/compat");
|
|
31
31
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
@@ -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>;
|
|
@@ -51,15 +51,15 @@ var __webpack_exports__ = {};
|
|
|
51
51
|
(()=>{
|
|
52
52
|
__webpack_require__.r(__webpack_exports__);
|
|
53
53
|
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
-
extractLoaderName: ()=>extractLoaderName,
|
|
55
|
-
mapEachRules: ()=>mapEachRules,
|
|
56
54
|
addProbeLoader2Rules: ()=>addProbeLoader2Rules,
|
|
57
55
|
createLoaderContextTrap: ()=>createLoaderContextTrap,
|
|
58
|
-
|
|
59
|
-
parseQuery: ()=>parseQuery,
|
|
56
|
+
extractLoaderName: ()=>extractLoaderName,
|
|
60
57
|
getLoaderNameMatch: ()=>getLoaderNameMatch,
|
|
58
|
+
isESMLoader: ()=>isESMLoader,
|
|
59
|
+
loadLoaderModule: ()=>loadLoaderModule,
|
|
60
|
+
mapEachRules: ()=>mapEachRules,
|
|
61
61
|
parsePathQueryFragment: ()=>parsePathQueryFragment,
|
|
62
|
-
|
|
62
|
+
parseQuery: ()=>parseQuery
|
|
63
63
|
});
|
|
64
64
|
const external_node_path_namespaceObject = require("node:path");
|
|
65
65
|
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
@@ -139,7 +139,7 @@ var __webpack_exports__ = {};
|
|
|
139
139
|
const newRule = {
|
|
140
140
|
...rule,
|
|
141
141
|
use: (...args)=>{
|
|
142
|
-
const rules = funcUse
|
|
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
|
+
};
|
|
@@ -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;
|
|
@@ -24,9 +24,9 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
interceptCompilationHooks: ()=>interceptCompilationHooks,
|
|
27
28
|
interceptCompilerHooks: ()=>interceptCompilerHooks,
|
|
28
|
-
shouldInterceptPluginHook: ()=>shouldInterceptPluginHook
|
|
29
|
-
interceptCompilationHooks: ()=>interceptCompilationHooks
|
|
29
|
+
shouldInterceptPluginHook: ()=>shouldInterceptPluginHook
|
|
30
30
|
});
|
|
31
31
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
32
32
|
function shouldInterceptPluginHook(hook) {
|
|
@@ -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';
|
package/dist/index.d.cts
ADDED
|
@@ -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;
|
|
@@ -24,9 +24,9 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
raw: ()=>raw,
|
|
28
27
|
default: ()=>proxy,
|
|
29
|
-
pitch: ()=>pitch
|
|
28
|
+
pitch: ()=>pitch,
|
|
29
|
+
raw: ()=>raw
|
|
30
30
|
});
|
|
31
31
|
const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
|
|
32
32
|
const external_utils_index_cjs_namespaceObject = require("../utils/index.cjs");
|
|
@@ -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
|
+
}
|
|
@@ -24,9 +24,9 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn,
|
|
28
27
|
calculateNamespaceAndRegex: ()=>calculateNamespaceAndRegex,
|
|
29
|
-
ensureDevtools: ()=>ensureDevtools
|
|
28
|
+
ensureDevtools: ()=>ensureDevtools,
|
|
29
|
+
ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn
|
|
30
30
|
});
|
|
31
31
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
32
32
|
const build_namespaceObject = require("@rsdoctor/utils/build");
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
+
}
|
|
@@ -26,9 +26,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
UNASSIGNED: ()=>UNASSIGNED,
|
|
28
28
|
bindContextCache: ()=>bindContextCache,
|
|
29
|
+
collectSourceMaps: ()=>collectSourceMaps,
|
|
29
30
|
handleAfterEmitAssets: ()=>handleAfterEmitAssets,
|
|
30
|
-
handleEmitAssets: ()=>handleEmitAssets
|
|
31
|
-
collectSourceMaps: ()=>collectSourceMaps
|
|
31
|
+
handleEmitAssets: ()=>handleEmitAssets
|
|
32
32
|
});
|
|
33
33
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
34
34
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|