@rsbuild/core 2.1.6 → 2.1.7

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.
@@ -1,10 +1,12 @@
1
1
  import type { Compiler, MultiCompiler } from '@rspack/core';
2
+ import type { LoadConfigResult } from '../loadConfig';
2
3
  import type { LoadEnvOptions } from '../loadEnv';
3
4
  import type { Logger } from '../logger';
4
5
  import type { RsbuildDevServer } from '../server/devServer';
5
6
  import type { StartDevServerResult, StartPreviewServerResult } from '../server/helper';
6
7
  import type { NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
7
8
  import type { RsbuildContext } from './context';
9
+ import type { RestartFn } from './hooks';
8
10
  import type { RsbuildPlugin, RsbuildPluginAPI } from './plugin';
9
11
  import type { Rspack } from './rspack';
10
12
  import type { Falsy } from './utils';
@@ -90,6 +92,7 @@ export type InspectConfigResult = {
90
92
  };
91
93
  };
92
94
  export type CreateCompiler = () => Promise<Compiler | MultiCompiler>;
95
+ type RsbuildConfigInput = RsbuildConfig | LoadConfigResult;
93
96
  export type CreateRsbuildOptions = {
94
97
  /**
95
98
  * The root path of current project.
@@ -109,18 +112,21 @@ export type CreateRsbuildOptions = {
109
112
  /**
110
113
  * Alias for `config`.
111
114
  * This option will be deprecated in the future.
112
- */ rsbuildConfig?: RsbuildConfig | (() => Promise<RsbuildConfig>);
115
+ */ rsbuildConfig?: RsbuildConfigInput | (() => Promise<RsbuildConfigInput>);
113
116
  /**
114
- * Rsbuild configurations.
117
+ * Rsbuild configuration or the result returned by `loadConfig`.
115
118
  * Passing a function to load the config asynchronously with custom logic.
116
- */ config?: RsbuildConfig | (() => Promise<RsbuildConfig>);
119
+ */ config?: RsbuildConfigInput | (() => Promise<RsbuildConfigInput>);
117
120
  /**
118
121
  * Whether to call `loadEnv` to load environment variables and define them
119
122
  * as global variables via `source.define`.
120
123
  * @default false
121
124
  */ loadEnv?: boolean | LoadEnvOptions;
125
+ /**
126
+ * Function used to restart the current dev server or watch build.
127
+ */ restart?: RestartFn;
122
128
  };
123
- export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd' | 'callerName'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment'> & {
129
+ export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd' | 'callerName'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment' | 'restart'> & {
124
130
  rsbuildConfig: RsbuildConfig;
125
131
  };
126
132
  export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
@@ -214,7 +220,7 @@ export type RsbuildInstance = {
214
220
  * 1. Start a development server that serves your application.
215
221
  * 2. Watch for file changes and trigger recompilation.
216
222
  */ startDevServer: StartDevServer;
217
- } & Pick<RsbuildPluginAPI, 'context' | 'expose' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'modifyEnvironmentConfig' | 'modifyRsbuildConfig' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterDevCompile' | 'onAfterEnvironmentCompile' | 'onAfterStartDevServer' | 'onAfterStartPreviewServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeDevCompile' | 'onBeforeEnvironmentCompile' | 'onBeforeStartDevServer' | 'onBeforeStartPreviewServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit'>;
223
+ } & Pick<RsbuildPluginAPI, 'context' | 'expose' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'modifyEnvironmentConfig' | 'modifyRsbuildConfig' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterDevCompile' | 'onAfterEnvironmentCompile' | 'onAfterStartDevServer' | 'onAfterStartPreviewServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeDevCompile' | 'onBeforeEnvironmentCompile' | 'onBeforeStartDevServer' | 'onBeforeStartPreviewServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit' | 'onRestart'>;
218
224
  export type RsbuildTarget = 'web' | 'node' | 'web-worker';
219
225
  export type RsbuildEntryDescription = Rspack.EntryDescription & {
220
226
  /**
@@ -231,3 +237,4 @@ export type RsbuildStatsItem = Pick<Rspack.StatsCompilation, 'errors' | 'warning
231
237
  */ export type RsbuildStats = RsbuildStatsItem & {
232
238
  children: RsbuildStatsItem[];
233
239
  };
240
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -40,13 +40,13 @@
40
40
  "registry": "https://registry.npmjs.org/"
41
41
  },
42
42
  "dependencies": {
43
- "@rspack/core": "~2.1.4",
43
+ "@rspack/core": "~2.1.5",
44
44
  "@swc/helpers": "^0.5.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@jridgewell/remapping": "^2.3.5",
48
48
  "@jridgewell/trace-mapping": "^0.3.31",
49
- "@rslib/core": "0.23.2",
49
+ "@rslib/core": "1.0.0-beta.0",
50
50
  "@rstackjs/load-config": "^0.1.2",
51
51
  "@types/cors": "^2.8.19",
52
52
  "@types/node": "^24.13.3",
@@ -71,13 +71,13 @@
71
71
  "mrmime": "^2.0.1",
72
72
  "on-finished": "2.4.1",
73
73
  "open": "^11.0.0",
74
- "postcss": "^8.5.17",
74
+ "postcss": "^8.5.19",
75
75
  "postcss-load-config": "6.0.1",
76
76
  "postcss-loader": "8.2.1",
77
77
  "prebundle": "1.6.5",
78
78
  "range-parser": "^1.3.0",
79
79
  "reduce-configs": "^2.0.1",
80
- "rslog": "^2.2.0",
80
+ "rslog": "^2.3.0",
81
81
  "rspack-chain": "^2.1.1",
82
82
  "rspack-manifest-plugin": "5.2.2",
83
83
  "rspack-merge": "1.0.1",
@@ -86,7 +86,7 @@
86
86
  "style-loader": "^4.0.0",
87
87
  "tinyglobby": "^0.2.17",
88
88
  "typescript": "^6.0.3",
89
- "ws": "^8.21.0"
89
+ "ws": "^8.21.1"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "core-js": ">= 3.0.0"