@winner-fed/bundler-rsbuild 0.9.6-alpha.1 → 0.9.6-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/config/outConfig.d.ts +7 -2
- package/dist/config/outConfig.js +29 -5
- package/dist/config/performanceConfig.js +1 -13
- package/dist/config/serverConfig.d.ts +1 -0
- package/dist/config/serverConfig.js +2 -0
- package/dist/dev.js +1 -1
- package/dist/server/server.js +6 -1
- package/dist/types.d.ts +5 -2
- package/dist/types.js +8 -2
- package/package.json +3 -3
|
@@ -19,10 +19,15 @@ export declare function getOutConfig(opts: IOpts): {
|
|
|
19
19
|
css: string;
|
|
20
20
|
cssAsync: string;
|
|
21
21
|
};
|
|
22
|
-
externals:
|
|
22
|
+
externals: Record<string, string> | never[];
|
|
23
23
|
filenameHash: boolean;
|
|
24
24
|
manifest: boolean | undefined;
|
|
25
|
-
minify:
|
|
25
|
+
minify: true | {
|
|
26
|
+
js?: boolean | undefined;
|
|
27
|
+
jsOptions?: import("@rspack/core").SwcJsMinimizerRspackPluginOptions | undefined;
|
|
28
|
+
css?: boolean | undefined;
|
|
29
|
+
cssOptions?: import("@rspack/core").LightningCssMinimizerRspackPluginOptions | undefined;
|
|
30
|
+
};
|
|
26
31
|
overrideBrowserslist: any;
|
|
27
32
|
sourceMap: {
|
|
28
33
|
js: any;
|
package/dist/config/outConfig.js
CHANGED
|
@@ -45,15 +45,39 @@ function getOutConfig(opts) {
|
|
|
45
45
|
clean = true
|
|
46
46
|
} = userConfig;
|
|
47
47
|
const disableCompress = process.env.COMPRESS === "none";
|
|
48
|
-
const
|
|
48
|
+
const jsMinifier = userConfig.jsMinifier || import_types.JSMinifier.swc;
|
|
49
|
+
const cssMinifier = userConfig.cssMinifier || import_types.CSSMinifier.parcelCSS;
|
|
50
|
+
let minify = !(isDev || disableCompress || jsMinifier === import_types.JSMinifier.none && cssMinifier === import_types.CSSMinifier.none);
|
|
51
|
+
if (!minify) {
|
|
52
|
+
let tempJsMinifier = {
|
|
53
|
+
js: true,
|
|
54
|
+
jsOptions: {
|
|
55
|
+
...userConfig.jsMinifierOptions
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (jsMinifier === import_types.JSMinifier.none) {
|
|
59
|
+
tempJsMinifier.js = false;
|
|
60
|
+
}
|
|
61
|
+
let tempCssMinifier = {
|
|
62
|
+
css: true,
|
|
63
|
+
cssOptions: {
|
|
64
|
+
...userConfig.cssMinifierOptions
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
if (cssMinifier === import_types.CSSMinifier.none) {
|
|
68
|
+
tempCssMinifier.css = false;
|
|
69
|
+
}
|
|
70
|
+
minify = {
|
|
71
|
+
...tempJsMinifier,
|
|
72
|
+
...tempCssMinifier
|
|
73
|
+
};
|
|
74
|
+
}
|
|
49
75
|
const legalComments = "inline";
|
|
50
76
|
userConfig.targets || (userConfig.targets = import_constants.DEFAULT_BROWSER_TARGETS);
|
|
51
|
-
if (typeof externals === "string") {
|
|
52
|
-
throw new Error("externals string is not supported");
|
|
53
|
-
}
|
|
54
77
|
return {
|
|
55
78
|
assetPrefix: publicPath,
|
|
56
|
-
|
|
79
|
+
// 默认生产开启
|
|
80
|
+
cleanDistPath: isDev ? false : clean,
|
|
57
81
|
copy,
|
|
58
82
|
cssModules: cssLoaderModules,
|
|
59
83
|
dataUriLimit: inlineLimit,
|
|
@@ -26,15 +26,6 @@ var import_types = require("@winner-fed/bundler-webpack/dist/types");
|
|
|
26
26
|
function getPerformanceConfig(opts) {
|
|
27
27
|
const { userConfig } = opts;
|
|
28
28
|
const isDev = opts.env === import_types.Env.development;
|
|
29
|
-
let strategy = "split-by-experience";
|
|
30
|
-
if (userConfig.codeSplitting) {
|
|
31
|
-
if (userConfig.codeSplitting.jsStrategy === "bigVendors") {
|
|
32
|
-
strategy = "all-in-one";
|
|
33
|
-
}
|
|
34
|
-
if (userConfig.codeSplitting.jsStrategy === "depPerChunk") {
|
|
35
|
-
strategy = "split-by-module";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
29
|
let bundleAnalyze = void 0;
|
|
39
30
|
if (userConfig.analyze || process.env.ANALYZE) {
|
|
40
31
|
bundleAnalyze = {
|
|
@@ -47,10 +38,7 @@ function getPerformanceConfig(opts) {
|
|
|
47
38
|
}
|
|
48
39
|
return {
|
|
49
40
|
bundleAnalyze,
|
|
50
|
-
|
|
51
|
-
strategy
|
|
52
|
-
},
|
|
53
|
-
removeMomentLocale: true,
|
|
41
|
+
removeMomentLocale: userConfig.ignoreMomentLocale || true,
|
|
54
42
|
printFileSize: !isDev
|
|
55
43
|
};
|
|
56
44
|
}
|
|
@@ -16,6 +16,7 @@ interface IOpts {
|
|
|
16
16
|
env: Env;
|
|
17
17
|
}
|
|
18
18
|
export declare function getServerConfig(opts: IOpts): {
|
|
19
|
+
compress: boolean;
|
|
19
20
|
https: import("@winner-fed/bundler-utils").HttpsServerOptions | undefined;
|
|
20
21
|
proxy: {
|
|
21
22
|
[key: string]: import("@winner-fed/bundler-utils").ProxyOptions;
|
package/dist/dev.js
CHANGED
package/dist/server/server.js
CHANGED
|
@@ -92,7 +92,12 @@ async function createServer(opts) {
|
|
|
92
92
|
});
|
|
93
93
|
import_utils.logger.info(`Building with rsbuild for ${process.env.NODE_ENV}...
|
|
94
94
|
`);
|
|
95
|
-
return
|
|
95
|
+
return {
|
|
96
|
+
close: async () => {
|
|
97
|
+
await rsbuildServer.close();
|
|
98
|
+
httpServer.close();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
96
101
|
}
|
|
97
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
98
103
|
0 && (module.exports = {
|
package/dist/types.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ export declare enum Env {
|
|
|
11
11
|
production = "production"
|
|
12
12
|
}
|
|
13
13
|
export declare enum JSMinifier {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
swc = "swc",
|
|
15
|
+
none = "none"
|
|
16
|
+
}
|
|
17
|
+
export declare enum CSSMinifier {
|
|
18
|
+
parcelCSS = "parcelCSS",
|
|
16
19
|
none = "none"
|
|
17
20
|
}
|
|
18
21
|
export interface ICopy {
|
package/dist/types.js
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/types.ts
|
|
20
20
|
var types_exports = {};
|
|
21
21
|
__export(types_exports, {
|
|
22
|
+
CSSMinifier: () => CSSMinifier,
|
|
22
23
|
Env: () => Env,
|
|
23
24
|
JSMinifier: () => JSMinifier
|
|
24
25
|
});
|
|
@@ -29,13 +30,18 @@ var Env = /* @__PURE__ */ ((Env2) => {
|
|
|
29
30
|
return Env2;
|
|
30
31
|
})(Env || {});
|
|
31
32
|
var JSMinifier = /* @__PURE__ */ ((JSMinifier2) => {
|
|
32
|
-
JSMinifier2["
|
|
33
|
-
JSMinifier2["esbuild"] = "esbuild";
|
|
33
|
+
JSMinifier2["swc"] = "swc";
|
|
34
34
|
JSMinifier2["none"] = "none";
|
|
35
35
|
return JSMinifier2;
|
|
36
36
|
})(JSMinifier || {});
|
|
37
|
+
var CSSMinifier = /* @__PURE__ */ ((CSSMinifier2) => {
|
|
38
|
+
CSSMinifier2["parcelCSS"] = "parcelCSS";
|
|
39
|
+
CSSMinifier2["none"] = "none";
|
|
40
|
+
return CSSMinifier2;
|
|
41
|
+
})(CSSMinifier || {});
|
|
37
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38
43
|
0 && (module.exports = {
|
|
44
|
+
CSSMinifier,
|
|
39
45
|
Env,
|
|
40
46
|
JSMinifier
|
|
41
47
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@winner-fed/bundler-rsbuild",
|
|
3
|
-
"version": "0.9.6-alpha.
|
|
3
|
+
"version": "0.9.6-alpha.3",
|
|
4
4
|
"description": "@winner-fed/bundler-rsbuild",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"@rsbuild/plugin-node-polyfill": "1.0.3",
|
|
16
16
|
"@rsbuild/plugin-sass": "1.0.1-beta.6",
|
|
17
17
|
"@rsbuild/plugin-type-check": "1.0.1-beta.6",
|
|
18
|
-
"@winner-fed/bundler-utils": "0.9.6-alpha.
|
|
19
|
-
"@winner-fed/utils": "0.9.6-alpha.
|
|
18
|
+
"@winner-fed/bundler-utils": "0.9.6-alpha.3",
|
|
19
|
+
"@winner-fed/utils": "0.9.6-alpha.3"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|