@rsbuild/core 1.3.21 → 1.4.0-beta.0
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 +2 -2
- package/compiled/css-loader/index.js +44 -44
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss/index.js +189 -144
- package/compiled/postcss/lib/input.d.ts +24 -3
- package/compiled/postcss/lib/node.d.ts +17 -2
- package/compiled/postcss/lib/stringifier.d.ts +2 -2
- 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 +115 -125
- package/compiled/rspack-chain/index.js +67 -67
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-chain/types/index.d.ts +1 -0
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/sirv/index.js +12 -6
- package/compiled/style-loader/index.js +10 -10
- package/compiled/tinyglobby/index.d.ts +35 -16
- package/compiled/tinyglobby/index.js +517 -531
- package/compiled/tinyglobby/package.json +1 -1
- package/compiled/webpack-bundle-analyzer/index.js +62 -46
- package/dist/index.cjs +274 -236
- package/dist/index.js +233 -227
- package/dist-types/cli/commands.d.ts +1 -1
- package/dist-types/defaultConfig.d.ts +26 -0
- package/dist-types/index.d.ts +2 -2
- package/dist-types/{config.d.ts → loadConfig.d.ts} +9 -34
- package/dist-types/pluginHelper.d.ts +1 -1
- package/dist-types/plugins/minimize.d.ts +1 -1
- package/dist-types/server/cliShortcuts.d.ts +2 -2
- package/dist-types/server/helper.d.ts +2 -2
- package/dist-types/server/runner/asModule.d.ts +2 -2
- package/dist-types/types/config.d.ts +41 -20
- package/dist-types/types/hooks.d.ts +1 -1
- package/dist-types/types/plugin.d.ts +18 -18
- package/dist-types/types/rsbuild.d.ts +2 -2
- package/package.json +11 -10
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { NormalizedConfig, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default allowed origins for CORS.
|
|
4
|
+
* - localhost
|
|
5
|
+
* - 127.0.0.1
|
|
6
|
+
* - [::1]
|
|
7
|
+
*
|
|
8
|
+
* Can be used in `server.cors.origin` config.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* server: {
|
|
12
|
+
* cors: {
|
|
13
|
+
* origin: [defaultAllowedOrigins, 'https://example.com'],
|
|
14
|
+
* },
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const defaultAllowedOrigins: RegExp;
|
|
19
|
+
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
20
|
+
export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
21
|
+
/**
|
|
22
|
+
* Merges user config with default values to ensure required properties
|
|
23
|
+
* are initialized.
|
|
24
|
+
*/
|
|
25
|
+
export declare const normalizeConfig: (config: RsbuildConfig) => NormalizedConfig;
|
|
26
|
+
export declare const normalizePublicDirs: (publicDir?: PublicDir) => Required<PublicDirOptions>[];
|
package/dist-types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { rspack } from '@rspack/core';
|
|
|
6
6
|
import type * as Rspack from '@rspack/core';
|
|
7
7
|
export { loadEnv, type LoadEnvOptions, type LoadEnvResult } from './loadEnv';
|
|
8
8
|
export { createRsbuild } from './createRsbuild';
|
|
9
|
-
export { loadConfig, defineConfig, type ConfigParams, type LoadConfigOptions, type LoadConfigResult, } from './
|
|
9
|
+
export { loadConfig, defineConfig, type ConfigParams, type LoadConfigOptions, type LoadConfigResult, } from './loadConfig';
|
|
10
10
|
export { runCLI } from './cli';
|
|
11
11
|
export declare const version: string;
|
|
12
12
|
export { rspack };
|
|
@@ -14,7 +14,7 @@ export type { Rspack };
|
|
|
14
14
|
export { logger } from './logger';
|
|
15
15
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
16
16
|
export { ensureAssetPrefix } from './helpers';
|
|
17
|
-
export { defaultAllowedOrigins } from './
|
|
17
|
+
export { defaultAllowedOrigins } from './defaultConfig';
|
|
18
18
|
export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
|
|
19
19
|
export type { AppIcon, AppIconItem, AliasStrategy, Build, BuildOptions, BundlerPluginInstance, Charset, ClientConfig, CliShortcut, CleanDistPath, CleanDistPathObject, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlFallback, HtmlTagHandler, HtmlTagDescriptor, HtmlTagContext, InspectConfigOptions, InspectConfigResult, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InternalContext, LegalComments, ManifestData, ManifestConfig, ManifestObjectConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, MergedEnvironmentConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterEnvironmentCompileFn, OnBeforeEnvironmentCompileFn, OnCloseBuildFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreviewOptions, PreconnectOption, ProcessAssetsDescriptor, ProcessAssetsHook, ProcessAssetsHandler, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PrintUrls, PublicDir, PublicDirOptions, ProgressBarConfig, RequestHandler, ResolveHook, ResolveHandler, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ResourceHintsIncludeType, StartDevServerOptions, SriOptions, SriAlgorithm, ScriptInject, ScriptLoading, SecurityConfig, SourceMap, SetupMiddlewaresFn, SetupMiddlewaresServer, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, TransformContext, TransformDescriptor, ToolsConfig, TransformHook, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
20
20
|
export type { ChainIdentifier } from './configChain';
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
/**
|
|
3
|
-
* Default allowed origins for CORS.
|
|
4
|
-
* - localhost
|
|
5
|
-
* - 127.0.0.1
|
|
6
|
-
* - [::1]
|
|
7
|
-
*
|
|
8
|
-
* Can be used in `server.cors.origin` config.
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* server: {
|
|
12
|
-
* cors: {
|
|
13
|
-
* origin: [defaultAllowedOrigins, 'https://example.com'],
|
|
14
|
-
* },
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const defaultAllowedOrigins: RegExp;
|
|
19
|
-
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
20
|
-
export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
21
|
-
/**
|
|
22
|
-
* Merges user config with default values to ensure required properties
|
|
23
|
-
* are initialized.
|
|
24
|
-
*/
|
|
25
|
-
export declare const normalizeConfig: (config: RsbuildConfig) => NormalizedConfig;
|
|
1
|
+
import type { RsbuildConfig } from './types';
|
|
26
2
|
export type ConfigParams = {
|
|
27
3
|
env: string;
|
|
28
4
|
command: string;
|
|
@@ -32,14 +8,6 @@ export type ConfigParams = {
|
|
|
32
8
|
export type RsbuildConfigAsyncFn = (env: ConfigParams) => Promise<RsbuildConfig>;
|
|
33
9
|
export type RsbuildConfigSyncFn = (env: ConfigParams) => RsbuildConfig;
|
|
34
10
|
export type RsbuildConfigExport = RsbuildConfig | RsbuildConfigSyncFn | RsbuildConfigAsyncFn;
|
|
35
|
-
/**
|
|
36
|
-
* This function helps you to autocomplete configuration types.
|
|
37
|
-
* It accepts a Rsbuild config object, or a function that returns a config.
|
|
38
|
-
*/
|
|
39
|
-
export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
|
|
40
|
-
export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
|
|
41
|
-
export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
|
|
42
|
-
export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
|
|
43
11
|
export type LoadConfigOptions = {
|
|
44
12
|
/**
|
|
45
13
|
* The root path to resolve the config file.
|
|
@@ -79,6 +47,13 @@ export type LoadConfigResult = {
|
|
|
79
47
|
*/
|
|
80
48
|
filePath: string | null;
|
|
81
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* This function helps you to autocomplete configuration types.
|
|
52
|
+
* It accepts a Rsbuild config object, or a function that returns a config.
|
|
53
|
+
*/
|
|
54
|
+
export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
|
|
55
|
+
export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
|
|
56
|
+
export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
|
|
57
|
+
export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
|
|
82
58
|
export type ConfigLoader = 'jiti' | 'native';
|
|
83
59
|
export declare function loadConfig({ cwd, path, envMode, meta, loader, }?: LoadConfigOptions): Promise<LoadConfigResult>;
|
|
84
|
-
export declare const normalizePublicDirs: (publicDir?: PublicDir) => Required<PublicDirOptions>[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file is used to get/set the global instance for html-plugin and css-extract plugin.
|
|
3
3
|
*/
|
|
4
|
-
import rspack from '@rspack/core';
|
|
4
|
+
import { rspack } from '@rspack/core';
|
|
5
5
|
import type { HtmlRspackPlugin } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* This method is used to override the Rsbuild default html-plugin (html-rspack-plugin).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LightningCssMinimizerRspackPluginOptions, SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
|
|
2
2
|
import type { NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
|
|
3
3
|
export declare const getSwcMinimizerOptions: (config: NormalizedEnvironmentConfig, jsOptions?: SwcJsMinimizerRspackPluginOptions) => SwcJsMinimizerRspackPluginOptions;
|
|
4
|
-
export declare const parseMinifyOptions: (config: NormalizedEnvironmentConfig
|
|
4
|
+
export declare const parseMinifyOptions: (config: NormalizedEnvironmentConfig) => {
|
|
5
5
|
minifyJs: boolean;
|
|
6
6
|
minifyCss: boolean;
|
|
7
7
|
jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CliShortcut, NormalizedDevConfig } from '../types/config';
|
|
2
2
|
export declare const isCliShortcutsEnabled: (devConfig: NormalizedDevConfig) => boolean;
|
|
3
3
|
export declare function setupCliShortcuts({ help, openPage, closeServer, printUrls, restartServer, customShortcuts, }: {
|
|
4
|
-
help?: boolean;
|
|
4
|
+
help?: boolean | string;
|
|
5
5
|
openPage: () => Promise<void>;
|
|
6
6
|
closeServer: () => Promise<void>;
|
|
7
7
|
printUrls: () => void;
|
|
8
8
|
restartServer?: () => Promise<boolean>;
|
|
9
9
|
customShortcuts?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
10
|
-
}): () => void
|
|
10
|
+
}): Promise<() => void>;
|
|
@@ -61,7 +61,7 @@ export declare const getServerConfig: ({ config, }: {
|
|
|
61
61
|
portTip: string | undefined;
|
|
62
62
|
}>;
|
|
63
63
|
export declare const isWildcardHost: (host: string) => boolean;
|
|
64
|
-
export declare const getHostInUrl: (host: string) => string
|
|
64
|
+
export declare const getHostInUrl: (host: string) => Promise<string>;
|
|
65
65
|
type AddressUrl = {
|
|
66
66
|
label: string;
|
|
67
67
|
url: string;
|
|
@@ -70,7 +70,7 @@ export declare const getAddressUrls: ({ protocol, port, host, }: {
|
|
|
70
70
|
protocol?: string;
|
|
71
71
|
port: number;
|
|
72
72
|
host?: string;
|
|
73
|
-
}) => AddressUrl[]
|
|
73
|
+
}) => Promise<AddressUrl[]>;
|
|
74
74
|
export declare const getCompilationId: (compiler: Rspack.Compiler | Rspack.Compilation) => string;
|
|
75
75
|
export declare function getServerTerminator(server: Server | Http2SecureServer): () => Promise<void>;
|
|
76
76
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const asModule: (something: Record<string, any>, context: Record<string, any>, unlinked?: boolean) => Promise<
|
|
1
|
+
import type { SourceTextModule } from 'node:vm';
|
|
2
|
+
export declare const asModule: (something: Record<string, any>, context: Record<string, any>, unlinked?: boolean) => Promise<SourceTextModule>;
|
|
@@ -9,7 +9,7 @@ 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
11
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
12
|
-
import type { ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
|
|
12
|
+
import type { EnvironmentContext, ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
|
|
13
13
|
import type { ModifyWebpackChainUtils, ModifyWebpackConfigUtils, RsbuildPlugins } from './plugin';
|
|
14
14
|
import type { RsbuildEntry, RsbuildMode, RsbuildTarget } from './rsbuild';
|
|
15
15
|
import type { BundlerPluginInstance, Rspack, RspackRule } from './rspack';
|
|
@@ -114,7 +114,7 @@ export interface ToolsConfig {
|
|
|
114
114
|
*/
|
|
115
115
|
lightningcssLoader?: boolean | ConfigChain<Rspack.LightningcssLoaderOptions>;
|
|
116
116
|
/**
|
|
117
|
-
* Modify the options of [CssExtractRspackPlugin](https://rspack.
|
|
117
|
+
* Modify the options of [CssExtractRspackPlugin](https://rspack.rs/plugins/rspack/css-extract-rspack-plugin).
|
|
118
118
|
*/
|
|
119
119
|
cssExtract?: CSSExtractOptions;
|
|
120
120
|
/**
|
|
@@ -165,7 +165,7 @@ export interface SourceConfig {
|
|
|
165
165
|
* Specify additional JavaScript files that need to be compiled by SWC.
|
|
166
166
|
* Through the `source.include` config, you can specify directories or modules
|
|
167
167
|
* that need to be compiled by Rsbuild. The usage of `source.include` is
|
|
168
|
-
* consistent with [Rule.include](https://rspack.
|
|
168
|
+
* consistent with [Rule.include](https://rspack.rs/config/module#ruleinclude)
|
|
169
169
|
* in Rspack, which supports passing in strings or regular expressions to match
|
|
170
170
|
* the module path.
|
|
171
171
|
* @default
|
|
@@ -176,7 +176,14 @@ export interface SourceConfig {
|
|
|
176
176
|
*/
|
|
177
177
|
include?: RuleSetCondition[];
|
|
178
178
|
/**
|
|
179
|
-
* Set the entry modules.
|
|
179
|
+
* Set the entry modules for building.
|
|
180
|
+
*
|
|
181
|
+
* The value of `source.entry` is an object, the key is the entry name, and the
|
|
182
|
+
* value is the path of the entry module or a description object.
|
|
183
|
+
*
|
|
184
|
+
* If the value is a path, it can be an absolute path or a relative path, the
|
|
185
|
+
* relative path will be resolved based on `root`.
|
|
186
|
+
*
|
|
180
187
|
* @default
|
|
181
188
|
* {
|
|
182
189
|
* // Rsbuild also supports other suffixes by default, such as ts,
|
|
@@ -226,11 +233,6 @@ export type TransformImport = {
|
|
|
226
233
|
type TransformImportFn = (imports: TransformImport[]) => TransformImport[] | void;
|
|
227
234
|
export interface NormalizedSourceConfig extends SourceConfig {
|
|
228
235
|
define: Define;
|
|
229
|
-
/**
|
|
230
|
-
* @deprecated Use `resolve.alias` instead.
|
|
231
|
-
* `source.alias` will be removed in v2.0.0.
|
|
232
|
-
*/
|
|
233
|
-
alias: ConfigChain<Alias>;
|
|
234
236
|
preEntry: string[];
|
|
235
237
|
decorators: Required<Decorators>;
|
|
236
238
|
}
|
|
@@ -587,7 +589,7 @@ export interface PerformanceConfig {
|
|
|
587
589
|
prefetch?: true | PrefetchOptions;
|
|
588
590
|
/**
|
|
589
591
|
* Whether capture timing information for each module,
|
|
590
|
-
* same as the [profile](https://rspack.
|
|
592
|
+
* same as the [profile](https://rspack.rs/config/other-options#profile) config of Rspack.
|
|
591
593
|
*/
|
|
592
594
|
profile?: boolean;
|
|
593
595
|
}
|
|
@@ -805,19 +807,29 @@ export type CSSModules = {
|
|
|
805
807
|
};
|
|
806
808
|
export type Minify = boolean | {
|
|
807
809
|
/**
|
|
808
|
-
* Whether to enable JavaScript
|
|
810
|
+
* Whether to enable minification for JavaScript bundles.
|
|
811
|
+
* - `true`: Enabled in production mode.
|
|
812
|
+
* - `false`: Disabled in all modes.
|
|
813
|
+
* - `'always'`: Enabled in all modes.
|
|
814
|
+
* @default true
|
|
809
815
|
*/
|
|
810
|
-
js?: boolean;
|
|
816
|
+
js?: boolean | 'always';
|
|
811
817
|
/**
|
|
812
818
|
* Minimizer options of JavaScript, which will be passed to SWC.
|
|
819
|
+
* @default {}
|
|
813
820
|
*/
|
|
814
821
|
jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
815
822
|
/**
|
|
816
|
-
* Whether to enable CSS
|
|
823
|
+
* Whether to enable minification for CSS bundles.
|
|
824
|
+
* - `true`: Enabled in production mode.
|
|
825
|
+
* - `false`: Disabled in all modes.
|
|
826
|
+
* - `'always'`: Enabled in all modes.
|
|
827
|
+
* @default true
|
|
817
828
|
*/
|
|
818
|
-
css?: boolean;
|
|
829
|
+
css?: boolean | 'always';
|
|
819
830
|
/**
|
|
820
831
|
* Minimizer options of CSS, which will be passed to LightningCSS.
|
|
832
|
+
* @default inherit from `tools.lightningcssLoader` config
|
|
821
833
|
*/
|
|
822
834
|
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
823
835
|
};
|
|
@@ -898,7 +910,7 @@ export interface OutputConfig {
|
|
|
898
910
|
/**
|
|
899
911
|
* At build time, prevent some `import` dependencies from being packed into bundles in
|
|
900
912
|
* your code, and instead fetch them externally at runtime.
|
|
901
|
-
* For more information, please see: [Rspack Externals](https://rspack.
|
|
913
|
+
* For more information, please see: [Rspack Externals](https://rspack.rs/config/externals)
|
|
902
914
|
* @default undefined
|
|
903
915
|
*/
|
|
904
916
|
externals?: Externals;
|
|
@@ -954,7 +966,8 @@ export interface OutputConfig {
|
|
|
954
966
|
*/
|
|
955
967
|
cssModules?: CSSModules;
|
|
956
968
|
/**
|
|
957
|
-
*
|
|
969
|
+
* Configure whether to enable code minification in production mode, or to configure
|
|
970
|
+
* minimizer options.
|
|
958
971
|
* @default true
|
|
959
972
|
*/
|
|
960
973
|
minify?: Minify;
|
|
@@ -1254,6 +1267,10 @@ export type EnvironmentAPI = {
|
|
|
1254
1267
|
* Get the compiled HTML template.
|
|
1255
1268
|
*/
|
|
1256
1269
|
getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Provides some context information about the current environment
|
|
1272
|
+
*/
|
|
1273
|
+
context: EnvironmentContext;
|
|
1257
1274
|
};
|
|
1258
1275
|
};
|
|
1259
1276
|
export type SetupMiddlewaresServer = Pick<RsbuildDevServer, 'sockWrite' | 'environments'>;
|
|
@@ -1325,12 +1342,13 @@ export interface DevConfig {
|
|
|
1325
1342
|
liveReload?: boolean;
|
|
1326
1343
|
/**
|
|
1327
1344
|
* Set the URL prefix of static assets in development mode,
|
|
1328
|
-
* similar to the [output.publicPath](https://rspack.
|
|
1345
|
+
* similar to the [output.publicPath](https://rspack.rs/config/output#outputpublicpath)
|
|
1329
1346
|
* config of Rspack.
|
|
1330
1347
|
*/
|
|
1331
1348
|
assetPrefix?: string | boolean;
|
|
1332
1349
|
/**
|
|
1333
|
-
* Whether to
|
|
1350
|
+
* Whether to render progress bars to display the build progress.
|
|
1351
|
+
* @default false
|
|
1334
1352
|
*/
|
|
1335
1353
|
progressBar?: boolean | ProgressBarConfig;
|
|
1336
1354
|
/**
|
|
@@ -1349,9 +1367,12 @@ export interface DevConfig {
|
|
|
1349
1367
|
custom?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
1350
1368
|
/**
|
|
1351
1369
|
* Whether to print the help hint when the server is started.
|
|
1370
|
+
* - `true`: Print the default help hint.
|
|
1371
|
+
* - `false`: Disable the help hint.
|
|
1372
|
+
* - `string`: Print a custom help hint.
|
|
1352
1373
|
* @default true
|
|
1353
1374
|
*/
|
|
1354
|
-
help?: boolean;
|
|
1375
|
+
help?: boolean | string;
|
|
1355
1376
|
};
|
|
1356
1377
|
/**
|
|
1357
1378
|
* Provides the ability to execute a custom function and apply custom middlewares.
|
|
@@ -1386,7 +1407,7 @@ export interface ResolveConfig {
|
|
|
1386
1407
|
/**
|
|
1387
1408
|
* Set the alias for the module path, which is used to simplify the import path or
|
|
1388
1409
|
* redirect the module reference.
|
|
1389
|
-
* Similar to the [resolve.alias](https://rspack.
|
|
1410
|
+
* Similar to the [resolve.alias](https://rspack.rs/config/resolve) config of Rspack.
|
|
1390
1411
|
*/
|
|
1391
1412
|
alias?: ConfigChain<Alias>;
|
|
1392
1413
|
/**
|
|
@@ -154,7 +154,7 @@ export type EnvironmentContext = {
|
|
|
154
154
|
* Manifest data. Only available when:
|
|
155
155
|
* - The `output.manifest` config is enabled
|
|
156
156
|
* - The build has completed, accessible in hooks like `onAfterBuild`,
|
|
157
|
-
* `onDevCompileDone` and `onAfterEnvironmentCompile`
|
|
157
|
+
* `onDevCompileDone` and `onAfterEnvironmentCompile` or via the environment API
|
|
158
158
|
*/
|
|
159
159
|
manifest?: Record<string, unknown> | ManifestData;
|
|
160
160
|
};
|
|
@@ -20,7 +20,7 @@ export type EnvironmentAsyncHook<Callback extends (...args: any[]) => T, T = any
|
|
|
20
20
|
* Registers a callback function to be executed when the hook is triggered.
|
|
21
21
|
* The callback can be a plain function or a HookDescriptor that includes execution order.
|
|
22
22
|
* The callback will be executed in all environments by default.
|
|
23
|
-
* If you need to specify the environment,
|
|
23
|
+
* If you need to specify the environment, use `tapEnvironment`
|
|
24
24
|
* @param cb The callback function or hook descriptor to register
|
|
25
25
|
*/
|
|
26
26
|
tap: (cb: Callback | HookDescriptor<Callback>) => void;
|
|
@@ -234,60 +234,60 @@ export type TransformHandler = (context: TransformContext) => MaybePromise<Trans
|
|
|
234
234
|
export type TransformDescriptor = {
|
|
235
235
|
/**
|
|
236
236
|
* Include modules that match the test assertion, the same as `rule.test`
|
|
237
|
-
* @see https://rspack.
|
|
237
|
+
* @see https://rspack.rs/config/module#ruletest
|
|
238
238
|
*/
|
|
239
239
|
test?: Rspack.RuleSetCondition;
|
|
240
240
|
/**
|
|
241
241
|
* A condition that matches the resource query.
|
|
242
|
-
* @see https://rspack.
|
|
242
|
+
* @see https://rspack.rs/config/module#ruleresourcequery
|
|
243
243
|
*/
|
|
244
244
|
resourceQuery?: Rspack.RuleSetCondition;
|
|
245
245
|
/**
|
|
246
246
|
* Match based on the Rsbuild targets and only apply the transform to
|
|
247
247
|
* certain targets.
|
|
248
|
-
* @see https://rsbuild.
|
|
248
|
+
* @see https://rsbuild.rs/config/output/target
|
|
249
249
|
*/
|
|
250
250
|
targets?: RsbuildTarget[];
|
|
251
251
|
/**
|
|
252
252
|
* Match based on the Rsbuild environment names and only apply the transform
|
|
253
253
|
* to certain environments.
|
|
254
|
-
* @see https://rsbuild.
|
|
254
|
+
* @see https://rsbuild.rs/config/environments
|
|
255
255
|
*/
|
|
256
256
|
environments?: string[];
|
|
257
257
|
/**
|
|
258
258
|
* If raw is `true`, the transform handler will receive the Buffer type code
|
|
259
259
|
* instead of the string type.
|
|
260
|
-
* @see https://rspack.
|
|
260
|
+
* @see https://rspack.rs/api/loader-api/examples#raw-loader
|
|
261
261
|
*/
|
|
262
262
|
raw?: boolean;
|
|
263
263
|
/**
|
|
264
264
|
* Marks the layer of the matching module, can be used to group a group of
|
|
265
265
|
* modules into one layer
|
|
266
|
-
* @see https://rspack.
|
|
266
|
+
* @see https://rspack.rs/config/module#rulelayer
|
|
267
267
|
*/
|
|
268
268
|
layer?: string;
|
|
269
269
|
/**
|
|
270
270
|
* Matches all modules that match this resource, and will match against layer of
|
|
271
271
|
* the module that issued the current module.
|
|
272
|
-
* @see https://rspack.
|
|
272
|
+
* @see https://rspack.rs/config/module#ruleissuerlayer
|
|
273
273
|
*/
|
|
274
274
|
issuerLayer?: string;
|
|
275
275
|
/**
|
|
276
276
|
* Matches all modules that match this resource, and will match against Resource
|
|
277
277
|
* (the absolute path without query and fragment) of the module that issued the
|
|
278
278
|
* current module.
|
|
279
|
-
* @see https://rspack.
|
|
279
|
+
* @see https://rspack.rs/config/module#ruleissuer
|
|
280
280
|
*/
|
|
281
281
|
issuer?: Rspack.RuleSetCondition;
|
|
282
282
|
/**
|
|
283
283
|
* Matches [import attributes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import/with)
|
|
284
|
-
* @see https://rspack.
|
|
284
|
+
* @see https://rspack.rs/config/module#rulewith
|
|
285
285
|
*/
|
|
286
286
|
with?: Record<string, Rspack.RuleSetCondition>;
|
|
287
287
|
/**
|
|
288
288
|
* Matches modules based on MIME type instead of file extension. It's primarily
|
|
289
289
|
* useful for data URI module (like `data:text/javascript,...`).
|
|
290
|
-
* @see https://rspack.
|
|
290
|
+
* @see https://rspack.rs/config/module#rulemimetype
|
|
291
291
|
*/
|
|
292
292
|
mimetype?: Rspack.RuleSetCondition;
|
|
293
293
|
/**
|
|
@@ -296,7 +296,7 @@ export type TransformDescriptor = {
|
|
|
296
296
|
* transform functions (or Rspack loaders).
|
|
297
297
|
* - When specified as 'post', the transform function will execute after other
|
|
298
298
|
* transform functions (or Rspack loaders).
|
|
299
|
-
* @see https://rspack.
|
|
299
|
+
* @see https://rspack.rs/config/module#ruleenforce
|
|
300
300
|
*/
|
|
301
301
|
enforce?: 'pre' | 'post';
|
|
302
302
|
};
|
|
@@ -309,12 +309,12 @@ export type ProcessAssetsDescriptor = {
|
|
|
309
309
|
stage: ProcessAssetsStage;
|
|
310
310
|
/**
|
|
311
311
|
* Match based on the Rsbuild targets and only process the assets of certain targets.
|
|
312
|
-
* @see https://rsbuild.
|
|
312
|
+
* @see https://rsbuild.rs/config/output/target
|
|
313
313
|
*/
|
|
314
314
|
targets?: RsbuildTarget[];
|
|
315
315
|
/**
|
|
316
316
|
* Match based on the Rsbuild environment names and only process the assets of certain environments.
|
|
317
|
-
* @see https://rsbuild.
|
|
317
|
+
* @see https://rsbuild.rs/config/environments
|
|
318
318
|
*/
|
|
319
319
|
environments?: string[];
|
|
320
320
|
};
|
|
@@ -424,7 +424,7 @@ export type RsbuildPluginAPI = Readonly<{
|
|
|
424
424
|
/**
|
|
425
425
|
* A callback function that is triggered after running the production build.
|
|
426
426
|
* You can access the build result information via the
|
|
427
|
-
* [stats](https://rspack.
|
|
427
|
+
* [stats](https://rspack.rs/api/javascript-api/stats) parameter.
|
|
428
428
|
*/
|
|
429
429
|
onAfterBuild: PluginHook<OnAfterBuildFn>;
|
|
430
430
|
/**
|
|
@@ -436,7 +436,7 @@ export type RsbuildPluginAPI = Readonly<{
|
|
|
436
436
|
/**
|
|
437
437
|
* A callback function that is triggered after the compilation of a single environment.
|
|
438
438
|
* You can access the build result information via the
|
|
439
|
-
* [stats](https://rspack.
|
|
439
|
+
* [stats](https://rspack.rs/api/javascript-api/stats) parameter.
|
|
440
440
|
*/
|
|
441
441
|
onAfterEnvironmentCompile: PluginHook<OnAfterEnvironmentCompileFn>;
|
|
442
442
|
/**
|
|
@@ -494,12 +494,12 @@ export type RsbuildPluginAPI = Readonly<{
|
|
|
494
494
|
onExit: PluginHook<OnExitFn>;
|
|
495
495
|
/**
|
|
496
496
|
* Modify assets before emitting, the same as Rspack's
|
|
497
|
-
* [compilation.hooks.processAssets](https://rspack.
|
|
497
|
+
* [compilation.hooks.processAssets](https://rspack.rs/api/plugin-api/compilation-hooks#processassets) hook.
|
|
498
498
|
*/
|
|
499
499
|
processAssets: ProcessAssetsHook;
|
|
500
500
|
/**
|
|
501
501
|
* Intercept and modify module request information before module resolution begins.
|
|
502
|
-
* The same as Rspack's [normalModuleFactory.hooks.resolve](https://rspack.
|
|
502
|
+
* The same as Rspack's [normalModuleFactory.hooks.resolve](https://rspack.rs/api/plugin-api/normal-module-factory-hooks#resolve) hook.
|
|
503
503
|
*/
|
|
504
504
|
resolve: ResolveHook;
|
|
505
505
|
/**
|
|
@@ -59,7 +59,7 @@ export type Build = (options?: BuildOptions) => Promise<{
|
|
|
59
59
|
*/
|
|
60
60
|
close: () => Promise<void>;
|
|
61
61
|
/**
|
|
62
|
-
* Rspack's [stats](https://rspack.
|
|
62
|
+
* Rspack's [stats](https://rspack.rs/api/javascript-api/stats) object.
|
|
63
63
|
*/
|
|
64
64
|
stats?: Rspack.Stats | Rspack.MultiStats;
|
|
65
65
|
}>;
|
|
@@ -214,7 +214,7 @@ export type RsbuildInstance = {
|
|
|
214
214
|
*/
|
|
215
215
|
inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult>;
|
|
216
216
|
/**
|
|
217
|
-
* Create an Rspack [Compiler](https://rspack.
|
|
217
|
+
* Create an Rspack [Compiler](https://rspack.rs/api/javascript-api/compiler)
|
|
218
218
|
* instance. If there are multiple [environments](/config/environments) for
|
|
219
219
|
* this build, the return value is `MultiCompiler`.
|
|
220
220
|
*/
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-beta.0",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
|
-
"homepage": "https://rsbuild.
|
|
5
|
+
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/web-infra-dev/rsbuild/issues"
|
|
8
8
|
},
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.
|
|
49
|
+
"@rspack/core": "1.3.13",
|
|
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.9.1",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
58
|
"@types/cors": "^2.8.18",
|
|
59
|
-
"@types/node": "^22.15.
|
|
59
|
+
"@types/node": "^22.15.29",
|
|
60
60
|
"@types/on-finished": "2.3.4",
|
|
61
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
@@ -77,20 +77,20 @@
|
|
|
77
77
|
"on-finished": "2.4.1",
|
|
78
78
|
"open": "^8.4.0",
|
|
79
79
|
"picocolors": "^1.1.1",
|
|
80
|
-
"postcss": "^8.5.
|
|
80
|
+
"postcss": "^8.5.4",
|
|
81
81
|
"postcss-load-config": "6.0.1",
|
|
82
82
|
"postcss-loader": "8.1.1",
|
|
83
83
|
"prebundle": "1.3.3",
|
|
84
84
|
"reduce-configs": "^1.1.0",
|
|
85
85
|
"rsbuild-dev-middleware": "0.2.0",
|
|
86
86
|
"rslog": "^1.2.3",
|
|
87
|
-
"rspack-chain": "^1.2.
|
|
87
|
+
"rspack-chain": "^1.2.5",
|
|
88
88
|
"rspack-manifest-plugin": "5.0.3",
|
|
89
89
|
"sirv": "^3.0.1",
|
|
90
90
|
"style-loader": "3.3.4",
|
|
91
|
-
"tinyglobby": "^0.2.
|
|
91
|
+
"tinyglobby": "^0.2.14",
|
|
92
92
|
"typescript": "^5.8.3",
|
|
93
|
-
"webpack": "^5.99.
|
|
93
|
+
"webpack": "^5.99.9",
|
|
94
94
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
95
95
|
"webpack-merge": "6.0.1",
|
|
96
96
|
"ws": "^8.18.2"
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "rslib build",
|
|
108
108
|
"dev": "rslib build --watch",
|
|
109
|
-
"prebundle": "prebundle"
|
|
109
|
+
"prebundle": "prebundle",
|
|
110
|
+
"bump": "npx bumpp --no-tag"
|
|
110
111
|
}
|
|
111
112
|
}
|