@rsbuild/core 2.0.8 → 2.0.10

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.
Files changed (86) hide show
  1. package/compiled/connect-next/package.json +1 -1
  2. package/compiled/css-loader/index.js +2 -2
  3. package/compiled/html-rspack-plugin/index.js +14 -14
  4. package/compiled/html-rspack-plugin/package.json +1 -1
  5. package/compiled/postcss-loader/index.js +6 -6
  6. package/compiled/rslog/index.d.ts +3 -3
  7. package/compiled/rslog/package.json +1 -1
  8. package/compiled/rspack-chain/package.json +1 -1
  9. package/dist/1~rslib-runtime.js +8 -5
  10. package/dist/756.js +25 -21
  11. package/dist/launch-editor-middleware.js +58 -23
  12. package/dist/manifest-plugin.js +6 -6
  13. package/dist/memfs.js +101 -99
  14. package/dist/tinyglobby.js +11 -9
  15. package/dist-types/build.d.ts +1 -1
  16. package/dist-types/cli/init.d.ts +1 -1
  17. package/dist-types/configChain.d.ts +59 -118
  18. package/dist-types/constants.d.ts +35 -31
  19. package/dist-types/createContext.d.ts +1 -2
  20. package/dist-types/createRsbuild.d.ts +1 -2
  21. package/dist-types/defaultConfig.d.ts +2 -4
  22. package/dist-types/helpers/exitHook.d.ts +1 -1
  23. package/dist-types/helpers/format.d.ts +2 -1
  24. package/dist-types/helpers/fs.d.ts +2 -4
  25. package/dist-types/helpers/index.d.ts +1 -2
  26. package/dist-types/helpers/path.d.ts +4 -8
  27. package/dist-types/helpers/stats.d.ts +3 -5
  28. package/dist-types/helpers/url.d.ts +1 -0
  29. package/dist-types/helpers/vendors.d.ts +2 -3
  30. package/dist-types/helpers/version.d.ts +2 -3
  31. package/dist-types/hooks.d.ts +6 -8
  32. package/dist-types/index.d.ts +10 -5
  33. package/dist-types/initConfigs.d.ts +2 -3
  34. package/dist-types/initPlugins.d.ts +1 -1
  35. package/dist-types/inspectConfig.d.ts +1 -1
  36. package/dist-types/loadConfig.d.ts +24 -32
  37. package/dist-types/loadEnv.d.ts +48 -57
  38. package/dist-types/loader/transformRawLoader.d.ts +1 -0
  39. package/dist-types/logger.d.ts +1 -2
  40. package/dist-types/mergeConfig.d.ts +1 -2
  41. package/dist-types/pluginHelper.d.ts +1 -2
  42. package/dist-types/pluginManager.d.ts +4 -7
  43. package/dist-types/plugins/basic.d.ts +1 -2
  44. package/dist-types/plugins/css.d.ts +4 -0
  45. package/dist-types/plugins/fileSize.d.ts +6 -5
  46. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  47. package/dist-types/plugins/server.d.ts +1 -0
  48. package/dist-types/plugins/swc.d.ts +1 -2
  49. package/dist-types/restart.d.ts +4 -5
  50. package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +2 -3
  51. package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +2 -3
  52. package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +3 -4
  53. package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +1 -2
  54. package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +2 -3
  55. package/dist-types/rspackConfig.d.ts +1 -1
  56. package/dist-types/server/ansiHTML.d.ts +1 -2
  57. package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +1 -2
  58. package/dist-types/server/assets-middleware/index.d.ts +3 -5
  59. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +1 -2
  60. package/dist-types/server/browserLogs.d.ts +1 -2
  61. package/dist-types/server/buildManager.d.ts +4 -6
  62. package/dist-types/server/cliShortcuts.d.ts +3 -1
  63. package/dist-types/server/devMiddlewares.d.ts +2 -3
  64. package/dist-types/server/devServer.d.ts +18 -23
  65. package/dist-types/server/gracefulShutdown.d.ts +2 -4
  66. package/dist-types/server/gzipMiddleware.d.ts +1 -1
  67. package/dist-types/server/helper.d.ts +36 -45
  68. package/dist-types/server/historyApiFallback.d.ts +8 -1
  69. package/dist-types/server/httpServer.d.ts +1 -1
  70. package/dist-types/server/middlewares.d.ts +4 -8
  71. package/dist-types/server/open.d.ts +1 -1
  72. package/dist-types/server/runner/basic.d.ts +4 -5
  73. package/dist-types/server/runner/index.d.ts +3 -1
  74. package/dist-types/server/socketServer.d.ts +24 -18
  75. package/dist-types/server/watchFiles.d.ts +1 -1
  76. package/dist-types/types/config.d.ts +1192 -1465
  77. package/dist-types/types/context.d.ts +63 -92
  78. package/dist-types/types/hooks.d.ts +106 -150
  79. package/dist-types/types/plugin.d.ts +359 -444
  80. package/dist-types/types/rsbuild.d.ts +156 -191
  81. package/dist-types/types/thirdParty.d.ts +101 -132
  82. package/dist-types/types/utils.d.ts +2 -5
  83. package/package.json +13 -13
  84. package/dist-types/client/hmr.d.ts +0 -3
  85. package/dist-types/client/log.d.ts +0 -13
  86. package/dist-types/client/overlay.d.ts +0 -1
@@ -7,108 +7,79 @@ import type { RsbuildPluginAPI } from './plugin';
7
7
  import type { RsbuildStats } from './rsbuild';
8
8
  export type BundlerType = 'rspack';
9
9
  export type ActionType = 'dev' | 'build' | 'preview';
10
- /** The public context */
11
- export type RsbuildContext = {
12
- /** The Rsbuild core version. */
13
- version: string;
14
- /** The root path of current project. */
15
- rootPath: string;
16
- /** Absolute path of output files. */
17
- distPath: string;
18
- /** Absolute path of cache files. */
19
- cachePath: string;
10
+ /** The public context */ export type RsbuildContext = {
11
+ /** The Rsbuild core version. */ version: string;
12
+ /** The root path of current project. */ rootPath: string;
13
+ /** Absolute path of output files. */ distPath: string;
14
+ /** Absolute path of cache files. */ cachePath: string;
20
15
  /**
21
- * Dev server information when running in dev mode.
22
- * Available after the dev server has been created.
23
- *
24
- * @example
25
- * ```ts
26
- * import { createRsbuild } from '@rsbuild/core';
27
- *
28
- * async function main() {
29
- * const rsbuild = createRsbuild({
30
- * // ...
31
- * });
32
- * await rsbuild.startDevServer();
33
- * console.log(rsbuild.context.devServer);
34
- * // { hostname: 'localhost', port: 3000, https: false }
35
- * }
36
- * ```
37
- */
38
- devServer?: {
39
- /** The hostname the server is running on. */
40
- hostname: string;
41
- /** The actual port number the server is listening on. */
42
- port: number;
43
- /** Whether the server is using HTTPS protocol. */
44
- https: boolean;
16
+ * Dev server information when running in dev mode.
17
+ * Available after the dev server has been created.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { createRsbuild } from '@rsbuild/core';
22
+ *
23
+ * async function main() {
24
+ * const rsbuild = createRsbuild({
25
+ * // ...
26
+ * });
27
+ * await rsbuild.startDevServer();
28
+ * console.log(rsbuild.context.devServer);
29
+ * // { hostname: 'localhost', port: 3000, https: false }
30
+ * }
31
+ * ```
32
+ */ devServer?: {
33
+ /** The hostname the server is running on. */ hostname: string;
34
+ /** The actual port number the server is listening on. */ port: number;
35
+ /** Whether the server is using HTTPS protocol. */ https: boolean;
45
36
  };
46
37
  /**
47
- * The current action type.
48
- * - dev: will be set when running `rsbuild dev` or `rsbuild.startDevServer()`
49
- * - build: will be set when running `rsbuild build` or `rsbuild.build()`
50
- * - preview: will be set when running `rsbuild preview` or `rsbuild.preview()`
51
- */
52
- action?: ActionType;
38
+ * The current action type.
39
+ * - dev: will be set when running `rsbuild dev` or `rsbuild.startDevServer()`
40
+ * - build: will be set when running `rsbuild build` or `rsbuild.build()`
41
+ * - preview: will be set when running `rsbuild preview` or `rsbuild.preview()`
42
+ */ action?: ActionType;
53
43
  /**
54
- * The bundler type, currently only `rspack` is supported.
55
- * @deprecated Do not use this field, it will be removed in future versions.
56
- */
57
- bundlerType: BundlerType;
44
+ * The bundler type, currently only `rspack` is supported.
45
+ * @deprecated Do not use this field, it will be removed in future versions.
46
+ */ bundlerType: BundlerType;
58
47
  /**
59
- * The name of the framework or tool that is currently invoking Rsbuild,
60
- * same as the `callerName` option in the `createRsbuild` method.
61
- * @example
62
- * - `rslib` is set when Rslib calls Rsbuild.
63
- * - `rspress` is set when Rspress calls Rsbuild.
64
- */
65
- callerName: string;
48
+ * The name of the framework or tool that is currently invoking Rsbuild,
49
+ * same as the `callerName` option in the `createRsbuild` method.
50
+ * @example
51
+ * - `rslib` is set when Rslib calls Rsbuild.
52
+ * - `rspress` is set when Rspress calls Rsbuild.
53
+ */ callerName: string;
66
54
  };
67
55
  export type BuildStatus = 'idle' | 'building' | 'done';
68
56
  export type BuildState = {
69
57
  /**
70
- * The stats object of the last build.
71
- * Available after the build has been done.
72
- */
73
- stats: RsbuildStats | null;
74
- /** Current build status */
75
- status: BuildStatus;
76
- /** Whether there are build errors */
77
- hasErrors: boolean;
78
- /** The build time of each environment */
79
- time: Record<string, number>;
58
+ * The stats object of the last build.
59
+ * Available after the build has been done.
60
+ */ stats: RsbuildStats | null;
61
+ /** Current build status */ status: BuildStatus;
62
+ /** Whether there are build errors */ hasErrors: boolean;
63
+ /** The build time of each environment */ time: Record<string, number>;
80
64
  };
81
- /** The inner context. */
82
- export type InternalContext = RsbuildContext & {
83
- /** The logger associated with current Rsbuild instance. */
84
- logger: Logger;
85
- /** All hooks. */
86
- hooks: Readonly<Hooks>;
87
- /** Current Rsbuild config. */
88
- config: Readonly<RsbuildConfig>;
89
- /** The original Rsbuild config passed from the createRsbuild method. */
90
- originalConfig: Readonly<RsbuildConfig>;
91
- /** The normalized Rsbuild config. */
92
- normalizedConfig?: NormalizedConfig;
65
+ /** The inner context. */ export type InternalContext = RsbuildContext & {
66
+ /** The logger associated with current Rsbuild instance. */ logger: Logger;
67
+ /** All hooks. */ hooks: Readonly<Hooks>;
68
+ /** Current Rsbuild config. */ config: Readonly<RsbuildConfig>;
69
+ /** The original Rsbuild config passed from the createRsbuild method. */ originalConfig: Readonly<RsbuildConfig>;
70
+ /** The normalized Rsbuild config. */ normalizedConfig?: NormalizedConfig;
93
71
  /**
94
- * Get the plugin API.
95
- * When environment is undefined, the global plugin API is returned, which
96
- * can be used in all environments.
97
- */
98
- getPluginAPI?: (environment?: string) => RsbuildPluginAPI;
99
- /** Context information for all environments. */
100
- environments: Record<string, EnvironmentContext>;
101
- /** Array of all environments. */
102
- environmentList: EnvironmentContext[];
103
- /** Only build specified environment. */
104
- specifiedEnvironments?: string[];
105
- /** Build state information */
106
- buildState: BuildState;
107
- /** The socket server instance. */
108
- socketServer?: SocketServer;
72
+ * Get the plugin API.
73
+ * When environment is undefined, the global plugin API is returned, which
74
+ * can be used in all environments.
75
+ */ getPluginAPI?: (environment?: string) => RsbuildPluginAPI;
76
+ /** Context information for all environments. */ environments: Record<string, EnvironmentContext>;
77
+ /** Array of all environments. */ environmentList: EnvironmentContext[];
78
+ /** Only build specified environment. */ specifiedEnvironments?: string[];
79
+ /** Build state information */ buildState: BuildState;
80
+ /** The socket server instance. */ socketServer?: SocketServer;
109
81
  /**
110
- * Pathnames derived from public paths, stripped of `server.base`.
111
- * Used for static asset serving.
112
- */
113
- publicPathnames: string[];
82
+ * Pathnames derived from public paths, stripped of `server.base`.
83
+ * Used for static asset serving.
84
+ */ publicPathnames: string[];
114
85
  };
@@ -20,64 +20,54 @@ export type OnCloseBuildFn = () => MaybePromise<void>;
20
20
  export type OnBeforeBuildFn = (params: CompileCommonParams & {
21
21
  /**
22
22
  * Context information for all environments.
23
- */
24
- environments: Record<string, EnvironmentContext>;
23
+ */ environments: Record<string, EnvironmentContext>;
25
24
  bundlerConfigs?: Rspack.Configuration[];
26
25
  }) => MaybePromise<void>;
27
26
  export type OnBeforeDevCompileFn = (params: CompileCommonParams & {
28
27
  /**
29
28
  * Context information for all environments.
30
- */
31
- environments: Record<string, EnvironmentContext>;
29
+ */ environments: Record<string, EnvironmentContext>;
32
30
  bundlerConfigs?: Rspack.Configuration[];
33
31
  }) => MaybePromise<void>;
34
32
  export type OnAfterEnvironmentCompileFn = (params: CompileCommonParams & {
35
33
  stats?: Rspack.Stats;
36
34
  /**
37
35
  * The time it takes to build the current environment in milliseconds.
38
- */
39
- time: number;
36
+ */ time: number;
40
37
  environment: EnvironmentContext;
41
38
  }) => MaybePromise<void>;
42
39
  export type OnAfterBuildFn = (params: CompileCommonParams & {
43
40
  stats?: Rspack.Stats | Rspack.MultiStats;
44
41
  /**
45
42
  * Context information for all environments.
46
- */
47
- environments: Record<string, EnvironmentContext>;
43
+ */ environments: Record<string, EnvironmentContext>;
48
44
  }) => MaybePromise<void>;
49
45
  export type OnCloseDevServerFn = () => MaybePromise<void>;
50
46
  export type OnAfterDevCompileFn = (params: {
51
47
  isFirstCompile: boolean;
52
48
  stats: Rspack.Stats | Rspack.MultiStats;
53
49
  /**
54
- * Context information for all environments.
55
- */
56
- environments: Record<string, EnvironmentContext>;
50
+ * Context information for all environments.
51
+ */ environments: Record<string, EnvironmentContext>;
57
52
  }) => MaybePromise<void>;
58
53
  /**
59
54
  * @deprecated Use `OnAfterDevCompileFn` instead.
60
- */
61
- export type OnDevCompileDoneFn = OnAfterDevCompileFn;
55
+ */ export type OnDevCompileDoneFn = OnAfterDevCompileFn;
62
56
  export type OnBeforeStartDevServerFn = (params: {
63
57
  /**
64
- * The dev server instance, the same as the return value of `createDevServer`.
65
- */
66
- server: RsbuildDevServer;
58
+ * The dev server instance, the same as the return value of `createDevServer`.
59
+ */ server: RsbuildDevServer;
67
60
  /**
68
- * Context information for all environments.
69
- */
70
- environments: Record<string, EnvironmentContext>;
61
+ * Context information for all environments.
62
+ */ environments: Record<string, EnvironmentContext>;
71
63
  }) => MaybePromise<(() => MaybePromise<void>) | void>;
72
64
  export type OnBeforeStartPreviewServerFn = (params: {
73
65
  /**
74
- * The preview server instance.
75
- */
76
- server: RsbuildPreviewServer;
66
+ * The preview server instance.
67
+ */ server: RsbuildPreviewServer;
77
68
  /**
78
- * Context information for all environments.
79
- */
80
- environments: Record<string, EnvironmentContext>;
69
+ * Context information for all environments.
70
+ */ environments: Record<string, EnvironmentContext>;
81
71
  }) => MaybePromise<void>;
82
72
  export type Routes = {
83
73
  entryName: string;
@@ -87,53 +77,45 @@ export type OnAfterStartDevServerFn = (params: {
87
77
  port: number;
88
78
  routes: Routes;
89
79
  /**
90
- * Context information for all environments.
91
- */
92
- environments: Record<string, EnvironmentContext>;
80
+ * Context information for all environments.
81
+ */ environments: Record<string, EnvironmentContext>;
93
82
  }) => MaybePromise<void>;
94
83
  export type OnAfterStartPreviewServerFn = (params: {
95
84
  port: number;
96
85
  routes: Routes;
97
86
  /**
98
- * Context information for all environments.
99
- */
100
- environments: Record<string, EnvironmentContext>;
87
+ * Context information for all environments.
88
+ */ environments: Record<string, EnvironmentContext>;
101
89
  }) => MaybePromise<void>;
102
90
  export type OnBeforeCreateCompilerFn = (params: {
103
91
  bundlerConfigs: Rspack.Configuration[];
104
92
  /**
105
- * Context information for all environments.
106
- */
107
- environments: Record<string, EnvironmentContext>;
93
+ * Context information for all environments.
94
+ */ environments: Record<string, EnvironmentContext>;
108
95
  }) => MaybePromise<void>;
109
96
  export type OnAfterCreateCompilerFn<Compiler = Rspack.Compiler | Rspack.MultiCompiler> = (params: {
110
97
  compiler: Compiler;
111
98
  /**
112
- * Context information for all environments.
113
- */
114
- environments: Record<string, EnvironmentContext>;
99
+ * Context information for all environments.
100
+ */ environments: Record<string, EnvironmentContext>;
115
101
  }) => MaybePromise<void>;
116
102
  export type OnExitFn = (context: {
117
103
  exitCode: number;
118
104
  }) => void;
119
105
  export type ModifyHTMLContext = {
120
106
  /**
121
- * The Compilation object of Rspack.
122
- */
123
- compilation: Rspack.Compilation;
107
+ * The Compilation object of Rspack.
108
+ */ compilation: Rspack.Compilation;
124
109
  /**
125
- * The Compiler object of Rspack.
126
- */
127
- compiler: Rspack.Compiler;
110
+ * The Compiler object of Rspack.
111
+ */ compiler: Rspack.Compiler;
128
112
  /**
129
- * The name of the HTML file, relative to the dist directory.
130
- * @example 'index.html'
131
- */
132
- filename: string;
113
+ * The name of the HTML file, relative to the dist directory.
114
+ * @example 'index.html'
115
+ */ filename: string;
133
116
  /**
134
- * The environment context for current build.
135
- */
136
- environment: EnvironmentContext;
117
+ * The environment context for current build.
118
+ */ environment: EnvironmentContext;
137
119
  };
138
120
  export type ModifyHTMLFn = (html: string, context: ModifyHTMLContext) => MaybePromise<string>;
139
121
  type HTMLTags = {
@@ -142,136 +124,110 @@ type HTMLTags = {
142
124
  };
143
125
  export type ModifyHTMLTagsContext = Pick<ModifyHTMLContext, 'compilation' | 'compiler' | 'filename' | 'environment'> & {
144
126
  /**
145
- * URL prefix of assets.
146
- * @example 'https://example.com/'
147
- */
148
- assetPrefix: string;
127
+ * URL prefix of assets.
128
+ * @example 'https://example.com/'
129
+ */ assetPrefix: string;
149
130
  };
150
131
  export type ModifyHTMLTagsFn = (tags: HTMLTags, context: ModifyHTMLTagsContext) => MaybePromise<HTMLTags>;
151
132
  export type ModifyRsbuildConfigUtils = {
152
- /** Merge multiple Rsbuild config objects into one. */
153
- mergeRsbuildConfig: (...configs: RsbuildConfig[]) => RsbuildConfig;
133
+ /** Merge multiple Rsbuild config objects into one. */ mergeRsbuildConfig: (...configs: RsbuildConfig[]) => RsbuildConfig;
154
134
  };
155
135
  type ArrayAtLeastOne<A, B> = [A, ...(A | B)[]] | [...(A | B)[], A];
156
136
  export type ModifyEnvironmentConfigUtils = {
157
- /** environment name. */
158
- name: string;
159
- /** Merge multiple Rsbuild environment config objects into one. */
160
- mergeEnvironmentConfig: (...configs: ArrayAtLeastOne<MergedEnvironmentConfig, EnvironmentConfig>) => MergedEnvironmentConfig;
137
+ /** environment name. */ name: string;
138
+ /** Merge multiple Rsbuild environment config objects into one. */ mergeEnvironmentConfig: (...configs: ArrayAtLeastOne<MergedEnvironmentConfig, EnvironmentConfig>) => MergedEnvironmentConfig;
161
139
  };
162
140
  export type ModifyRsbuildConfigFn = (config: RsbuildConfig, utils: ModifyRsbuildConfigUtils) => MaybePromise<RsbuildConfig | void>;
163
141
  export type ModifyEnvironmentConfigFn = (config: MergedEnvironmentConfig, utils: ModifyEnvironmentConfigUtils) => MaybePromise<MergedEnvironmentConfig | void>;
164
142
  export type EnvironmentContext = {
165
143
  /**
166
- * The index of the current environment.
167
- */
168
- index: number;
169
- /**
170
- * The unique name of the current environment is used to distinguish and locate the
171
- * environment, corresponds to the key in the `environments` configuration.
172
- */
173
- name: string;
174
- /**
175
- * The entry object from the `source.entry` option.
176
- */
177
- entry: RsbuildEntry;
178
- /**
179
- * The path information for all HTML assets.
180
- * This value is an object, the key is the entry name and the value is the relative
181
- * path of the HTML file in the dist directory.
182
- */
183
- htmlPaths: Record<string, string>;
184
- /**
185
- * The absolute path of the output directory, corresponding to the `output.distPath.root`
186
- * config of Rsbuild.
187
- */
188
- distPath: string;
189
- /**
190
- * The browserslist configuration of the current environment.
191
- */
192
- browserslist: string[];
193
- /**
194
- * The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json file
195
- * does not exist in current project.
196
- */
197
- tsconfigPath?: string;
198
- /**
199
- * The normalized Rsbuild config for the current environment.
200
- */
201
- config: NormalizedEnvironmentConfig;
202
- /**
203
- * Manifest data. Only available when:
204
- * - The `output.manifest` config is enabled
205
- * - The build has completed, accessible in hooks like `onAfterBuild`,
206
- * `onAfterDevCompile` and `onAfterEnvironmentCompile` or via the environment API
207
- */
208
- manifest?: Record<string, unknown> | ManifestData;
209
- /**
210
- * WebSocket authentication token, used to authenticate WebSocket connections and
211
- * prevent unauthorized access. Only available in the development mode, and is
212
- * an empty string in the production mode.
213
- */
214
- webSocketToken: string;
144
+ * The index of the current environment.
145
+ */ index: number;
146
+ /**
147
+ * The unique name of the current environment is used to distinguish and locate the
148
+ * environment, corresponds to the key in the `environments` configuration.
149
+ */ name: string;
150
+ /**
151
+ * The entry object from the `source.entry` option.
152
+ */ entry: RsbuildEntry;
153
+ /**
154
+ * The path information for all HTML assets.
155
+ * This value is an object, the key is the entry name and the value is the relative
156
+ * path of the HTML file in the dist directory.
157
+ */ htmlPaths: Record<string, string>;
158
+ /**
159
+ * The absolute path of the output directory, corresponding to the `output.distPath.root`
160
+ * config of Rsbuild.
161
+ */ distPath: string;
162
+ /**
163
+ * The browserslist configuration of the current environment.
164
+ */ browserslist: string[];
165
+ /**
166
+ * The absolute path of the tsconfig.json file, or `undefined` if the tsconfig.json file
167
+ * does not exist in current project.
168
+ */ tsconfigPath?: string;
169
+ /**
170
+ * The normalized Rsbuild config for the current environment.
171
+ */ config: NormalizedEnvironmentConfig;
172
+ /**
173
+ * Manifest data. Only available when:
174
+ * - The `output.manifest` config is enabled
175
+ * - The build has completed, accessible in hooks like `onAfterBuild`,
176
+ * `onAfterDevCompile` and `onAfterEnvironmentCompile` or via the environment API
177
+ */ manifest?: Record<string, unknown> | ManifestData;
178
+ /**
179
+ * WebSocket authentication token, used to authenticate WebSocket connections and
180
+ * prevent unauthorized access. Only available in the development mode, and is
181
+ * an empty string in the production mode.
182
+ */ webSocketToken: string;
215
183
  };
216
184
  export type ModifyChainUtils = {
217
185
  /**
218
- * The value of `process.env.NODE_ENV`
219
- */
220
- env: string;
186
+ * The value of `process.env.NODE_ENV`
187
+ */ env: string;
221
188
  /**
222
- * A boolean value indicating whether this is a development build.
223
- * Set to `true` when the `mode` is `development`.
224
- */
225
- isDev: boolean;
189
+ * A boolean value indicating whether this is a development build.
190
+ * Set to `true` when the `mode` is `development`.
191
+ */ isDev: boolean;
226
192
  /**
227
- * A boolean value indicating whether this is a production build.
228
- * Set to `true` when the `mode` is `production`.
229
- */
230
- isProd: boolean;
193
+ * A boolean value indicating whether this is a production build.
194
+ * Set to `true` when the `mode` is `production`.
195
+ */ isProd: boolean;
231
196
  /**
232
- * The current build target.
233
- */
234
- target: RsbuildTarget;
197
+ * The current build target.
198
+ */ target: RsbuildTarget;
235
199
  /**
236
- * A boolean value indicating whether the build target is `node`.
237
- * Equivalent to `target === 'node'`.
238
- */
239
- isServer: boolean;
200
+ * A boolean value indicating whether the build target is `node`.
201
+ * Equivalent to `target === 'node'`.
202
+ */ isServer: boolean;
240
203
  /**
241
- * A boolean value indicating whether the build target is `web-worker`.
242
- * Equivalent to `target === 'web-worker'`.
243
- */
244
- isWebWorker: boolean;
204
+ * A boolean value indicating whether the build target is `web-worker`.
205
+ * Equivalent to `target === 'web-worker'`.
206
+ */ isWebWorker: boolean;
245
207
  /**
246
- * Predefined chain IDs.
247
- */
248
- CHAIN_ID: ChainIdentifier;
208
+ * Predefined chain IDs.
209
+ */ CHAIN_ID: ChainIdentifier;
249
210
  /**
250
- * The environment context for current build.
251
- */
252
- environment: EnvironmentContext;
211
+ * The environment context for current build.
212
+ */ environment: EnvironmentContext;
253
213
  /**
254
- * Context information for all environments.
255
- */
256
- environments: Record<string, EnvironmentContext>;
214
+ * Context information for all environments.
215
+ */ environments: Record<string, EnvironmentContext>;
257
216
  /**
258
- * The Rspack instance, same as `import { rspack } from '@rsbuild/core'`.
259
- */
260
- rspack: typeof rspack;
217
+ * The Rspack instance, same as `import { rspack } from '@rsbuild/core'`.
218
+ */ rspack: typeof rspack;
261
219
  /**
262
- * The default export of `html-rspack-plugin`.
263
- */
264
- HtmlPlugin: typeof HtmlRspackPlugin;
220
+ * The default export of `html-rspack-plugin`.
221
+ */ HtmlPlugin: typeof HtmlRspackPlugin;
265
222
  };
266
223
  export type ModifyBundlerChainUtils = ModifyChainUtils & {
267
224
  /**
268
- * @deprecated Use `rspack` instead.
269
- */
270
- bundler: typeof rspack;
225
+ * @deprecated Use `rspack` instead.
226
+ */ bundler: typeof rspack;
271
227
  };
272
228
  export type ModifyBundlerChainFn = (chain: RspackChain, utils: ModifyBundlerChainUtils) => MaybePromise<void>;
273
229
  export type CreateAsyncHook<Callback extends (...args: any[]) => any> = {
274
230
  tap: (cb: Callback) => void;
275
231
  call: (...args: Parameters<Callback>) => Promise<Parameters<Callback>>;
276
232
  };
277
- export {};
233
+ export { };