@rsdoctor/core 1.3.8 → 1.3.9
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/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 +2 -7
- package/dist/inner-plugins/plugins/bundle.js +2 -7
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +1 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +1 -1
- package/dist/inner-plugins/plugins/sourcemapTool.cjs +20 -1
- package/dist/inner-plugins/plugins/sourcemapTool.js +20 -1
- package/package.json +6 -6
|
@@ -70,7 +70,7 @@ function appendDependency(webpackDep, module, webpackGraph, graph) {
|
|
|
70
70
|
const resolveRequest = graph_namespaceObject.Webpack.getWebpackModulePath(resolvedWebpackModule);
|
|
71
71
|
const request = rawRequest ?? resolveRequest;
|
|
72
72
|
if (!module.getDependencyByRequest(request)) {
|
|
73
|
-
const depModule = graph.getModuleByFile(resolveRequest);
|
|
73
|
+
const depModule = graph.getModuleByFile(resolveRequest)[0];
|
|
74
74
|
if (depModule) {
|
|
75
75
|
const dep = module.addDependency(request, depModule, graph_namespaceObject.ModuleGraphTrans.getImportKind(webpackDep));
|
|
76
76
|
if (dep) graph.addDependency(dep);
|
|
@@ -33,7 +33,7 @@ function appendDependency(webpackDep, module, webpackGraph, graph) {
|
|
|
33
33
|
const resolveRequest = Webpack.getWebpackModulePath(resolvedWebpackModule);
|
|
34
34
|
const request = rawRequest ?? resolveRequest;
|
|
35
35
|
if (!module.getDependencyByRequest(request)) {
|
|
36
|
-
const depModule = graph.getModuleByFile(resolveRequest);
|
|
36
|
+
const depModule = graph.getModuleByFile(resolveRequest)[0];
|
|
37
37
|
if (depModule) {
|
|
38
38
|
const dep = module.addDependency(request, depModule, ModuleGraphTrans.getImportKind(webpackDep));
|
|
39
39
|
if (dep) graph.addDependency(dep);
|
|
@@ -35,12 +35,7 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
35
35
|
(0, logger_namespaceObject.time)('InternalBundlePlugin.apply');
|
|
36
36
|
try {
|
|
37
37
|
this.scheduler.ensureModulesChunksGraphApplied(compiler);
|
|
38
|
-
|
|
39
|
-
name: 'ChangeDevtoolModuleFilename',
|
|
40
|
-
stage: -100
|
|
41
|
-
}, ()=>{
|
|
42
|
-
this.changeDevtoolModuleFilename(compiler);
|
|
43
|
-
});
|
|
38
|
+
this.changeDevtoolModuleFilename(compiler);
|
|
44
39
|
compiler.hooks.compilation.tap(this.tapPostOptions, this.thisCompilation);
|
|
45
40
|
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
|
|
46
41
|
} finally{
|
|
@@ -54,7 +49,7 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
|
|
|
54
49
|
if (!compiler.options.output) compiler.options.output = {};
|
|
55
50
|
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
56
51
|
logger_namespaceObject.logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
|
|
57
|
-
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = '[absolute-resource-path]';
|
|
52
|
+
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
ensureAssetContent(name) {
|
|
@@ -9,12 +9,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
9
9
|
time('InternalBundlePlugin.apply');
|
|
10
10
|
try {
|
|
11
11
|
this.scheduler.ensureModulesChunksGraphApplied(compiler);
|
|
12
|
-
|
|
13
|
-
name: 'ChangeDevtoolModuleFilename',
|
|
14
|
-
stage: -100
|
|
15
|
-
}, ()=>{
|
|
16
|
-
this.changeDevtoolModuleFilename(compiler);
|
|
17
|
-
});
|
|
12
|
+
this.changeDevtoolModuleFilename(compiler);
|
|
18
13
|
compiler.hooks.compilation.tap(this.tapPostOptions, this.thisCompilation);
|
|
19
14
|
compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
|
|
20
15
|
} finally{
|
|
@@ -28,7 +23,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
28
23
|
if (!compiler.options.output) compiler.options.output = {};
|
|
29
24
|
compiler.options.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
30
25
|
logger.warn("output.devtoolModuleFilenameTemplate has been changed to [absolute-resource-path], this is for bundle analysis.");
|
|
31
|
-
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = '[absolute-resource-path]';
|
|
26
|
+
if (devtool.includes('source-map')) compiler.options.output.devtoolFallbackModuleFilenameTemplate = ()=>'[absolute-resource-path]';
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
29
|
ensureAssetContent(name) {
|
|
@@ -69,7 +69,7 @@ async function doneHandler(_stats, _this, context, compiler) {
|
|
|
69
69
|
let cached = null;
|
|
70
70
|
return ()=>{
|
|
71
71
|
if (cached) return cached;
|
|
72
|
-
cached = stats.toJson({
|
|
72
|
+
cached = 'lynx' === compiler.options.name ? stats.toJson() : stats.toJson({
|
|
73
73
|
all: false,
|
|
74
74
|
chunks: true,
|
|
75
75
|
modules: true,
|
|
@@ -41,7 +41,7 @@ async function doneHandler(_stats, _this, context, compiler) {
|
|
|
41
41
|
let cached = null;
|
|
42
42
|
return ()=>{
|
|
43
43
|
if (cached) return cached;
|
|
44
|
-
cached = stats.toJson({
|
|
44
|
+
cached = 'lynx' === compiler.options.name ? stats.toJson() : stats.toJson({
|
|
45
45
|
all: false,
|
|
46
46
|
chunks: true,
|
|
47
47
|
modules: true,
|
|
@@ -57,6 +57,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
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);
|
|
59
59
|
const lineMappings = new Map();
|
|
60
|
+
consumer._absoluteSources = consumer._sources;
|
|
60
61
|
consumer.eachMapping((m)=>{
|
|
61
62
|
if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
|
|
62
63
|
lineMappings.get(m.generatedLine).push(m);
|
|
@@ -69,7 +70,25 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
69
70
|
for(let i = 0; i < mappings.length; i++){
|
|
70
71
|
const m = mappings[i];
|
|
71
72
|
if (!m.source) continue;
|
|
72
|
-
let realSource = m.source
|
|
73
|
+
let realSource = m.source;
|
|
74
|
+
if (realSource.includes('!')) {
|
|
75
|
+
const parts = realSource.split('!');
|
|
76
|
+
for(let j = parts.length - 1; j >= 0; j--){
|
|
77
|
+
const part = parts[j];
|
|
78
|
+
if (!part) continue;
|
|
79
|
+
const cleanPart = part.split('??')[0];
|
|
80
|
+
if (!cleanPart.startsWith('builtin:')) {
|
|
81
|
+
if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
|
|
82
|
+
realSource = cleanPart;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (realSource === m.source) {
|
|
88
|
+
const lastPart = parts[parts.length - 1];
|
|
89
|
+
realSource = lastPart ? lastPart.split('??')[0] : lastPart;
|
|
90
|
+
}
|
|
91
|
+
} else if (realSource.includes('??')) realSource = realSource.split('??')[0];
|
|
73
92
|
if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
74
93
|
if (!realSource) continue;
|
|
75
94
|
if (skipSources && skipSources.has(realSource)) continue;
|
|
@@ -27,6 +27,7 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
27
27
|
const consumer = await new SourceMapConsumer(map);
|
|
28
28
|
const getRealSourcePath = bindContextCache(_this.sdk.root || process.cwd(), namespace, _this._realSourcePathCache);
|
|
29
29
|
const lineMappings = new Map();
|
|
30
|
+
consumer._absoluteSources = consumer._sources;
|
|
30
31
|
consumer.eachMapping((m)=>{
|
|
31
32
|
if (!lineMappings.has(m.generatedLine)) lineMappings.set(m.generatedLine, []);
|
|
32
33
|
lineMappings.get(m.generatedLine).push(m);
|
|
@@ -39,7 +40,25 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
39
40
|
for(let i = 0; i < mappings.length; i++){
|
|
40
41
|
const m = mappings[i];
|
|
41
42
|
if (!m.source) continue;
|
|
42
|
-
let realSource = m.source
|
|
43
|
+
let realSource = m.source;
|
|
44
|
+
if (realSource.includes('!')) {
|
|
45
|
+
const parts = realSource.split('!');
|
|
46
|
+
for(let j = parts.length - 1; j >= 0; j--){
|
|
47
|
+
const part = parts[j];
|
|
48
|
+
if (!part) continue;
|
|
49
|
+
const cleanPart = part.split('??')[0];
|
|
50
|
+
if (!cleanPart.startsWith('builtin:')) {
|
|
51
|
+
if (cleanPart.startsWith('/') || cleanPart.includes('\\')) {
|
|
52
|
+
realSource = cleanPart;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (realSource === m.source) {
|
|
58
|
+
const lastPart = parts[parts.length - 1];
|
|
59
|
+
realSource = lastPart ? lastPart.split('??')[0] : lastPart;
|
|
60
|
+
}
|
|
61
|
+
} else if (realSource.includes('??')) realSource = realSource.split('??')[0];
|
|
43
62
|
if ((realSource?.startsWith('webpack://') || realSource?.startsWith('file://')) && sourceMapFilenameRegex) realSource = getRealSourcePath(realSource, sourceMapFilenameRegex);
|
|
44
63
|
if (!realSource) continue;
|
|
45
64
|
if (skipSources && skipSources.has(realSource)) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"fs-extra": "^11.1.1",
|
|
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/types": "1.3.
|
|
75
|
-
"@rsdoctor/utils": "1.3.
|
|
72
|
+
"@rsdoctor/graph": "1.3.9",
|
|
73
|
+
"@rsdoctor/sdk": "1.3.9",
|
|
74
|
+
"@rsdoctor/types": "1.3.9",
|
|
75
|
+
"@rsdoctor/utils": "1.3.9"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"axios": "^1.12.2",
|
|
79
|
-
"@rspack/core": "1.
|
|
79
|
+
"@rspack/core": "1.6.1",
|
|
80
80
|
"@types/fs-extra": "^11.0.4",
|
|
81
81
|
"@types/node": "^22.8.1",
|
|
82
82
|
"@types/node-fetch": "^2.6.13",
|