@rsbuild/core 2.0.7 → 2.0.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/compiled/css-loader/index.js +2 -2
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +1 -1
- package/compiled/postcss/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/dist/1~rslib-runtime.js +8 -5
- package/dist/{753.js → 756.js} +157 -128
- package/dist/client/hmr.js +1 -1
- package/dist/client/overlay.js +1 -1
- package/dist/http-proxy-middleware.js +2 -5
- package/dist/index.js +1 -1
- package/dist/launch-editor-middleware.js +1 -1
- package/dist/manifest-plugin.js +7 -7
- package/dist/memfs.js +5 -5
- package/dist/ws.js +45 -31
- package/dist-types/build.d.ts +1 -1
- package/dist-types/cli/init.d.ts +1 -1
- package/dist-types/configChain.d.ts +59 -118
- package/dist-types/constants.d.ts +35 -31
- package/dist-types/createContext.d.ts +1 -2
- package/dist-types/createRsbuild.d.ts +1 -2
- package/dist-types/defaultConfig.d.ts +2 -4
- package/dist-types/helpers/exitHook.d.ts +1 -1
- package/dist-types/helpers/format.d.ts +2 -1
- package/dist-types/helpers/fs.d.ts +2 -4
- package/dist-types/helpers/index.d.ts +1 -2
- package/dist-types/helpers/packageJson.d.ts +1 -1
- package/dist-types/helpers/path.d.ts +4 -8
- package/dist-types/helpers/stats.d.ts +3 -5
- package/dist-types/helpers/url.d.ts +1 -0
- package/dist-types/helpers/vendors.d.ts +2 -3
- package/dist-types/helpers/version.d.ts +2 -3
- package/dist-types/hooks.d.ts +6 -8
- package/dist-types/index.d.ts +10 -5
- package/dist-types/initConfigs.d.ts +2 -3
- package/dist-types/initPlugins.d.ts +1 -1
- package/dist-types/inspectConfig.d.ts +1 -1
- package/dist-types/loadConfig.d.ts +24 -32
- package/dist-types/loadEnv.d.ts +48 -57
- package/dist-types/loader/transformRawLoader.d.ts +1 -0
- package/dist-types/logger.d.ts +1 -2
- package/dist-types/mergeConfig.d.ts +1 -2
- package/dist-types/pluginHelper.d.ts +1 -2
- package/dist-types/pluginManager.d.ts +4 -7
- package/dist-types/plugins/basic.d.ts +1 -2
- package/dist-types/plugins/css.d.ts +5 -1
- package/dist-types/plugins/externals.d.ts +1 -1
- package/dist-types/plugins/fileSize.d.ts +6 -5
- package/dist-types/plugins/rspackProfile.d.ts +2 -0
- package/dist-types/plugins/server.d.ts +1 -0
- package/dist-types/plugins/swc.d.ts +1 -2
- package/dist-types/restart.d.ts +4 -5
- package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +2 -3
- package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +3 -4
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +1 -2
- package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +2 -3
- package/dist-types/rspackConfig.d.ts +1 -1
- package/dist-types/server/ansiHTML.d.ts +1 -2
- package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +1 -2
- package/dist-types/server/assets-middleware/index.d.ts +3 -5
- package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +1 -2
- package/dist-types/server/browserLogs.d.ts +1 -2
- package/dist-types/server/buildManager.d.ts +4 -6
- package/dist-types/server/cliShortcuts.d.ts +3 -1
- package/dist-types/server/devMiddlewares.d.ts +2 -3
- package/dist-types/server/devServer.d.ts +18 -23
- package/dist-types/server/gracefulShutdown.d.ts +2 -4
- package/dist-types/server/gzipMiddleware.d.ts +1 -1
- package/dist-types/server/helper.d.ts +39 -47
- package/dist-types/server/historyApiFallback.d.ts +8 -1
- package/dist-types/server/httpServer.d.ts +1 -1
- package/dist-types/server/middlewares.d.ts +4 -8
- package/dist-types/server/open.d.ts +1 -1
- package/dist-types/server/runner/basic.d.ts +4 -5
- package/dist-types/server/runner/index.d.ts +3 -1
- package/dist-types/server/socketServer.d.ts +24 -18
- package/dist-types/server/watchFiles.d.ts +1 -1
- package/dist-types/types/config.d.ts +1197 -1457
- package/dist-types/types/context.d.ts +63 -92
- package/dist-types/types/hooks.d.ts +106 -150
- package/dist-types/types/plugin.d.ts +359 -444
- package/dist-types/types/rsbuild.d.ts +156 -191
- package/dist-types/types/thirdParty.d.ts +101 -132
- package/dist-types/types/utils.d.ts +2 -5
- package/package.json +10 -10
- package/dist-types/client/hmr.d.ts +0 -3
- package/dist-types/client/log.d.ts +0 -13
- package/dist-types/client/overlay.d.ts +0 -1
- /package/dist/{753.js.LICENSE.txt → 756.js.LICENSE.txt} +0 -0
- /package/dist/client/{797.js → 60.js} +0 -0
|
@@ -12,84 +12,70 @@ export type HookDescriptor<T extends (...args: any[]) => any> = {
|
|
|
12
12
|
};
|
|
13
13
|
export type EnvironmentAsyncHook<Callback extends (...args: any[]) => T, T = any> = {
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
tapEnvironment: (params: {
|
|
15
|
+
* Registers a callback function to be executed when the hook is triggered.
|
|
16
|
+
* The callback can be a plain function or a HookDescriptor that includes execution order.
|
|
17
|
+
* The callback will be executed in all environments by default.
|
|
18
|
+
* If you need to specify the environment, use `tapEnvironment`
|
|
19
|
+
* @param cb The callback function or hook descriptor to register
|
|
20
|
+
*/ tap: (cb: Callback | HookDescriptor<Callback>) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Registers a callback function to be executed when the hook is triggered.
|
|
23
|
+
* The callback will only be executed under the specified environment.
|
|
24
|
+
*/ tapEnvironment: (params: {
|
|
27
25
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
environment?: string;
|
|
26
|
+
* Specify the environment that the callback will be executed under.
|
|
27
|
+
*/ environment?: string;
|
|
31
28
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
handler: Callback | HookDescriptor<Callback>;
|
|
29
|
+
* The callback function or hook descriptor to register
|
|
30
|
+
*/ handler: Callback | HookDescriptor<Callback>;
|
|
35
31
|
}) => void;
|
|
36
32
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
callChain: (params: {
|
|
33
|
+
* Executes callbacks in sequence independently and collects all their results into an array.
|
|
34
|
+
* Each callback receives the original parameters, and their results don't affect subsequent callbacks.
|
|
35
|
+
* @returns A promise that resolves with an array containing the results of all callbacks
|
|
36
|
+
*/ callChain: (params: {
|
|
42
37
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
environment?: string;
|
|
38
|
+
* Specify the environment for filtering callbacks.
|
|
39
|
+
*/ environment?: string;
|
|
46
40
|
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
args: Parameters<Callback>;
|
|
41
|
+
* The parameters to pass to each callback
|
|
42
|
+
*/ args: Parameters<Callback>;
|
|
50
43
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
afterEach?: (args: Parameters<Callback>) => void;
|
|
44
|
+
* The callback function to be executed after each callback
|
|
45
|
+
*/ afterEach?: (args: Parameters<Callback>) => void;
|
|
54
46
|
}) => Promise<Parameters<Callback>>;
|
|
55
47
|
/**
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
callBatch: (params: {
|
|
48
|
+
* Executes callbacks in sequence independently and collects all their results into an array.
|
|
49
|
+
* Each callback receives the original parameters, and their results don't affect subsequent callbacks.
|
|
50
|
+
* @returns A promise that resolves with an array containing the results of all callbacks
|
|
51
|
+
*/ callBatch: (params: {
|
|
61
52
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
environment?: string;
|
|
53
|
+
* Specify the environment for filtering callbacks.
|
|
54
|
+
*/ environment?: string;
|
|
65
55
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
args: Parameters<Callback>;
|
|
56
|
+
* The parameters to pass to each callback
|
|
57
|
+
*/ args: Parameters<Callback>;
|
|
69
58
|
}) => Promise<Awaited<ReturnType<Callback>>[]>;
|
|
70
59
|
};
|
|
71
60
|
export type AsyncHook<Callback extends (...args: any[]) => T, T = any> = {
|
|
72
61
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
* @returns A promise that resolves with an array containing the results of all callbacks
|
|
91
|
-
*/
|
|
92
|
-
callBatch: (...args: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>>[]>;
|
|
62
|
+
* Registers a callback function to be executed when the hook is triggered.
|
|
63
|
+
* The callback can be a plain function or a HookDescriptor that includes execution order.
|
|
64
|
+
* @param cb The callback function or hook descriptor to register
|
|
65
|
+
*/ tap: (cb: Callback | HookDescriptor<Callback>) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Executes callbacks in sequence, passing the result of each callback as the first argument
|
|
68
|
+
* to the next callback in the chain. If a callback returns undefined, the original arguments
|
|
69
|
+
* will be passed to the next callback.
|
|
70
|
+
* @param params The initial parameters to pass to the first callback
|
|
71
|
+
* @returns A promise that resolves with the final parameters after all callbacks have executed
|
|
72
|
+
*/ callChain: (...args: Parameters<Callback>) => Promise<Parameters<Callback>>;
|
|
73
|
+
/**
|
|
74
|
+
* Executes callbacks in sequence independently and collects all their results into an array.
|
|
75
|
+
* Each callback receives the original parameters, and their results don't affect subsequent callbacks.
|
|
76
|
+
* @param params The parameters to pass to each callback
|
|
77
|
+
* @returns A promise that resolves with an array containing the results of all callbacks
|
|
78
|
+
*/ callBatch: (...args: Parameters<Callback>) => Promise<Awaited<ReturnType<Callback>>[]>;
|
|
93
79
|
};
|
|
94
80
|
export type ModifyRspackConfigFn = (config: NarrowedRspackConfig, utils: ModifyRspackConfigUtils) => MaybePromise<Rspack.Configuration | void>;
|
|
95
81
|
export type PluginMeta = {
|
|
@@ -97,14 +83,12 @@ export type PluginMeta = {
|
|
|
97
83
|
instance: RsbuildPlugin;
|
|
98
84
|
};
|
|
99
85
|
export type PluginManager = Pick<RsbuildInstance, 'getPlugins' | 'addPlugins' | 'isPluginExists' | 'removePlugins'> & {
|
|
100
|
-
/** Get all plugins with environment info */
|
|
101
|
-
getAllPluginsWithMeta: () => PluginMeta[];
|
|
86
|
+
/** Get all plugins with environment info */ getAllPluginsWithMeta: () => PluginMeta[];
|
|
102
87
|
};
|
|
103
|
-
export type RsbuildPluginApplyFn = (
|
|
104
|
-
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
config: RsbuildConfig, context: Pick<RsbuildContext, 'action'>) => boolean;
|
|
88
|
+
export type RsbuildPluginApplyFn = (// rslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
89
|
+
this: void, /**
|
|
90
|
+
* The original Rsbuild configuration object (before plugin processing)
|
|
91
|
+
*/ config: RsbuildConfig, context: Pick<RsbuildContext, 'action'>) => boolean;
|
|
108
92
|
export type RsbuildPluginApply = 'serve' | 'build' | RsbuildPluginApplyFn;
|
|
109
93
|
/**
|
|
110
94
|
* Defines the structure and behavior of an Rsbuild plugin.
|
|
@@ -122,60 +106,56 @@ export type RsbuildPluginApply = 'serve' | 'build' | RsbuildPluginApplyFn;
|
|
|
122
106
|
* }
|
|
123
107
|
* });
|
|
124
108
|
* ```
|
|
125
|
-
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* Declare the names of post-plugins, which will be executed after the current plugin.
|
|
162
|
-
* This has higher precedence than the `enforce` property.
|
|
163
|
-
*/
|
|
164
|
-
post?: string[];
|
|
165
|
-
/**
|
|
166
|
-
* Declare the plugins that need to be removed, you can pass an array of plugin names.
|
|
167
|
-
*/
|
|
168
|
-
remove?: string[];
|
|
109
|
+
*/ export type RsbuildPlugin = {
|
|
110
|
+
/**
|
|
111
|
+
* The name of the plugin, a unique identifier.
|
|
112
|
+
*/ name: string;
|
|
113
|
+
/**
|
|
114
|
+
* Conditional apply the plugin during serve or build.
|
|
115
|
+
* - `'serve'`: Apply the plugin when starting the dev server or preview server.
|
|
116
|
+
* - `'build'`: Apply the plugin during build.
|
|
117
|
+
* - Can be a function that returns `true` to apply the plugin or `false` to skip it.
|
|
118
|
+
* - If not specified, the plugin will be applied during both serve and build.
|
|
119
|
+
*/ apply?: RsbuildPluginApply;
|
|
120
|
+
/**
|
|
121
|
+
* The setup function of the plugin, which can be an async function.
|
|
122
|
+
* This function is called once when the plugin is initialized.
|
|
123
|
+
* @param api provides the context info, utility functions and lifecycle hooks.
|
|
124
|
+
*/ setup: (api: RsbuildPluginAPI) => MaybePromise<void>;
|
|
125
|
+
/**
|
|
126
|
+
* Specifies the execution order of the plugin.
|
|
127
|
+
* - `'pre'`: Execute the plugin before other plugins.
|
|
128
|
+
* - `'post'`: Execute the plugin after other plugins.
|
|
129
|
+
* - If not specified, the plugin will execute in the order they were registered.
|
|
130
|
+
*
|
|
131
|
+
* This affects the order in which hooks are registered, but if a hook specifies
|
|
132
|
+
* an `order` property, the `order` takes higher precedence.
|
|
133
|
+
*/ enforce?: 'pre' | 'post';
|
|
134
|
+
/**
|
|
135
|
+
* Declare the names of pre-plugins, which will be executed before the current plugin.
|
|
136
|
+
* This has higher precedence than the `enforce` property.
|
|
137
|
+
*/ pre?: string[];
|
|
138
|
+
/**
|
|
139
|
+
* Declare the names of post-plugins, which will be executed after the current plugin.
|
|
140
|
+
* This has higher precedence than the `enforce` property.
|
|
141
|
+
*/ post?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* Declare the plugins that need to be removed, you can pass an array of plugin names.
|
|
144
|
+
*/ remove?: string[];
|
|
169
145
|
};
|
|
146
|
+
// Support for registering lower version Rsbuild plugins in the new version of
|
|
147
|
+
// Rsbuild core without throwing type mismatches. In most cases, Rsbuild core
|
|
148
|
+
// only adds new methods or properties to the API object, which means that lower
|
|
149
|
+
// version plugins will usually work fine.
|
|
170
150
|
type LooseRsbuildPlugin = Omit<RsbuildPlugin, 'setup' | 'apply'> & {
|
|
171
151
|
apply?: any;
|
|
172
152
|
setup: (api: any) => MaybePromise<void>;
|
|
173
153
|
};
|
|
174
154
|
export type RsbuildPlugins = (LooseRsbuildPlugin | Falsy | Promise<LooseRsbuildPlugin | Falsy | RsbuildPlugins> | RsbuildPlugins)[];
|
|
175
155
|
export type GetRsbuildConfig = {
|
|
176
|
-
(): Readonly<RsbuildConfig>;
|
|
177
|
-
(type: 'original' | 'current'): Readonly<RsbuildConfig>;
|
|
178
|
-
(type: 'normalized'): NormalizedConfig;
|
|
156
|
+
() : Readonly<RsbuildConfig>;
|
|
157
|
+
(type: 'original' | 'current') : Readonly<RsbuildConfig>;
|
|
158
|
+
(type: 'normalized') : NormalizedConfig;
|
|
179
159
|
};
|
|
180
160
|
type PluginHook<T extends (...args: any[]) => any> = (options: T | HookDescriptor<T>) => void;
|
|
181
161
|
type TransformResult = string | Buffer | {
|
|
@@ -184,162 +164,135 @@ type TransformResult = string | Buffer | {
|
|
|
184
164
|
};
|
|
185
165
|
export type TransformContext<Raw extends boolean = false> = {
|
|
186
166
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
* @param sourceMap source map of the asset
|
|
239
|
-
* @param assetInfo additional asset information
|
|
240
|
-
*/
|
|
241
|
-
emitFile: Rspack.LoaderContext['emitFile'];
|
|
242
|
-
/**
|
|
243
|
-
* Compile and execute a module at the build time.
|
|
244
|
-
*/
|
|
245
|
-
importModule: Rspack.LoaderContext['importModule'];
|
|
246
|
-
/**
|
|
247
|
-
* Resolve a module specifier.
|
|
248
|
-
*/
|
|
249
|
-
resolve: Rspack.LoaderContext['resolve'];
|
|
167
|
+
* The code of the module.
|
|
168
|
+
* When `raw` is true, this will be a Buffer instead of a string.
|
|
169
|
+
*/ code: Raw extends true ? Buffer : string;
|
|
170
|
+
/**
|
|
171
|
+
* The directory path of the currently processed module,
|
|
172
|
+
* which changes with the location of each processed module.
|
|
173
|
+
*/ context: string | null;
|
|
174
|
+
/**
|
|
175
|
+
* The absolute path of the module, including the query.
|
|
176
|
+
* @example '/home/user/project/src/index.js?foo=123'
|
|
177
|
+
*/ resource: string;
|
|
178
|
+
/**
|
|
179
|
+
* The absolute path of the module, without the query.
|
|
180
|
+
* @example '/home/user/project/src/index.js'
|
|
181
|
+
*/ resourcePath: string;
|
|
182
|
+
/**
|
|
183
|
+
* The query of the module.
|
|
184
|
+
* @example '?foo=123'
|
|
185
|
+
*/ resourceQuery: string;
|
|
186
|
+
/**
|
|
187
|
+
* The environment context for current build.
|
|
188
|
+
*/ environment: EnvironmentContext;
|
|
189
|
+
/**
|
|
190
|
+
* Add an additional file as the dependency.
|
|
191
|
+
* The file will be watched and changes to the file will trigger rebuild.
|
|
192
|
+
* @param file The absolute path of the module
|
|
193
|
+
*/ addDependency: (file: string) => void;
|
|
194
|
+
/**
|
|
195
|
+
* Add a non-existing file as a dependency.
|
|
196
|
+
* Similar to addDependency, but handles the creation of files during compilation before watchers are attached correctly.
|
|
197
|
+
* The file will be watched and changes to the file will trigger rebuild.
|
|
198
|
+
* @param file The absolute path of the module
|
|
199
|
+
*/ addMissingDependency(file: string): void;
|
|
200
|
+
/**
|
|
201
|
+
* Add a directory as dependency.
|
|
202
|
+
* The directory will be watched and changes to the directory will trigger rebuild.
|
|
203
|
+
* @param context The absolute path of the directory
|
|
204
|
+
*/ addContextDependency(context: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Emits a file to the build output.
|
|
207
|
+
* @param name file name of the asset
|
|
208
|
+
* @param content the source of the asset
|
|
209
|
+
* @param sourceMap source map of the asset
|
|
210
|
+
* @param assetInfo additional asset information
|
|
211
|
+
*/ emitFile: Rspack.LoaderContext['emitFile'];
|
|
212
|
+
/**
|
|
213
|
+
* Compile and execute a module at the build time.
|
|
214
|
+
*/ importModule: Rspack.LoaderContext['importModule'];
|
|
215
|
+
/**
|
|
216
|
+
* Resolve a module specifier.
|
|
217
|
+
*/ resolve: Rspack.LoaderContext['resolve'];
|
|
250
218
|
};
|
|
251
219
|
export type TransformHandler<Raw extends boolean = false> = (context: TransformContext<Raw>) => MaybePromise<TransformResult>;
|
|
252
220
|
export type TransformDescriptor = {
|
|
253
221
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
* @deprecated Use `order` instead.
|
|
314
|
-
*/
|
|
315
|
-
enforce?: 'pre' | 'post';
|
|
316
|
-
/**
|
|
317
|
-
* Specifies the execution order of the transform function.
|
|
318
|
-
* - When specified as 'pre', the transform function will execute before other
|
|
319
|
-
* transform functions (or Rspack loaders).
|
|
320
|
-
* - When specified as 'post', the transform function will execute after other
|
|
321
|
-
* transform functions (or Rspack loaders).
|
|
322
|
-
* @see https://rspack.rs/config/module-rules#rulesenforce
|
|
323
|
-
*/
|
|
324
|
-
order?: HookOrder;
|
|
222
|
+
* Include modules that match the test assertion, the same as `rules[].test`
|
|
223
|
+
* @see https://rspack.rs/config/module-rules#rulestest
|
|
224
|
+
*/ test?: Rspack.RuleSetCondition;
|
|
225
|
+
/**
|
|
226
|
+
* A condition that matches the resource query.
|
|
227
|
+
* @see https://rspack.rs/config/module-rules#rulesresourcequery
|
|
228
|
+
*/ resourceQuery?: Rspack.RuleSetCondition;
|
|
229
|
+
/**
|
|
230
|
+
* Match based on the Rsbuild targets and only apply the transform to
|
|
231
|
+
* certain targets.
|
|
232
|
+
* @see https://rsbuild.rs/config/output/target
|
|
233
|
+
*/ targets?: RsbuildTarget[];
|
|
234
|
+
/**
|
|
235
|
+
* Match based on the Rsbuild environment names and only apply the transform
|
|
236
|
+
* to certain environments.
|
|
237
|
+
* @see https://rsbuild.rs/config/environments
|
|
238
|
+
*/ environments?: string[];
|
|
239
|
+
/**
|
|
240
|
+
* If raw is `true`, the transform handler will receive the Buffer type code
|
|
241
|
+
* instead of the string type.
|
|
242
|
+
* @see https://rspack.rs/api/loader-api/examples#raw-loader
|
|
243
|
+
*/ raw?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Marks the layer of the matching module, can be used to group a group of
|
|
246
|
+
* modules into one layer
|
|
247
|
+
* @see https://rspack.rs/config/module-rules#ruleslayer
|
|
248
|
+
*/ layer?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Matches all modules that match this resource, and will match against layer of
|
|
251
|
+
* the module that issued the current module.
|
|
252
|
+
* @see https://rspack.rs/config/module-rules#rulesissuerlayer
|
|
253
|
+
*/ issuerLayer?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Matches all modules that match this resource, and will match against Resource
|
|
256
|
+
* (the absolute path without query and fragment) of the module that issued the
|
|
257
|
+
* current module.
|
|
258
|
+
* @see https://rspack.rs/config/module-rules#rulesissuer
|
|
259
|
+
*/ issuer?: Rspack.RuleSetCondition;
|
|
260
|
+
/**
|
|
261
|
+
* Matches [import attributes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with)
|
|
262
|
+
* @see https://rspack.rs/config/module-rules#ruleswith
|
|
263
|
+
*/ with?: Record<string, Rspack.RuleSetCondition>;
|
|
264
|
+
/**
|
|
265
|
+
* Matches modules based on MIME type instead of file extension. It's primarily
|
|
266
|
+
* useful for data URI module (like `data:text/javascript,...`).
|
|
267
|
+
* @see https://rspack.rs/config/module-rules#rulesmimetype
|
|
268
|
+
*/ mimetype?: Rspack.RuleSetCondition;
|
|
269
|
+
/**
|
|
270
|
+
* The original property for specifying execution order, now deprecated in favor of `order`.
|
|
271
|
+
* @deprecated Use `order` instead.
|
|
272
|
+
*/ enforce?: 'pre' | 'post';
|
|
273
|
+
/**
|
|
274
|
+
* Specifies the execution order of the transform function.
|
|
275
|
+
* - When specified as 'pre', the transform function will execute before other
|
|
276
|
+
* transform functions (or Rspack loaders).
|
|
277
|
+
* - When specified as 'post', the transform function will execute after other
|
|
278
|
+
* transform functions (or Rspack loaders).
|
|
279
|
+
* @see https://rspack.rs/config/module-rules#rulesenforce
|
|
280
|
+
*/ order?: HookOrder;
|
|
325
281
|
};
|
|
326
282
|
export type TransformHook = <T extends TransformDescriptor>(descriptor: T, handler: TransformHandler<T['raw'] extends true ? true : false>) => void;
|
|
327
283
|
export type ProcessAssetsStage = 'additional' | 'pre-process' | 'derived' | 'additions' | 'none' | 'optimize' | 'optimize-count' | 'optimize-compatibility' | 'optimize-size' | 'dev-tooling' | 'optimize-inline' | 'summarize' | 'optimize-hash' | 'optimize-transfer' | 'analyse' | 'report';
|
|
328
284
|
export type ProcessAssetsDescriptor = {
|
|
329
285
|
/**
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
stage: ProcessAssetsStage;
|
|
286
|
+
* Specifies the order in which your asset processing logic should run relative to other plugins.
|
|
287
|
+
*/ stage: ProcessAssetsStage;
|
|
333
288
|
/**
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
targets?: RsbuildTarget[];
|
|
289
|
+
* Match based on the Rsbuild targets and only process the assets of certain targets.
|
|
290
|
+
* @see https://rsbuild.rs/config/output/target
|
|
291
|
+
*/ targets?: RsbuildTarget[];
|
|
338
292
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
environments?: string[];
|
|
293
|
+
* Match based on the Rsbuild environment names and only process the assets of certain environments.
|
|
294
|
+
* @see https://rsbuild.rs/config/environments
|
|
295
|
+
*/ environments?: string[];
|
|
343
296
|
};
|
|
344
297
|
export type RspackSources = Pick<typeof Rspack.sources, 'Source' | 'RawSource' | 'OriginalSource' | 'SourceMapSource' | 'CachedSource' | 'ConcatSource' | 'ReplaceSource' | 'PrefixSource' | 'SizeOnlySource' | 'CompatSource'>;
|
|
345
298
|
export type ProcessAssetsHandler = (context: {
|
|
@@ -347,205 +300,167 @@ export type ProcessAssetsHandler = (context: {
|
|
|
347
300
|
compiler: Rspack.Compiler;
|
|
348
301
|
compilation: Rspack.Compilation;
|
|
349
302
|
/**
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
environment: EnvironmentContext;
|
|
303
|
+
* The environment context for current build.
|
|
304
|
+
*/ environment: EnvironmentContext;
|
|
353
305
|
/**
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
sources: RspackSources;
|
|
306
|
+
* Contains multiple classes which represent an Rspack `Source`.
|
|
307
|
+
*/ sources: RspackSources;
|
|
357
308
|
}) => Promise<void> | void;
|
|
358
309
|
export type ResolveHandler = (context: {
|
|
359
|
-
/** Module request information */
|
|
360
|
-
|
|
361
|
-
/** The environment context for current build. */
|
|
362
|
-
environment: EnvironmentContext;
|
|
310
|
+
/** Module request information */ resolveData: Rspack.ResolveData;
|
|
311
|
+
/** The environment context for current build. */ environment: EnvironmentContext;
|
|
363
312
|
compiler: Rspack.Compiler;
|
|
364
313
|
compilation: Rspack.Compilation;
|
|
365
314
|
}) => Promise<void> | void;
|
|
366
315
|
export type ResolveHook = (handler: ResolveHandler) => void;
|
|
367
316
|
export type ProcessAssetsHook = (descriptor: ProcessAssetsDescriptor, handler: ProcessAssetsHandler) => void;
|
|
368
317
|
export type GetNormalizedConfig = {
|
|
369
|
-
(): NormalizedConfig;
|
|
318
|
+
() : NormalizedConfig;
|
|
370
319
|
(options: {
|
|
371
320
|
environment: string;
|
|
372
|
-
}): NormalizedEnvironmentConfig;
|
|
321
|
+
}) : NormalizedEnvironmentConfig;
|
|
373
322
|
};
|
|
374
323
|
/**
|
|
375
324
|
* The API interface provided to Rsbuild plugins through the `setup` function.
|
|
376
325
|
* It allows plugins to interact with the build process, modify configurations,
|
|
377
326
|
* register hooks, and access context information.
|
|
378
|
-
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
* `config.customLogger` when provided.
|
|
405
|
-
*/
|
|
406
|
-
logger: Logger;
|
|
407
|
-
/**
|
|
408
|
-
* Determines if a plugin has been registered in the current Rsbuild instance.
|
|
409
|
-
*/
|
|
410
|
-
isPluginExists: (pluginName: string, options?: {
|
|
327
|
+
*/ export type RsbuildPluginAPI = Readonly<{
|
|
328
|
+
/**
|
|
329
|
+
* A read-only object that provides some context information.
|
|
330
|
+
*/ context: Readonly<RsbuildContext>;
|
|
331
|
+
/**
|
|
332
|
+
* Explicitly expose some properties or methods of the current plugin,
|
|
333
|
+
* and other plugins can get these APIs through `api.useExposed`.
|
|
334
|
+
*/ expose: <T = any>(id: string | symbol, api: T) => void;
|
|
335
|
+
/**
|
|
336
|
+
* Get the Rsbuild config, this method must be called after the
|
|
337
|
+
* `modifyRsbuildConfig` hook is executed.
|
|
338
|
+
*/ getRsbuildConfig: GetRsbuildConfig;
|
|
339
|
+
/**
|
|
340
|
+
* Get the all normalized Rsbuild config or the Rsbuild config of a specified
|
|
341
|
+
* environment, this method must be called after the
|
|
342
|
+
* `modifyRsbuildConfig` hook is executed.
|
|
343
|
+
*/ getNormalizedConfig: GetNormalizedConfig;
|
|
344
|
+
/**
|
|
345
|
+
* A logger instance used to output log information in a unified format.
|
|
346
|
+
* Use this instead of `console.log` to maintain consistent logging with Rsbuild.
|
|
347
|
+
* It is associated with the current Rsbuild instance and reflects
|
|
348
|
+
* `config.customLogger` when provided.
|
|
349
|
+
*/ logger: Logger;
|
|
350
|
+
/**
|
|
351
|
+
* Determines if a plugin has been registered in the current Rsbuild instance.
|
|
352
|
+
*/ isPluginExists: (pluginName: string, options?: {
|
|
411
353
|
/**
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
environment: string;
|
|
354
|
+
* Whether it exists in the specified environment.
|
|
355
|
+
* If environment is not specified, determine whether the plugin is a global plugin.
|
|
356
|
+
*/ environment: string;
|
|
416
357
|
}) => boolean;
|
|
417
358
|
/**
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Called when the process is going to exit, this hook can only execute
|
|
526
|
-
* synchronous code.
|
|
527
|
-
*/
|
|
528
|
-
onExit: PluginHook<OnExitFn>;
|
|
529
|
-
/**
|
|
530
|
-
* Modify assets before emitting, the same as Rspack's
|
|
531
|
-
* [compilation.hooks.processAssets](https://rspack.rs/api/plugin-api/compilation-hooks#processassets) hook.
|
|
532
|
-
*/
|
|
533
|
-
processAssets: ProcessAssetsHook;
|
|
534
|
-
/**
|
|
535
|
-
* Intercept and modify module request information before module resolution begins.
|
|
536
|
-
* The same as Rspack's [normalModuleFactory.hooks.resolve](https://rspack.rs/api/plugin-api/normal-module-factory-hooks#resolve) hook.
|
|
537
|
-
*/
|
|
538
|
-
resolve: ResolveHook;
|
|
539
|
-
/**
|
|
540
|
-
* A simplified wrapper around Rspack loaders, `api.transform` lets you
|
|
541
|
-
* easily transform the code of specific modules during the build process.
|
|
542
|
-
* You can match files by module path, query, or other conditions, and
|
|
543
|
-
* apply custom transformations to their contents.
|
|
544
|
-
*/
|
|
545
|
-
transform: TransformHook;
|
|
546
|
-
/**
|
|
547
|
-
* Get the properties or methods exposed by other plugins.
|
|
548
|
-
*/
|
|
549
|
-
useExposed: <T = any>(id: string | symbol) => T | undefined;
|
|
359
|
+
* Allows you to modify the Rspack configuration using the `rspack-chain` API,
|
|
360
|
+
* providing the same functionality as `tools.bundlerChain`.
|
|
361
|
+
*/ modifyBundlerChain: PluginHook<ModifyBundlerChainFn>;
|
|
362
|
+
/**
|
|
363
|
+
* Modify the Rsbuild configuration of a specific environment.
|
|
364
|
+
*/ modifyEnvironmentConfig: PluginHook<ModifyEnvironmentConfigFn>;
|
|
365
|
+
/**
|
|
366
|
+
* Modify the final HTML content. The hook receives a HTML string
|
|
367
|
+
* and a context object, and you can return a new HTML string to
|
|
368
|
+
* replace the original one. This hook is triggered after the
|
|
369
|
+
* `modifyHTMLTags` hook.
|
|
370
|
+
*/ modifyHTML: PluginHook<ModifyHTMLFn>;
|
|
371
|
+
/**
|
|
372
|
+
* Modify the tags that are injected into the HTML.
|
|
373
|
+
* This hook is triggered before the `modifyHTML` hook.
|
|
374
|
+
*/ modifyHTMLTags: PluginHook<ModifyHTMLTagsFn>;
|
|
375
|
+
/**
|
|
376
|
+
* To modify the Rspack config, you can directly modify the config object,
|
|
377
|
+
* or return a new object to replace the previous object.
|
|
378
|
+
*/ modifyRspackConfig: PluginHook<ModifyRspackConfigFn>;
|
|
379
|
+
/**
|
|
380
|
+
* Modify the config passed to the Rsbuild, you can directly modify the config object,
|
|
381
|
+
* or return a new object to replace the previous object.
|
|
382
|
+
*/ modifyRsbuildConfig: PluginHook<ModifyRsbuildConfigFn>;
|
|
383
|
+
/**
|
|
384
|
+
* A callback function that is triggered after running the production build.
|
|
385
|
+
* You can access the build result information via the
|
|
386
|
+
* [stats](https://rspack.rs/api/javascript-api/stats) parameter.
|
|
387
|
+
*/ onAfterBuild: PluginHook<OnAfterBuildFn>;
|
|
388
|
+
/**
|
|
389
|
+
* A callback function that is triggered after the Rspack Compiler instance has been
|
|
390
|
+
* created, but before the build process. This hook is called when you run
|
|
391
|
+
* `rsbuild.startDevServer`, `rsbuild.build`, or `rsbuild.createCompiler`.
|
|
392
|
+
*/ onAfterCreateCompiler: PluginHook<OnAfterCreateCompilerFn>;
|
|
393
|
+
/**
|
|
394
|
+
* Called after each development mode build, you can use `isFirstCompile`
|
|
395
|
+
* to determine whether it is the first build.
|
|
396
|
+
*/ onAfterDevCompile: PluginHook<OnAfterDevCompileFn>;
|
|
397
|
+
/**
|
|
398
|
+
* A callback function that is triggered after the compilation of a single environment.
|
|
399
|
+
* You can access the build result information via the
|
|
400
|
+
* [stats](https://rspack.rs/api/javascript-api/stats) parameter.
|
|
401
|
+
*/ onAfterEnvironmentCompile: PluginHook<OnAfterEnvironmentCompileFn>;
|
|
402
|
+
/**
|
|
403
|
+
* Called after starting the dev server, you can get the port number with the
|
|
404
|
+
* `port` parameter, and the page routes info with the `routes` parameter.
|
|
405
|
+
*/ onAfterStartDevServer: PluginHook<OnAfterStartDevServerFn>;
|
|
406
|
+
/**
|
|
407
|
+
* Called after starting the preview server, you can get the port
|
|
408
|
+
* number with the `port` parameter, and the page routes info with the
|
|
409
|
+
* `routes` parameter.
|
|
410
|
+
*/ onAfterStartPreviewServer: PluginHook<OnAfterStartPreviewServerFn>;
|
|
411
|
+
/**
|
|
412
|
+
* A callback function that is triggered before the production build is executed.
|
|
413
|
+
*/ onBeforeBuild: PluginHook<OnBeforeBuildFn>;
|
|
414
|
+
/**
|
|
415
|
+
* A callback function that is triggered before the dev build is executed.
|
|
416
|
+
*/ onBeforeDevCompile: PluginHook<OnBeforeDevCompileFn>;
|
|
417
|
+
/**
|
|
418
|
+
* A callback function that is triggered before the Rspack Compiler instance is
|
|
419
|
+
* created. This hook is called when you
|
|
420
|
+
* run `rsbuild.startDevServer`, `rsbuild.build`, or `rsbuild.createCompiler`.
|
|
421
|
+
*/ onBeforeCreateCompiler: PluginHook<OnBeforeCreateCompilerFn>;
|
|
422
|
+
/**
|
|
423
|
+
* A callback function that is triggered before the compilation of a single environment.
|
|
424
|
+
*/ onBeforeEnvironmentCompile: PluginHook<OnBeforeEnvironmentCompileFn>;
|
|
425
|
+
/**
|
|
426
|
+
* Called before starting the dev server.
|
|
427
|
+
*/ onBeforeStartDevServer: PluginHook<OnBeforeStartDevServerFn>;
|
|
428
|
+
/**
|
|
429
|
+
* Called before starting the preview server.
|
|
430
|
+
*/ onBeforeStartPreviewServer: PluginHook<OnBeforeStartPreviewServerFn>;
|
|
431
|
+
/**
|
|
432
|
+
* Called when closing the build instance. Can be used to perform cleanup
|
|
433
|
+
* operations when the building is closed.
|
|
434
|
+
*/ onCloseBuild: PluginHook<OnCloseBuildFn>;
|
|
435
|
+
/**
|
|
436
|
+
* Called when closing the dev server. Can be used to perform cleanup
|
|
437
|
+
* operations when the dev server is closed.
|
|
438
|
+
*/ onCloseDevServer: PluginHook<OnCloseDevServerFn>;
|
|
439
|
+
/**
|
|
440
|
+
* Alias for the `onAfterDevCompile` hook.
|
|
441
|
+
* @deprecated Use `onAfterDevCompile` instead (added in v1.5.0).
|
|
442
|
+
* Both hooks have identical functionality.
|
|
443
|
+
*/ onDevCompileDone: PluginHook<OnAfterDevCompileFn>;
|
|
444
|
+
/**
|
|
445
|
+
* Called when the process is going to exit, this hook can only execute
|
|
446
|
+
* synchronous code.
|
|
447
|
+
*/ onExit: PluginHook<OnExitFn>;
|
|
448
|
+
/**
|
|
449
|
+
* Modify assets before emitting, the same as Rspack's
|
|
450
|
+
* [compilation.hooks.processAssets](https://rspack.rs/api/plugin-api/compilation-hooks#processassets) hook.
|
|
451
|
+
*/ processAssets: ProcessAssetsHook;
|
|
452
|
+
/**
|
|
453
|
+
* Intercept and modify module request information before module resolution begins.
|
|
454
|
+
* The same as Rspack's [normalModuleFactory.hooks.resolve](https://rspack.rs/api/plugin-api/normal-module-factory-hooks#resolve) hook.
|
|
455
|
+
*/ resolve: ResolveHook;
|
|
456
|
+
/**
|
|
457
|
+
* A simplified wrapper around Rspack loaders, `api.transform` lets you
|
|
458
|
+
* easily transform the code of specific modules during the build process.
|
|
459
|
+
* You can match files by module path, query, or other conditions, and
|
|
460
|
+
* apply custom transformations to their contents.
|
|
461
|
+
*/ transform: TransformHook;
|
|
462
|
+
/**
|
|
463
|
+
* Get the properties or methods exposed by other plugins.
|
|
464
|
+
*/ useExposed: <T = any>(id: string | symbol) => T | undefined;
|
|
550
465
|
}>;
|
|
551
|
-
export {};
|
|
466
|
+
export { };
|