@rsbuild/core 1.3.18 → 1.3.20
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/compiled/cors/index.d.ts +1 -1
- package/compiled/css-loader/index.js +23 -21
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/style-loader/index.js +10 -10
- package/dist/client/hmr.js +0 -1
- package/dist/index.cjs +70 -45
- package/dist/index.js +68 -45
- package/dist-types/rspack/RsbuildHtmlPlugin.d.ts +7 -3
- package/dist-types/server/devMiddlewares.d.ts +3 -2
- package/dist-types/server/devServer.d.ts +10 -2
- package/dist-types/server/socketServer.d.ts +2 -1
- package/dist-types/types/config.d.ts +52 -8
- package/dist-types/types/plugin.d.ts +3 -3
- package/package.json +6 -6
|
@@ -8,12 +8,13 @@ import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../c
|
|
|
8
8
|
import type RspackChain from '../../compiled/rspack-chain';
|
|
9
9
|
import type { FileDescriptor } from '../../compiled/rspack-manifest-plugin';
|
|
10
10
|
import type { BundleAnalyzerPlugin } from '../../compiled/webpack-bundle-analyzer/index.js';
|
|
11
|
+
import type { RsbuildDevServer } from '../server/devServer';
|
|
11
12
|
import type { ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
|
|
12
13
|
import type { ModifyWebpackChainUtils, ModifyWebpackConfigUtils, RsbuildPlugins } from './plugin';
|
|
13
14
|
import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
|
|
14
15
|
import type { BundlerPluginInstance, Rspack, RspackRule } from './rspack';
|
|
15
16
|
import type { CSSExtractOptions, CSSLoaderModulesOptions, CSSLoaderOptions, HtmlRspackPlugin, PostCSSLoaderOptions, PostCSSPlugin, StyleLoaderOptions, WebpackConfig } from './thirdParty';
|
|
16
|
-
import type { ConfigChain,
|
|
17
|
+
import type { ConfigChain, ConfigChainMergeContext, ConfigChainWithContext, DeepReadonly, MaybePromise, OneOrMany } from './utils';
|
|
17
18
|
export type ToolsSwcConfig = ConfigChain<SwcLoaderOptions>;
|
|
18
19
|
export type ToolsBundlerChainConfig = OneOrMany<(chain: RspackChain, utils: ModifyBundlerChainUtils) => MaybePromise<void>>;
|
|
19
20
|
export type ToolsPostCSSLoaderConfig = ConfigChainWithContext<PostCSSLoaderOptions, {
|
|
@@ -25,16 +26,62 @@ export type ToolsHtmlPluginConfig = ConfigChainWithContext<HtmlRspackPlugin.Opti
|
|
|
25
26
|
entryName: string;
|
|
26
27
|
entryValue: (string | string[] | Rspack.EntryDescription)[];
|
|
27
28
|
}>;
|
|
28
|
-
export type
|
|
29
|
+
export type RspackMerge = (firstConfiguration: Rspack.Configuration | Rspack.Configuration[], ...configurations: Rspack.Configuration[]) => Rspack.Configuration;
|
|
29
30
|
export type ModifyRspackConfigUtils = ModifyChainUtils & {
|
|
30
31
|
addRules: (rules: RspackRule | RspackRule[]) => void;
|
|
31
32
|
appendRules: (rules: RspackRule | RspackRule[]) => void;
|
|
32
33
|
prependPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
|
|
33
34
|
appendPlugins: (plugins: BundlerPluginInstance | BundlerPluginInstance[]) => void;
|
|
34
35
|
removePlugin: (pluginName: string) => void;
|
|
35
|
-
mergeConfig:
|
|
36
|
+
mergeConfig: RspackMerge;
|
|
36
37
|
};
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Narrow the type of Rspack.Configuration to make it easier
|
|
40
|
+
* to use `tools.rspack` function. These properties are set
|
|
41
|
+
* by Rsbuild by default so they are non-nullable.
|
|
42
|
+
*
|
|
43
|
+
* - With `Rspack.Configuration`, the `plugins` property is nullable:
|
|
44
|
+
*
|
|
45
|
+
* ```js
|
|
46
|
+
* tools: {
|
|
47
|
+
* rspack(config) {
|
|
48
|
+
* if (!config.plugins) {
|
|
49
|
+
* config.plugins = [];
|
|
50
|
+
* }
|
|
51
|
+
* config.plugins.push(new SomePlugin());
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* - With `NarrowedRspackConfig`, the `plugins` property is non-nullable:
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* tools: {
|
|
60
|
+
* rspack(config) {
|
|
61
|
+
* config.plugins.push(new SomePlugin());
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export type NarrowedRspackConfig = Omit<Rspack.Configuration, 'plugins' | 'module' | 'resolve' | 'output'> & {
|
|
67
|
+
/**
|
|
68
|
+
* Plugins to use during compilation.
|
|
69
|
+
*/
|
|
70
|
+
plugins: NonNullable<Rspack.Configuration['plugins']>;
|
|
71
|
+
/**
|
|
72
|
+
* Options for module configuration.
|
|
73
|
+
*/
|
|
74
|
+
module: NonNullable<Rspack.Configuration['module']>;
|
|
75
|
+
/**
|
|
76
|
+
* Options for resolving modules.
|
|
77
|
+
*/
|
|
78
|
+
resolve: NonNullable<Rspack.Configuration['resolve']>;
|
|
79
|
+
/**
|
|
80
|
+
* Configuration for the output of the compilation.
|
|
81
|
+
*/
|
|
82
|
+
output: NonNullable<Rspack.Configuration['output']>;
|
|
83
|
+
};
|
|
84
|
+
export type ToolsRspackConfig = OneOrMany<Rspack.Configuration | ((config: NarrowedRspackConfig, ctx: ModifyRspackConfigUtils) => MaybePromise<Rspack.Configuration | void>)>;
|
|
38
85
|
export type ToolsWebpackConfig = ConfigChainWithContext<WebpackConfig, ModifyWebpackConfigUtils>;
|
|
39
86
|
export type ToolsWebpackChainConfig = OneOrMany<(chain: RspackChain, utils: ModifyWebpackChainUtils) => void>;
|
|
40
87
|
export interface ToolsConfig {
|
|
@@ -1209,10 +1256,7 @@ export type EnvironmentAPI = {
|
|
|
1209
1256
|
getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1210
1257
|
};
|
|
1211
1258
|
};
|
|
1212
|
-
export type SetupMiddlewaresServer =
|
|
1213
|
-
sockWrite: (type: string, data?: string | boolean | Record<string, any>) => void;
|
|
1214
|
-
environments: EnvironmentAPI;
|
|
1215
|
-
};
|
|
1259
|
+
export type SetupMiddlewaresServer = Pick<RsbuildDevServer, 'sockWrite' | 'environments'>;
|
|
1216
1260
|
export type SetupMiddlewaresFn = (middlewares: {
|
|
1217
1261
|
unshift: (...handlers: RequestHandler[]) => void;
|
|
1218
1262
|
push: (...handlers: RequestHandler[]) => void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { RuleSetRule, Configuration as WebpackConfig, WebpackPluginInstance } from 'webpack';
|
|
3
3
|
import type RspackChain from '../../compiled/rspack-chain';
|
|
4
4
|
import type { ChainIdentifier } from '../configChain';
|
|
5
|
-
import type { ModifyRspackConfigUtils, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig,
|
|
5
|
+
import type { ModifyRspackConfigUtils, NarrowedRspackConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig, RspackMerge } from './config';
|
|
6
6
|
import type { RsbuildContext } from './context';
|
|
7
7
|
import type { EnvironmentContext, ModifyBundlerChainFn, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './hooks';
|
|
8
8
|
import type { RsbuildInstance, RsbuildTarget } from './rsbuild';
|
|
@@ -92,7 +92,7 @@ export type AsyncHook<Callback extends (...args: any[]) => T, T = any> = {
|
|
|
92
92
|
*/
|
|
93
93
|
callBatch: (...args: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>>[]>;
|
|
94
94
|
};
|
|
95
|
-
export type ModifyRspackConfigFn = (config:
|
|
95
|
+
export type ModifyRspackConfigFn = (config: NarrowedRspackConfig, utils: ModifyRspackConfigUtils) => MaybePromise<Rspack.Configuration | void>;
|
|
96
96
|
export type ModifyWebpackChainUtils = ModifyChainUtils & {
|
|
97
97
|
/** @ts-ignore `webpack` type only exists when `@rsbuild/webpack` is installed */
|
|
98
98
|
webpack: typeof import('webpack');
|
|
@@ -112,7 +112,7 @@ export type ModifyWebpackConfigUtils = ModifyWebpackChainUtils & {
|
|
|
112
112
|
prependPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
|
|
113
113
|
appendPlugins: (plugins: WebpackPluginInstance | WebpackPluginInstance[]) => void;
|
|
114
114
|
removePlugin: (pluginName: string) => void;
|
|
115
|
-
mergeConfig:
|
|
115
|
+
mergeConfig: RspackMerge;
|
|
116
116
|
};
|
|
117
117
|
export type ModifyWebpackChainFn = (chain: RspackChain, utils: ModifyWebpackChainUtils) => Promise<void> | void;
|
|
118
118
|
export type ModifyWebpackConfigFn = (config: WebpackConfig, utils: ModifyWebpackConfigUtils) => Promise<WebpackConfig | void> | WebpackConfig | void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.20",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.
|
|
49
|
+
"@rspack/core": "1.3.10",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.42.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.
|
|
56
|
+
"@rslib/core": "0.7.0",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
|
-
"@types/cors": "^2.8.
|
|
59
|
-
"@types/node": "^22.15.
|
|
58
|
+
"@types/cors": "^2.8.18",
|
|
59
|
+
"@types/node": "^22.15.17",
|
|
60
60
|
"@types/on-finished": "2.3.4",
|
|
61
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"style-loader": "3.3.4",
|
|
91
91
|
"tinyglobby": "^0.2.13",
|
|
92
92
|
"typescript": "^5.8.3",
|
|
93
|
-
"webpack": "^5.
|
|
93
|
+
"webpack": "^5.99.8",
|
|
94
94
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
95
95
|
"webpack-merge": "6.0.1",
|
|
96
96
|
"ws": "^8.18.2"
|