@rsbuild/plugin-source-build 0.0.19 → 0.0.20
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/index.js +18 -20
- package/dist/index.mjs +18 -20
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -75,28 +75,26 @@ function pluginSourceBuild(options) {
|
|
|
75
75
|
config.source.include = [...(_b = config.source.include) != null ? _b : [], ...includes];
|
|
76
76
|
});
|
|
77
77
|
if (api.context.bundlerType === "webpack") {
|
|
78
|
-
api.modifyWebpackChain(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
api.modifyWebpackChain((chain, { CHAIN_ID }) => {
|
|
79
|
+
const {
|
|
80
|
+
tools: { tsLoader }
|
|
81
|
+
} = api.getNormalizedConfig();
|
|
82
|
+
const useTsLoader = Boolean(tsLoader);
|
|
83
|
+
chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
|
|
84
|
+
chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
|
|
85
|
+
conditionNames: ["...", sourceField]
|
|
86
|
+
});
|
|
87
|
+
const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
|
|
88
|
+
if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
|
|
89
|
+
chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
|
|
90
|
+
const references = projects.map((project) => import_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_fs_extra.fs.existsSync(filePath));
|
|
91
|
+
return options2.map((option) => ({
|
|
92
|
+
...option,
|
|
93
|
+
references
|
|
94
|
+
}));
|
|
87
95
|
});
|
|
88
|
-
const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
|
|
89
|
-
if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
|
|
90
|
-
chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
|
|
91
|
-
const references = projects.map((project) => import_path.default.join(project.dir, import_shared.TS_CONFIG_FILE)).filter((filePath) => import_fs_extra.fs.existsSync(filePath));
|
|
92
|
-
return options2.map((option) => ({
|
|
93
|
-
...option,
|
|
94
|
-
references
|
|
95
|
-
}));
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
96
|
}
|
|
99
|
-
);
|
|
97
|
+
});
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -49,28 +49,26 @@ function pluginSourceBuild(options) {
|
|
|
49
49
|
config.source.include = [...config.source.include ?? [], ...includes];
|
|
50
50
|
});
|
|
51
51
|
if (api.context.bundlerType === "webpack") {
|
|
52
|
-
api.modifyWebpackChain(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
api.modifyWebpackChain((chain, { CHAIN_ID }) => {
|
|
53
|
+
const {
|
|
54
|
+
tools: { tsLoader }
|
|
55
|
+
} = api.getNormalizedConfig();
|
|
56
|
+
const useTsLoader = Boolean(tsLoader);
|
|
57
|
+
chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.mainFields.merge([sourceField, "..."]);
|
|
58
|
+
chain.module.rule(useTsLoader ? CHAIN_ID.RULE.TS : CHAIN_ID.RULE.JS).resolve.merge({
|
|
59
|
+
conditionNames: ["...", sourceField]
|
|
60
|
+
});
|
|
61
|
+
const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
|
|
62
|
+
if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
|
|
63
|
+
chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
|
|
64
|
+
const references = projects.map((project) => path2.join(project.dir, TS_CONFIG_FILE)).filter((filePath) => fs.existsSync(filePath));
|
|
65
|
+
return options2.map((option) => ({
|
|
66
|
+
...option,
|
|
67
|
+
references
|
|
68
|
+
}));
|
|
61
69
|
});
|
|
62
|
-
const { TS_CONFIG_PATHS } = CHAIN_ID.RESOLVE_PLUGIN;
|
|
63
|
-
if (chain.resolve.plugins.has(TS_CONFIG_PATHS)) {
|
|
64
|
-
chain.resolve.plugin(TS_CONFIG_PATHS).tap((options2) => {
|
|
65
|
-
const references = projects.map((project) => path2.join(project.dir, TS_CONFIG_FILE)).filter((filePath) => fs.existsSync(filePath));
|
|
66
|
-
return options2.map((option) => ({
|
|
67
|
-
...option,
|
|
68
|
-
references
|
|
69
|
-
}));
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
70
|
}
|
|
73
|
-
);
|
|
71
|
+
});
|
|
74
72
|
}
|
|
75
73
|
}
|
|
76
74
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-source-build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Source build plugin of Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@rsbuild/monorepo-utils": "0.0.
|
|
26
|
-
"@rsbuild/shared": "0.0.
|
|
25
|
+
"@rsbuild/monorepo-utils": "0.0.20",
|
|
26
|
+
"@rsbuild/shared": "0.0.20"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/core": "^7.23.2",
|
|
30
30
|
"typescript": "^5.2.2",
|
|
31
|
-
"@rsbuild/core": "0.0.
|
|
32
|
-
"@rsbuild/test-helper": "0.0.
|
|
33
|
-
"@rsbuild/webpack": "0.0.
|
|
31
|
+
"@rsbuild/core": "0.0.20",
|
|
32
|
+
"@rsbuild/test-helper": "0.0.20",
|
|
33
|
+
"@rsbuild/webpack": "0.0.20"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@rsbuild/core": "^0.0.
|
|
36
|
+
"@rsbuild/core": "^0.0.20"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public",
|