@rsbuild/core 1.2.7 → 1.2.9
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/README.md +10 -2
- package/compiled/css-loader/index.js +41 -41
- package/compiled/postcss/index.js +107 -105
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-load-config/index.js +10 -10
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/style-loader/index.js +10 -10
- package/dist/index.cjs +149 -106
- package/dist/index.js +149 -106
- package/dist-types/createRsbuild.d.ts +3 -0
- package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +3 -3
- package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +2 -2
- package/dist-types/server/devServer.d.ts +11 -6
- package/dist-types/server/getDevMiddlewares.d.ts +7 -2
- package/dist-types/server/runner/basic.d.ts +6 -0
- package/dist-types/server/runner/index.d.ts +6 -4
- package/dist-types/server/runner/type.d.ts +7 -1
- package/dist-types/server/watchFiles.d.ts +3 -2
- package/dist-types/types/config.d.ts +11 -3
- package/dist-types/types/hooks.d.ts +9 -1
- package/dist-types/types/plugin.d.ts +201 -74
- package/dist-types/types/rsbuild.d.ts +96 -29
- package/package.json +4 -4
|
@@ -4,10 +4,11 @@ import type { RsbuildDevServer } from '../server/devServer';
|
|
|
4
4
|
import type { StartServerResult } from '../server/helper';
|
|
5
5
|
import type { RsbuildConfig } from './config';
|
|
6
6
|
import type { NormalizedConfig, NormalizedEnvironmentConfig } from './config';
|
|
7
|
-
import type { InternalContext
|
|
8
|
-
import type { PluginManager, RsbuildPluginAPI } from './plugin';
|
|
7
|
+
import type { InternalContext } from './context';
|
|
8
|
+
import type { PluginManager, RsbuildPlugin, RsbuildPluginAPI } from './plugin';
|
|
9
9
|
import type { Rspack } from './rspack';
|
|
10
10
|
import type { WebpackConfig } from './thirdParty';
|
|
11
|
+
import type { Falsy } from './utils';
|
|
11
12
|
export type Bundler = 'rspack' | 'webpack';
|
|
12
13
|
export type StartDevServerOptions = {
|
|
13
14
|
/**
|
|
@@ -23,7 +24,6 @@ export type StartDevServerOptions = {
|
|
|
23
24
|
export type CreateDevServerOptions = StartDevServerOptions & {
|
|
24
25
|
/**
|
|
25
26
|
* Whether to trigger Rsbuild compilation
|
|
26
|
-
*
|
|
27
27
|
* @default true
|
|
28
28
|
*/
|
|
29
29
|
runCompile?: boolean;
|
|
@@ -118,33 +118,100 @@ export type RsbuildProvider<B extends 'rspack' | 'webpack' = 'rspack'> = (option
|
|
|
118
118
|
helpers: RsbuildProviderHelpers;
|
|
119
119
|
}) => Promise<ProviderInstance<B>>;
|
|
120
120
|
export type RsbuildInstance = {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Register one or more Rsbuild plugins, which can be called multiple times.
|
|
123
|
+
* This method needs to be called before compiling. If it is called after
|
|
124
|
+
* compiling, it will not affect the compilation result.
|
|
125
|
+
*/
|
|
126
|
+
addPlugins: (plugins: Array<RsbuildPlugin | Falsy>, options?: {
|
|
127
|
+
/**
|
|
128
|
+
* Insert before the specified plugin.
|
|
129
|
+
*/
|
|
130
|
+
before?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Add a plugin for the specified environment.
|
|
133
|
+
* If environment is not specified, it will be registered as a global plugin (effective in all environments)
|
|
134
|
+
*/
|
|
135
|
+
environment?: string;
|
|
136
|
+
}) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Get all the Rsbuild plugins registered in the current Rsbuild instance.
|
|
139
|
+
*/
|
|
140
|
+
getPlugins: (options?: {
|
|
141
|
+
/**
|
|
142
|
+
* Get the plugins in the specified environment.
|
|
143
|
+
* If environment is not specified, get the global plugins.
|
|
144
|
+
*/
|
|
145
|
+
environment: string;
|
|
146
|
+
}) => RsbuildPlugin[];
|
|
147
|
+
/**
|
|
148
|
+
* Removes one or more Rsbuild plugins, which can be called multiple times.
|
|
149
|
+
* This method needs to be called before compiling. If it is called after
|
|
150
|
+
* compiling, it will not affect the compilation result.
|
|
151
|
+
*/
|
|
152
|
+
removePlugins: (pluginNames: string[], options?: {
|
|
153
|
+
/**
|
|
154
|
+
* Remove the plugin in the specified environment.
|
|
155
|
+
* If environment is not specified, remove it in all environments.
|
|
156
|
+
*/
|
|
157
|
+
environment: string;
|
|
158
|
+
}) => void;
|
|
159
|
+
/**
|
|
160
|
+
* Perform a production mode build. This method will generate optimized
|
|
161
|
+
* production bundles and emit them to the output directory.
|
|
162
|
+
*/
|
|
163
|
+
build: Build;
|
|
164
|
+
/**
|
|
165
|
+
* Start a server to preview the production build locally.
|
|
166
|
+
* This method should be executed after `rsbuild.build`.
|
|
167
|
+
*/
|
|
127
168
|
preview: (options?: PreviewOptions) => Promise<StartServerResult>;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Initialize and return the internal Rspack configurations used by Rsbuild.
|
|
171
|
+
* This method processes all plugins and configurations to generate the final
|
|
172
|
+
* Rspack configs. Note: You typically don't need to call this method directly
|
|
173
|
+
* since it's automatically invoked by methods like `rsbuild.build` and
|
|
174
|
+
* `rsbuild.startDevServer`.
|
|
175
|
+
*/
|
|
176
|
+
initConfigs: () => Promise<Rspack.Configuration[]>;
|
|
177
|
+
/**
|
|
178
|
+
* Inspect and debug Rsbuild's internal configurations. It provides access to:
|
|
179
|
+
* - The resolved Rsbuild configuration
|
|
180
|
+
* - The environment-specific Rsbuild configurations
|
|
181
|
+
* - The generated Rspack configurations
|
|
182
|
+
*
|
|
183
|
+
* The method serializes these configurations to strings and optionally writes
|
|
184
|
+
* them to disk for inspection.
|
|
185
|
+
*/
|
|
186
|
+
inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult>;
|
|
187
|
+
/**
|
|
188
|
+
* Create an Rspack [Compiler](https://rspack.dev/api/javascript-api/compiler)
|
|
189
|
+
* instance. If there are multiple [environments](/config/environments) for
|
|
190
|
+
* this build, the return value is `MultiCompiler`.
|
|
191
|
+
*/
|
|
192
|
+
createCompiler: CreateCompiler;
|
|
193
|
+
/**
|
|
194
|
+
* Rsbuild includes a built-in dev server designed to improve the development
|
|
195
|
+
* experience. When you run the `rsbuild dev` command, the server starts
|
|
196
|
+
* automatically and provides features such as page preview, routing, and hot
|
|
197
|
+
* module reloading.
|
|
198
|
+
*
|
|
199
|
+
* If you want to integrate the Rsbuild dev server into a custom server, you
|
|
200
|
+
* can use the `createDevServer` method to create a dev server instance and
|
|
201
|
+
* call its methods as needed.
|
|
202
|
+
*
|
|
203
|
+
* If you want to directly start the Rsbuild dev server, use the
|
|
204
|
+
* `rsbuild.startDevServer` method.
|
|
205
|
+
*/
|
|
206
|
+
createDevServer: CreateDevServer;
|
|
207
|
+
/**
|
|
208
|
+
* Start the local dev server. This method will:
|
|
209
|
+
*
|
|
210
|
+
* 1. Start a development server that serves your application.
|
|
211
|
+
* 2. Watch for file changes and trigger recompilation.
|
|
212
|
+
*/
|
|
213
|
+
startDevServer: StartDevServer;
|
|
214
|
+
} & Pick<RsbuildPluginAPI, 'context' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterStartDevServer' | 'onAfterStartProdServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeStartDevServer' | 'onBeforeStartProdServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit'>;
|
|
148
215
|
export type RsbuildTarget = 'web' | 'node' | 'web-worker';
|
|
149
216
|
export type RsbuildEntryDescription = Rspack.EntryDescription & {
|
|
150
217
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@rslib/core": "0.4.1",
|
|
56
56
|
"@types/connect": "3.4.38",
|
|
57
|
-
"@types/node": "^22.13.
|
|
57
|
+
"@types/node": "^22.13.4",
|
|
58
58
|
"@types/on-finished": "2.3.4",
|
|
59
59
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
60
60
|
"@types/ws": "^8.5.14",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"on-finished": "2.4.1",
|
|
77
77
|
"open": "^8.4.0",
|
|
78
78
|
"picocolors": "^1.1.1",
|
|
79
|
-
"postcss": "^8.5.
|
|
79
|
+
"postcss": "^8.5.2",
|
|
80
80
|
"postcss-load-config": "6.0.1",
|
|
81
81
|
"postcss-loader": "8.1.1",
|
|
82
82
|
"prebundle": "1.2.7",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"style-loader": "3.3.4",
|
|
90
90
|
"tinyglobby": "^0.2.10",
|
|
91
91
|
"typescript": "^5.7.3",
|
|
92
|
-
"webpack": "^5.
|
|
92
|
+
"webpack": "^5.98.0",
|
|
93
93
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
94
94
|
"webpack-merge": "6.0.1",
|
|
95
95
|
"ws": "^8.18.0"
|