@rsbuild/plugin-source-build 0.2.17 → 0.3.0
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/README.md +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -1
- package/dist/index.mjs +6 -1
- package/package.json +6 -5
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ interface PluginSourceBuildOptions {
|
|
|
12
12
|
* @default 'source''
|
|
13
13
|
*/
|
|
14
14
|
sourceField?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to read source code or output code first.
|
|
17
|
+
* @default 'source'
|
|
18
|
+
*/
|
|
19
|
+
resolvePriority?: 'source' | 'output';
|
|
15
20
|
projectName?: string;
|
|
16
21
|
extraMonorepoStrategies?: ExtraMonorepoStrategies;
|
|
17
22
|
}
|
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ function pluginSourceBuild(options) {
|
|
|
52
52
|
const {
|
|
53
53
|
projectName,
|
|
54
54
|
sourceField = "source",
|
|
55
|
+
resolvePriority = "source",
|
|
55
56
|
extraMonorepoStrategies
|
|
56
57
|
} = options ?? {};
|
|
57
58
|
return {
|
|
@@ -83,8 +84,12 @@ function pluginSourceBuild(options) {
|
|
|
83
84
|
[CHAIN_ID.RULE.TS, CHAIN_ID.RULE.JS].forEach((ruleId) => {
|
|
84
85
|
if (chain.module.rules.get(ruleId)) {
|
|
85
86
|
const rule = chain.module.rule(ruleId);
|
|
86
|
-
rule.resolve.mainFields.merge(
|
|
87
|
+
rule.resolve.mainFields.merge(
|
|
88
|
+
resolvePriority === "source" ? [sourceField, "..."] : ["...", sourceField]
|
|
89
|
+
);
|
|
87
90
|
rule.resolve.merge({
|
|
91
|
+
// `conditionNames` is not affected by `resolvePriority`.
|
|
92
|
+
// The priority is controlled by the order of fields declared in `exports`.
|
|
88
93
|
conditionNames: ["...", sourceField]
|
|
89
94
|
});
|
|
90
95
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -27,6 +27,7 @@ function pluginSourceBuild(options) {
|
|
|
27
27
|
const {
|
|
28
28
|
projectName,
|
|
29
29
|
sourceField = "source",
|
|
30
|
+
resolvePriority = "source",
|
|
30
31
|
extraMonorepoStrategies
|
|
31
32
|
} = options ?? {};
|
|
32
33
|
return {
|
|
@@ -58,8 +59,12 @@ function pluginSourceBuild(options) {
|
|
|
58
59
|
[CHAIN_ID.RULE.TS, CHAIN_ID.RULE.JS].forEach((ruleId) => {
|
|
59
60
|
if (chain.module.rules.get(ruleId)) {
|
|
60
61
|
const rule = chain.module.rule(ruleId);
|
|
61
|
-
rule.resolve.mainFields.merge(
|
|
62
|
+
rule.resolve.mainFields.merge(
|
|
63
|
+
resolvePriority === "source" ? [sourceField, "..."] : ["...", sourceField]
|
|
64
|
+
);
|
|
62
65
|
rule.resolve.merge({
|
|
66
|
+
// `conditionNames` is not affected by `resolvePriority`.
|
|
67
|
+
// The priority is controlled by the order of fields declared in `exports`.
|
|
63
68
|
conditionNames: ["...", sourceField]
|
|
64
69
|
});
|
|
65
70
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-source-build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Source build plugin of Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@rsbuild/
|
|
27
|
-
"@rsbuild/
|
|
26
|
+
"@rsbuild/shared": "0.3.0",
|
|
27
|
+
"@rsbuild/monorepo-utils": "0.3.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/core": "^7.23.2",
|
|
31
31
|
"typescript": "^5.3.0",
|
|
32
|
-
"@rsbuild/core": "0.
|
|
33
|
-
"@rsbuild/
|
|
32
|
+
"@rsbuild/core": "0.3.0",
|
|
33
|
+
"@rsbuild/plugin-babel": "0.3.0",
|
|
34
|
+
"@rsbuild/test-helper": "0.3.0"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
37
|
"@rsbuild/core": "0.x"
|