@winner-fed/bundler-rsbuild 0.9.12 → 0.9.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/README.md +1 -1
- package/dist/config/toolsConfig.d.ts +2 -1
- package/dist/config/toolsConfig.js +19 -5
- package/dist/utils/checkConfig.js +16 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -19,10 +19,11 @@ interface IOpts {
|
|
|
19
19
|
modifyBundlerChain?: Function;
|
|
20
20
|
}
|
|
21
21
|
export declare function getToolsConfig(opts: IOpts): {
|
|
22
|
+
lightningcssLoader: any;
|
|
22
23
|
bundlerChain: (chain: RspackChain, utils: ModifyBundlerChainUtils) => Promise<void>;
|
|
23
24
|
rspack: (config: RspackConfig, utils: ModifyRspackConfigUtils) => Promise<RspackConfig>;
|
|
24
25
|
cssLoader: any;
|
|
25
|
-
postcss: () => {
|
|
26
|
+
postcss: (config: any) => {
|
|
26
27
|
postcssOptions: any;
|
|
27
28
|
};
|
|
28
29
|
styleLoader: any;
|
|
@@ -22,9 +22,12 @@ __export(toolsConfig_exports, {
|
|
|
22
22
|
getToolsConfig: () => getToolsConfig
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(toolsConfig_exports);
|
|
25
|
+
var import_css = require("@winner-fed/bundler-vite/dist/config/transformer/css");
|
|
25
26
|
function getToolsConfig(opts) {
|
|
27
|
+
var _a;
|
|
26
28
|
const { userConfig } = opts;
|
|
27
29
|
return {
|
|
30
|
+
lightningcssLoader: ((_a = userConfig.rsbuild) == null ? void 0 : _a.lightningcssLoader) ?? {},
|
|
28
31
|
bundlerChain: async (chain, utils) => {
|
|
29
32
|
if (opts.modifyBundlerChain) {
|
|
30
33
|
await opts.modifyBundlerChain(chain, utils);
|
|
@@ -37,21 +40,32 @@ function getToolsConfig(opts) {
|
|
|
37
40
|
return config;
|
|
38
41
|
},
|
|
39
42
|
cssLoader: userConfig.cssLoader || {},
|
|
40
|
-
postcss: () => {
|
|
41
|
-
var
|
|
43
|
+
postcss: (config) => {
|
|
44
|
+
var _a2, _b, _c, _d;
|
|
42
45
|
return {
|
|
43
46
|
postcssOptions: {
|
|
44
47
|
// handle postcssLoader
|
|
45
|
-
...((
|
|
48
|
+
...((_a2 = userConfig.postcssLoader) == null ? void 0 : _a2.postcssOptions) || {},
|
|
46
49
|
plugins: [
|
|
47
50
|
...((_c = (_b = userConfig.postcssLoader) == null ? void 0 : _b.postcssOptions) == null ? void 0 : _c.plugins) || [],
|
|
51
|
+
// autoprefixer
|
|
52
|
+
((_d = userConfig.rsbuild) == null ? void 0 : _d.lightningcssLoader) === false && require("postcss-preset-env")({
|
|
53
|
+
// handle targets for css
|
|
54
|
+
browsers: (0, import_css.getBrowserlist)(userConfig.targets || {}),
|
|
55
|
+
// handle autoprefixer
|
|
56
|
+
autoprefixer: {
|
|
57
|
+
flexbox: "no-2009",
|
|
58
|
+
...userConfig.autoprefixer || {}
|
|
59
|
+
},
|
|
60
|
+
stage: 3
|
|
61
|
+
}),
|
|
48
62
|
// handle extraPostCSSPlugins
|
|
49
63
|
...userConfig.extraPostCSSPlugins || []
|
|
50
|
-
]
|
|
64
|
+
].filter(Boolean)
|
|
51
65
|
}
|
|
52
66
|
};
|
|
53
67
|
},
|
|
54
|
-
styleLoader: userConfig.styleLoader
|
|
68
|
+
styleLoader: userConfig.styleLoader ?? {},
|
|
55
69
|
// 自带的 htmlPlugin 不满足,禁掉了,可以参考 preset-win/src/features/rsbuild/rsbuid.ts
|
|
56
70
|
htmlPlugin: false
|
|
57
71
|
};
|
|
@@ -32,6 +32,7 @@ __export(checkConfig_exports, {
|
|
|
32
32
|
checkConfig: () => checkConfig
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(checkConfig_exports);
|
|
35
|
+
var import_utils = require("@winner-fed/utils");
|
|
35
36
|
var import_assert = __toESM(require("assert"));
|
|
36
37
|
function checkConfig(opts) {
|
|
37
38
|
const unsupportedKeys = [
|
|
@@ -43,6 +44,21 @@ function checkConfig(opts) {
|
|
|
43
44
|
unsupportedKeys.forEach((key) => {
|
|
44
45
|
(0, import_assert.default)(!opts.config[key], `${key} is not supported in Rsbuild bundler`);
|
|
45
46
|
});
|
|
47
|
+
const warningKeys = [];
|
|
48
|
+
if (opts.config.mdx && Object.keys(opts.config.mdx).length) {
|
|
49
|
+
warningKeys.push("mdx");
|
|
50
|
+
}
|
|
51
|
+
if (warningKeys.length) {
|
|
52
|
+
console.warn(
|
|
53
|
+
import_utils.chalk.yellow(
|
|
54
|
+
`
|
|
55
|
+
Rsbuild bundler does not support the following options:
|
|
56
|
+
- ${warningKeys.join("\n - ")}
|
|
57
|
+
|
|
58
|
+
`
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
64
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@winner-fed/bundler-rsbuild",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.13",
|
|
4
4
|
"description": "@winner-fed/bundler-rsbuild",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"@rsbuild/plugin-node-polyfill": "1.0.3",
|
|
16
16
|
"@rsbuild/plugin-sass": "1.0.1-beta.9",
|
|
17
17
|
"@rsbuild/plugin-type-check": "1.0.1-beta.9",
|
|
18
|
-
"
|
|
19
|
-
"@winner-fed/utils": "0.9.
|
|
18
|
+
"postcss-preset-env": "7.5.0",
|
|
19
|
+
"@winner-fed/bundler-utils": "0.9.13",
|
|
20
|
+
"@winner-fed/utils": "0.9.13"
|
|
20
21
|
},
|
|
21
22
|
"publishConfig": {
|
|
22
23
|
"access": "public"
|