@rsbuild/core 1.4.6 → 1.4.8

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.
@@ -135,7 +135,7 @@ export type CreateRsbuildOptions = {
135
135
  */
136
136
  rsbuildConfig?: RsbuildConfig | (() => Promise<RsbuildConfig>);
137
137
  /**
138
- * Whether to call `loadEnv` to load env variables and define them
138
+ * Whether to call `loadEnv` to load environment variables and define them
139
139
  * as global variables via `source.define`.
140
140
  * @default false
141
141
  */
@@ -158,23 +158,26 @@ export type RsbuildProvider<B extends 'rspack' | 'webpack' = 'rspack'> = (option
158
158
  rsbuildOptions: ResolvedCreateRsbuildOptions;
159
159
  helpers: RsbuildProviderHelpers;
160
160
  }) => Promise<ProviderInstance<B>>;
161
+ export type AddPluginsOptions = {
162
+ /**
163
+ * Insert before the specified plugin.
164
+ */
165
+ before?: string;
166
+ /**
167
+ * Specify the environment that the plugin will be applied to.
168
+ * If not specified, the plugin will be be registered as a global plugin and
169
+ * applied to all environments.
170
+ */
171
+ environment?: string;
172
+ };
173
+ export type AddPlugins = (plugins: Array<RsbuildPlugin | Falsy>, options?: AddPluginsOptions) => void;
161
174
  export type RsbuildInstance = {
162
175
  /**
163
176
  * Register one or more Rsbuild plugins, which can be called multiple times.
164
177
  * This method needs to be called before compiling. If it is called after
165
178
  * compiling, it will not affect the compilation result.
166
179
  */
167
- addPlugins: (plugins: Array<RsbuildPlugin | Falsy>, options?: {
168
- /**
169
- * Insert before the specified plugin.
170
- */
171
- before?: string;
172
- /**
173
- * Add a plugin for the specified environment.
174
- * If environment is not specified, it will be registered as a global plugin (effective in all environments)
175
- */
176
- environment?: string;
177
- }) => void;
180
+ addPlugins: AddPlugins;
178
181
  /**
179
182
  * Get all the Rsbuild plugins registered in the current Rsbuild instance.
180
183
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,17 +46,17 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.4.6",
49
+ "@rspack/core": "1.4.8",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.44.0",
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@rslib/core": "0.10.4",
56
+ "@rslib/core": "0.10.5",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.19",
59
- "@types/node": "^22.16.0",
59
+ "@types/node": "^22.16.4",
60
60
  "@types/on-finished": "2.3.5",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
62
  "@types/ws": "^8.18.1",
@@ -74,7 +74,7 @@
74
74
  "launch-editor-middleware": "^2.10.0",
75
75
  "mrmime": "^2.0.1",
76
76
  "on-finished": "2.4.1",
77
- "open": "^10.1.2",
77
+ "open": "^10.2.0",
78
78
  "picocolors": "^1.1.1",
79
79
  "postcss": "^8.5.6",
80
80
  "postcss-load-config": "6.0.1",
package/types.d.ts CHANGED
@@ -1,10 +1,27 @@
1
1
  /// <reference types="@rspack/core/module" />
2
2
 
3
+ /**
4
+ * This is a placeholder for extending the type options.
5
+ * You can augment this interface to enable stricter type checking.
6
+ * @example
7
+ * ```ts
8
+ * interface RsbuildTypeOptions {
9
+ * // This will enable strict type checking for `import.meta.env`.
10
+ * strictImportMetaEnv: true;
11
+ * }
12
+ * ```
13
+ */
14
+ // biome-ignore lint/suspicious/noEmptyInterface: placeholder
15
+ interface RsbuildTypeOptions {}
16
+
3
17
  /**
4
18
  * import.meta
5
19
  */
20
+ type ImportMetaEnvFallbackKey =
21
+ 'strictImportMetaEnv' extends keyof RsbuildTypeOptions ? never : string;
22
+
6
23
  interface ImportMetaEnv {
7
- [key: string]: any;
24
+ [key: ImportMetaEnvFallbackKey]: any;
8
25
  /**
9
26
  * The value of the `mode` configuration.
10
27
  * @example