@winner-fed/bundler-rsbuild 0.9.6-alpha.0 → 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.
@@ -22,7 +22,12 @@ export declare function getOutConfig(opts: IOpts): {
22
22
  externals: Record<string, string> | never[];
23
23
  filenameHash: boolean;
24
24
  manifest: boolean | undefined;
25
- minify: boolean;
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;
@@ -45,15 +45,39 @@ function getOutConfig(opts) {
45
45
  clean = true
46
46
  } = userConfig;
47
47
  const disableCompress = process.env.COMPRESS === "none";
48
- const minify = !(isDev || disableCompress);
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
- cleanDistPath: clean,
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
- chunkSplit: {
51
- strategy
52
- },
53
- removeMomentLocale: true,
41
+ removeMomentLocale: userConfig.ignoreMomentLocale || true,
54
42
  printFileSize: !isDev
55
43
  };
56
44
  }
@@ -16,7 +16,7 @@ interface IOpts {
16
16
  env: Env;
17
17
  }
18
18
  export declare function getServerConfig(opts: IOpts): {
19
- compress: any;
19
+ compress: boolean;
20
20
  https: import("@winner-fed/bundler-utils").HttpsServerOptions | undefined;
21
21
  proxy: {
22
22
  [key: string]: import("@winner-fed/bundler-utils").ProxyOptions;
@@ -41,7 +41,8 @@ function getServerConfig(opts) {
41
41
  }
42
42
  }
43
43
  return {
44
- compress: userConfig.compression,
44
+ // See https://github.com/umijs/umi/issues/12144
45
+ compress: process.env.WIN_DEV_SERVER_COMPRESS !== "none",
45
46
  https: httpsOpts,
46
47
  proxy: userConfig.proxy,
47
48
  host: opts.host,
package/dist/dev.js CHANGED
@@ -56,7 +56,7 @@ async function dev(opts) {
56
56
  ],
57
57
  ...opts
58
58
  });
59
- await (0, import_server.createServer)({
59
+ const httpServer = await (0, import_server.createServer)({
60
60
  cwd: opts.cwd,
61
61
  rsbuildConfig,
62
62
  userConfig: opts.config,
@@ -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 httpServer;
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
- terser = "terser",
15
- esbuild = "esbuild",
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["terser"] = "terser";
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.0",
3
+ "version": "0.9.6-alpha.3",
4
4
  "description": "@winner-fed/bundler-rsbuild",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -9,14 +9,14 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@rsbuild/core": "1.0.1-beta.4",
13
- "@rsbuild/plugin-babel": "1.0.1-beta.4",
14
- "@rsbuild/plugin-less": "1.0.1-beta.4",
12
+ "@rsbuild/core": "1.0.1-beta.6",
13
+ "@rsbuild/plugin-babel": "1.0.1-beta.6",
14
+ "@rsbuild/plugin-less": "1.0.1-beta.6",
15
15
  "@rsbuild/plugin-node-polyfill": "1.0.3",
16
- "@rsbuild/plugin-sass": "1.0.1-beta.4",
17
- "@rsbuild/plugin-type-check": "1.0.1-beta.4",
18
- "@winner-fed/bundler-utils": "0.9.6-alpha.0",
19
- "@winner-fed/utils": "0.9.6-alpha.0"
16
+ "@rsbuild/plugin-sass": "1.0.1-beta.6",
17
+ "@rsbuild/plugin-type-check": "1.0.1-beta.6",
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"