@rsdoctor/core 1.3.4 → 1.3.5
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/loader/probeLoader.cjs +3 -4
- package/dist/build-utils/build/loader/probeLoader.js +3 -4
- package/dist/build-utils/build/module-graph/treeShaking.cjs +1 -2
- package/dist/build-utils/build/module-graph/treeShaking.js +1 -2
- package/dist/build-utils/build/module-graph/utils.cjs +5 -7
- package/dist/build-utils/build/module-graph/utils.js +5 -7
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +7 -9
- package/dist/build-utils/build/module-graph/webpack/transform.js +7 -9
- package/dist/build-utils/build/utils/loader.cjs +10 -11
- package/dist/build-utils/build/utils/loader.js +10 -11
- package/dist/build-utils/build/utils/parseBundle.cjs +10 -15
- package/dist/build-utils/build/utils/parseBundle.js +10 -15
- package/dist/build-utils/build/utils/plugin.cjs +2 -2
- package/dist/build-utils/build/utils/plugin.js +2 -2
- package/dist/inner-plugins/plugins/bundle.cjs +1 -4
- package/dist/inner-plugins/plugins/bundle.js +1 -4
- package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +6 -15
- package/dist/inner-plugins/plugins/bundleTagPlugin.js +6 -15
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +3 -6
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +3 -6
- package/dist/inner-plugins/plugins/loader.cjs +1 -1
- package/dist/inner-plugins/plugins/loader.js +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +10 -17
- package/dist/inner-plugins/plugins/sourcemapTool.js +10 -17
- package/dist/inner-plugins/utils/config.cjs +1 -2
- package/dist/inner-plugins/utils/config.js +1 -2
- package/dist/inner-plugins/utils/loader.cjs +6 -8
- package/dist/inner-plugins/utils/loader.js +6 -8
- package/dist/inner-plugins/utils/normalize-config.cjs +7 -8
- package/dist/inner-plugins/utils/normalize-config.js +7 -8
- package/dist/inner-plugins/utils/plugin-common.cjs +4 -5
- package/dist/inner-plugins/utils/plugin-common.js +4 -5
- package/dist/inner-plugins/utils/plugin.cjs +2 -3
- package/dist/inner-plugins/utils/plugin.js +2 -3
- package/dist/rules/rules/default-import-check/index.cjs +1 -1
- package/dist/rules/rules/default-import-check/index.js +1 -1
- package/dist/rules/rules/default-import-check/utils.cjs +1 -2
- package/dist/rules/rules/default-import-check/utils.js +1 -2
- package/dist/rules/rules/ecma-version-check/index.cjs +3 -4
- package/dist/rules/rules/ecma-version-check/index.js +3 -4
- package/dist/rules/rules/ecma-version-check/utils.cjs +1 -1
- package/dist/rules/rules/ecma-version-check/utils.js +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.cjs +1 -1
- package/dist/rules/rules/loader-performance-optimization/index.js +1 -1
- package/package.json +7 -7
|
@@ -33,31 +33,22 @@ class InternalBundleTagPlugin extends external_base_cjs_namespaceObject.Internal
|
|
|
33
33
|
apply(compiler) {
|
|
34
34
|
(0, logger_namespaceObject.time)('InternalBundleTagPlugin.apply');
|
|
35
35
|
try {
|
|
36
|
-
|
|
37
|
-
const supportBannerPlugin = null == (_this_options_supports = this.options.supports) ? void 0 : _this_options_supports.banner;
|
|
36
|
+
const supportBannerPlugin = this.options.supports?.banner;
|
|
38
37
|
compiler.hooks.compilation.tap('RsdoctorTagBannerPlugin', (compilation)=>{
|
|
39
38
|
compilation.hooks.processAssets.tapPromise({
|
|
40
39
|
name: 'RsdoctorTagBannerPlugin',
|
|
41
40
|
stage: -2000
|
|
42
41
|
}, async ()=>{
|
|
43
|
-
var _compiler_options_optimization;
|
|
44
42
|
if (!compilation.options.plugins.map((p)=>p && p.constructor.name).includes('BannerPlugin') && true !== supportBannerPlugin || false === supportBannerPlugin || 'rspack' in compiler) return;
|
|
45
43
|
logger_namespaceObject.logger.info(logger_namespaceObject.chalk.magenta("Rsdoctor's `supports.banner` option is enabled, this is for debugging only. Do not use it for production."));
|
|
46
|
-
const minimizers =
|
|
47
|
-
const terserPlugin = minimizers.find((plugin)=>
|
|
48
|
-
|
|
49
|
-
return (null == plugin ? void 0 : null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === 'TerserPlugin';
|
|
50
|
-
});
|
|
51
|
-
const swcPlugin = minimizers.find((plugin)=>{
|
|
52
|
-
var _plugin_constructor;
|
|
53
|
-
return (null == plugin ? void 0 : null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === 'SwcJsMinimizerRspackPlugin';
|
|
54
|
-
});
|
|
44
|
+
const minimizers = compiler.options.optimization?.minimizer || [];
|
|
45
|
+
const terserPlugin = minimizers.find((plugin)=>plugin?.constructor?.name === 'TerserPlugin');
|
|
46
|
+
const swcPlugin = minimizers.find((plugin)=>plugin?.constructor?.name === 'SwcJsMinimizerRspackPlugin');
|
|
55
47
|
const hasTerserPlugin = !!terserPlugin;
|
|
56
48
|
const hasSwcJsMinimizer = !!swcPlugin;
|
|
57
49
|
if (hasTerserPlugin || hasSwcJsMinimizer) {
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const swcDropConsole = null == swcPlugin ? void 0 : null == (_swcPlugin__args = swcPlugin._args) ? void 0 : null == (_swcPlugin__args_ = _swcPlugin__args[0]) ? void 0 : null == (_swcPlugin__args__minimizerOptions = _swcPlugin__args_.minimizerOptions) ? void 0 : null == (_swcPlugin__args__minimizerOptions_compress = _swcPlugin__args__minimizerOptions.compress) ? void 0 : _swcPlugin__args__minimizerOptions_compress.drop_console;
|
|
50
|
+
const terserDropConsole = terserPlugin?.options?.minimizer?.options?.compress?.drop_console;
|
|
51
|
+
const swcDropConsole = swcPlugin?._args?.[0]?.minimizerOptions?.compress?.drop_console;
|
|
61
52
|
if (true === terserDropConsole || true === swcDropConsole) logger_namespaceObject.logger.warn(logger_namespaceObject.chalk.yellow('Warning: BannerPlugin detected in project. Please disable drop_console option in TerserPlugin or SwcJsMinimizerRspackPlugin to enable Rsdoctor analysis for BannerPlugin.'));
|
|
62
53
|
}
|
|
63
54
|
const chunks = compilation.chunks;
|
|
@@ -7,31 +7,22 @@ class InternalBundleTagPlugin extends InternalBasePlugin {
|
|
|
7
7
|
apply(compiler) {
|
|
8
8
|
time('InternalBundleTagPlugin.apply');
|
|
9
9
|
try {
|
|
10
|
-
|
|
11
|
-
const supportBannerPlugin = null == (_this_options_supports = this.options.supports) ? void 0 : _this_options_supports.banner;
|
|
10
|
+
const supportBannerPlugin = this.options.supports?.banner;
|
|
12
11
|
compiler.hooks.compilation.tap('RsdoctorTagBannerPlugin', (compilation)=>{
|
|
13
12
|
compilation.hooks.processAssets.tapPromise({
|
|
14
13
|
name: 'RsdoctorTagBannerPlugin',
|
|
15
14
|
stage: -2000
|
|
16
15
|
}, async ()=>{
|
|
17
|
-
var _compiler_options_optimization;
|
|
18
16
|
if (!compilation.options.plugins.map((p)=>p && p.constructor.name).includes('BannerPlugin') && true !== supportBannerPlugin || false === supportBannerPlugin || 'rspack' in compiler) return;
|
|
19
17
|
logger.info(chalk.magenta("Rsdoctor's `supports.banner` option is enabled, this is for debugging only. Do not use it for production."));
|
|
20
|
-
const minimizers =
|
|
21
|
-
const terserPlugin = minimizers.find((plugin)=>
|
|
22
|
-
|
|
23
|
-
return (null == plugin ? void 0 : null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === 'TerserPlugin';
|
|
24
|
-
});
|
|
25
|
-
const swcPlugin = minimizers.find((plugin)=>{
|
|
26
|
-
var _plugin_constructor;
|
|
27
|
-
return (null == plugin ? void 0 : null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === 'SwcJsMinimizerRspackPlugin';
|
|
28
|
-
});
|
|
18
|
+
const minimizers = compiler.options.optimization?.minimizer || [];
|
|
19
|
+
const terserPlugin = minimizers.find((plugin)=>plugin?.constructor?.name === 'TerserPlugin');
|
|
20
|
+
const swcPlugin = minimizers.find((plugin)=>plugin?.constructor?.name === 'SwcJsMinimizerRspackPlugin');
|
|
29
21
|
const hasTerserPlugin = !!terserPlugin;
|
|
30
22
|
const hasSwcJsMinimizer = !!swcPlugin;
|
|
31
23
|
if (hasTerserPlugin || hasSwcJsMinimizer) {
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const swcDropConsole = null == swcPlugin ? void 0 : null == (_swcPlugin__args = swcPlugin._args) ? void 0 : null == (_swcPlugin__args_ = _swcPlugin__args[0]) ? void 0 : null == (_swcPlugin__args__minimizerOptions = _swcPlugin__args_.minimizerOptions) ? void 0 : null == (_swcPlugin__args__minimizerOptions_compress = _swcPlugin__args__minimizerOptions.compress) ? void 0 : _swcPlugin__args__minimizerOptions_compress.drop_console;
|
|
24
|
+
const terserDropConsole = terserPlugin?.options?.minimizer?.options?.compress?.drop_console;
|
|
25
|
+
const swcDropConsole = swcPlugin?._args?.[0]?.minimizerOptions?.compress?.drop_console;
|
|
35
26
|
if (true === terserDropConsole || true === swcDropConsole) logger.warn(chalk.yellow('Warning: BannerPlugin detected in project. Please disable drop_console option in TerserPlugin or SwcJsMinimizerRspackPlugin to enable Rsdoctor analysis for BannerPlugin.'));
|
|
36
27
|
}
|
|
37
28
|
const chunks = compilation.chunks;
|
|
@@ -37,7 +37,6 @@ const external_rspack_cjs_namespaceObject = require("./rspack.cjs");
|
|
|
37
37
|
const external_sourcemapTool_cjs_namespaceObject = require("./sourcemapTool.cjs");
|
|
38
38
|
let hasConsole = false;
|
|
39
39
|
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
40
|
-
var _compiler_webpack_experiments;
|
|
41
40
|
if (_this._modulesGraphApplied) return;
|
|
42
41
|
_this._modulesGraphApplied = true;
|
|
43
42
|
const context = {
|
|
@@ -45,7 +44,7 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
45
44
|
packagePathMap: new Map(),
|
|
46
45
|
getSourceMap: (file)=>_this.sdk.getSourceMap(file)
|
|
47
46
|
};
|
|
48
|
-
const RsdoctorRspackPlugin =
|
|
47
|
+
const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
49
48
|
if (RsdoctorRspackPlugin) (0, external_rspack_cjs_namespaceObject.applyRspackNativePlugin)(compiler, _this, RsdoctorRspackPlugin);
|
|
50
49
|
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
51
50
|
compiler.hooks.done.tapPromise((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('moduleGraph'), async (_stats)=>{
|
|
@@ -65,7 +64,6 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
65
64
|
}, emitHandler.bind(null, _this, compiler));
|
|
66
65
|
};
|
|
67
66
|
async function doneHandler(_stats, _this, context, compiler) {
|
|
68
|
-
var _this_chunkGraph;
|
|
69
67
|
const stats = _stats;
|
|
70
68
|
const getStatsJson = (()=>{
|
|
71
69
|
let cached = null;
|
|
@@ -86,7 +84,7 @@ async function doneHandler(_stats, _this, context, compiler) {
|
|
|
86
84
|
};
|
|
87
85
|
})();
|
|
88
86
|
logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
89
|
-
if (!
|
|
87
|
+
if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = index_cjs_namespaceObject.Chunks.chunkTransform(new Map(), getStatsJson());
|
|
90
88
|
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await index_cjs_namespaceObject.ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
|
|
91
89
|
logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
92
90
|
if (_this.options.features.treeShaking) {
|
|
@@ -131,8 +129,7 @@ function escapeRegExp(str) {
|
|
|
131
129
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
132
130
|
}
|
|
133
131
|
function calculateNamespaceAndRegex(compiler) {
|
|
134
|
-
|
|
135
|
-
let namespace = compiler.options.output.devtoolNamespace || (null == (_compiler_options_output_library = compiler.options.output.library) ? void 0 : _compiler_options_output_library.name) || '[^/]+/';
|
|
132
|
+
let namespace = compiler.options.output.devtoolNamespace || compiler.options.output.library?.name || '[^/]+/';
|
|
136
133
|
if (Array.isArray(namespace)) namespace = namespace[0];
|
|
137
134
|
else if ('object' == typeof namespace && 'name' in namespace) namespace = namespace.name;
|
|
138
135
|
const safeNamespace = escapeRegExp(namespace);
|
|
@@ -9,7 +9,6 @@ import { applyRspackNativePlugin } from "./rspack.js";
|
|
|
9
9
|
import { handleAfterEmitAssets, handleEmitAssets } from "./sourcemapTool.js";
|
|
10
10
|
let hasConsole = false;
|
|
11
11
|
const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
12
|
-
var _compiler_webpack_experiments;
|
|
13
12
|
if (_this._modulesGraphApplied) return;
|
|
14
13
|
_this._modulesGraphApplied = true;
|
|
15
14
|
const context = {
|
|
@@ -17,7 +16,7 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
17
16
|
packagePathMap: new Map(),
|
|
18
17
|
getSourceMap: (file)=>_this.sdk.getSourceMap(file)
|
|
19
18
|
};
|
|
20
|
-
const RsdoctorRspackPlugin =
|
|
19
|
+
const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
|
|
21
20
|
if (RsdoctorRspackPlugin) applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
|
|
22
21
|
if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
|
|
23
22
|
compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async (_stats)=>{
|
|
@@ -37,7 +36,6 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
37
36
|
}, emitHandler.bind(null, _this, compiler));
|
|
38
37
|
};
|
|
39
38
|
async function doneHandler(_stats, _this, context, compiler) {
|
|
40
|
-
var _this_chunkGraph;
|
|
41
39
|
const stats = _stats;
|
|
42
40
|
const getStatsJson = (()=>{
|
|
43
41
|
let cached = null;
|
|
@@ -58,7 +56,7 @@ async function doneHandler(_stats, _this, context, compiler) {
|
|
|
58
56
|
};
|
|
59
57
|
})();
|
|
60
58
|
logger.debug(`${(Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
|
|
61
|
-
if (!
|
|
59
|
+
if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = Chunks.chunkTransform(new Map(), getStatsJson());
|
|
62
60
|
if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
|
|
63
61
|
logger.debug(`${(Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
|
|
64
62
|
if (_this.options.features.treeShaking) {
|
|
@@ -103,8 +101,7 @@ function escapeRegExp(str) {
|
|
|
103
101
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
104
102
|
}
|
|
105
103
|
function calculateNamespaceAndRegex(compiler) {
|
|
106
|
-
|
|
107
|
-
let namespace = compiler.options.output.devtoolNamespace || (null == (_compiler_options_output_library = compiler.options.output.library) ? void 0 : _compiler_options_output_library.name) || '[^/]+/';
|
|
104
|
+
let namespace = compiler.options.output.devtoolNamespace || compiler.options.output.library?.name || '[^/]+/';
|
|
108
105
|
if (Array.isArray(namespace)) namespace = namespace[0];
|
|
109
106
|
else if ('object' == typeof namespace && 'name' in namespace) namespace = namespace.name;
|
|
110
107
|
const safeNamespace = escapeRegExp(namespace);
|
|
@@ -64,7 +64,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
64
64
|
try {
|
|
65
65
|
if (compiler.isChild()) return;
|
|
66
66
|
const wrapper = (callback)=>(loaderContext, module)=>{
|
|
67
|
-
const proxyLoaders =
|
|
67
|
+
const proxyLoaders = module?.loaders || loaderContext?.loaders || [];
|
|
68
68
|
const originLoaders = proxyLoaders.map((loader)=>{
|
|
69
69
|
const opts = loader.options || {};
|
|
70
70
|
if (opts[common_namespaceObject.Loader.LoaderInternalPropertyName]) return {
|
|
@@ -25,7 +25,7 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
25
25
|
try {
|
|
26
26
|
if (compiler.isChild()) return;
|
|
27
27
|
const wrapper = (callback)=>(loaderContext, module)=>{
|
|
28
|
-
const proxyLoaders =
|
|
28
|
+
const proxyLoaders = module?.loaders || loaderContext?.loaders || [];
|
|
29
29
|
const originLoaders = proxyLoaders.map((loader)=>{
|
|
30
30
|
const opts = loader.options || {};
|
|
31
31
|
if (opts[Loader.LoaderInternalPropertyName]) return {
|
|
@@ -43,7 +43,7 @@ function bindContextCache(context, namespace, cache) {
|
|
|
43
43
|
if (source.startsWith('file://')) resolved = (0, external_path_namespaceObject.resolve)(context, source.replace(/^file:\/\//, ''));
|
|
44
44
|
else if (source.startsWith('webpack://')) {
|
|
45
45
|
const match = source.match(sourceMapFilenameRegex);
|
|
46
|
-
const filePath =
|
|
46
|
+
const filePath = match?.[1];
|
|
47
47
|
const hasNamespace = namespace && source.startsWith(`webpack://${namespace}`) || namespace && source.startsWith(`file://${namespace}`);
|
|
48
48
|
const baseDir = hasNamespace ? process.cwd() : context;
|
|
49
49
|
resolved = filePath ? (0, external_path_namespaceObject.resolve)(baseDir, `./${filePath}`) : UNASSIGNED;
|
|
@@ -70,7 +70,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
70
70
|
const m = mappings[i];
|
|
71
71
|
if (!m.source) continue;
|
|
72
72
|
let realSource = m.source.split('!').pop();
|
|
73
|
-
if ((
|
|
73
|
+
if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
74
74
|
if (!realSource) continue;
|
|
75
75
|
if (skipSources && skipSources.has(realSource)) continue;
|
|
76
76
|
const next = mappings[i + 1];
|
|
@@ -95,9 +95,8 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
95
95
|
const { assetLinesCodeList, map: mapFromAsset } = parseAsset(asset, assets, 'js/css');
|
|
96
96
|
let map = mapFromAsset;
|
|
97
97
|
if (!map) {
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
let sourceMapFileAssetName = null == sourceMapFile ? void 0 : sourceMapFile.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
98
|
+
let sourceMapFile = asset.info.related?.sourceMap;
|
|
99
|
+
let sourceMapFileAssetName = sourceMapFile?.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
101
100
|
if (!sourceMapFile) continue;
|
|
102
101
|
{
|
|
103
102
|
let sourceMapAsset = assets.find((asset)=>asset.name === sourceMapFile);
|
|
@@ -145,15 +144,13 @@ async function handleEmitAssets(options) {
|
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
function parseAsset(asset, assets, type) {
|
|
148
|
-
|
|
149
|
-
const assetName = (null == (_asset_source = asset.source) ? void 0 : _asset_source.name) || asset.name;
|
|
147
|
+
const assetName = asset.source?.name || asset.name;
|
|
150
148
|
let assetContent = '';
|
|
151
149
|
let assetLinesCodeList = [];
|
|
152
150
|
let map = null;
|
|
153
151
|
try {
|
|
154
152
|
if ('map' === type && assetName.endsWith('.map') && !asset.name.includes('d.ts')) {
|
|
155
|
-
|
|
156
|
-
assetContent = (null == (_asset_source1 = asset.source) ? void 0 : null == (_asset_source_source = _asset_source1.source) ? void 0 : null == (_asset_source_source_source = _asset_source_source.source) ? void 0 : _asset_source_source_source.call(_asset_source_source)) || '';
|
|
153
|
+
assetContent = asset.source?.source?.source?.() || '';
|
|
157
154
|
if (!assetContent) {
|
|
158
155
|
logger_namespaceObject.logger.debug(`Failed to get source content for asset: ${assetName}`);
|
|
159
156
|
return {
|
|
@@ -164,11 +161,8 @@ function parseAsset(asset, assets, type) {
|
|
|
164
161
|
};
|
|
165
162
|
}
|
|
166
163
|
map = JSON.parse(assetContent);
|
|
167
|
-
const bundledAsset = assets.find((asset2)=>
|
|
168
|
-
|
|
169
|
-
return (null == (_asset2_source = asset2.source) ? void 0 : _asset2_source.name) === map.file;
|
|
170
|
-
});
|
|
171
|
-
const bundledCode = (null == bundledAsset ? void 0 : null == (_bundledAsset_source = bundledAsset.source) ? void 0 : null == (_bundledAsset_source_source = _bundledAsset_source.source) ? void 0 : null == (_bundledAsset_source_source_source = _bundledAsset_source_source.source) ? void 0 : _bundledAsset_source_source_source.call(_bundledAsset_source_source)) || '';
|
|
164
|
+
const bundledAsset = assets.find((asset2)=>asset2.source?.name === map.file);
|
|
165
|
+
const bundledCode = bundledAsset?.source?.source?.source?.() || '';
|
|
172
166
|
if (!bundledCode) {
|
|
173
167
|
logger_namespaceObject.logger.debug(`Failed to get bundled code for asset: ${map.file}`);
|
|
174
168
|
return {
|
|
@@ -180,10 +174,9 @@ function parseAsset(asset, assets, type) {
|
|
|
180
174
|
}
|
|
181
175
|
assetLinesCodeList = bundledCode.split(/\r?\n/);
|
|
182
176
|
} else if ('js/css' === type && (assetName.endsWith('.js') || assetName.endsWith('.css'))) {
|
|
183
|
-
|
|
184
|
-
assetContent = (null == (_asset_source2 = asset.source) ? void 0 : null == (_asset_source_source1 = _asset_source2.source) ? void 0 : _asset_source_source1.call(_asset_source2)) || '';
|
|
177
|
+
assetContent = asset.source?.source?.() || '';
|
|
185
178
|
assetLinesCodeList = assetContent.split(/\r?\n/);
|
|
186
|
-
map =
|
|
179
|
+
map = asset.source?.sourceAndMap?.()?.map || null;
|
|
187
180
|
}
|
|
188
181
|
} catch (error) {
|
|
189
182
|
logger_namespaceObject.logger.debug(`Error parsing asset ${assetName}:`, error);
|
|
@@ -13,7 +13,7 @@ function bindContextCache(context, namespace, cache) {
|
|
|
13
13
|
if (source.startsWith('file://')) resolved = resolve(context, source.replace(/^file:\/\//, ''));
|
|
14
14
|
else if (source.startsWith('webpack://')) {
|
|
15
15
|
const match = source.match(sourceMapFilenameRegex);
|
|
16
|
-
const filePath =
|
|
16
|
+
const filePath = match?.[1];
|
|
17
17
|
const hasNamespace = namespace && source.startsWith(`webpack://${namespace}`) || namespace && source.startsWith(`file://${namespace}`);
|
|
18
18
|
const baseDir = hasNamespace ? process.cwd() : context;
|
|
19
19
|
resolved = filePath ? resolve(baseDir, `./${filePath}`) : UNASSIGNED;
|
|
@@ -40,7 +40,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
40
40
|
const m = mappings[i];
|
|
41
41
|
if (!m.source) continue;
|
|
42
42
|
let realSource = m.source.split('!').pop();
|
|
43
|
-
if ((
|
|
43
|
+
if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
44
44
|
if (!realSource) continue;
|
|
45
45
|
if (skipSources && skipSources.has(realSource)) continue;
|
|
46
46
|
const next = mappings[i + 1];
|
|
@@ -65,9 +65,8 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
65
65
|
const { assetLinesCodeList, map: mapFromAsset } = parseAsset(asset, assets, 'js/css');
|
|
66
66
|
let map = mapFromAsset;
|
|
67
67
|
if (!map) {
|
|
68
|
-
|
|
69
|
-
let
|
|
70
|
-
let sourceMapFileAssetName = null == sourceMapFile ? void 0 : sourceMapFile.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
68
|
+
let sourceMapFile = asset.info.related?.sourceMap;
|
|
69
|
+
let sourceMapFileAssetName = sourceMapFile?.replace(/(\.[^.]+)(\.[^.]+)?$/, '$1');
|
|
71
70
|
if (!sourceMapFile) continue;
|
|
72
71
|
{
|
|
73
72
|
let sourceMapAsset = assets.find((asset)=>asset.name === sourceMapFile);
|
|
@@ -115,15 +114,13 @@ async function handleEmitAssets(options) {
|
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
function parseAsset(asset, assets, type) {
|
|
118
|
-
|
|
119
|
-
const assetName = (null == (_asset_source = asset.source) ? void 0 : _asset_source.name) || asset.name;
|
|
117
|
+
const assetName = asset.source?.name || asset.name;
|
|
120
118
|
let assetContent = '';
|
|
121
119
|
let assetLinesCodeList = [];
|
|
122
120
|
let map = null;
|
|
123
121
|
try {
|
|
124
122
|
if ('map' === type && assetName.endsWith('.map') && !asset.name.includes('d.ts')) {
|
|
125
|
-
|
|
126
|
-
assetContent = (null == (_asset_source1 = asset.source) ? void 0 : null == (_asset_source_source = _asset_source1.source) ? void 0 : null == (_asset_source_source_source = _asset_source_source.source) ? void 0 : _asset_source_source_source.call(_asset_source_source)) || '';
|
|
123
|
+
assetContent = asset.source?.source?.source?.() || '';
|
|
127
124
|
if (!assetContent) {
|
|
128
125
|
logger.debug(`Failed to get source content for asset: ${assetName}`);
|
|
129
126
|
return {
|
|
@@ -134,11 +131,8 @@ function parseAsset(asset, assets, type) {
|
|
|
134
131
|
};
|
|
135
132
|
}
|
|
136
133
|
map = JSON.parse(assetContent);
|
|
137
|
-
const bundledAsset = assets.find((asset2)=>
|
|
138
|
-
|
|
139
|
-
return (null == (_asset2_source = asset2.source) ? void 0 : _asset2_source.name) === map.file;
|
|
140
|
-
});
|
|
141
|
-
const bundledCode = (null == bundledAsset ? void 0 : null == (_bundledAsset_source = bundledAsset.source) ? void 0 : null == (_bundledAsset_source_source = _bundledAsset_source.source) ? void 0 : null == (_bundledAsset_source_source_source = _bundledAsset_source_source.source) ? void 0 : _bundledAsset_source_source_source.call(_bundledAsset_source_source)) || '';
|
|
134
|
+
const bundledAsset = assets.find((asset2)=>asset2.source?.name === map.file);
|
|
135
|
+
const bundledCode = bundledAsset?.source?.source?.source?.() || '';
|
|
142
136
|
if (!bundledCode) {
|
|
143
137
|
logger.debug(`Failed to get bundled code for asset: ${map.file}`);
|
|
144
138
|
return {
|
|
@@ -150,10 +144,9 @@ function parseAsset(asset, assets, type) {
|
|
|
150
144
|
}
|
|
151
145
|
assetLinesCodeList = bundledCode.split(/\r?\n/);
|
|
152
146
|
} else if ('js/css' === type && (assetName.endsWith('.js') || assetName.endsWith('.css'))) {
|
|
153
|
-
|
|
154
|
-
assetContent = (null == (_asset_source2 = asset.source) ? void 0 : null == (_asset_source_source1 = _asset_source2.source) ? void 0 : _asset_source_source1.call(_asset_source2)) || '';
|
|
147
|
+
assetContent = asset.source?.source?.() || '';
|
|
155
148
|
assetLinesCodeList = assetContent.split(/\r?\n/);
|
|
156
|
-
map =
|
|
149
|
+
map = asset.source?.sourceAndMap?.()?.map || null;
|
|
157
150
|
}
|
|
158
151
|
} catch (error) {
|
|
159
152
|
logger.debug(`Error parsing asset ${assetName}:`, error);
|
|
@@ -146,7 +146,6 @@ const normalizeReportType = (reportCodeType, mode)=>{
|
|
|
146
146
|
return types_namespaceObject.SDK.ToDataType.Normal;
|
|
147
147
|
};
|
|
148
148
|
function normalizeRspackUserOptions(options) {
|
|
149
|
-
var _options_experiments, _options_experiments1;
|
|
150
149
|
const config = normalizeUserConfig(options);
|
|
151
150
|
config.experiments ??= {
|
|
152
151
|
enableNativePlugin: {
|
|
@@ -154,7 +153,7 @@ function normalizeRspackUserOptions(options) {
|
|
|
154
153
|
chunkGraph: false
|
|
155
154
|
}
|
|
156
155
|
};
|
|
157
|
-
if ('boolean' == typeof
|
|
156
|
+
if ('boolean' == typeof options.experiments?.enableNativePlugin && options.experiments?.enableNativePlugin === true) config.experiments.enableNativePlugin = {
|
|
158
157
|
moduleGraph: true,
|
|
159
158
|
chunkGraph: true
|
|
160
159
|
};
|
|
@@ -108,7 +108,6 @@ const normalizeReportType = (reportCodeType, mode)=>{
|
|
|
108
108
|
return SDK.ToDataType.Normal;
|
|
109
109
|
};
|
|
110
110
|
function normalizeRspackUserOptions(options) {
|
|
111
|
-
var _options_experiments, _options_experiments1;
|
|
112
111
|
const config = normalizeUserConfig(options);
|
|
113
112
|
config.experiments ??= {
|
|
114
113
|
enableNativePlugin: {
|
|
@@ -116,7 +115,7 @@ function normalizeRspackUserOptions(options) {
|
|
|
116
115
|
chunkGraph: false
|
|
117
116
|
}
|
|
118
117
|
};
|
|
119
|
-
if ('boolean' == typeof
|
|
118
|
+
if ('boolean' == typeof options.experiments?.enableNativePlugin && options.experiments?.enableNativePlugin === true) config.experiments.enableNativePlugin = {
|
|
120
119
|
moduleGraph: true,
|
|
121
120
|
chunkGraph: true
|
|
122
121
|
};
|
|
@@ -70,7 +70,7 @@ function getLoaderOptionsWithoutInternalKeys(loaderContext) {
|
|
|
70
70
|
]);
|
|
71
71
|
(0, external_circleDetect_cjs_namespaceObject.checkCirclePath)(loaderOptions, [], circlePaths, 0);
|
|
72
72
|
if (circlePaths.length > 0) circlePaths.forEach((_path)=>{
|
|
73
|
-
if (
|
|
73
|
+
if (_path?.length > 0 && '[Circular]' !== loaderOptions[_path[0]]) loaderOptions[_path[0]] = '[Circular]';
|
|
74
74
|
});
|
|
75
75
|
return loaderOptions;
|
|
76
76
|
}
|
|
@@ -123,8 +123,7 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
123
123
|
return target;
|
|
124
124
|
};
|
|
125
125
|
return index_cjs_namespaceObject.Utils.mapEachRules(rules, (rule)=>{
|
|
126
|
-
|
|
127
|
-
if ((null == (_rule_loader = rule.loader) ? void 0 : _rule_loader.startsWith('builtin:')) || (null == (_rule_loader1 = rule.loader) ? void 0 : _rule_loader1.endsWith('.mjs')) || (0, utils_index_cjs_namespaceObject.isESMLoader)(rule)) return rule;
|
|
126
|
+
if (rule.loader?.startsWith('builtin:') || rule.loader?.endsWith('.mjs') || (0, utils_index_cjs_namespaceObject.isESMLoader)(rule)) return rule;
|
|
128
127
|
const opts = {
|
|
129
128
|
...'options' in rule ? 'string' == typeof rule.options ? JSON.parse(rule.options) : rule.options : {}
|
|
130
129
|
};
|
|
@@ -141,17 +140,16 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
141
140
|
});
|
|
142
141
|
}
|
|
143
142
|
async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, res, sourceMap) {
|
|
144
|
-
var _ctx__module, _ctx__module1, _ctx__compilation;
|
|
145
143
|
const end = common_namespaceObject.Time.getCurrentTimestamp(start, startHRTime);
|
|
146
144
|
const { loader, host } = getInternalLoaderOptions(ctx);
|
|
147
145
|
const loaderData = [
|
|
148
146
|
{
|
|
149
147
|
resource: {
|
|
150
|
-
path:
|
|
148
|
+
path: ctx._module?.layer ? `${ctx.resourcePath}[${ctx._module.layer}]` : ctx.resourcePath,
|
|
151
149
|
query: (0, utils_index_cjs_namespaceObject.parseQuery)(ctx.resourceQuery || '?'),
|
|
152
150
|
queryRaw: ctx.resourceQuery,
|
|
153
151
|
ext: external_path_default().extname(ctx.resourcePath).slice(1),
|
|
154
|
-
...
|
|
152
|
+
...ctx._module?.layer ? {
|
|
155
153
|
layer: ctx._module.layer
|
|
156
154
|
} : {}
|
|
157
155
|
},
|
|
@@ -192,8 +190,8 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
192
190
|
mappings: data.mappings,
|
|
193
191
|
file: loaderData[0].resource.path
|
|
194
192
|
};
|
|
195
|
-
const sdk = (0, external_sdk_cjs_namespaceObject.getSDK)(
|
|
196
|
-
if (
|
|
193
|
+
const sdk = (0, external_sdk_cjs_namespaceObject.getSDK)(ctx._compilation?.name);
|
|
194
|
+
if (sdk?.reportLoader && !('parent' in sdk && sdk.parent)) {
|
|
197
195
|
sdk.reportLoader(loaderData);
|
|
198
196
|
sdk.reportSourceMap(sourceMapData);
|
|
199
197
|
return loaderData;
|
|
@@ -26,7 +26,7 @@ function getLoaderOptionsWithoutInternalKeys(loaderContext) {
|
|
|
26
26
|
]);
|
|
27
27
|
checkCirclePath(loaderOptions, [], circlePaths, 0);
|
|
28
28
|
if (circlePaths.length > 0) circlePaths.forEach((_path)=>{
|
|
29
|
-
if (
|
|
29
|
+
if (_path?.length > 0 && '[Circular]' !== loaderOptions[_path[0]]) loaderOptions[_path[0]] = '[Circular]';
|
|
30
30
|
});
|
|
31
31
|
return loaderOptions;
|
|
32
32
|
}
|
|
@@ -79,8 +79,7 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
79
79
|
return target;
|
|
80
80
|
};
|
|
81
81
|
return Utils.mapEachRules(rules, (rule)=>{
|
|
82
|
-
|
|
83
|
-
if ((null == (_rule_loader = rule.loader) ? void 0 : _rule_loader.startsWith('builtin:')) || (null == (_rule_loader1 = rule.loader) ? void 0 : _rule_loader1.endsWith('.mjs')) || isESMLoader(rule)) return rule;
|
|
82
|
+
if (rule.loader?.startsWith('builtin:') || rule.loader?.endsWith('.mjs') || isESMLoader(rule)) return rule;
|
|
84
83
|
const opts = {
|
|
85
84
|
...'options' in rule ? 'string' == typeof rule.options ? JSON.parse(rule.options) : rule.options : {}
|
|
86
85
|
};
|
|
@@ -97,17 +96,16 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, res, sourceMap) {
|
|
100
|
-
var _ctx__module, _ctx__module1, _ctx__compilation;
|
|
101
99
|
const end = Time.getCurrentTimestamp(start, startHRTime);
|
|
102
100
|
const { loader, host } = getInternalLoaderOptions(ctx);
|
|
103
101
|
const loaderData = [
|
|
104
102
|
{
|
|
105
103
|
resource: {
|
|
106
|
-
path:
|
|
104
|
+
path: ctx._module?.layer ? `${ctx.resourcePath}[${ctx._module.layer}]` : ctx.resourcePath,
|
|
107
105
|
query: parseQuery(ctx.resourceQuery || '?'),
|
|
108
106
|
queryRaw: ctx.resourceQuery,
|
|
109
107
|
ext: path.extname(ctx.resourcePath).slice(1),
|
|
110
|
-
...
|
|
108
|
+
...ctx._module?.layer ? {
|
|
111
109
|
layer: ctx._module.layer
|
|
112
110
|
} : {}
|
|
113
111
|
},
|
|
@@ -148,8 +146,8 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
148
146
|
mappings: data.mappings,
|
|
149
147
|
file: loaderData[0].resource.path
|
|
150
148
|
};
|
|
151
|
-
const sdk = getSDK(
|
|
152
|
-
if (
|
|
149
|
+
const sdk = getSDK(ctx._compilation?.name);
|
|
150
|
+
if (sdk?.reportLoader && !('parent' in sdk && sdk.parent)) {
|
|
153
151
|
sdk.reportLoader(loaderData);
|
|
154
152
|
sdk.reportSourceMap(sourceMapData);
|
|
155
153
|
return loaderData;
|
|
@@ -41,30 +41,29 @@ function processModeConfigurations(finalMode, output, brief) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function processBriefHtmlModeConfig(output, brief) {
|
|
44
|
-
var _briefOptions_type, _briefOptions_type1, _output_options;
|
|
45
44
|
let htmlOptions = {
|
|
46
45
|
reportHtmlName: void 0,
|
|
47
46
|
writeDataJson: false
|
|
48
47
|
};
|
|
49
48
|
let jsonOptions = {};
|
|
50
|
-
const briefOptions =
|
|
51
|
-
if ('type' in briefOptions &&
|
|
49
|
+
const briefOptions = output?.options || {};
|
|
50
|
+
if ('type' in briefOptions && briefOptions.type?.includes('json')) jsonOptions = briefOptions.jsonOptions || {
|
|
52
51
|
sections: {
|
|
53
52
|
moduleGraph: true,
|
|
54
53
|
chunkGraph: true,
|
|
55
54
|
rules: true
|
|
56
55
|
}
|
|
57
56
|
};
|
|
58
|
-
if ('type' in briefOptions &&
|
|
59
|
-
const outputBriefOptions =
|
|
57
|
+
if ('type' in briefOptions && briefOptions.type?.includes('html') || !briefOptions.type) {
|
|
58
|
+
const outputBriefOptions = briefOptions?.htmlOptions;
|
|
60
59
|
const outputBrief = brief;
|
|
61
60
|
htmlOptions = {
|
|
62
|
-
reportHtmlName:
|
|
63
|
-
writeDataJson:
|
|
61
|
+
reportHtmlName: outputBriefOptions?.reportHtmlName || outputBrief?.reportHtmlName || void 0,
|
|
62
|
+
writeDataJson: outputBriefOptions?.writeDataJson || outputBrief?.writeDataJson || false
|
|
64
63
|
};
|
|
65
64
|
}
|
|
66
65
|
return {
|
|
67
|
-
type:
|
|
66
|
+
type: output.options?.type || [
|
|
68
67
|
'html'
|
|
69
68
|
],
|
|
70
69
|
htmlOptions,
|
|
@@ -11,30 +11,29 @@ function processModeConfigurations(finalMode, output, brief) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
function processBriefHtmlModeConfig(output, brief) {
|
|
14
|
-
var _briefOptions_type, _briefOptions_type1, _output_options;
|
|
15
14
|
let htmlOptions = {
|
|
16
15
|
reportHtmlName: void 0,
|
|
17
16
|
writeDataJson: false
|
|
18
17
|
};
|
|
19
18
|
let jsonOptions = {};
|
|
20
|
-
const briefOptions =
|
|
21
|
-
if ('type' in briefOptions &&
|
|
19
|
+
const briefOptions = output?.options || {};
|
|
20
|
+
if ('type' in briefOptions && briefOptions.type?.includes('json')) jsonOptions = briefOptions.jsonOptions || {
|
|
22
21
|
sections: {
|
|
23
22
|
moduleGraph: true,
|
|
24
23
|
chunkGraph: true,
|
|
25
24
|
rules: true
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
|
-
if ('type' in briefOptions &&
|
|
29
|
-
const outputBriefOptions =
|
|
27
|
+
if ('type' in briefOptions && briefOptions.type?.includes('html') || !briefOptions.type) {
|
|
28
|
+
const outputBriefOptions = briefOptions?.htmlOptions;
|
|
30
29
|
const outputBrief = brief;
|
|
31
30
|
htmlOptions = {
|
|
32
|
-
reportHtmlName:
|
|
33
|
-
writeDataJson:
|
|
31
|
+
reportHtmlName: outputBriefOptions?.reportHtmlName || outputBrief?.reportHtmlName || void 0,
|
|
32
|
+
writeDataJson: outputBriefOptions?.writeDataJson || outputBrief?.writeDataJson || false
|
|
34
33
|
};
|
|
35
34
|
}
|
|
36
35
|
return {
|
|
37
|
-
type:
|
|
36
|
+
type: output.options?.type || [
|
|
38
37
|
'html'
|
|
39
38
|
],
|
|
40
39
|
htmlOptions,
|
|
@@ -44,20 +44,19 @@ const compat_namespaceObject = require("es-toolkit/compat");
|
|
|
44
44
|
const external_path_namespaceObject = require("path");
|
|
45
45
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
46
46
|
function processCompilerConfig(config) {
|
|
47
|
-
var _rest_module, _rest_module1;
|
|
48
47
|
const { plugins, infrastructureLogging, ...rest } = config;
|
|
49
48
|
const _rest = (0, compat_namespaceObject.cloneDeep)(rest);
|
|
50
|
-
if (
|
|
51
|
-
if (
|
|
49
|
+
if (_rest.module?.defaultRules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.defaultRules);
|
|
50
|
+
if (_rest.module?.rules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.rules);
|
|
52
51
|
return {
|
|
53
52
|
..._rest,
|
|
54
|
-
plugins: plugins.map((e)=>
|
|
53
|
+
plugins: plugins.map((e)=>e?.constructor.name)
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
function handleBriefModeReport(sdk, options, disableClientServer) {
|
|
58
57
|
if (!disableClientServer && options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) {
|
|
59
58
|
const htmlOptions = 'htmlOptions' in options.output.options && options.output.options.htmlOptions || void 0;
|
|
60
|
-
const outputFilePath = external_path_default().resolve(sdk.outputDir,
|
|
59
|
+
const outputFilePath = external_path_default().resolve(sdk.outputDir, htmlOptions?.reportHtmlName || 'rsdoctor-report.html');
|
|
61
60
|
console.log(`${logger_namespaceObject.chalk.green('[RSDOCTOR] generated brief report')}: ${outputFilePath}`);
|
|
62
61
|
(0, sdk_namespaceObject.openBrowser)(`file:///${outputFilePath}`);
|
|
63
62
|
}
|
|
@@ -7,20 +7,19 @@ import { chalk } from "@rsdoctor/utils/logger";
|
|
|
7
7
|
import { cloneDeep } from "es-toolkit/compat";
|
|
8
8
|
import path from "path";
|
|
9
9
|
function processCompilerConfig(config) {
|
|
10
|
-
var _rest_module, _rest_module1;
|
|
11
10
|
const { plugins, infrastructureLogging, ...rest } = config;
|
|
12
11
|
const _rest = cloneDeep(rest);
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
12
|
+
if (_rest.module?.defaultRules) makeRulesSerializable(_rest.module.defaultRules);
|
|
13
|
+
if (_rest.module?.rules) makeRulesSerializable(_rest.module.rules);
|
|
15
14
|
return {
|
|
16
15
|
..._rest,
|
|
17
|
-
plugins: plugins.map((e)=>
|
|
16
|
+
plugins: plugins.map((e)=>e?.constructor.name)
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
19
|
function handleBriefModeReport(sdk, options, disableClientServer) {
|
|
21
20
|
if (!disableClientServer && options.output.mode === SDK.IMode[SDK.IMode.brief]) {
|
|
22
21
|
const htmlOptions = 'htmlOptions' in options.output.options && options.output.options.htmlOptions || void 0;
|
|
23
|
-
const outputFilePath = path.resolve(sdk.outputDir,
|
|
22
|
+
const outputFilePath = path.resolve(sdk.outputDir, htmlOptions?.reportHtmlName || 'rsdoctor-report.html');
|
|
24
23
|
console.log(`${chalk.green('[RSDOCTOR] generated brief report')}: ${outputFilePath}`);
|
|
25
24
|
openBrowser(`file:///${outputFilePath}`);
|
|
26
25
|
}
|