@rsbuild/core 1.3.21 → 1.3.22
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 +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rsbuild-dev-middleware/index.js +25 -25
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/compiled/style-loader/index.js +10 -10
- package/compiled/tinyglobby/index.d.ts +35 -16
- package/compiled/tinyglobby/index.js +417 -439
- package/compiled/tinyglobby/package.json +1 -1
- package/dist/index.cjs +261 -224
- package/dist/index.js +220 -215
- 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 +20 -11
- package/dist-types/types/plugin.d.ts +1 -1
- package/package.json +6 -6
|
@@ -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>;
|
|
@@ -226,11 +226,6 @@ export type TransformImport = {
|
|
|
226
226
|
type TransformImportFn = (imports: TransformImport[]) => TransformImport[] | void;
|
|
227
227
|
export interface NormalizedSourceConfig extends SourceConfig {
|
|
228
228
|
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
229
|
preEntry: string[];
|
|
235
230
|
decorators: Required<Decorators>;
|
|
236
231
|
}
|
|
@@ -805,19 +800,29 @@ export type CSSModules = {
|
|
|
805
800
|
};
|
|
806
801
|
export type Minify = boolean | {
|
|
807
802
|
/**
|
|
808
|
-
* Whether to enable JavaScript
|
|
803
|
+
* Whether to enable minification for JavaScript bundles.
|
|
804
|
+
* - `true`: Enabled in production mode.
|
|
805
|
+
* - `false`: Disabled in all modes.
|
|
806
|
+
* - `'always'`: Enabled in all modes.
|
|
807
|
+
* @default true
|
|
809
808
|
*/
|
|
810
|
-
js?: boolean;
|
|
809
|
+
js?: boolean | 'always';
|
|
811
810
|
/**
|
|
812
811
|
* Minimizer options of JavaScript, which will be passed to SWC.
|
|
812
|
+
* @default {}
|
|
813
813
|
*/
|
|
814
814
|
jsOptions?: SwcJsMinimizerRspackPluginOptions;
|
|
815
815
|
/**
|
|
816
|
-
* Whether to enable CSS
|
|
816
|
+
* Whether to enable minification for CSS bundles.
|
|
817
|
+
* - `true`: Enabled in production mode.
|
|
818
|
+
* - `false`: Disabled in all modes.
|
|
819
|
+
* - `'always'`: Enabled in all modes.
|
|
820
|
+
* @default true
|
|
817
821
|
*/
|
|
818
|
-
css?: boolean;
|
|
822
|
+
css?: boolean | 'always';
|
|
819
823
|
/**
|
|
820
824
|
* Minimizer options of CSS, which will be passed to LightningCSS.
|
|
825
|
+
* @default inherit from `tools.lightningcssLoader` config
|
|
821
826
|
*/
|
|
822
827
|
cssOptions?: LightningCssMinimizerRspackPluginOptions;
|
|
823
828
|
};
|
|
@@ -954,7 +959,8 @@ export interface OutputConfig {
|
|
|
954
959
|
*/
|
|
955
960
|
cssModules?: CSSModules;
|
|
956
961
|
/**
|
|
957
|
-
*
|
|
962
|
+
* Configure whether to enable code minification in production mode, or to configure
|
|
963
|
+
* minimizer options.
|
|
958
964
|
* @default true
|
|
959
965
|
*/
|
|
960
966
|
minify?: Minify;
|
|
@@ -1349,9 +1355,12 @@ export interface DevConfig {
|
|
|
1349
1355
|
custom?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
1350
1356
|
/**
|
|
1351
1357
|
* Whether to print the help hint when the server is started.
|
|
1358
|
+
* - `true`: Print the default help hint.
|
|
1359
|
+
* - `false`: Disable the help hint.
|
|
1360
|
+
* - `string`: Print a custom help hint.
|
|
1352
1361
|
* @default true
|
|
1353
1362
|
*/
|
|
1354
|
-
help?: boolean;
|
|
1363
|
+
help?: boolean | string;
|
|
1355
1364
|
};
|
|
1356
1365
|
/**
|
|
1357
1366
|
* Provides the ability to execute a custom function and apply custom middlewares.
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.22",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.
|
|
49
|
+
"@rspack/core": "1.3.12",
|
|
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.8.0",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
58
|
"@types/cors": "^2.8.18",
|
|
59
|
-
"@types/node": "^22.15.
|
|
59
|
+
"@types/node": "^22.15.21",
|
|
60
60
|
"@types/on-finished": "2.3.4",
|
|
61
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
@@ -88,9 +88,9 @@
|
|
|
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"
|