@rsdoctor/core 1.3.3 → 1.3.5-beta.0
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 +2 -3
- package/dist/build-utils/build/loader/probeLoader.js +1 -1
- package/dist/build-utils/build/module-graph/utils.cjs +2 -12
- package/dist/build-utils/build/module-graph/utils.js +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +2 -3
- package/dist/build-utils/build/module-graph/webpack/transform.js +1 -1
- package/dist/build-utils/build/utils/loader.cjs +3 -4
- package/dist/build-utils/build/utils/loader.js +1 -1
- package/dist/build-utils/build/utils/parseBundle.cjs +3 -6
- package/dist/build-utils/build/utils/parseBundle.js +1 -2
- package/dist/inner-plugins/plugins/loader.cjs +5 -10
- package/dist/inner-plugins/plugins/loader.js +1 -3
- package/dist/inner-plugins/plugins/rules.cjs +3 -13
- 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 -15
- package/dist/inner-plugins/plugins/summary.js +1 -2
- package/dist/inner-plugins/utils/loader.cjs +2 -3
- package/dist/inner-plugins/utils/loader.js +1 -1
- package/dist/inner-plugins/utils/plugin-common.cjs +2 -3
- package/dist/inner-plugins/utils/plugin-common.js +1 -1
- package/dist/rules/rules/cross-chunks-package/index.cjs +2 -12
- package/dist/rules/rules/cross-chunks-package/index.js +1 -1
- package/package.json +6 -7
|
@@ -38,8 +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
|
|
42
|
-
var omit_js_default = /*#__PURE__*/ __webpack_require__.n(omit_js_namespaceObject);
|
|
41
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
43
42
|
const external_path_namespaceObject = require("path");
|
|
44
43
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
45
44
|
const loaderModule = function(...args) {
|
|
@@ -67,7 +66,7 @@ const loaderModule = function(...args) {
|
|
|
67
66
|
result: 'end' === _options.type ? code : null,
|
|
68
67
|
startAt: 'start' === _options.type ? time : 0,
|
|
69
68
|
endAt: 'end' === _options.type ? time : 0,
|
|
70
|
-
options:
|
|
69
|
+
options: (0, compat_namespaceObject.omit)(_options.options, 'type'),
|
|
71
70
|
isPitch: false,
|
|
72
71
|
sync: false,
|
|
73
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;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -36,8 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
36
27
|
getDeclarationIdentifier: ()=>getDeclarationIdentifier,
|
|
37
28
|
getExportIdentifierStatement: ()=>getExportIdentifierStatement
|
|
38
29
|
});
|
|
39
|
-
const
|
|
40
|
-
var isNumber_js_default = /*#__PURE__*/ __webpack_require__.n(isNumber_js_namespaceObject);
|
|
30
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
41
31
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
42
32
|
function getDefaultExportIdentifier(node, module, searchId) {
|
|
43
33
|
var _node_declaration_loc;
|
|
@@ -54,7 +44,7 @@ function getDefaultExportIdentifier(node, module, searchId) {
|
|
|
54
44
|
if (null == (_declaration_id = declaration.id) ? void 0 : _declaration_id.loc) return module.getStatement(declaration.id.loc);
|
|
55
45
|
}
|
|
56
46
|
const startLine = null == (_node_declaration_loc = node.declaration.loc) ? void 0 : _node_declaration_loc.start.line;
|
|
57
|
-
if (!
|
|
47
|
+
if (!(0, compat_namespaceObject.isNumber)(startLine)) return;
|
|
58
48
|
const { transformed } = module.getSource();
|
|
59
49
|
const endColumn = transformed.split('\n')[startLine - 1].length - 1;
|
|
60
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,8 +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
|
|
44
|
-
var isFunction_js_default = /*#__PURE__*/ __webpack_require__.n(isFunction_js_namespaceObject);
|
|
43
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
45
44
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
46
45
|
async function readFile(target, wbFs) {
|
|
47
46
|
var _wbFs_fs;
|
|
@@ -113,7 +112,7 @@ async function appendModuleData(origin, webpackGraph, graph, wbFs, features, con
|
|
|
113
112
|
module.setProgram(program);
|
|
114
113
|
module.meta.hasSetEsModuleStatement = (0, external_parser_cjs_namespaceObject.hasSetEsModuleStatement)(program);
|
|
115
114
|
}
|
|
116
|
-
const transformed = graph_namespaceObject.Webpack.isExternalModule(origin) ? '' : module.getSource().transformed.length > 0 ? module.getSource().transformed :
|
|
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()) ?? '' : '';
|
|
117
116
|
const transformedSize = graph_namespaceObject.Webpack.isExternalModule(origin) ? 0 : module.getSize().transformedSize > 0 ? module.getSize().transformedSize : Buffer.from(transformed).byteLength;
|
|
118
117
|
module.setSource({
|
|
119
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,8 +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
|
|
70
|
-
var omit_js_default = /*#__PURE__*/ __webpack_require__.n(omit_js_namespaceObject);
|
|
69
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
71
70
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
72
71
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
73
72
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -290,7 +289,7 @@ var __webpack_exports__ = {};
|
|
|
290
289
|
}
|
|
291
290
|
if ('object' == typeof target.query) {
|
|
292
291
|
const options = target.query[common_namespaceObject.Loader.LoaderInternalPropertyName];
|
|
293
|
-
if (options.hasOptions) return
|
|
292
|
+
if (options.hasOptions) return (0, compat_namespaceObject.omit)(target.query, [
|
|
294
293
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
295
294
|
]);
|
|
296
295
|
const innerLoaderPath = null == options ? void 0 : options.loader;
|
|
@@ -300,7 +299,7 @@ var __webpack_exports__ = {};
|
|
|
300
299
|
}
|
|
301
300
|
return Reflect.get(target, key, receiver);
|
|
302
301
|
case 'getOptions':
|
|
303
|
-
return 'function' == typeof target.getOptions ? ()=>
|
|
302
|
+
return 'function' == typeof target.getOptions ? ()=>(0, compat_namespaceObject.omit)(target.getOptions(), [
|
|
304
303
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
305
304
|
]) : Reflect.get(target, key, receiver);
|
|
306
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,10 +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
|
|
41
|
-
var find_js_default = /*#__PURE__*/ __webpack_require__.n(find_js_namespaceObject);
|
|
42
|
-
const mapValues_js_namespaceObject = require("lodash/mapValues.js");
|
|
43
|
-
var mapValues_js_default = /*#__PURE__*/ __webpack_require__.n(mapValues_js_namespaceObject);
|
|
40
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
44
41
|
const external_filesize_namespaceObject = require("filesize");
|
|
45
42
|
const ruleUtils_namespaceObject = require("@rsdoctor/utils/ruleUtils");
|
|
46
43
|
const external_path_namespaceObject = require("path");
|
|
@@ -142,14 +139,14 @@ const parseBundle = (bundlePath, modulesData)=>{
|
|
|
142
139
|
}
|
|
143
140
|
});
|
|
144
141
|
let modules;
|
|
145
|
-
modules = walkState.locations ?
|
|
142
|
+
modules = walkState.locations ? (0, compat_namespaceObject.mapValues)(walkState.locations, (loc)=>content.slice(loc.start, loc.end)) : {};
|
|
146
143
|
const modulesObj = {};
|
|
147
144
|
for(const module in modules){
|
|
148
145
|
var _find;
|
|
149
146
|
if (!module) return {};
|
|
150
147
|
const moduleContent = modules[module];
|
|
151
148
|
const size = moduleContent && Buffer.byteLength(moduleContent);
|
|
152
|
-
const identifier = (null == (_find =
|
|
149
|
+
const identifier = (null == (_find = (0, compat_namespaceObject.find)(modulesData, {
|
|
153
150
|
renderId: module
|
|
154
151
|
})) ? void 0 : _find.webpackId) || '';
|
|
155
152
|
modulesObj[identifier] = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import find from "
|
|
5
|
-
import mapValues from "lodash/mapValues.js";
|
|
4
|
+
import { find, mapValues } from "es-toolkit/compat";
|
|
6
5
|
import { filesize } from "filesize";
|
|
7
6
|
import { parser } from "@rsdoctor/utils/ruleUtils";
|
|
8
7
|
import { extname } from "path";
|
|
@@ -40,12 +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
|
|
44
|
-
var cloneDeep_js_default = /*#__PURE__*/ __webpack_require__.n(cloneDeep_js_namespaceObject);
|
|
45
|
-
const isEqual_js_namespaceObject = require("lodash/isEqual.js");
|
|
46
|
-
var isEqual_js_default = /*#__PURE__*/ __webpack_require__.n(isEqual_js_namespaceObject);
|
|
47
|
-
const omit_js_namespaceObject = require("lodash/omit.js");
|
|
48
|
-
var omit_js_default = /*#__PURE__*/ __webpack_require__.n(omit_js_namespaceObject);
|
|
43
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
49
44
|
const index_cjs_namespaceObject = require("../utils/index.cjs");
|
|
50
45
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
51
46
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -75,11 +70,11 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
75
70
|
if (opts[common_namespaceObject.Loader.LoaderInternalPropertyName]) return {
|
|
76
71
|
...loader,
|
|
77
72
|
loader: opts[common_namespaceObject.Loader.LoaderInternalPropertyName].loader,
|
|
78
|
-
options:
|
|
73
|
+
options: (0, compat_namespaceObject.omit)(opts, common_namespaceObject.Loader.LoaderInternalPropertyName)
|
|
79
74
|
};
|
|
80
75
|
return loader;
|
|
81
76
|
});
|
|
82
|
-
const newLoaders =
|
|
77
|
+
const newLoaders = (0, compat_namespaceObject.cloneDeep)(originLoaders);
|
|
83
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 || {});
|
|
84
79
|
else {
|
|
85
80
|
const proxyModule = new Proxy(module || {}, {
|
|
@@ -88,7 +83,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
88
83
|
return Reflect.get(target, p, receiver);
|
|
89
84
|
},
|
|
90
85
|
set (target, p, newValue, receiver) {
|
|
91
|
-
const _newValue =
|
|
86
|
+
const _newValue = (0, compat_namespaceObject.cloneDeep)(newValue);
|
|
92
87
|
if ('loaders' === p) {
|
|
93
88
|
if (Array.isArray(_newValue)) {
|
|
94
89
|
newLoaders.length = 0;
|
|
@@ -105,7 +100,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
105
100
|
});
|
|
106
101
|
callback(loaderContext, proxyModule);
|
|
107
102
|
}
|
|
108
|
-
if (!
|
|
103
|
+
if (!(0, compat_namespaceObject.isEqual)(originLoaders, newLoaders)) {
|
|
109
104
|
const rules = this.getInterceptRules(compiler, newLoaders.map((e)=>({
|
|
110
105
|
loader: e.loader,
|
|
111
106
|
options: e.options
|
|
@@ -2,9 +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 from "
|
|
6
|
-
import isEqual from "lodash/isEqual.js";
|
|
7
|
-
import omit from "lodash/omit.js";
|
|
5
|
+
import { cloneDeep, isEqual, omit } from "es-toolkit/compat";
|
|
8
6
|
import { interceptLoader } from "../utils/index.js";
|
|
9
7
|
import { InternalBasePlugin } from "./base.js";
|
|
10
8
|
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -38,8 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
29
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
39
30
|
const index_cjs_namespaceObject = require("../../rules/index.cjs");
|
|
40
31
|
const error_namespaceObject = require("@rsdoctor/utils/error");
|
|
41
|
-
const
|
|
42
|
-
var pull_js_default = /*#__PURE__*/ __webpack_require__.n(pull_js_namespaceObject);
|
|
32
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
43
33
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
44
34
|
class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
45
35
|
apply(compiler) {
|
|
@@ -66,8 +56,8 @@ class InternalRulesPlugin extends external_base_cjs_namespaceObject.InternalBase
|
|
|
66
56
|
const warnings = validateErrors.filter((item)=>'Warn' === item.level);
|
|
67
57
|
const toWebpackError = (err)=>err.toError();
|
|
68
58
|
result.replace.forEach((item)=>{
|
|
69
|
-
if (Array.isArray(compilation.errors) && compilation.errors.includes(item))
|
|
70
|
-
if (Array.isArray(compilation.warnings) && compilation.warnings.includes(item))
|
|
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);
|
|
71
61
|
});
|
|
72
62
|
if (Array.isArray(compilation.errors)) errors.forEach((err)=>{
|
|
73
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
|
}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -36,10 +27,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
36
27
|
InternalSummaryPlugin: ()=>InternalSummaryPlugin
|
|
37
28
|
});
|
|
38
29
|
const common_namespaceObject = require("@rsdoctor/utils/common");
|
|
39
|
-
const
|
|
40
|
-
var minBy_js_default = /*#__PURE__*/ __webpack_require__.n(minBy_js_namespaceObject);
|
|
41
|
-
const sumBy_js_namespaceObject = require("lodash/sumBy.js");
|
|
42
|
-
var sumBy_js_default = /*#__PURE__*/ __webpack_require__.n(sumBy_js_namespaceObject);
|
|
30
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
43
31
|
const external_base_cjs_namespaceObject = require("./base.cjs");
|
|
44
32
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
45
33
|
class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBasePlugin {
|
|
@@ -116,8 +104,8 @@ class InternalSummaryPlugin extends external_base_cjs_namespaceObject.InternalBa
|
|
|
116
104
|
costs: [
|
|
117
105
|
{
|
|
118
106
|
name: common_namespaceObject.Summary.SummaryCostsDataName.Minify,
|
|
119
|
-
startAt:
|
|
120
|
-
costs:
|
|
107
|
+
startAt: (0, compat_namespaceObject.minBy)(minifyHookData, (e)=>e.startAt).startAt,
|
|
108
|
+
costs: (0, compat_namespaceObject.sumBy)(minifyHookData, (e)=>e.costs)
|
|
121
109
|
}
|
|
122
110
|
]
|
|
123
111
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import { Summary } from "@rsdoctor/utils/common";
|
|
4
|
-
import minBy from "
|
|
5
|
-
import sumBy from "lodash/sumBy.js";
|
|
4
|
+
import { minBy, sumBy } from "es-toolkit/compat";
|
|
6
5
|
import { InternalBasePlugin } from "./base.js";
|
|
7
6
|
import { time, timeEnd } from "@rsdoctor/utils/logger";
|
|
8
7
|
class InternalSummaryPlugin extends InternalBasePlugin {
|
|
@@ -46,8 +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
|
|
50
|
-
var omit_js_default = /*#__PURE__*/ __webpack_require__.n(omit_js_namespaceObject);
|
|
49
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
51
50
|
const external_path_namespaceObject = require("path");
|
|
52
51
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
53
52
|
const logger_namespaceObject = require("@rsdoctor/utils/logger");
|
|
@@ -66,7 +65,7 @@ function getInternalLoaderOptions(loaderContext) {
|
|
|
66
65
|
function getLoaderOptionsWithoutInternalKeys(loaderContext) {
|
|
67
66
|
const options = loaderContext.getOptions();
|
|
68
67
|
const circlePaths = [];
|
|
69
|
-
const loaderOptions =
|
|
68
|
+
const loaderOptions = (0, compat_namespaceObject.omit)(options, [
|
|
70
69
|
common_namespaceObject.Loader.LoaderInternalPropertyName
|
|
71
70
|
]);
|
|
72
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,14 +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
|
|
44
|
-
var cloneDeep_js_default = /*#__PURE__*/ __webpack_require__.n(cloneDeep_js_namespaceObject);
|
|
43
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
45
44
|
const external_path_namespaceObject = require("path");
|
|
46
45
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
47
46
|
function processCompilerConfig(config) {
|
|
48
47
|
var _rest_module, _rest_module1;
|
|
49
48
|
const { plugins, infrastructureLogging, ...rest } = config;
|
|
50
|
-
const _rest =
|
|
49
|
+
const _rest = (0, compat_namespaceObject.cloneDeep)(rest);
|
|
51
50
|
if (null == (_rest_module = _rest.module) ? void 0 : _rest_module.defaultRules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.defaultRules);
|
|
52
51
|
if (null == (_rest_module1 = _rest.module) ? void 0 : _rest_module1.rules) (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.rules);
|
|
53
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;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
3
|
(()=>{
|
|
13
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
14
5
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -38,8 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
29
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
39
30
|
const external_rule_cjs_namespaceObject = require("../../rule.cjs");
|
|
40
31
|
const external_utils_cjs_namespaceObject = require("./utils.cjs");
|
|
41
|
-
const
|
|
42
|
-
var uniq_js_default = /*#__PURE__*/ __webpack_require__.n(uniq_js_namespaceObject);
|
|
32
|
+
const compat_namespaceObject = require("es-toolkit/compat");
|
|
43
33
|
const title = 'cross-chunks-package';
|
|
44
34
|
const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
45
35
|
meta: {
|
|
@@ -66,7 +56,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
66
56
|
};
|
|
67
57
|
const chunks = [];
|
|
68
58
|
pkg.duplicates.forEach((dup)=>chunks.push(...dup.chunks.map((ck)=>ck.name)));
|
|
69
|
-
const message = (0, external_utils_cjs_namespaceObject.getErrorMsgForDupPckChunks)(
|
|
59
|
+
const message = (0, external_utils_cjs_namespaceObject.getErrorMsgForDupPckChunks)((0, compat_namespaceObject.uniq)(chunks), pkg.name);
|
|
70
60
|
report({
|
|
71
61
|
message,
|
|
72
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.5-beta.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -64,21 +64,20 @@
|
|
|
64
64
|
"browserslist-load-config": "^1.0.1",
|
|
65
65
|
"@rsbuild/plugin-check-syntax": "1.4.0",
|
|
66
66
|
"enhanced-resolve": "5.12.0",
|
|
67
|
+
"es-toolkit": "^1.40.0",
|
|
67
68
|
"filesize": "^10.1.6",
|
|
68
69
|
"fs-extra": "^11.1.1",
|
|
69
|
-
"lodash": "^4.17.21",
|
|
70
70
|
"semver": "^7.7.3",
|
|
71
71
|
"source-map": "^0.7.6",
|
|
72
|
-
"@rsdoctor/graph": "1.3.
|
|
73
|
-
"@rsdoctor/sdk": "1.3.
|
|
74
|
-
"@rsdoctor/
|
|
75
|
-
"@rsdoctor/
|
|
72
|
+
"@rsdoctor/graph": "1.3.5-beta.0",
|
|
73
|
+
"@rsdoctor/sdk": "1.3.5-beta.0",
|
|
74
|
+
"@rsdoctor/types": "1.3.5-beta.0",
|
|
75
|
+
"@rsdoctor/utils": "1.3.5-beta.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"axios": "^1.12.2",
|
|
79
79
|
"@rspack/core": "1.5.8",
|
|
80
80
|
"@types/fs-extra": "^11.0.4",
|
|
81
|
-
"@types/lodash": "^4.17.20",
|
|
82
81
|
"@types/node": "^22.8.1",
|
|
83
82
|
"@types/node-fetch": "^2.6.13",
|
|
84
83
|
"@types/semver": "^7.7.1",
|