@rsdoctor/core 0.4.12 → 0.4.13
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/treeShaking.d.ts.map +1 -1
- package/dist/build-utils/build/module-graph/treeShaking.js +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.js +4 -3
- package/dist/build-utils/build/utils/plugin.js +1 -1
- package/dist/build-utils/common/module-graph/compatible.d.ts +2 -1
- package/dist/build-utils/common/module-graph/compatible.d.ts.map +1 -1
- package/dist/build-utils/common/module-graph/compatible.js +8 -3
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +1 -1
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +12 -12
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeShaking.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/treeShaking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAMZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAuJnD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"treeShaking.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/module-graph/treeShaking.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAMZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAuJnD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,MAAM,CAAC,eAAe,2BAwBpC"}
|
|
@@ -108,7 +108,7 @@ function appendImportConnection(origin, graph) {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function appendTreeShaking(moduleGraph, compilation) {
|
|
111
|
-
if (!(0, import_module_graph.
|
|
111
|
+
if (!(0, import_module_graph.hasModuleGraphApi)(compilation) || (0, import_module_graph.isRspack)(compilation)) {
|
|
112
112
|
return moduleGraph;
|
|
113
113
|
}
|
|
114
114
|
if ("moduleGraph" in compilation) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/build-utils/build/module-graph/webpack/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAU,WAAW,EAAe,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../src/build-utils/build/module-graph/webpack/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAU,WAAW,EAAe,MAAM,iBAAiB,CAAC;AAoBnE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;CACvE;AAuND,wBAAsB,8BAA8B,CAClD,WAAW,EAAE,MAAM,CAAC,eAAe,EACnC,KAAK,EAAE,WAAW,EAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,6BAA6B,EAC/C,OAAO,CAAC,EAAE,gBAAgB,wBA2B3B"}
|
|
@@ -108,7 +108,7 @@ function getModuleSource(modulePath, wbFs, sourceMap) {
|
|
|
108
108
|
}
|
|
109
109
|
return process.env.NODE_ENV === "test" ? Buffer.from("test code") : readFile(modulePath, wbFs);
|
|
110
110
|
}
|
|
111
|
-
async function appendModuleData(origin, webpackGraph, graph, wbFs, features, context) {
|
|
111
|
+
async function appendModuleData(origin, webpackGraph, graph, wbFs, features, context, isRspack2) {
|
|
112
112
|
const module2 = graph.getModuleByWebpackId((0, import_compatible.getWebpackModuleId)(origin));
|
|
113
113
|
if (!origin || !module2) {
|
|
114
114
|
return;
|
|
@@ -155,7 +155,7 @@ async function appendModuleData(origin, webpackGraph, graph, wbFs, features, con
|
|
|
155
155
|
}
|
|
156
156
|
module2.meta.strictHarmonyModule = origin.buildMeta?.strictHarmonyModule ?? false;
|
|
157
157
|
module2.meta.packageData = packageData;
|
|
158
|
-
if (!features?.lite && origin?.dependencies) {
|
|
158
|
+
if (!features?.lite && origin?.dependencies && !isRspack2) {
|
|
159
159
|
Array.from(origin.dependencies).filter((item) => (0, import_module_graph.isImportDependency)(item)).concat(
|
|
160
160
|
origin.blocks.reduce(
|
|
161
161
|
(ans, item) => ans.concat(item.dependencies),
|
|
@@ -180,7 +180,8 @@ async function appendModuleGraphByCompilation(compilation, graph, features, cont
|
|
|
180
180
|
graph,
|
|
181
181
|
fileSystemInfo,
|
|
182
182
|
features,
|
|
183
|
-
context
|
|
183
|
+
context,
|
|
184
|
+
(0, import_module_graph.isRspack)(compilation)
|
|
184
185
|
);
|
|
185
186
|
})
|
|
186
187
|
);
|
|
@@ -46,7 +46,7 @@ function interceptCompilerHooks(compiler, interceptor) {
|
|
|
46
46
|
}
|
|
47
47
|
function interceptCompilationHooks(compilation, interceptor) {
|
|
48
48
|
Object.keys(compilation.hooks).forEach((hook) => {
|
|
49
|
-
if (hook === "normalModuleLoader" && (0, import_compatible.
|
|
49
|
+
if (hook === "normalModuleLoader" && (0, import_compatible.hasModuleGraphApi)(compilation)) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
const v = compilation.hooks[hook];
|
|
@@ -5,5 +5,6 @@ import { Plugin, SDK } from '@rsdoctor/types';
|
|
|
5
5
|
* @link https://github.com/webpack/webpack/blob/main/lib/formatLocation.js#L30-L66
|
|
6
6
|
*/
|
|
7
7
|
export declare function getPositionByStatsLocation(loc: string): SDK.SourceRange | undefined;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function hasModuleGraphApi(compilation: Plugin.BaseCompilation): Boolean;
|
|
9
|
+
export declare function isRspack(compilation: Plugin.BaseCompilation): Boolean;
|
|
9
10
|
//# sourceMappingURL=compatible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compatible.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,GAAG,CAAC,WAAW,GAAG,SAAS,CAqC7B;AAED,wBAAgB,
|
|
1
|
+
{"version":3,"file":"compatible.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/compatible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,MAAM,GACV,GAAG,CAAC,WAAW,GAAG,SAAS,CAqC7B;AAED,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,CAAC,eAAe,GAClC,OAAO,CAET;AAED,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,eAAe,GAAG,OAAO,CAKrE"}
|
|
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var compatible_exports = {};
|
|
20
20
|
__export(compatible_exports, {
|
|
21
21
|
getPositionByStatsLocation: () => getPositionByStatsLocation,
|
|
22
|
-
|
|
22
|
+
hasModuleGraphApi: () => hasModuleGraphApi,
|
|
23
|
+
isRspack: () => isRspack
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(compatible_exports);
|
|
25
26
|
function getPositionByStatsLocation(loc) {
|
|
@@ -53,11 +54,15 @@ function getPositionByStatsLocation(loc) {
|
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
function
|
|
57
|
+
function hasModuleGraphApi(compilation) {
|
|
57
58
|
return "moduleGraph" in compilation && Boolean(compilation.moduleGraph);
|
|
58
59
|
}
|
|
60
|
+
function isRspack(compilation) {
|
|
61
|
+
return "rspackVersion" in compilation.compiler.webpack && Boolean(compilation.compiler.webpack.rspackVersion);
|
|
62
|
+
}
|
|
59
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60
64
|
0 && (module.exports = {
|
|
61
65
|
getPositionByStatsLocation,
|
|
62
|
-
|
|
66
|
+
hasModuleGraphApi,
|
|
67
|
+
isRspack
|
|
63
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureModulesChunkGraph.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/ensureModulesChunkGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAWtE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAC3B,MAAM,CAAC,YAAY,SACtB,sBAAsB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"ensureModulesChunkGraph.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/ensureModulesChunkGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAWtE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAC3B,MAAM,CAAC,YAAY,SACtB,sBAAsB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,SAgG5E,CAAC"}
|
|
@@ -73,19 +73,19 @@ const ensureModulesChunksGraphFn = (compiler, _this) => {
|
|
|
73
73
|
"Rspack currently does not support treeShaking capabilities."
|
|
74
74
|
)
|
|
75
75
|
);
|
|
76
|
-
|
|
76
|
+
} else {
|
|
77
|
+
_this.modulesGraph = import_build2.ModuleGraph.appendTreeShaking(
|
|
78
|
+
_this.modulesGraph,
|
|
79
|
+
stats.compilation
|
|
80
|
+
) || _this.modulesGraph;
|
|
81
|
+
_this.sdk.addClientRoutes([
|
|
82
|
+
import_types2.Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
83
|
+
]);
|
|
84
|
+
(0, import_logger.debug)(
|
|
85
|
+
import_build.Process.getMemoryUsageMessage,
|
|
86
|
+
"[After AppendTreeShaking to ModuleGraph]"
|
|
87
|
+
);
|
|
77
88
|
}
|
|
78
|
-
_this.modulesGraph = import_build2.ModuleGraph.appendTreeShaking(
|
|
79
|
-
_this.modulesGraph,
|
|
80
|
-
stats.compilation
|
|
81
|
-
) || _this.modulesGraph;
|
|
82
|
-
_this.sdk.addClientRoutes([
|
|
83
|
-
import_types2.Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
84
|
-
]);
|
|
85
|
-
(0, import_logger.debug)(
|
|
86
|
-
import_build.Process.getMemoryUsageMessage,
|
|
87
|
-
"[After AppendTreeShaking to ModuleGraph]"
|
|
88
|
-
);
|
|
89
89
|
}
|
|
90
90
|
const shouldParseBundle = _this.options.supports.parseBundle !== false;
|
|
91
91
|
await getModulesInfosByStats(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"semver": "^7.6.3",
|
|
72
72
|
"source-map": "^0.7.4",
|
|
73
73
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
74
|
-
"@rsdoctor/
|
|
75
|
-
"@rsdoctor/
|
|
76
|
-
"@rsdoctor/
|
|
77
|
-
"@rsdoctor/
|
|
74
|
+
"@rsdoctor/sdk": "0.4.13",
|
|
75
|
+
"@rsdoctor/types": "0.4.13",
|
|
76
|
+
"@rsdoctor/utils": "0.4.13",
|
|
77
|
+
"@rsdoctor/graph": "0.4.13"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@rspack/core": "^1.1.
|
|
80
|
+
"@rspack/core": "^1.1.8",
|
|
81
81
|
"@types/fs-extra": "^11.0.4",
|
|
82
82
|
"@types/lodash": "^4.17.13",
|
|
83
83
|
"@types/node": "^16",
|