@rsbuild/core 2.3.1 → 2.3.2

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.
@@ -2,7 +2,7 @@ import type { IncomingMessage, Server } from 'node:http';
2
2
  import type { Http2SecureServer } from 'node:http2';
3
3
  import type { Socket } from 'node:net';
4
4
  import type { Logger } from '../logger.js';
5
- import type { InternalContext, NormalizedConfig, OutputStructure, PrintUrls, Routes, RsbuildConfig, RsbuildEntry, RsbuildMiddlewares } from '../types/index.js';
5
+ import type { InternalContext, NormalizedConfig, NormalizedEnvironmentConfig, OutputStructure, PrintUrls, Routes, RsbuildConfig, RsbuildEntry, RsbuildMiddlewares } from '../types/index.js';
6
6
  import type { RsbuildDevServer } from './devServer.js';
7
7
  import type { RsbuildPreviewServer } from './previewServer.js';
8
8
  /**
@@ -27,6 +27,7 @@ export declare const normalizeUrl: (url: string) => string;
27
27
  export declare const joinUrlPath: (basePath: string, pathname: string) => string;
28
28
  export declare const isUrlPathUnderBase: (pathname: string, base: string) => boolean;
29
29
  export declare const removeBasePath: (url: string, base: string) => string;
30
+ export declare const isServingAssets: (config: NormalizedEnvironmentConfig) => boolean;
30
31
  export declare const getRoutes: (context: InternalContext) => Routes;
31
32
  /*
32
33
  * format route by entry and adjust the index route to be the first
@@ -329,6 +329,11 @@ export interface ServerConfig {
329
329
  * @default { name: 'public', copyOnBuild: 'auto', watch: false }
330
330
  */ publicDir?: PublicDir;
331
331
  /**
332
+ * Whether the dev and preview servers serve this environment's build output.
333
+ * Does not affect compilation or programmatic access to the output.
334
+ * @default true for 'web' and 'web-worker' targets, false for 'node'
335
+ */ serveAssets?: boolean;
336
+ /**
332
337
  * Specify a port number for Rsbuild server to listen.
333
338
  * @default 3000
334
339
  */ port?: number;
@@ -420,7 +425,7 @@ export interface ServerConfig {
420
425
  export type NormalizedServerConfig = {
421
426
  host: string;
422
427
  publicDir: Required<PublicDirOptions>[];
423
- } & Omit<Optional<Required<ServerConfig>, 'headers' | 'https' | 'historyApiFallback' | 'proxy' | 'setup'>, 'host' | 'publicDir'>;
428
+ } & Omit<Optional<Required<ServerConfig>, 'headers' | 'https' | 'historyApiFallback' | 'proxy' | 'setup' | 'serveAssets'>, 'host' | 'publicDir'>;
424
429
  export type ServerSetupContext = {
425
430
  /**
426
431
  * Environment contexts of all environments.
@@ -1712,9 +1717,9 @@ export type RsbuildConfigMeta = {
1712
1717
  * The Rsbuild config to run in the specified environment.
1713
1718
  */ export interface EnvironmentConfig {
1714
1719
  /**
1715
- * Configure public directories for this environment.
1720
+ * Configure public directories and build output serving for this environment.
1716
1721
  * Other server options are shared across environments.
1717
- */ server?: Pick<ServerConfig, 'publicDir'>;
1722
+ */ server?: Pick<ServerConfig, 'publicDir' | 'serveAssets'>;
1718
1723
  /**
1719
1724
  * Options for local development.
1720
1725
  */ dev?: Pick<DevConfig, AllowedEnvironmentDevKeys>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -39,8 +39,8 @@
39
39
  "types.d.ts"
40
40
  ],
41
41
  "dependencies": {
42
- "@rspack/core": "~2.3.1",
43
- "@swc/helpers": "^0.5.23"
42
+ "@rspack/core": "~2.3.2",
43
+ "@swc/helpers": "^0.5.24"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@jridgewell/remapping": "^2.3.5",