@rsdoctor/core 1.5.2 → 1.5.3
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/compiled/axios/index.d.ts +1 -0
- package/compiled/axios/index.js +1898 -1479
- package/compiled/axios/package.json +1 -1
- package/dist/build-utils/build/module-graph/rspack/transform.cjs +32 -5
- package/dist/build-utils/build/module-graph/rspack/transform.d.ts +6 -0
- package/dist/build-utils/build/module-graph/rspack/transform.js +29 -5
- package/dist/build-utils/build/module-graph/webpack/transform.cjs +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.js +1 -1
- package/dist/inner-plugins/plugins/bundle.cjs +1 -1
- package/dist/inner-plugins/plugins/bundle.js +1 -1
- package/dist/inner-plugins/plugins/loader.cjs +3 -2
- package/dist/inner-plugins/plugins/loader.js +3 -2
- package/dist/inner-plugins/plugins/rspack.cjs +1 -0
- package/dist/inner-plugins/plugins/rspack.js +1 -0
- package/dist/inner-plugins/utils/loader.cjs +4 -9
- package/dist/inner-plugins/utils/loader.d.ts +4 -1
- package/dist/inner-plugins/utils/loader.js +4 -7
- package/dist/rules/rules/cross-chunks-package/index.cjs +4 -3
- package/dist/rules/rules/cross-chunks-package/index.js +4 -3
- package/dist/rules/rules/index.d.ts +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"axios","author":"Matt Zabriskie","version":"1.13.
|
|
1
|
+
{"name":"axios","author":"Matt Zabriskie","version":"1.13.6","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -24,9 +24,10 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
extractSideEffectCodes: ()=>extractSideEffectCodes,
|
|
28
|
+
patchNativeModuleSources: ()=>patchNativeModuleSources,
|
|
27
29
|
patchNativeModuleIds: ()=>patchNativeModuleIds,
|
|
28
|
-
patchNativeModuleGraph: ()=>patchNativeModuleGraph
|
|
29
|
-
patchNativeModuleSources: ()=>patchNativeModuleSources
|
|
30
|
+
patchNativeModuleGraph: ()=>patchNativeModuleGraph
|
|
30
31
|
});
|
|
31
32
|
const graph_namespaceObject = require("@rsdoctor/graph");
|
|
32
33
|
const types_namespaceObject = require("@rsdoctor/types");
|
|
@@ -74,10 +75,15 @@ function patchNativeModuleGraph(mg, cg, rawModuleGraph) {
|
|
|
74
75
|
for (const rawModule of rawModules){
|
|
75
76
|
const module = mg.getModuleById(rawModule.ukey);
|
|
76
77
|
module.setDependencies(rawModule.dependencies.map((ukey)=>mg.getDependencyById(ukey)).filter(Boolean));
|
|
77
|
-
}
|
|
78
|
-
for (const rawModule of rawModules){
|
|
79
|
-
const module = mg.getModuleById(rawModule.ukey);
|
|
80
78
|
if (module && rawModule.bailoutReason) rawModule.bailoutReason.filter((reason)=>!reason.includes('ModuleConcatenation bailout')).forEach((reason)=>module.addBailoutReason(reason));
|
|
79
|
+
if (module && 'sideEffectsLocations' in rawModule && Array.isArray(rawModule.sideEffectsLocations) && rawModule.sideEffectsLocations.length) rawModule.sideEffectsLocations.forEach((item)=>{
|
|
80
|
+
module.addSideEffectLocation({
|
|
81
|
+
location: item.location,
|
|
82
|
+
nodeType: item.nodeType,
|
|
83
|
+
module: item.module,
|
|
84
|
+
request: item.request
|
|
85
|
+
});
|
|
86
|
+
});
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
function patchNativeModuleIds(mg, rawModuleIdsPatch) {
|
|
@@ -101,10 +107,31 @@ function patchNativeModuleSources(mg, rawModuleSourcesPatch) {
|
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
}
|
|
110
|
+
function extractSideEffectCodes(mg) {
|
|
111
|
+
const modules = mg.getModules();
|
|
112
|
+
for (const module of modules){
|
|
113
|
+
const sideEffectLocations = module.getSideEffectLocations();
|
|
114
|
+
if (!sideEffectLocations.length) continue;
|
|
115
|
+
const moduleSource = module.getSource();
|
|
116
|
+
const source = moduleSource.source || moduleSource.parsedSource;
|
|
117
|
+
if (source) for (const sideEffectLocation of sideEffectLocations){
|
|
118
|
+
const parsedLocation = (0, graph_namespaceObject.parseLocation)(sideEffectLocation.location);
|
|
119
|
+
if (!parsedLocation) continue;
|
|
120
|
+
const code = (0, graph_namespaceObject.extractCodeFromLocation)(source, parsedLocation);
|
|
121
|
+
if (code) module.addSideEffectCode({
|
|
122
|
+
moduleId: module.id,
|
|
123
|
+
startLine: parsedLocation.startLine,
|
|
124
|
+
code
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.extractSideEffectCodes = __webpack_exports__.extractSideEffectCodes;
|
|
104
130
|
exports.patchNativeModuleGraph = __webpack_exports__.patchNativeModuleGraph;
|
|
105
131
|
exports.patchNativeModuleIds = __webpack_exports__.patchNativeModuleIds;
|
|
106
132
|
exports.patchNativeModuleSources = __webpack_exports__.patchNativeModuleSources;
|
|
107
133
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
134
|
+
"extractSideEffectCodes",
|
|
108
135
|
"patchNativeModuleGraph",
|
|
109
136
|
"patchNativeModuleIds",
|
|
110
137
|
"patchNativeModuleSources"
|
|
@@ -18,3 +18,9 @@ export declare function patchNativeModuleIds(mg: SDK.ModuleGraphInstance, rawMod
|
|
|
18
18
|
* @param rawModuleIdsPatch Raw sources patch data from Rspack native plugin
|
|
19
19
|
*/
|
|
20
20
|
export declare function patchNativeModuleSources(mg: SDK.ModuleGraphInstance, rawModuleSourcesPatch: Plugin.RspackNativeModuleSourcePatch): void;
|
|
21
|
+
/**
|
|
22
|
+
* Extract and store code snippets for side effect locations
|
|
23
|
+
* This should be called after module sources have been set
|
|
24
|
+
* @param mg The ModuleGraph instance with modules and side effect locations
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractSideEffectCodes(mg: SDK.ModuleGraphInstance): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
-
import { Dependency, Module } from "@rsdoctor/graph";
|
|
3
|
+
import { Dependency, Module, extractCodeFromLocation, parseLocation } from "@rsdoctor/graph";
|
|
4
4
|
import { SDK } from "@rsdoctor/types";
|
|
5
5
|
const createDependencyKind = (type)=>{
|
|
6
6
|
if (type.includes('harmony')) return SDK.DependencyKind.ImportStatement;
|
|
@@ -46,10 +46,15 @@ function patchNativeModuleGraph(mg, cg, rawModuleGraph) {
|
|
|
46
46
|
for (const rawModule of rawModules){
|
|
47
47
|
const module = mg.getModuleById(rawModule.ukey);
|
|
48
48
|
module.setDependencies(rawModule.dependencies.map((ukey)=>mg.getDependencyById(ukey)).filter(Boolean));
|
|
49
|
-
}
|
|
50
|
-
for (const rawModule of rawModules){
|
|
51
|
-
const module = mg.getModuleById(rawModule.ukey);
|
|
52
49
|
if (module && rawModule.bailoutReason) rawModule.bailoutReason.filter((reason)=>!reason.includes('ModuleConcatenation bailout')).forEach((reason)=>module.addBailoutReason(reason));
|
|
50
|
+
if (module && 'sideEffectsLocations' in rawModule && Array.isArray(rawModule.sideEffectsLocations) && rawModule.sideEffectsLocations.length) rawModule.sideEffectsLocations.forEach((item)=>{
|
|
51
|
+
module.addSideEffectLocation({
|
|
52
|
+
location: item.location,
|
|
53
|
+
nodeType: item.nodeType,
|
|
54
|
+
module: item.module,
|
|
55
|
+
request: item.request
|
|
56
|
+
});
|
|
57
|
+
});
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
function patchNativeModuleIds(mg, rawModuleIdsPatch) {
|
|
@@ -73,4 +78,23 @@ function patchNativeModuleSources(mg, rawModuleSourcesPatch) {
|
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
|
-
|
|
81
|
+
function extractSideEffectCodes(mg) {
|
|
82
|
+
const modules = mg.getModules();
|
|
83
|
+
for (const module of modules){
|
|
84
|
+
const sideEffectLocations = module.getSideEffectLocations();
|
|
85
|
+
if (!sideEffectLocations.length) continue;
|
|
86
|
+
const moduleSource = module.getSource();
|
|
87
|
+
const source = moduleSource.source || moduleSource.parsedSource;
|
|
88
|
+
if (source) for (const sideEffectLocation of sideEffectLocations){
|
|
89
|
+
const parsedLocation = parseLocation(sideEffectLocation.location);
|
|
90
|
+
if (!parsedLocation) continue;
|
|
91
|
+
const code = extractCodeFromLocation(source, parsedLocation);
|
|
92
|
+
if (code) module.addSideEffectCode({
|
|
93
|
+
moduleId: module.id,
|
|
94
|
+
startLine: parsedLocation.startLine,
|
|
95
|
+
code
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
export { extractSideEffectCodes, patchNativeModuleGraph, patchNativeModuleIds, patchNativeModuleSources };
|
|
@@ -125,7 +125,7 @@ async function appendModuleData(origin, webpackGraph, graph, wbFs, features, con
|
|
|
125
125
|
if (packagePathMap && origin.resourceResolveData) {
|
|
126
126
|
let { descriptionFileRoot: root } = origin.resourceResolveData;
|
|
127
127
|
const { descriptionFileData: data } = origin.resourceResolveData;
|
|
128
|
-
if (root && data.name && data.version) {
|
|
128
|
+
if (root && data && data.name && data.version) {
|
|
129
129
|
if (packagePathMap.has(root)) root = packagePathMap.get(root);
|
|
130
130
|
else {
|
|
131
131
|
const realpath = await external_node_fs_default().promises.realpath(root, {
|
|
@@ -88,7 +88,7 @@ async function appendModuleData(origin, webpackGraph, graph, wbFs, features, con
|
|
|
88
88
|
if (packagePathMap && origin.resourceResolveData) {
|
|
89
89
|
let { descriptionFileRoot: root } = origin.resourceResolveData;
|
|
90
90
|
const { descriptionFileData: data } = origin.resourceResolveData;
|
|
91
|
-
if (root && data.name && data.version) {
|
|
91
|
+
if (root && data && data.name && data.version) {
|
|
92
92
|
if (packagePathMap.has(root)) root = packagePathMap.get(root);
|
|
93
93
|
else {
|
|
94
94
|
const realpath = await node_fs.promises.realpath(root, {
|
|
@@ -48,7 +48,7 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
48
48
|
if (!compiler.options.output) compiler.options.output = {};
|
|
49
49
|
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
50
50
|
logger_namespaceObject.logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
|
|
51
|
-
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
51
|
+
if ('string' == typeof devtool && devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
ensureAssetContent(name) {
|
|
@@ -22,7 +22,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
22
22
|
if (!compiler.options.output) compiler.options.output = {};
|
|
23
23
|
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
24
24
|
logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
|
|
25
|
-
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
25
|
+
if ('string' == typeof devtool && devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
ensureAssetContent(name) {
|
|
@@ -67,7 +67,8 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
67
67
|
const wrapper = (callback)=>(loaderContext, module)=>{
|
|
68
68
|
const proxyLoaders = module?.loaders || loaderContext?.loaders || [];
|
|
69
69
|
const originLoaders = proxyLoaders.map((loader)=>{
|
|
70
|
-
const
|
|
70
|
+
const rawOptions = loader.options;
|
|
71
|
+
const opts = 'object' == typeof rawOptions && null !== rawOptions ? rawOptions : {};
|
|
71
72
|
if (opts[common_namespaceObject.Loader.LoaderInternalPropertyName]) return {
|
|
72
73
|
...loader,
|
|
73
74
|
loader: opts[common_namespaceObject.Loader.LoaderInternalPropertyName].loader,
|
|
@@ -104,7 +105,7 @@ class InternalLoaderPlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
104
105
|
if (!(0, compat_namespaceObject.isEqual)(originLoaders, newLoaders)) {
|
|
105
106
|
const rules = this.getInterceptRules(compiler, newLoaders.map((e)=>({
|
|
106
107
|
loader: e.loader,
|
|
107
|
-
options: e.options
|
|
108
|
+
options: e.options ?? void 0
|
|
108
109
|
})));
|
|
109
110
|
module.loaders = rules.map((e, i)=>({
|
|
110
111
|
...newLoaders[i],
|
|
@@ -28,7 +28,8 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
28
28
|
const wrapper = (callback)=>(loaderContext, module)=>{
|
|
29
29
|
const proxyLoaders = module?.loaders || loaderContext?.loaders || [];
|
|
30
30
|
const originLoaders = proxyLoaders.map((loader)=>{
|
|
31
|
-
const
|
|
31
|
+
const rawOptions = loader.options;
|
|
32
|
+
const opts = 'object' == typeof rawOptions && null !== rawOptions ? rawOptions : {};
|
|
32
33
|
if (opts[Loader.LoaderInternalPropertyName]) return {
|
|
33
34
|
...loader,
|
|
34
35
|
loader: opts[Loader.LoaderInternalPropertyName].loader,
|
|
@@ -65,7 +66,7 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
65
66
|
if (!isEqual(originLoaders, newLoaders)) {
|
|
66
67
|
const rules = this.getInterceptRules(compiler, newLoaders.map((e)=>({
|
|
67
68
|
loader: e.loader,
|
|
68
|
-
options: e.options
|
|
69
|
+
options: e.options ?? void 0
|
|
69
70
|
})));
|
|
70
71
|
module.loaders = rules.map((e, i)=>({
|
|
71
72
|
...newLoaders[i],
|
|
@@ -63,6 +63,7 @@ function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
|
63
63
|
},
|
|
64
64
|
moduleSourcesPatchData: (data)=>{
|
|
65
65
|
index_cjs_namespaceObject.ModuleGraph.patchNativeModuleSources(plugin.modulesGraph, data);
|
|
66
|
+
index_cjs_namespaceObject.ModuleGraph.extractSideEffectCodes(plugin.modulesGraph);
|
|
66
67
|
},
|
|
67
68
|
assetPatchData: (data)=>{
|
|
68
69
|
index_cjs_namespaceObject.Chunks.patchNativeAssets(plugin.chunkGraph, data);
|
|
@@ -37,6 +37,7 @@ function applyRspackNativePlugin(compiler, plugin, RsdoctorRspackPlugin) {
|
|
|
37
37
|
},
|
|
38
38
|
moduleSourcesPatchData: (data)=>{
|
|
39
39
|
ModuleGraph.patchNativeModuleSources(plugin.modulesGraph, data);
|
|
40
|
+
ModuleGraph.extractSideEffectCodes(plugin.modulesGraph);
|
|
40
41
|
},
|
|
41
42
|
assetPatchData: (data)=>{
|
|
42
43
|
Chunks.patchNativeAssets(plugin.chunkGraph, data);
|
|
@@ -42,10 +42,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
42
42
|
});
|
|
43
43
|
const index_js_namespaceObject = require("../../../compiled/axios/index.js");
|
|
44
44
|
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
45
|
-
const
|
|
46
|
-
var external_enhanced_resolve_default = /*#__PURE__*/ __webpack_require__.n(external_enhanced_resolve_namespaceObject);
|
|
47
|
-
const external_fs_namespaceObject = require("fs");
|
|
48
|
-
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
45
|
+
const resolver_namespaceObject = require("@rspack/resolver");
|
|
49
46
|
const compat_namespaceObject = require("es-toolkit/compat");
|
|
50
47
|
const external_path_namespaceObject = require("path");
|
|
51
48
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
@@ -57,7 +54,6 @@ const external_sdk_cjs_namespaceObject = require("./sdk.cjs");
|
|
|
57
54
|
const external_circleDetect_cjs_namespaceObject = require("./circleDetect.cjs");
|
|
58
55
|
const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
|
|
59
56
|
const utils_index_cjs_namespaceObject = require("../../build-utils/build/utils/index.cjs");
|
|
60
|
-
const { CachedInputFileSystem, create: ResolverCreator } = external_enhanced_resolve_default();
|
|
61
57
|
function getInternalLoaderOptions(loaderContext) {
|
|
62
58
|
const options = loaderContext.getOptions();
|
|
63
59
|
return options[common_namespaceObject.Loader.LoaderInternalPropertyName];
|
|
@@ -89,8 +85,7 @@ function shouldSkipLoader(loaderContext) {
|
|
|
89
85
|
return false;
|
|
90
86
|
}
|
|
91
87
|
function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolveLoader) {
|
|
92
|
-
const loaderResolver =
|
|
93
|
-
fileSystem: new CachedInputFileSystem(external_fs_default(), 4000),
|
|
88
|
+
const loaderResolver = new resolver_namespaceObject.ResolverFactory({
|
|
94
89
|
conditionNames: [
|
|
95
90
|
'loader',
|
|
96
91
|
'require',
|
|
@@ -117,8 +112,8 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
117
112
|
});
|
|
118
113
|
const resolve = (target)=>{
|
|
119
114
|
try {
|
|
120
|
-
const result = loaderResolver(
|
|
121
|
-
if (
|
|
115
|
+
const result = loaderResolver.sync(cwd, target);
|
|
116
|
+
if (result.path) return result.path;
|
|
122
117
|
} catch (e) {}
|
|
123
118
|
return target;
|
|
124
119
|
};
|
|
@@ -6,5 +6,8 @@ export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderCon
|
|
|
6
6
|
export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): Omit<ProxyLoaderOptions, typeof Loader.LoaderInternalPropertyName>;
|
|
7
7
|
export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
|
|
8
8
|
export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
|
|
9
|
-
export
|
|
9
|
+
export type CompatibleResolve = Omit<Plugin.Configuration['resolve'], 'mainFields'> & {
|
|
10
|
+
mainFields?: string[];
|
|
11
|
+
};
|
|
12
|
+
export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, cwd?: string, resolveLoader?: CompatibleResolve): T[];
|
|
10
13
|
export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Plugin.SourceMapInput): Promise<SDK.LoaderData>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
3
|
import axios from "../../../compiled/axios/index.js";
|
|
4
|
-
import
|
|
5
|
-
import fs from "fs";
|
|
4
|
+
import { ResolverFactory } from "@rspack/resolver";
|
|
6
5
|
import { omit } from "es-toolkit/compat";
|
|
7
6
|
import path from "path";
|
|
8
7
|
import { logger } from "@rsdoctor/utils/logger";
|
|
@@ -13,7 +12,6 @@ import { getSDK } from "./sdk.js";
|
|
|
13
12
|
import { checkCirclePath } from "./circleDetect.js";
|
|
14
13
|
import { Utils } from "../../build-utils/build/index.js";
|
|
15
14
|
import { isESMLoader, parseQuery } from "../../build-utils/build/utils/index.js";
|
|
16
|
-
const { CachedInputFileSystem, create: ResolverCreator } = enhanced_resolve;
|
|
17
15
|
function getInternalLoaderOptions(loaderContext) {
|
|
18
16
|
const options = loaderContext.getOptions();
|
|
19
17
|
return options[Loader.LoaderInternalPropertyName];
|
|
@@ -45,8 +43,7 @@ function shouldSkipLoader(loaderContext) {
|
|
|
45
43
|
return false;
|
|
46
44
|
}
|
|
47
45
|
function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolveLoader) {
|
|
48
|
-
const loaderResolver =
|
|
49
|
-
fileSystem: new CachedInputFileSystem(fs, 4000),
|
|
46
|
+
const loaderResolver = new ResolverFactory({
|
|
50
47
|
conditionNames: [
|
|
51
48
|
'loader',
|
|
52
49
|
'require',
|
|
@@ -73,8 +70,8 @@ function interceptLoader(rules, loaderPath, options, cwd = process.cwd(), resolv
|
|
|
73
70
|
});
|
|
74
71
|
const resolve = (target)=>{
|
|
75
72
|
try {
|
|
76
|
-
const result = loaderResolver(
|
|
77
|
-
if (
|
|
73
|
+
const result = loaderResolver.sync(cwd, target);
|
|
74
|
+
if (result.path) return result.path;
|
|
78
75
|
} catch (e) {}
|
|
79
76
|
return target;
|
|
80
77
|
};
|
|
@@ -42,11 +42,12 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
check ({ packageGraph, report }) {
|
|
45
|
-
const packages = packageGraph.getPackages().filter((pkg)=>pkg.duplicates
|
|
45
|
+
const packages = packageGraph.getPackages().filter((pkg)=>(pkg.duplicates?.length ?? 0) > 0);
|
|
46
46
|
for (const pkg of packages){
|
|
47
|
+
const duplicates = pkg.duplicates;
|
|
47
48
|
const detail = {
|
|
48
49
|
type: title,
|
|
49
|
-
chunks:
|
|
50
|
+
chunks: duplicates,
|
|
50
51
|
package: {
|
|
51
52
|
name: pkg.name,
|
|
52
53
|
id: pkg.id,
|
|
@@ -55,7 +56,7 @@ const rule = (0, external_rule_cjs_namespaceObject.defineRule)(()=>({
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
const chunks = [];
|
|
58
|
-
|
|
59
|
+
duplicates.forEach((dup)=>chunks.push(...dup.chunks.map((ck)=>ck.name)));
|
|
59
60
|
const message = (0, external_utils_cjs_namespaceObject.getErrorMsgForDupPckChunks)((0, compat_namespaceObject.uniq)(chunks), pkg.name);
|
|
60
61
|
report({
|
|
61
62
|
message,
|
|
@@ -16,11 +16,12 @@ const rule = defineRule(()=>({
|
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
check ({ packageGraph, report }) {
|
|
19
|
-
const packages = packageGraph.getPackages().filter((pkg)=>pkg.duplicates
|
|
19
|
+
const packages = packageGraph.getPackages().filter((pkg)=>(pkg.duplicates?.length ?? 0) > 0);
|
|
20
20
|
for (const pkg of packages){
|
|
21
|
+
const duplicates = pkg.duplicates;
|
|
21
22
|
const detail = {
|
|
22
23
|
type: title,
|
|
23
|
-
chunks:
|
|
24
|
+
chunks: duplicates,
|
|
24
25
|
package: {
|
|
25
26
|
name: pkg.name,
|
|
26
27
|
id: pkg.id,
|
|
@@ -29,7 +30,7 @@ const rule = defineRule(()=>({
|
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
const chunks = [];
|
|
32
|
-
|
|
33
|
+
duplicates.forEach((dup)=>chunks.push(...dup.chunks.map((ck)=>ck.name)));
|
|
33
34
|
const message = getErrorMsgForDupPckChunks(uniq(chunks), pkg.name);
|
|
34
35
|
report({
|
|
35
36
|
message,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const rules: (import("
|
|
1
|
+
export declare const rules: (import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package/index.js").Config, "duplicate-package"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./default-import-check/index.js").Config, "default-import-check"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization/index.js").Config, "loader-performance-optimization"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check/index.js").Config, "ecma-version-check"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./cross-chunks-package/index.js").Config, "cross-chunks-package"> | import("node_modules/@rsdoctor/types/dist/linter").RuleData<import("./module-mixed-chunks/index.js").Config, "module-mixed-chunks">)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -63,32 +63,32 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"browserslist-load-config": "^1.0.1",
|
|
65
65
|
"@rsbuild/plugin-check-syntax": "1.6.1",
|
|
66
|
-
"
|
|
67
|
-
"es-toolkit": "^1.
|
|
66
|
+
"@rspack/resolver": "0.2.6",
|
|
67
|
+
"es-toolkit": "^1.44.0",
|
|
68
68
|
"filesize": "^10.1.6",
|
|
69
69
|
"fs-extra": "^11.1.1",
|
|
70
|
-
"semver": "^7.7.
|
|
70
|
+
"semver": "^7.7.4",
|
|
71
71
|
"source-map": "^0.7.6",
|
|
72
|
-
"@rsdoctor/graph": "1.5.
|
|
73
|
-
"@rsdoctor/types": "1.5.
|
|
74
|
-
"@rsdoctor/utils": "1.5.
|
|
75
|
-
"@rsdoctor/sdk": "1.5.
|
|
72
|
+
"@rsdoctor/graph": "1.5.3",
|
|
73
|
+
"@rsdoctor/types": "1.5.3",
|
|
74
|
+
"@rsdoctor/utils": "1.5.3",
|
|
75
|
+
"@rsdoctor/sdk": "1.5.3"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"axios": "^1.13.
|
|
79
|
-
"@rspack/core": "
|
|
78
|
+
"axios": "^1.13.6",
|
|
79
|
+
"@rspack/core": "2.0.0-beta.5",
|
|
80
80
|
"@types/fs-extra": "^11.0.4",
|
|
81
81
|
"@types/node": "^22.8.1",
|
|
82
82
|
"@types/node-fetch": "^2.6.13",
|
|
83
83
|
"@types/semver": "^7.7.1",
|
|
84
84
|
"@types/tapable": "2.2.7",
|
|
85
85
|
"babel-loader": "10.0.0",
|
|
86
|
-
"prebundle": "1.
|
|
86
|
+
"prebundle": "1.6.2",
|
|
87
87
|
"string-loader": "0.0.1",
|
|
88
88
|
"ts-loader": "^9.5.4",
|
|
89
89
|
"tslib": "2.8.1",
|
|
90
90
|
"typescript": "^5.9.2",
|
|
91
|
-
"webpack": "^5.
|
|
91
|
+
"webpack": "^5.105.3",
|
|
92
92
|
"@scripts/test-helper": "0.1.1"
|
|
93
93
|
},
|
|
94
94
|
"publishConfig": {
|