@rsbuild/core 2.0.0-alpha.4 → 2.0.0-beta.1

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.
@@ -230,20 +230,17 @@ export type ProxyBypass = (req: IncomingMessage, res: ServerResponse, proxyOptio
230
230
  export type { ProxyFilter };
231
231
  export type ProxyOptions = HttpProxyOptions & {
232
232
  /**
233
- * Bypass the proxy based on the return value of a function.
233
+ * Use the `bypass` function to skip the proxy.
234
+ * Inside the function, you have access to the request, response, and proxy options.
234
235
  * - Return `null` or `undefined` to continue processing the request with proxy.
235
- * - Return `true` to continue processing the request without proxy.
236
+ * - Return `true` to skip the proxy and continue processing the request.
236
237
  * - Return `false` to produce a 404 error for the request.
237
- * - Return a path to serve from, instead of continuing to proxy the request.
238
+ * - Return a specific path to replace the original request path.
238
239
  * - Return a Promise to handle the request asynchronously.
239
240
  */
240
241
  bypass?: ProxyBypass;
241
- /**
242
- * Used to proxy multiple specified paths to the same target.
243
- */
244
- context?: ProxyFilter;
245
242
  };
246
- export type ProxyConfig = Record<string, string | ProxyOptions> | ProxyOptions[] | ProxyOptions;
243
+ export type ProxyConfig = Record<string, string | ProxyOptions> | ProxyOptions[];
247
244
  export type HistoryApiFallbackContext = {
248
245
  match: RegExpMatchArray;
249
246
  parsedUrl: URL;
@@ -370,9 +367,12 @@ export interface ServerConfig {
370
367
  https?: HttpsServerOptions | SecureServerSessionOptions;
371
368
  /**
372
369
  * Specify the host that the Rsbuild server listens to.
373
- * @default '0.0.0.0'
370
+ * - `string`: specify a hostname or IP address to listen on.
371
+ * - `true`: equals to `0.0.0.0`, listen on all interfaces.
372
+ * - `false`: equals to `localhost`
373
+ * @default 'localhost'
374
374
  */
375
- host?: string;
375
+ host?: string | boolean;
376
376
  /**
377
377
  * Adds headers to all responses.
378
378
  */
@@ -437,8 +437,9 @@ export interface ServerConfig {
437
437
  middlewareMode?: boolean;
438
438
  }
439
439
  export type NormalizedServerConfig = {
440
+ host: string;
440
441
  publicDir: Required<PublicDirOptions>[];
441
- } & Omit<Optional<Required<ServerConfig>, 'headers' | 'https' | 'historyApiFallback' | 'proxy'>, 'publicDir'>;
442
+ } & Omit<Optional<Required<ServerConfig>, 'headers' | 'https' | 'historyApiFallback' | 'proxy'>, 'host' | 'publicDir'>;
442
443
  export type SriAlgorithm = 'sha256' | 'sha384' | 'sha512';
443
444
  export type SriOptions = {
444
445
  /**
@@ -606,7 +607,7 @@ export interface PerformanceConfig {
606
607
  printFileSize?: PrintFileSizeOptions | boolean;
607
608
  /**
608
609
  * Configure the chunk splitting strategy.
609
- * @default { strategy: 'split-by-experience' }
610
+ * @deprecated Use `splitChunks` instead.
610
611
  */
611
612
  chunkSplit?: ChunkSplit;
612
613
  /**
@@ -659,9 +660,21 @@ export interface PerformanceConfig {
659
660
  }
660
661
  export interface NormalizedPerformanceConfig extends PerformanceConfig {
661
662
  printFileSize: PrintFileSizeOptions | boolean;
662
- chunkSplit: ChunkSplit;
663
663
  }
664
664
  export type SplitChunks = Rspack.OptimizationSplitChunksOptions | false;
665
+ /**
666
+ * Split chunks preset rules.
667
+ * - `default`: splits polyfills when enabled and applies extra groups when using
668
+ * framework plugins.
669
+ * - `per-package`: splits dependencies in `node_modules` by npm package.
670
+ * - `single-vendor`: splits all `node_modules` dependencies into one vendor chunk.
671
+ * - `none`: disables Rsbuild preset rules.
672
+ */
673
+ export type SplitChunksPreset = 'default' | 'single-vendor' | 'per-package' | 'none';
674
+ export type SplitChunksConfig = Rspack.OptimizationSplitChunksOptions & {
675
+ preset?: SplitChunksPreset;
676
+ };
677
+ export type NormalizedSplitChunksConfig = SplitChunksConfig;
665
678
  export type ForceSplitting = RegExp[] | Record<string, RegExp>;
666
679
  export interface BaseSplitRules {
667
680
  strategy?: string;
@@ -1750,6 +1763,10 @@ export interface EnvironmentConfig {
1750
1763
  * Options for build performance and runtime performance.
1751
1764
  */
1752
1765
  performance?: PerformanceConfig;
1766
+ /**
1767
+ * Options for chunk splitting.
1768
+ */
1769
+ splitChunks?: SplitChunksConfig | false;
1753
1770
  /**
1754
1771
  * Options for module federation.
1755
1772
  */
@@ -1791,8 +1808,9 @@ export interface RsbuildConfig extends EnvironmentConfig {
1791
1808
  */
1792
1809
  dev?: DevConfig;
1793
1810
  /**
1794
- * Options for the Rsbuild server,
1795
- * will take effect during local development and preview.
1811
+ * Options for the Rsbuild server.
1812
+ * Mainly applies to local development and preview.
1813
+ * Some options (e.g. `publicDir`, `base`) also affect production builds.
1796
1814
  */
1797
1815
  server?: ServerConfig;
1798
1816
  /**
@@ -1820,6 +1838,7 @@ export type MergedEnvironmentConfig = {
1820
1838
  plugins?: RsbuildPlugins;
1821
1839
  security: NormalizedSecurityConfig;
1822
1840
  performance: NormalizedPerformanceConfig;
1841
+ splitChunks: NormalizedSplitChunksConfig | false;
1823
1842
  moduleFederation?: ModuleFederationConfig;
1824
1843
  };
1825
1844
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -37,7 +37,6 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@rspack/core": "2.0.0-alpha.1",
40
- "@rspack/lite-tapable": "~1.1.0",
41
40
  "@swc/helpers": "^0.5.18",
42
41
  "jiti": "^2.6.1"
43
42
  },
@@ -52,7 +51,7 @@
52
51
  "devDependencies": {
53
52
  "@jridgewell/remapping": "^2.3.5",
54
53
  "@jridgewell/trace-mapping": "^0.3.31",
55
- "@rslib/core": "0.19.3",
54
+ "@rslib/core": "0.19.4",
56
55
  "@types/connect": "3.4.38",
57
56
  "@types/cors": "^2.8.19",
58
57
  "@types/node": "^24.10.9",
@@ -64,11 +63,11 @@
64
63
  "chokidar": "^5.0.0",
65
64
  "connect": "3.7.0",
66
65
  "cors": "^2.8.6",
67
- "css-loader": "7.1.2",
66
+ "css-loader": "7.1.3",
68
67
  "deepmerge": "^4.3.1",
69
68
  "dotenv-expand": "12.0.3",
70
69
  "html-rspack-plugin": "6.1.6",
71
- "http-proxy-middleware": "^2.0.9",
70
+ "http-proxy-middleware": "^3.0.5",
72
71
  "launch-editor-middleware": "^2.12.0",
73
72
  "memfs": "^4.56.10",
74
73
  "mrmime": "^2.0.1",
@@ -1,2 +0,0 @@
1
- declare const rspack: (typeof import('@rspack/core'))['rspack'];
2
- export { rspack };