@rsdoctor/core 1.5.6 → 1.5.8
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/utils/loader.js +6 -5
- package/dist/index.js +1 -1
- package/dist/inner-plugins/utils/loader.cjs +3 -9
- package/dist/inner-plugins/utils/loader.js +4 -9
- package/dist/rslib-runtime.js +0 -21
- package/dist/rules/rules/cjs-require/index.cjs +2 -1
- package/dist/rules/rules/cjs-require/index.js +2 -1
- package/dist/rules/rules/cjs-require/types.d.ts +4 -1
- package/dist/rules/rules/duplicate-package/index.js +4 -10
- package/dist/rules/rules/loader-performance-optimization/index.cjs +3 -3
- package/dist/rules/rules/loader-performance-optimization/index.js +3 -3
- package/package.json +7 -8
- package/compiled/axios/index.d.ts +0 -811
- package/compiled/axios/index.js +0 -10421
- package/compiled/axios/license +0 -7
- package/compiled/axios/package.json +0 -1
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import __rslib_shim_module__ from "node:module";
|
|
2
2
|
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
|
|
3
|
-
import * as __rspack_external_module from "module";
|
|
4
|
-
import { __webpack_require__ } from "../../../rslib-runtime.js";
|
|
5
3
|
import node_path from "node:path";
|
|
6
4
|
import { fileURLToPath } from "node:url";
|
|
7
5
|
import fs_extra from "fs-extra";
|
|
@@ -9,9 +7,12 @@ import { omit } from "es-toolkit/compat";
|
|
|
9
7
|
import { Loader } from "@rsdoctor/utils/common";
|
|
10
8
|
import { readPackageJson } from "@rsdoctor/graph";
|
|
11
9
|
import { logger } from "@rsdoctor/utils/logger";
|
|
10
|
+
import { __webpack_require__ } from "../../../rslib-runtime.js";
|
|
11
|
+
import { createRequire as __rspack_createRequire } from "node:module";
|
|
12
|
+
const __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
12
13
|
__webpack_require__.add({
|
|
13
|
-
"module?
|
|
14
|
-
module.exports =
|
|
14
|
+
"module?2382" (module) {
|
|
15
|
+
module.exports = __rspack_createRequire_require("module");
|
|
15
16
|
}
|
|
16
17
|
});
|
|
17
18
|
const loader_filename = fileURLToPath(import.meta.url);
|
|
@@ -27,7 +28,7 @@ function parsePathQueryFragment(str) {
|
|
|
27
28
|
}
|
|
28
29
|
function loadLoaderModule(loaderPath, cwd = process.cwd()) {
|
|
29
30
|
const cleanLoaderPath = parsePathQueryFragment(loaderPath).path;
|
|
30
|
-
const { createRequire } = __webpack_require__("module?
|
|
31
|
+
const { createRequire } = __webpack_require__("module?2382");
|
|
31
32
|
const requireFn = createRequire(import.meta.url);
|
|
32
33
|
const mod = requireFn(process.env.DOCTOR_TEST ? node_path.resolve(cwd, cleanLoaderPath) : requireFn.resolve(cleanLoaderPath, {
|
|
33
34
|
paths: [
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
+
import * as __rspack_external__inner_plugins_index_js_1dbd01aa from "./inner-plugins/index.js";
|
|
2
3
|
export * from "./build-utils/index.js";
|
|
3
4
|
export * from "./types/index.js";
|
|
4
|
-
import * as __rspack_external__inner_plugins_index_js_1dbd01aa from "./inner-plugins/index.js";
|
|
5
5
|
export { __rspack_external__inner_plugins_index_js_1dbd01aa as InnerPlugins };
|
|
@@ -40,8 +40,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
40
40
|
getInternalLoaderOptions: ()=>getInternalLoaderOptions,
|
|
41
41
|
getOriginLoaderModule: ()=>getOriginLoaderModule
|
|
42
42
|
});
|
|
43
|
-
const index_js_namespaceObject = require("../../../compiled/axios/index.js");
|
|
44
|
-
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
45
43
|
const resolver_namespaceObject = require("@rspack/resolver");
|
|
46
44
|
const compat_namespaceObject = require("es-toolkit/compat");
|
|
47
45
|
const external_path_namespaceObject = require("path");
|
|
@@ -114,7 +112,7 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
114
112
|
try {
|
|
115
113
|
const result = loaderResolver.sync(cwd, target);
|
|
116
114
|
if (result.path) return result.path;
|
|
117
|
-
} catch
|
|
115
|
+
} catch {}
|
|
118
116
|
return target;
|
|
119
117
|
};
|
|
120
118
|
return index_cjs_namespaceObject.Utils.mapEachRules(rules, (rule)=>{
|
|
@@ -192,14 +190,10 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
192
190
|
return loaderData;
|
|
193
191
|
}
|
|
194
192
|
await Promise.all([
|
|
195
|
-
|
|
196
|
-
timeout: 8888
|
|
197
|
-
}).catch((err)=>{
|
|
193
|
+
common_namespaceObject.Fetch.postJSON(`${host}${types_namespaceObject.SDK.ServerAPI.API.ReportLoader}`, loaderData, 8888).catch((err)=>{
|
|
198
194
|
logger_namespaceObject.logger.debug(`${err.message}`, '[WebpackPlugin.ReportLoader][error]');
|
|
199
195
|
}),
|
|
200
|
-
|
|
201
|
-
timeout: 8888
|
|
202
|
-
}).catch((err)=>{
|
|
196
|
+
common_namespaceObject.Fetch.postJSON(`${host}${types_namespaceObject.SDK.ServerAPI.API.ReportSourceMap}`, sourceMapData, 8888).catch((err)=>{
|
|
203
197
|
logger_namespaceObject.logger.debug(`${err.message}`, '[WebpackPlugin.ReportSourceMap][error]');
|
|
204
198
|
})
|
|
205
199
|
]);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import axios from "../../../compiled/axios/index.js";
|
|
3
2
|
import { ResolverFactory } from "@rspack/resolver";
|
|
4
3
|
import { omit } from "es-toolkit/compat";
|
|
5
4
|
import path from "path";
|
|
6
5
|
import { logger } from "@rsdoctor/utils/logger";
|
|
7
|
-
import { Loader, Lodash, Time } from "@rsdoctor/utils/common";
|
|
6
|
+
import { Fetch, Loader, Lodash, Time } from "@rsdoctor/utils/common";
|
|
8
7
|
import { SDK } from "@rsdoctor/types";
|
|
9
8
|
import { DevToolError } from "@rsdoctor/utils/error";
|
|
10
9
|
import { getSDK } from "./sdk.js";
|
|
@@ -71,7 +70,7 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
71
70
|
try {
|
|
72
71
|
const result = loaderResolver.sync(cwd, target);
|
|
73
72
|
if (result.path) return result.path;
|
|
74
|
-
} catch
|
|
73
|
+
} catch {}
|
|
75
74
|
return target;
|
|
76
75
|
};
|
|
77
76
|
return Utils.mapEachRules(rules, (rule)=>{
|
|
@@ -149,14 +148,10 @@ async function reportLoader(ctx, start, startHRTime, isPitch, sync, code, err, r
|
|
|
149
148
|
return loaderData;
|
|
150
149
|
}
|
|
151
150
|
await Promise.all([
|
|
152
|
-
|
|
153
|
-
timeout: 8888
|
|
154
|
-
}).catch((err)=>{
|
|
151
|
+
Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportLoader}`, loaderData, 8888).catch((err)=>{
|
|
155
152
|
logger.debug(`${err.message}`, '[WebpackPlugin.ReportLoader][error]');
|
|
156
153
|
}),
|
|
157
|
-
|
|
158
|
-
timeout: 8888
|
|
159
|
-
}).catch((err)=>{
|
|
154
|
+
Fetch.postJSON(`${host}${SDK.ServerAPI.API.ReportSourceMap}`, sourceMapData, 8888).catch((err)=>{
|
|
160
155
|
logger.debug(`${err.message}`, '[WebpackPlugin.ReportSourceMap][error]');
|
|
161
156
|
})
|
|
162
157
|
]);
|
package/dist/rslib-runtime.js
CHANGED
|
@@ -11,30 +11,9 @@ function __webpack_require__(moduleId) {
|
|
|
11
11
|
return module.exports;
|
|
12
12
|
}
|
|
13
13
|
__webpack_require__.m = __webpack_modules__;
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
16
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: definition[key]
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
14
|
(()=>{
|
|
23
15
|
__webpack_require__.add = function(modules) {
|
|
24
16
|
Object.assign(__webpack_require__.m, modules);
|
|
25
17
|
};
|
|
26
18
|
})();
|
|
27
|
-
(()=>{
|
|
28
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
29
|
-
})();
|
|
30
|
-
(()=>{
|
|
31
|
-
__webpack_require__.r = (exports)=>{
|
|
32
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
33
|
-
value: 'Module'
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(exports, '__esModule', {
|
|
36
|
-
value: true
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
})();
|
|
40
19
|
export { __webpack_require__ };
|
|
@@ -30,8 +30,9 @@ const types_namespaceObject = require("@rsdoctor/types");
|
|
|
30
30
|
const external_rule_cjs_namespaceObject = require("../../rule.cjs");
|
|
31
31
|
const title = 'cjs-require';
|
|
32
32
|
const CJS_REQUIRE_TYPE = 'cjs require';
|
|
33
|
+
const NODE_MODULES_PATH_REGEXP = /[/\\]node_modules[/\\]/;
|
|
33
34
|
function isNodeModulesPath(modulePath) {
|
|
34
|
-
return
|
|
35
|
+
return NODE_MODULES_PATH_REGEXP.test(modulePath);
|
|
35
36
|
}
|
|
36
37
|
const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
37
38
|
meta: {
|
|
@@ -3,8 +3,9 @@ import { Linter } from "@rsdoctor/types";
|
|
|
3
3
|
import { defineRule } from "../../rule.js";
|
|
4
4
|
const title = 'cjs-require';
|
|
5
5
|
const CJS_REQUIRE_TYPE = 'cjs require';
|
|
6
|
+
const NODE_MODULES_PATH_REGEXP = /[/\\]node_modules[/\\]/;
|
|
6
7
|
function isNodeModulesPath(modulePath) {
|
|
7
|
-
return
|
|
8
|
+
return NODE_MODULES_PATH_REGEXP.test(modulePath);
|
|
8
9
|
}
|
|
9
10
|
const rule = defineRule(()=>({
|
|
10
11
|
meta: {
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { __webpack_require__ } from "../../../rslib-runtime.js";
|
|
3
2
|
import { Linter } from "@rsdoctor/types";
|
|
4
3
|
import { diff, gt } from "semver";
|
|
5
|
-
import { CheckVersionMap } from "./types.js";
|
|
6
4
|
import { getErrorDetail, getErrorMsg } from "./utils.js";
|
|
7
5
|
import { defineRule } from "../../rule.js";
|
|
8
|
-
|
|
9
|
-
__webpack_require__.r(external_types_js_namespaceObject);
|
|
10
|
-
__webpack_require__.d(external_types_js_namespaceObject, {
|
|
11
|
-
CheckVersionMap: ()=>CheckVersionMap
|
|
12
|
-
});
|
|
6
|
+
import * as __rspack_external__types_js_7eec16d2 from "./types.js";
|
|
13
7
|
const title = 'duplicate-package';
|
|
14
|
-
const { CheckVersionMap:
|
|
8
|
+
const { CheckVersionMap: CheckVersionMap } = __rspack_external__types_js_7eec16d2;
|
|
15
9
|
const rule = defineRule(()=>({
|
|
16
10
|
meta: {
|
|
17
11
|
code: 'E1001',
|
|
@@ -24,9 +18,9 @@ const rule = defineRule(()=>({
|
|
|
24
18
|
}
|
|
25
19
|
},
|
|
26
20
|
check ({ packageGraph, report, root, ruleConfig }) {
|
|
27
|
-
const checkVersion =
|
|
21
|
+
const checkVersion = CheckVersionMap[ruleConfig.checkVersion];
|
|
28
22
|
const packages = packageGraph.getDuplicatePackages().filter((pkg)=>!ruleConfig.ignore.includes(pkg[0].name)).map((pkgs)=>pkgs.filter((current)=>{
|
|
29
|
-
const check = pkgs.reduce((ans, pkg)=>ans |
|
|
23
|
+
const check = pkgs.reduce((ans, pkg)=>ans | CheckVersionMap[diff(current.version, pkg.version) ?? 'null'], 0);
|
|
30
24
|
return check <= checkVersion;
|
|
31
25
|
}).sort((_packA, _packB)=>gt(_packA.version, _packB.version) ? 1 : -1)).filter((pkgs)=>pkgs.length > 1 && pkgs.filter((pkg)=>pkg.getSize().parsedSize > 0).length > 1);
|
|
32
26
|
for (const pkg of packages){
|
|
@@ -94,11 +94,11 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
94
94
|
const outofCwdFiles = v.filter((e)=>!e.__resource__.path.startsWith(cwd));
|
|
95
95
|
const outofCwdFilesCosts = sum(outofCwdFiles);
|
|
96
96
|
const msg = [
|
|
97
|
-
nodeModulesFilesCosts >= threshold &&
|
|
98
|
-
outofCwdFilesCosts >= threshold &&
|
|
97
|
+
nodeModulesFilesCosts >= threshold && `${nodeModulesFiles.length} node_modules files (costs: ${common_namespaceObject.Time.formatCosts(nodeModulesFilesCosts)})`,
|
|
98
|
+
outofCwdFilesCosts >= threshold && `${outofCwdFiles.length} outside project files (costs: ${common_namespaceObject.Time.formatCosts(outofCwdFilesCosts)})`
|
|
99
99
|
].filter(Boolean).join(' and ');
|
|
100
100
|
if (msg) {
|
|
101
|
-
const message =
|
|
101
|
+
const message = `${loaderName} has processed ${msg}.`;
|
|
102
102
|
report({
|
|
103
103
|
message,
|
|
104
104
|
detail: {
|
|
@@ -67,11 +67,11 @@ const rule = defineRule(()=>({
|
|
|
67
67
|
const outofCwdFiles = v.filter((e)=>!e.__resource__.path.startsWith(cwd));
|
|
68
68
|
const outofCwdFilesCosts = sum(outofCwdFiles);
|
|
69
69
|
const msg = [
|
|
70
|
-
nodeModulesFilesCosts >= threshold &&
|
|
71
|
-
outofCwdFilesCosts >= threshold &&
|
|
70
|
+
nodeModulesFilesCosts >= threshold && `${nodeModulesFiles.length} node_modules files (costs: ${Time.formatCosts(nodeModulesFilesCosts)})`,
|
|
71
|
+
outofCwdFilesCosts >= threshold && `${outofCwdFiles.length} outside project files (costs: ${Time.formatCosts(outofCwdFilesCosts)})`
|
|
72
72
|
].filter(Boolean).join(' and ');
|
|
73
73
|
if (msg) {
|
|
74
|
-
const message =
|
|
74
|
+
const message = `${loaderName} has processed ${msg}.`;
|
|
75
75
|
report({
|
|
76
76
|
message,
|
|
77
77
|
detail: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -69,14 +69,13 @@
|
|
|
69
69
|
"fs-extra": "^11.1.1",
|
|
70
70
|
"semver": "^7.7.4",
|
|
71
71
|
"source-map": "^0.7.6",
|
|
72
|
-
"@rsdoctor/graph": "1.5.
|
|
73
|
-
"@rsdoctor/
|
|
74
|
-
"@rsdoctor/utils": "1.5.
|
|
75
|
-
"@rsdoctor/
|
|
72
|
+
"@rsdoctor/graph": "1.5.8",
|
|
73
|
+
"@rsdoctor/sdk": "1.5.8",
|
|
74
|
+
"@rsdoctor/utils": "1.5.8",
|
|
75
|
+
"@rsdoctor/types": "1.5.8"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"
|
|
79
|
-
"@rspack/core": "2.0.0-canary-20260116",
|
|
78
|
+
"@rspack/core": "2.0.0-rc.1",
|
|
80
79
|
"@types/fs-extra": "^11.0.4",
|
|
81
80
|
"@types/node": "^22.8.1",
|
|
82
81
|
"@types/node-fetch": "^2.6.13",
|
|
@@ -85,7 +84,7 @@
|
|
|
85
84
|
"babel-loader": "10.1.1",
|
|
86
85
|
"prebundle": "1.6.4",
|
|
87
86
|
"string-loader": "0.0.1",
|
|
88
|
-
"ts-loader": "^9.5.
|
|
87
|
+
"ts-loader": "^9.5.7",
|
|
89
88
|
"tslib": "2.8.1",
|
|
90
89
|
"typescript": "^5.9.2",
|
|
91
90
|
"webpack": "^5.105.4",
|