@rsdoctor/core 1.0.0-alpha.2 → 1.0.0-alpha.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/dist/build-utils/build/module-graph/webpack/transform.d.ts +6 -0
- package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -1
- package/dist/build-utils/build/module-graph/webpack/transform.js +12 -3
- package/dist/build-utils/common/webpack/compatible.js +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SourceMapConsumer } from 'source-map';
|
|
2
2
|
import * as Webpack from 'webpack';
|
|
3
|
+
import * as Rspack from '@rspack/core';
|
|
3
4
|
import { Node } from '@rsdoctor/utils/ruleUtils';
|
|
4
5
|
import { Plugin, SDK } from '@rsdoctor/types';
|
|
5
6
|
export interface TransformContext {
|
|
@@ -7,5 +8,10 @@ export interface TransformContext {
|
|
|
7
8
|
packagePathMap?: Map<string, string>;
|
|
8
9
|
getSourceMap?(module: string): Promise<SourceMapConsumer | undefined>;
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the type of dependencies between modules.
|
|
13
|
+
* This property can determine what runtime webpack has added to the modules.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getModuleExportsType(module: Webpack.NormalModule | Rspack.NormalModule, moduleGraph?: Webpack.ModuleGraph, strict?: boolean): SDK.DependencyBuildMeta['exportsType'];
|
|
10
16
|
export declare function appendModuleGraphByCompilation(compilation: Plugin.BaseCompilation, graph: SDK.ModuleGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
|
|
11
17
|
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -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;
|
|
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;AACnC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAiB9C,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;AA6BD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,EAClD,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,EACjC,MAAM,UAAQ,GACb,GAAG,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAQxC;AA6LD,wBAAsB,8BAA8B,CAClD,WAAW,EAAE,MAAM,CAAC,eAAe,EACnC,KAAK,EAAE,GAAG,CAAC,mBAAmB,EAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,6BAA6B,EAC/C,OAAO,CAAC,EAAE,gBAAgB,oCA0B3B"}
|
|
@@ -18,7 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var transform_exports = {};
|
|
20
20
|
__export(transform_exports, {
|
|
21
|
-
appendModuleGraphByCompilation: () => appendModuleGraphByCompilation
|
|
21
|
+
appendModuleGraphByCompilation: () => appendModuleGraphByCompilation,
|
|
22
|
+
getModuleExportsType: () => getModuleExportsType
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(transform_exports);
|
|
24
25
|
var import_build = require("@rsdoctor/utils/build");
|
|
@@ -49,6 +50,12 @@ async function readFile(target, wbFs) {
|
|
|
49
50
|
return import_build.File.fse.readFile(target).catch(() => {
|
|
50
51
|
});
|
|
51
52
|
}
|
|
53
|
+
function getModuleExportsType(module2, moduleGraph, strict = false) {
|
|
54
|
+
if (moduleGraph && "getExportsType" in module2) {
|
|
55
|
+
return module2.getExportsType(moduleGraph, strict);
|
|
56
|
+
}
|
|
57
|
+
return strict ? "default-with-named" : "dynamic";
|
|
58
|
+
}
|
|
52
59
|
function appendDependency(webpackDep, module2, webpackGraph, graph) {
|
|
53
60
|
const resolvedWebpackModule = webpackGraph?.getResolvedModule ? webpackGraph.getResolvedModule(webpackDep) : void 0;
|
|
54
61
|
if (!resolvedWebpackModule) {
|
|
@@ -76,7 +83,8 @@ function appendDependency(webpackDep, module2, webpackGraph, graph) {
|
|
|
76
83
|
const dependency = module2.getDependencyByRequest(request);
|
|
77
84
|
if (dependency) {
|
|
78
85
|
dependency.setBuildMeta({
|
|
79
|
-
exportsType:
|
|
86
|
+
exportsType: getModuleExportsType(
|
|
87
|
+
resolvedWebpackModule,
|
|
80
88
|
webpackGraph,
|
|
81
89
|
module2.meta.strictHarmonyModule
|
|
82
90
|
)
|
|
@@ -188,5 +196,6 @@ async function appendModuleGraphByCompilation(compilation, graph, features, cont
|
|
|
188
196
|
}
|
|
189
197
|
// Annotate the CommonJS export names for ESM import in node:
|
|
190
198
|
0 && (module.exports = {
|
|
191
|
-
appendModuleGraphByCompilation
|
|
199
|
+
appendModuleGraphByCompilation,
|
|
200
|
+
getModuleExportsType
|
|
192
201
|
});
|
|
@@ -62,7 +62,7 @@ function getEntryModule(entryMap) {
|
|
|
62
62
|
}
|
|
63
63
|
function getDependencyPosition(dep, module2, getSource = true) {
|
|
64
64
|
const { loc: depLoc } = dep;
|
|
65
|
-
if (!("start" in depLoc)) {
|
|
65
|
+
if (depLoc === void 0 || !("start" in depLoc)) {
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
const transformed = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
74
74
|
"@rsbuild/plugin-check-syntax": "1.2.1",
|
|
75
75
|
"browserslist-load-config": "^1.0.0",
|
|
76
|
-
"@rsdoctor/graph": "1.0.0-alpha.
|
|
77
|
-
"@rsdoctor/
|
|
78
|
-
"@rsdoctor/
|
|
79
|
-
"@rsdoctor/
|
|
76
|
+
"@rsdoctor/graph": "1.0.0-alpha.3",
|
|
77
|
+
"@rsdoctor/sdk": "1.0.0-alpha.3",
|
|
78
|
+
"@rsdoctor/utils": "1.0.0-alpha.3",
|
|
79
|
+
"@rsdoctor/types": "1.0.0-alpha.3"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@rspack/core": "^1.
|
|
82
|
+
"@rspack/core": "^1.2.2",
|
|
83
83
|
"@types/fs-extra": "^11.0.4",
|
|
84
84
|
"@types/lodash": "^4.17.14",
|
|
85
85
|
"@types/node": "^16",
|