@rsdoctor/core 1.3.2 → 1.3.4
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/README.md +1 -1
- package/dist/build-utils/build/loader/probeLoader.cjs +2 -2
- package/dist/build-utils/build/loader/probeLoader.js +1 -1
- package/dist/build-utils/build/module-graph/utils.cjs +2 -2
- package/dist/build-utils/build/module-graph/utils.js +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +2 -2
- package/dist/build-utils/build/module-graph/webpack/transform.js +1 -1
- package/dist/build-utils/build/utils/loader.cjs +3 -3
- package/dist/build-utils/build/utils/loader.js +1 -1
- package/dist/build-utils/build/utils/parseBundle.cjs +3 -3
- package/dist/build-utils/build/utils/parseBundle.js +1 -1
- package/dist/inner-plugins/plugins/loader.cjs +5 -5
- package/dist/inner-plugins/plugins/loader.js +1 -1
- package/dist/inner-plugins/plugins/rules.cjs +3 -3
- package/dist/inner-plugins/plugins/rules.js +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +7 -2
- package/dist/inner-plugins/plugins/sourcemapTool.d.ts +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.js +7 -2
- package/dist/inner-plugins/plugins/summary.cjs +3 -3
- package/dist/inner-plugins/plugins/summary.js +1 -1
- package/dist/inner-plugins/utils/loader.cjs +2 -2
- package/dist/inner-plugins/utils/loader.js +1 -1
- package/dist/inner-plugins/utils/plugin-common.cjs +2 -2
- package/dist/inner-plugins/utils/plugin-common.js +1 -1
- package/dist/rules/rules/cross-chunks-package/index.cjs +2 -2
- package/dist/rules/rules/cross-chunks-package/index.js +1 -1
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
});
|
|
39
39
|
const external_index_cjs_namespaceObject = require("../../index.cjs");
|
|
40
40
|
const index_cjs_namespaceObject = require("../../../inner-plugins/index.cjs");
|
|
41
|
-
const
|
|
41
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
42
42
|
const external_path_namespaceObject = require("path");
|
|
43
43
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
44
44
|
const loaderModule = function(...args) {
|
|
@@ -66,7 +66,7 @@ const loaderModule = function(...args) {
|
|
|
66
66
|
result: 'end' === _options.type ? code : null,
|
|
67
67
|
startAt: 'start' === _options.type ? time : 0,
|
|
68
68
|
endAt: 'end' === _options.type ? time : 0,
|
|
69
|
-
options: (0,
|
|
69
|
+
options: (0, compat_namespaceObject.omit)(_options.options, 'type'),
|
|
70
70
|
isPitch: false,
|
|
71
71
|
sync: false,
|
|
72
72
|
errors: [],
|
|
@@ -2,7 +2,7 @@ import 'module';
|
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { Build } from "../../index.js";
|
|
4
4
|
import { getSDK } from "../../../inner-plugins/index.js";
|
|
5
|
-
import { omit } from "
|
|
5
|
+
import { omit } from "es-toolkit/compat";
|
|
6
6
|
import path from "path";
|
|
7
7
|
const loaderModule = function(...args) {
|
|
8
8
|
var _this__module, _this__module1;
|
|
@@ -27,7 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
getDeclarationIdentifier: ()=>getDeclarationIdentifier,
|
|
28
28
|
getExportIdentifierStatement: ()=>getExportIdentifierStatement
|
|
29
29
|
});
|
|
30
|
-
const
|
|
30
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
31
31
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
32
32
|
function getDefaultExportIdentifier(node, module, searchId) {
|
|
33
33
|
var _node_declaration_loc;
|
|
@@ -44,7 +44,7 @@ function getDefaultExportIdentifier(node, module, searchId) {
|
|
|
44
44
|
if (null == (_declaration_id = declaration.id) ? void 0 : _declaration_id.loc) return module.getStatement(declaration.id.loc);
|
|
45
45
|
}
|
|
46
46
|
const startLine = null == (_node_declaration_loc = node.declaration.loc) ? void 0 : _node_declaration_loc.start.line;
|
|
47
|
-
if (!(0,
|
|
47
|
+
if (!(0, compat_namespaceObject.isNumber)(startLine)) return;
|
|
48
48
|
const { transformed } = module.getSource();
|
|
49
49
|
const endColumn = transformed.split('\n')[startLine - 1].length - 1;
|
|
50
50
|
return module.getStatement({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { isNumber } from "
|
|
3
|
+
import { isNumber } from "es-toolkit/compat";
|
|
4
4
|
import { parser } from "@rsdoctor/utils/ruleUtils";
|
|
5
5
|
function getDefaultExportIdentifier(node, module, searchId) {
|
|
6
6
|
var _node_declaration_loc;
|
|
@@ -40,7 +40,7 @@ const external_node_fs_namespaceObject = require("node:fs");
|
|
|
40
40
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
41
41
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
42
42
|
const external_parser_cjs_namespaceObject = require("../parser.cjs");
|
|
43
|
-
const
|
|
43
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
44
44
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
45
45
|
async function readFile(target, wbFs) {
|
|
46
46
|
var _wbFs_fs;
|
|
@@ -112,7 +112,7 @@ async function appendModuleData(origin, webpackGraph, graph, wbFs, features, con
|
|
|
112
112
|
module.setProgram(program);
|
|
113
113
|
module.meta.hasSetEsModuleStatement = (0, external_parser_cjs_namespaceObject.hasSetEsModuleStatement)(program);
|
|
114
114
|
}
|
|
115
|
-
const transformed = graph_namespaceObject.Webpack.isExternalModule(origin) ? '' : module.getSource().transformed.length > 0 ? module.getSource().transformed : (0,
|
|
115
|
+
const transformed = graph_namespaceObject.Webpack.isExternalModule(origin) ? '' : module.getSource().transformed.length > 0 ? module.getSource().transformed : (0, compat_namespaceObject.isFunction)(null == origin ? void 0 : origin.originalSource) ? (null == (_origin_originalSource = origin.originalSource()) ? void 0 : null == (_origin_originalSource_source = _origin_originalSource.source()) ? void 0 : _origin_originalSource_source.toString()) ?? '' : '';
|
|
116
116
|
const transformedSize = graph_namespaceObject.Webpack.isExternalModule(origin) ? 0 : module.getSize().transformedSize > 0 ? module.getSize().transformedSize : Buffer.from(transformed).byteLength;
|
|
117
117
|
module.setSource({
|
|
118
118
|
transformed,
|
|
@@ -3,7 +3,7 @@ import 'module';
|
|
|
3
3
|
import node_fs from "node:fs";
|
|
4
4
|
import { ModuleGraphTrans, Webpack } from "@rsdoctor/graph";
|
|
5
5
|
import { hasSetEsModuleStatement } from "../parser.js";
|
|
6
|
-
import { isFunction } from "
|
|
6
|
+
import { isFunction } from "es-toolkit/compat";
|
|
7
7
|
import { logger } from "@rsdoctor/utils/logger";
|
|
8
8
|
async function readFile(target, wbFs) {
|
|
9
9
|
var _wbFs_fs;
|
|
@@ -66,7 +66,7 @@ var __webpack_exports__ = {};
|
|
|
66
66
|
const external_node_url_namespaceObject = require("node:url");
|
|
67
67
|
const external_fs_extra_namespaceObject = require("fs-extra");
|
|
68
68
|
var external_fs_extra_default = /*#__PURE__*/ __webpack_require__.n(external_fs_extra_namespaceObject);
|
|
69
|
-
const
|
|
69
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
70
70
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
71
71
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
72
72
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -289,7 +289,7 @@ var __webpack_exports__ = {};
|
|
|
289
289
|
}
|
|
290
290
|
if ('object' == typeof target.query) {
|
|
291
291
|
const options = target.query[common_namespaceObject.Loader.LoaderInternalPropertyName];
|
|
292
|
-
if (options.hasOptions) return (0,
|
|
292
|
+
if (options.hasOptions) return (0, compat_namespaceObject.omit)(target.query, [
|
|
293
293
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
294
294
|
]);
|
|
295
295
|
const innerLoaderPath = null == options ? void 0 : options.loader;
|
|
@@ -299,7 +299,7 @@ var __webpack_exports__ = {};
|
|
|
299
299
|
}
|
|
300
300
|
return Reflect.get(target, key, receiver);
|
|
301
301
|
case 'getOptions':
|
|
302
|
-
return 'function' == typeof target.getOptions ? ()=>(0,
|
|
302
|
+
return 'function' == typeof target.getOptions ? ()=>(0, compat_namespaceObject.omit)(target.getOptions(), [
|
|
303
303
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
304
304
|
]) : Reflect.get(target, key, receiver);
|
|
305
305
|
default:
|
|
@@ -4,7 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
|
|
|
4
4
|
import node_path from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import fs_extra from "fs-extra";
|
|
7
|
-
import { omit } from "
|
|
7
|
+
import { omit } from "es-toolkit/compat";
|
|
8
8
|
import { Loader } from "@rsdoctor/utils/common";
|
|
9
9
|
import { readPackageJson } from "@rsdoctor/graph";
|
|
10
10
|
import { logger } from "@rsdoctor/utils/logger";
|
|
@@ -37,7 +37,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37
37
|
});
|
|
38
38
|
const external_fs_namespaceObject = require("fs");
|
|
39
39
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
40
|
-
const
|
|
40
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
41
41
|
const external_filesize_namespaceObject = require("filesize");
|
|
42
42
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
43
43
|
const external_path_namespaceObject = require("path");
|
|
@@ -139,14 +139,14 @@ const parseBundle = (bundlePath, modulesData)=>{
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
let modules;
|
|
142
|
-
modules = walkState.locations ? (0,
|
|
142
|
+
modules = walkState.locations ? (0, compat_namespaceObject.mapValues)(walkState.locations, (loc)=>content.slice(loc.start, loc.end)) : {};
|
|
143
143
|
const modulesObj = {};
|
|
144
144
|
for(const module in modules){
|
|
145
145
|
var _find;
|
|
146
146
|
if (!module) return {};
|
|
147
147
|
const moduleContent = modules[module];
|
|
148
148
|
const size = moduleContent && Buffer.byteLength(moduleContent);
|
|
149
|
-
const identifier = (null == (_find = (0,
|
|
149
|
+
const identifier = (null == (_find = (0, compat_namespaceObject.find)(modulesData, {
|
|
150
150
|
renderId: module
|
|
151
151
|
})) ? void 0 : _find.webpackId) || '';
|
|
152
152
|
modulesObj[identifier] = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import { find, mapValues } from "
|
|
4
|
+
import { find, mapValues } from "es-toolkit/compat";
|
|
5
5
|
import { filesize } from "filesize";
|
|
6
6
|
import { parser } from "@rsdoctor/utils/ruleUtils";
|
|
7
7
|
import { extname } from "path";
|
|
@@ -40,7 +40,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
40
40
|
});
|
|
41
41
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
42
42
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
43
|
-
const
|
|
43
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
44
44
|
const index_cjs_namespaceObject = require("../utils/index.cjs");
|
|
45
45
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
46
46
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -70,11 +70,11 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
70
70
|
if (opts[common_namespaceObject.Loader.LoaderInternalPropertyName]) return {
|
|
71
71
|
...loader,
|
|
72
72
|
loader: opts[common_namespaceObject.Loader.LoaderInternalPropertyName].loader,
|
|
73
|
-
options: (0,
|
|
73
|
+
options: (0, compat_namespaceObject.omit)(opts, common_namespaceObject.Loader.LoaderInternalPropertyName)
|
|
74
74
|
};
|
|
75
75
|
return loader;
|
|
76
76
|
});
|
|
77
|
-
const newLoaders = (0,
|
|
77
|
+
const newLoaders = (0, compat_namespaceObject.cloneDeep)(originLoaders);
|
|
78
78
|
if ('object' == typeof compiler.options.cache && 'version' in compiler.options.cache && 'string' == typeof compiler.options.cache.version && compiler.options.cache.version.indexOf('next/dist/build') > -1) callback(loaderContext, module || {});
|
|
79
79
|
else {
|
|
80
80
|
const proxyModule = new Proxy(module || {}, {
|
|
@@ -83,7 +83,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
83
83
|
return Reflect.get(target, p, receiver);
|
|
84
84
|
},
|
|
85
85
|
set (target, p, newValue, receiver) {
|
|
86
|
-
const _newValue = (0,
|
|
86
|
+
const _newValue = (0, compat_namespaceObject.cloneDeep)(newValue);
|
|
87
87
|
if ('loaders' === p) {
|
|
88
88
|
if (Array.isArray(_newValue)) {
|
|
89
89
|
newLoaders.length = 0;
|
|
@@ -100,7 +100,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
100
100
|
});
|
|
101
101
|
callback(loaderContext, proxyModule);
|
|
102
102
|
}
|
|
103
|
-
if (!(0,
|
|
103
|
+
if (!(0, compat_namespaceObject.isEqual)(originLoaders, newLoaders)) {
|
|
104
104
|
const rules = this.getInterceptRules(compiler, newLoaders.map((e)=>({
|
|
105
105
|
loader: e.loader,
|
|
106
106
|
options: e.options
|
|
@@ -2,7 +2,7 @@ import __rslib_shim_module__ from 'module';
|
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
3
3
|
import { Manifest } from "@rsdoctor/types";
|
|
4
4
|
import { Loader } from "@rsdoctor/utils/common";
|
|
5
|
-
import { cloneDeep, isEqual, omit } from "
|
|
5
|
+
import { cloneDeep, isEqual, omit } from "es-toolkit/compat";
|
|
6
6
|
import { interceptLoader } from "../utils/index.js";
|
|
7
7
|
import { InternalBasePlugin } from "./base.js";
|
|
8
8
|
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
@@ -29,7 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
30
30
|
const index_cjs_namespaceObject = require("../../rules/index.cjs");
|
|
31
31
|
const error_namespaceObject = require("@rsdoctor/utils/error");
|
|
32
|
-
const
|
|
32
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
33
33
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
34
34
|
class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
35
35
|
apply(compiler) {
|
|
@@ -56,8 +56,8 @@ class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBase
|
|
|
56
56
|
const warnings = validateErrors.filter((item)=>'Warn' === item.level);
|
|
57
57
|
const toWebpackError = (err)=>err.toError();
|
|
58
58
|
result.replace.forEach((item)=>{
|
|
59
|
-
if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) (0,
|
|
60
|
-
if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) (0,
|
|
59
|
+
if (Array.isArray(compilation.errors) && compilation.errors.includes(item)) (0, compat_namespaceObject.pull)(compilation.errors, item);
|
|
60
|
+
if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item)) (0, compat_namespaceObject.pull)(compilation.warnings, item);
|
|
61
61
|
});
|
|
62
62
|
if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
|
|
63
63
|
compilation.warnings.push(toWebpackError(err));
|
|
@@ -3,7 +3,7 @@ import 'module';
|
|
|
3
3
|
import { InternalBasePlugin } from "./base.js";
|
|
4
4
|
import { Linter } from "../../rules/index.js";
|
|
5
5
|
import { DevToolError } from "@rsdoctor/utils/error";
|
|
6
|
-
import { pull } from "
|
|
6
|
+
import { pull } from "es-toolkit/compat";
|
|
7
7
|
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
8
8
|
class InternalRulesPlugin extends InternalBasePlugin {
|
|
9
9
|
apply(compiler) {
|
|
@@ -52,7 +52,7 @@ function bindContextCache(context, namespace, cache) {
|
|
|
52
52
|
return resolved;
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace) {
|
|
55
|
+
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace, skipSources) {
|
|
56
56
|
if (map) {
|
|
57
57
|
const consumer = await new external_source_map_namespaceObject.SourceMapConsumer(map);
|
|
58
58
|
const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache);
|
|
@@ -72,6 +72,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
72
72
|
let realSource = m.source.split('!').pop();
|
|
73
73
|
if (((null == realSource ? void 0 : realSource.startsWith('webpack://')) || (null == realSource ? void 0 : realSource.startsWith('file://'))) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
74
74
|
if (!realSource) continue;
|
|
75
|
+
if (skipSources && skipSources.has(realSource)) continue;
|
|
75
76
|
const next = mappings[i + 1];
|
|
76
77
|
const start = m.generatedColumn;
|
|
77
78
|
const end = next ? next.generatedColumn : line.length;
|
|
@@ -89,6 +90,7 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
89
90
|
const assets = [
|
|
90
91
|
...compilation.getAssets()
|
|
91
92
|
];
|
|
93
|
+
const skipSources = new Set();
|
|
92
94
|
for (const asset of assets){
|
|
93
95
|
const { assetLinesCodeList, map: mapFromAsset } = parseAsset(asset, assets, 'js/css');
|
|
94
96
|
let map = mapFromAsset;
|
|
@@ -110,10 +112,13 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
try {
|
|
113
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace);
|
|
115
|
+
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace, skipSources);
|
|
114
116
|
} catch (e) {
|
|
115
117
|
logger_namespaceObject.logger.debug(e);
|
|
116
118
|
}
|
|
119
|
+
_this.sourceMapSets.forEach((_value, key)=>{
|
|
120
|
+
if (!skipSources.has(key)) skipSources.add(key);
|
|
121
|
+
});
|
|
117
122
|
}
|
|
118
123
|
(0, logger_namespaceObject.timeEnd)('ensureModulesChunkGraph.afterEmit.start');
|
|
119
124
|
}
|
|
@@ -32,7 +32,7 @@ export declare function bindContextCache(context: string, namespace?: string, ca
|
|
|
32
32
|
* @param sourceMapFilenameRegex - Regex to extract file paths from source map sources.
|
|
33
33
|
* @param namespace - Optional namespace for resolving sources.
|
|
34
34
|
*/
|
|
35
|
-
export declare function collectSourceMaps(map: any, assetLinesCodeList: string[], _compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, sourceMapFilenameRegex?: RegExp, namespace?: string): Promise<void>;
|
|
35
|
+
export declare function collectSourceMaps(map: any, assetLinesCodeList: string[], _compilation: Plugin.BaseCompilation, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>, sourceMapFilenameRegex?: RegExp, namespace?: string, skipSources?: Set<string>): Promise<void>;
|
|
36
36
|
/**
|
|
37
37
|
* Handles source map collection after assets are emitted (Rspack only).
|
|
38
38
|
* Iterates over all assets, parses them, and collects source maps.
|
|
@@ -22,7 +22,7 @@ function bindContextCache(context, namespace, cache) {
|
|
|
22
22
|
return resolved;
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace) {
|
|
25
|
+
async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, sourceMapFilenameRegex, namespace, skipSources) {
|
|
26
26
|
if (map) {
|
|
27
27
|
const consumer = await new SourceMapConsumer(map);
|
|
28
28
|
const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache);
|
|
@@ -42,6 +42,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
42
42
|
let realSource = m.source.split('!').pop();
|
|
43
43
|
if (((null == realSource ? void 0 : realSource.startsWith('webpack://')) || (null == realSource ? void 0 : realSource.startsWith('file://'))) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
44
44
|
if (!realSource) continue;
|
|
45
|
+
if (skipSources && skipSources.has(realSource)) continue;
|
|
45
46
|
const next = mappings[i + 1];
|
|
46
47
|
const start = m.generatedColumn;
|
|
47
48
|
const end = next ? next.generatedColumn : line.length;
|
|
@@ -59,6 +60,7 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
59
60
|
const assets = [
|
|
60
61
|
...compilation.getAssets()
|
|
61
62
|
];
|
|
63
|
+
const skipSources = new Set();
|
|
62
64
|
for (const asset of assets){
|
|
63
65
|
const { assetLinesCodeList, map: mapFromAsset } = parseAsset(asset, assets, 'js/css');
|
|
64
66
|
let map = mapFromAsset;
|
|
@@ -80,10 +82,13 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
80
82
|
}
|
|
81
83
|
}
|
|
82
84
|
try {
|
|
83
|
-
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace);
|
|
85
|
+
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace, skipSources);
|
|
84
86
|
} catch (e) {
|
|
85
87
|
logger.debug(e);
|
|
86
88
|
}
|
|
89
|
+
_this.sourceMapSets.forEach((_value, key)=>{
|
|
90
|
+
if (!skipSources.has(key)) skipSources.add(key);
|
|
91
|
+
});
|
|
87
92
|
}
|
|
88
93
|
timeEnd('ensureModulesChunkGraph.afterEmit.start');
|
|
89
94
|
}
|
|
@@ -27,7 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27
27
|
InternalSummaryPlugin: ()=>InternalSummaryPlugin
|
|
28
28
|
});
|
|
29
29
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
30
|
-
const
|
|
30
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
31
31
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
32
32
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
33
33
|
class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
@@ -104,8 +104,8 @@ class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBa
|
|
|
104
104
|
costs: [
|
|
105
105
|
{
|
|
106
106
|
name: common_namespaceObject.Summary.SummaryCostsDataName.Minify,
|
|
107
|
-
startAt: (0,
|
|
108
|
-
costs: (0,
|
|
107
|
+
startAt: (0, compat_namespaceObject.minBy)(minifyHookData, (e)=>e.startAt).startAt,
|
|
108
|
+
costs: (0, compat_namespaceObject.sumBy)(minifyHookData, (e)=>e.costs)
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
111
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { Summary } from "@rsdoctor/utils/common";
|
|
4
|
-
import { minBy, sumBy } from "
|
|
4
|
+
import { minBy, sumBy } from "es-toolkit/compat";
|
|
5
5
|
import { InternalBasePlugin } from "./base.js";
|
|
6
6
|
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
7
7
|
class InternalSummaryPlugin extends InternalBasePlugin {
|
|
@@ -46,7 +46,7 @@ const external_enhanced_resolve_namespaceObject = require("enhanced-resolve");
|
|
|
46
46
|
var external_enhanced_resolve_default = /*#__PURE__*/ __webpack_require__.n(external_enhanced_resolve_namespaceObject);
|
|
47
47
|
const external_fs_namespaceObject = require("fs");
|
|
48
48
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
49
|
-
const
|
|
49
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
50
50
|
const external_path_namespaceObject = require("path");
|
|
51
51
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
52
52
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -65,7 +65,7 @@ function getInternalLoaderOptions(loaderContext) {
|
|
|
65
65
|
function getLoaderOptionsWithoutInternalKeys(loaderContext) {
|
|
66
66
|
const options = loaderContext.getOptions();
|
|
67
67
|
const circlePaths = [];
|
|
68
|
-
const loaderOptions = (0,
|
|
68
|
+
const loaderOptions = (0, compat_namespaceObject.omit)(options, [
|
|
69
69
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
70
70
|
]);
|
|
71
71
|
(0, external_circleDetect_cjs_namespaceObject.checkCirclePath)(loaderOptions, [], circlePaths, 0);
|
|
@@ -3,7 +3,7 @@ import 'module';
|
|
|
3
3
|
import axios from "../../../compiled/axios/index.js";
|
|
4
4
|
import enhanced_resolve from "enhanced-resolve";
|
|
5
5
|
import fs from "fs";
|
|
6
|
-
import { omit } from "
|
|
6
|
+
import { omit } from "es-toolkit/compat";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import { logger } from "@rsdoctor/utils/logger";
|
|
9
9
|
import { Loader, Lodash, Time } from "@rsdoctor/utils/common";
|
|
@@ -40,13 +40,13 @@ const sdk_namespaceObject = require("@rsdoctor/sdk");
|
|
|
40
40
|
const plugins_namespaceObject = require("@rsdoctor/core/plugins");
|
|
41
41
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
42
42
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
43
|
-
const
|
|
43
|
+
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
47
|
var _rest_module, _rest_module1;
|
|
48
48
|
const { plugins, infrastructureLogging, ...rest } = config;
|
|
49
|
-
const _rest = (0,
|
|
49
|
+
const _rest = (0, compat_namespaceObject.cloneDeep)(rest);
|
|
50
50
|
if (null == (_rest_module = _rest.module) ? void 0 : _rest_module.defaultRules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.defaultRules);
|
|
51
51
|
if (null == (_rest_module1 = _rest.module) ? void 0 : _rest_module1.rules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.rules);
|
|
52
52
|
return {
|
|
@@ -4,7 +4,7 @@ import { openBrowser } from "@rsdoctor/sdk";
|
|
|
4
4
|
import { makeRulesSerializable } from "@rsdoctor/core/plugins";
|
|
5
5
|
import { SDK } from "@rsdoctor/types";
|
|
6
6
|
import { chalk } from "@rsdoctor/utils/logger";
|
|
7
|
-
import { cloneDeep } from "
|
|
7
|
+
import { cloneDeep } from "es-toolkit/compat";
|
|
8
8
|
import path from "path";
|
|
9
9
|
function processCompilerConfig(config) {
|
|
10
10
|
var _rest_module, _rest_module1;
|
|
@@ -29,7 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
30
30
|
const external_rule_cjs_namespaceObject = require("../../rule.cjs");
|
|
31
31
|
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
32
|
-
const
|
|
32
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
33
33
|
const title = 'cross-chunks-package';
|
|
34
34
|
const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
35
35
|
meta: {
|
|
@@ -56,7 +56,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
56
56
|
};
|
|
57
57
|
const chunks = [];
|
|
58
58
|
pkg.duplicates.forEach((dup)=>chunks.push(...dup.chunks.map((ck)=>ck.name)));
|
|
59
|
-
const message = (0, external_utils_cjs_namespaceObject.getErrorMsgForDupPckChunks)((0,
|
|
59
|
+
const message = (0, external_utils_cjs_namespaceObject.getErrorMsgForDupPckChunks)((0, compat_namespaceObject.uniq)(chunks), pkg.name);
|
|
60
60
|
report({
|
|
61
61
|
message,
|
|
62
62
|
detail
|
|
@@ -3,7 +3,7 @@ import 'module';
|
|
|
3
3
|
import { Linter } from "@rsdoctor/types";
|
|
4
4
|
import { defineRule } from "../../rule.js";
|
|
5
5
|
import { getErrorMsgForDupPckChunks } from "./utils.js";
|
|
6
|
-
import { uniq } from "
|
|
6
|
+
import { uniq } from "es-toolkit/compat";
|
|
7
7
|
const title = 'cross-chunks-package';
|
|
8
8
|
const rule = defineRule(()=>({
|
|
9
9
|
meta: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -66,24 +66,23 @@
|
|
|
66
66
|
"enhanced-resolve": "5.12.0",
|
|
67
67
|
"filesize": "^10.1.6",
|
|
68
68
|
"fs-extra": "^11.1.1",
|
|
69
|
-
"lodash-es": "^4.17.21",
|
|
70
69
|
"semver": "^7.7.3",
|
|
71
70
|
"source-map": "^0.7.6",
|
|
72
|
-
"@rsdoctor/
|
|
73
|
-
"@rsdoctor/
|
|
74
|
-
"@rsdoctor/
|
|
75
|
-
"@rsdoctor/
|
|
71
|
+
"@rsdoctor/graph": "1.3.4",
|
|
72
|
+
"@rsdoctor/sdk": "1.3.4",
|
|
73
|
+
"@rsdoctor/types": "1.3.4",
|
|
74
|
+
"@rsdoctor/utils": "1.3.4"
|
|
76
75
|
},
|
|
77
76
|
"devDependencies": {
|
|
78
77
|
"axios": "^1.12.2",
|
|
79
78
|
"@rspack/core": "1.5.8",
|
|
80
79
|
"@types/fs-extra": "^11.0.4",
|
|
81
|
-
"@types/lodash-es": "^4.17.12",
|
|
82
80
|
"@types/node": "^22.8.1",
|
|
83
81
|
"@types/node-fetch": "^2.6.13",
|
|
84
82
|
"@types/semver": "^7.7.1",
|
|
85
83
|
"@types/tapable": "2.2.7",
|
|
86
84
|
"babel-loader": "10.0.0",
|
|
85
|
+
"es-toolkit": "^1.40.0",
|
|
87
86
|
"prebundle": "1.4.2",
|
|
88
87
|
"string-loader": "0.0.1",
|
|
89
88
|
"ts-loader": "^9.5.4",
|