@rsbuild/core 1.4.13 → 1.4.15
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/rslog/index.d.ts +63 -69
- package/compiled/rslog/index.js +1 -0
- package/compiled/rslog/package.json +1 -1
- package/compiled/rspack-chain/package.json +1 -1
- package/dist/client/hmr.js +10 -9
- package/dist/index.cjs +673 -682
- package/dist/index.js +644 -654
- package/dist-types/cli/index.d.ts +1 -1
- package/dist-types/createContext.d.ts +2 -2
- package/dist-types/helpers/index.d.ts +2 -2
- package/dist-types/index.d.ts +1 -1
- package/dist-types/inspectConfig.d.ts +2 -2
- package/dist-types/provider/rspackConfig.d.ts +1 -1
- package/dist-types/restart.d.ts +1 -1
- package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +2 -2
- package/dist-types/server/cliShortcuts.d.ts +2 -2
- package/dist-types/server/compilationManager.d.ts +7 -7
- package/dist-types/server/compilationMiddleware.d.ts +11 -11
- package/dist-types/server/devMiddlewares.d.ts +5 -6
- package/dist-types/server/environment.d.ts +2 -2
- package/dist-types/server/helper.d.ts +2 -2
- package/dist-types/server/hmrFallback.d.ts +1 -2
- package/dist-types/server/watchFiles.d.ts +2 -3
- package/dist-types/types/config.d.ts +8 -7
- package/dist-types/types/hooks.d.ts +3 -3
- package/dist-types/types/plugin.d.ts +4 -0
- package/dist-types/types/rsbuild.d.ts +6 -5
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function runCLI():
|
|
1
|
+
export declare function runCLI(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InternalContext, NormalizedEnvironmentConfig, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext } from './types';
|
|
2
|
-
export declare function getBrowserslist(path: string):
|
|
3
|
-
export declare function getBrowserslistByEnvironment(path: string, config: NormalizedEnvironmentConfig):
|
|
2
|
+
export declare function getBrowserslist(path: string): string[] | null;
|
|
3
|
+
export declare function getBrowserslistByEnvironment(path: string, config: NormalizedEnvironmentConfig): string[];
|
|
4
4
|
export declare function updateEnvironmentContext(context: InternalContext, configs: Record<string, NormalizedEnvironmentConfig>): Promise<void>;
|
|
5
5
|
export declare function updateContextByNormalizedConfig(context: InternalContext): void;
|
|
6
6
|
export declare function createPublicContext(context: RsbuildContext): Readonly<RsbuildContext>;
|
|
@@ -19,7 +19,7 @@ export declare const cloneDeep: <T>(value: T) => T;
|
|
|
19
19
|
* we should check that the Rspack version is greater than the minimum
|
|
20
20
|
* supported version.
|
|
21
21
|
*/
|
|
22
|
-
export declare const isSatisfyRspackVersion: (originalVersion: string) =>
|
|
22
|
+
export declare const isSatisfyRspackVersion: (originalVersion: string) => boolean;
|
|
23
23
|
export declare const removeLeadingSlash: (s: string) => string;
|
|
24
24
|
export declare const removeTailingSlash: (s: string) => string;
|
|
25
25
|
export declare const addTrailingSlash: (s: string) => string;
|
|
@@ -40,7 +40,7 @@ export declare const isURL: (str: string) => boolean;
|
|
|
40
40
|
export declare const createVirtualModule: (content: string) => string;
|
|
41
41
|
export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
|
|
42
42
|
export declare const isMultiCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler) => compiler is Rspack.MultiCompiler;
|
|
43
|
-
export declare function pick<T, U extends keyof T>(obj: T, keys:
|
|
43
|
+
export declare function pick<T, U extends keyof T>(obj: T, keys: readonly U[]): Pick<T, U>;
|
|
44
44
|
export declare const camelCase: (input: string) => string;
|
|
45
45
|
export declare const prettyTime: (seconds: number) => string;
|
|
46
46
|
/**
|
package/dist-types/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export { type Logger, logger } from './logger';
|
|
|
19
19
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
|
21
21
|
export type { StartServerResult } from './server/helper';
|
|
22
|
-
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
22
|
+
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, Connect, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InitConfigsOptions, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
@@ -7,10 +7,10 @@ export declare const getRsbuildInspectConfig: ({ normalizedConfig, inspectOption
|
|
|
7
7
|
}) => {
|
|
8
8
|
rawRsbuildConfig: string;
|
|
9
9
|
rsbuildConfig: InspectConfigResult["origin"]["rsbuildConfig"];
|
|
10
|
-
rawEnvironmentConfigs:
|
|
10
|
+
rawEnvironmentConfigs: {
|
|
11
11
|
name: string;
|
|
12
12
|
content: string;
|
|
13
|
-
}
|
|
13
|
+
}[];
|
|
14
14
|
environmentConfigs: InspectConfigResult["origin"]["environmentConfigs"];
|
|
15
15
|
};
|
|
16
16
|
type RawConfig = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EnvironmentContext, InternalContext, ModifyChainUtils, ModifyRspackConfigUtils, RsbuildTarget, Rspack } from '../types';
|
|
2
|
-
export declare function getConfigUtils(
|
|
2
|
+
export declare function getConfigUtils(getCurrentConfig: () => Rspack.Configuration, chainUtils: ModifyChainUtils): ModifyRspackConfigUtils;
|
|
3
3
|
export declare function getChainUtils(target: RsbuildTarget, environment: EnvironmentContext): ModifyChainUtils;
|
|
4
4
|
export declare function generateRspackConfig({ target, context, environment, }: {
|
|
5
5
|
environment: string;
|
package/dist-types/restart.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { Chunk, Compilation } from '@rspack/core';
|
|
19
19
|
import type { ResourceHintsIncludeType } from '../../types';
|
|
20
|
-
export declare function extractChunks(compilation: Compilation, includeType?: ResourceHintsIncludeType): Chunk[] |
|
|
20
|
+
export declare function extractChunks(compilation: Compilation, includeType?: ResourceHintsIncludeType): Chunk[] | {
|
|
21
21
|
files: string[];
|
|
22
22
|
auxiliaryFiles?: string[];
|
|
23
|
-
}
|
|
23
|
+
}[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CliShortcut,
|
|
2
|
-
export declare const isCliShortcutsEnabled: (
|
|
1
|
+
import type { CliShortcut, NormalizedConfig } from '../types/config';
|
|
2
|
+
export declare const isCliShortcutsEnabled: (config: NormalizedConfig) => boolean;
|
|
3
3
|
export declare function setupCliShortcuts({ help, openPage, closeServer, printUrls, restartServer, customShortcuts, }: {
|
|
4
4
|
help?: boolean | string;
|
|
5
5
|
openPage: () => Promise<void>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { EnvironmentContext,
|
|
1
|
+
import type { EnvironmentContext, NormalizedConfig, Rspack } from '../types';
|
|
2
2
|
import { type CompilationMiddleware } from './compilationMiddleware';
|
|
3
3
|
import { SocketServer } from './socketServer';
|
|
4
4
|
type Options = {
|
|
5
|
+
config: NormalizedConfig;
|
|
6
|
+
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
5
7
|
publicPaths: string[];
|
|
8
|
+
resolvedPort: number;
|
|
6
9
|
environments: Record<string, EnvironmentContext>;
|
|
7
|
-
dev: NormalizedDevConfig;
|
|
8
|
-
server: NormalizedServerConfig;
|
|
9
|
-
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Setup compiler-related logic:
|
|
@@ -16,13 +16,13 @@ type Options = {
|
|
|
16
16
|
export declare class CompilationManager {
|
|
17
17
|
middleware: CompilationMiddleware;
|
|
18
18
|
outputFileSystem: Rspack.OutputFileSystem;
|
|
19
|
-
private
|
|
20
|
-
private serverConfig;
|
|
19
|
+
private config;
|
|
21
20
|
compiler: Rspack.Compiler | Rspack.MultiCompiler;
|
|
22
21
|
private environments;
|
|
23
22
|
private publicPaths;
|
|
24
23
|
socketServer: SocketServer;
|
|
25
|
-
|
|
24
|
+
private resolvedPort;
|
|
25
|
+
constructor({ config, compiler, publicPaths, resolvedPort, environments, }: Options);
|
|
26
26
|
init(): Promise<void>;
|
|
27
27
|
/**
|
|
28
28
|
* Call `compiler.watch()` to start compiling.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Compiler, MultiCompiler, Stats } from '@rspack/core';
|
|
2
|
-
import type { Connect,
|
|
2
|
+
import type { Connect, EnvironmentContext, NormalizedConfig } from '../types';
|
|
3
3
|
export declare const isClientCompiler: (compiler: {
|
|
4
4
|
options: {
|
|
5
5
|
target?: Compiler["options"]["target"];
|
|
@@ -14,15 +14,6 @@ export declare const setupServerHooks: ({ compiler, token, callbacks: { onDone,
|
|
|
14
14
|
token: string;
|
|
15
15
|
callbacks: ServerCallbacks;
|
|
16
16
|
}) => void;
|
|
17
|
-
export type CompilationMiddlewareOptions = {
|
|
18
|
-
/**
|
|
19
|
-
* Should trigger when compiler hook called
|
|
20
|
-
*/
|
|
21
|
-
callbacks: ServerCallbacks;
|
|
22
|
-
devConfig: DevConfig;
|
|
23
|
-
serverConfig: ServerConfig;
|
|
24
|
-
environments: Record<string, EnvironmentContext>;
|
|
25
|
-
};
|
|
26
17
|
export type CompilationMiddleware = Connect.NextHandleFunction & {
|
|
27
18
|
close: (callback: (err: Error | null | undefined) => void) => any;
|
|
28
19
|
watch: () => void;
|
|
@@ -33,4 +24,13 @@ export type CompilationMiddleware = Connect.NextHandleFunction & {
|
|
|
33
24
|
* - Inject the HMR client path into page
|
|
34
25
|
* - Notify server when compiler hooks are triggered
|
|
35
26
|
*/
|
|
36
|
-
export declare const getCompilationMiddleware: (compiler
|
|
27
|
+
export declare const getCompilationMiddleware: ({ config, compiler, callbacks, environments, resolvedPort, }: {
|
|
28
|
+
config: NormalizedConfig;
|
|
29
|
+
compiler: Compiler | MultiCompiler;
|
|
30
|
+
/**
|
|
31
|
+
* Should trigger when compiler hook called
|
|
32
|
+
*/
|
|
33
|
+
callbacks: ServerCallbacks;
|
|
34
|
+
environments: Record<string, EnvironmentContext>;
|
|
35
|
+
resolvedPort: number;
|
|
36
|
+
}) => Promise<CompilationMiddleware>;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InternalContext, NormalizedConfig, RequestHandler } from '../types';
|
|
2
2
|
import type { CompilationManager } from './compilationManager';
|
|
3
3
|
import type { RsbuildDevServer } from './devServer';
|
|
4
4
|
import type { UpgradeEvent } from './helper';
|
|
5
5
|
export type RsbuildDevMiddlewareOptions = {
|
|
6
|
-
|
|
7
|
-
dev: DevConfig;
|
|
8
|
-
devServerAPI: RsbuildDevServer;
|
|
9
|
-
server: ServerConfig;
|
|
6
|
+
config: NormalizedConfig;
|
|
10
7
|
context: InternalContext;
|
|
11
8
|
compilationManager?: CompilationManager;
|
|
9
|
+
devServerAPI: RsbuildDevServer;
|
|
12
10
|
/**
|
|
13
11
|
* Callbacks returned by the `onBeforeStartDevServer` hook.
|
|
14
12
|
*/
|
|
15
13
|
postCallbacks: (() => void)[];
|
|
14
|
+
pwd: string;
|
|
16
15
|
};
|
|
17
|
-
export type Middlewares =
|
|
16
|
+
export type Middlewares = (RequestHandler | [string, RequestHandler])[];
|
|
18
17
|
export type GetDevMiddlewaresResult = {
|
|
19
18
|
close: () => Promise<void>;
|
|
20
19
|
onUpgrade: UpgradeEvent;
|
|
@@ -4,5 +4,5 @@ export type ServerUtils = {
|
|
|
4
4
|
environment: EnvironmentContext;
|
|
5
5
|
};
|
|
6
6
|
export declare const loadBundle: <T>(stats: Rspack.Stats, entryName: string, utils: ServerUtils) => Promise<T>;
|
|
7
|
-
export declare const getTransformedHtml: (entryName: string, utils: ServerUtils) =>
|
|
8
|
-
export declare const createCacheableFunction: <T>(getter: (stats: Rspack.Stats, entryName: string, utils: ServerUtils) => Promise<T>) => (stats: Rspack.Stats, entryName: string, utils: ServerUtils) => Promise<T>;
|
|
7
|
+
export declare const getTransformedHtml: (entryName: string, utils: ServerUtils) => string;
|
|
8
|
+
export declare const createCacheableFunction: <T>(getter: (stats: Rspack.Stats, entryName: string, utils: ServerUtils) => Promise<T> | T) => (stats: Rspack.Stats, entryName: string, utils: ServerUtils) => Promise<T>;
|
|
@@ -29,10 +29,10 @@ export declare const stripBase: (path: string, base: string) => string;
|
|
|
29
29
|
export declare const getRoutes: (context: InternalContext) => Routes;
|
|
30
30
|
export declare const formatRoutes: (entry: RsbuildEntry, base: string, distPathPrefix: string | undefined, outputStructure: OutputStructure | undefined) => Routes;
|
|
31
31
|
export declare function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls, trailingLineBreak, }: {
|
|
32
|
-
urls:
|
|
32
|
+
urls: {
|
|
33
33
|
url: string;
|
|
34
34
|
label: string;
|
|
35
|
-
}
|
|
35
|
+
}[];
|
|
36
36
|
port: number;
|
|
37
37
|
routes: Routes;
|
|
38
38
|
protocol: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { DevConfig, ServerConfig } from '../types/config';
|
|
2
1
|
/**
|
|
3
2
|
* Checks if localhost resolves differently between node's default DNS lookup
|
|
4
3
|
* and explicit DNS lookup.
|
|
@@ -7,4 +6,4 @@ import type { DevConfig, ServerConfig } from '../types/config';
|
|
|
7
6
|
* This helps detect cases where IPv4/IPv6 resolution might vary.
|
|
8
7
|
*/
|
|
9
8
|
export declare function getLocalhostResolvedAddress(): Promise<string | undefined>;
|
|
10
|
-
export declare function
|
|
9
|
+
export declare function resolveHostname(host?: string | undefined): Promise<string>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { FSWatcher } from '../../compiled/chokidar/index.js';
|
|
2
|
-
import type { ChokidarOptions,
|
|
2
|
+
import type { ChokidarOptions, NormalizedConfig } from '../types';
|
|
3
3
|
import type { CompilationManager } from './compilationManager';
|
|
4
4
|
type WatchFilesOptions = {
|
|
5
|
-
dev: DevConfig;
|
|
6
|
-
server: ServerConfig;
|
|
7
5
|
root: string;
|
|
6
|
+
config: NormalizedConfig;
|
|
8
7
|
compilationManager?: CompilationManager;
|
|
9
8
|
};
|
|
10
9
|
export type WatchFilesResult = {
|
|
@@ -214,7 +214,7 @@ export interface SourceConfig {
|
|
|
214
214
|
/**
|
|
215
215
|
* Used to import the code and style of the component library on demand.
|
|
216
216
|
*/
|
|
217
|
-
transformImport?: TransformImportFn |
|
|
217
|
+
transformImport?: TransformImportFn | (TransformImport | TransformImportFn)[];
|
|
218
218
|
/**
|
|
219
219
|
* Configure a custom tsconfig.json file path to use, can be a relative or absolute path.
|
|
220
220
|
* @default 'tsconfig.json'
|
|
@@ -266,10 +266,10 @@ export type HistoryApiFallbackOptions = {
|
|
|
266
266
|
index?: string;
|
|
267
267
|
htmlAcceptHeaders?: string[];
|
|
268
268
|
disableDotRule?: true;
|
|
269
|
-
rewrites?:
|
|
269
|
+
rewrites?: {
|
|
270
270
|
from: RegExp;
|
|
271
271
|
to: HistoryApiFallbackTo;
|
|
272
|
-
}
|
|
272
|
+
}[];
|
|
273
273
|
};
|
|
274
274
|
export type PrintUrls = boolean | ((params: {
|
|
275
275
|
urls: string[];
|
|
@@ -447,7 +447,7 @@ export type BuildCacheOptions = {
|
|
|
447
447
|
* when any value in the array changes.
|
|
448
448
|
* @default undefined
|
|
449
449
|
*/
|
|
450
|
-
cacheDigest?:
|
|
450
|
+
cacheDigest?: (string | undefined)[];
|
|
451
451
|
/**
|
|
452
452
|
* An array of files containing build dependencies.
|
|
453
453
|
* Rspack will use the hash of each of these files to invalidate the persistent cache.
|
|
@@ -506,7 +506,7 @@ export interface PreconnectOption {
|
|
|
506
506
|
*/
|
|
507
507
|
crossorigin?: boolean;
|
|
508
508
|
}
|
|
509
|
-
export type Preconnect =
|
|
509
|
+
export type Preconnect = (string | PreconnectOption)[];
|
|
510
510
|
export type DnsPrefetch = string[];
|
|
511
511
|
export type ResourceHintsIncludeType = 'async-chunks' | 'initial' | 'all-assets' | 'all-chunks';
|
|
512
512
|
export type ResourceHintsFilterFn = (filename: string) => boolean;
|
|
@@ -1421,6 +1421,7 @@ export type CliShortcut = {
|
|
|
1421
1421
|
*/
|
|
1422
1422
|
action: () => void | Promise<void>;
|
|
1423
1423
|
};
|
|
1424
|
+
export type WriteToDisk = boolean | ((filename: string) => boolean);
|
|
1424
1425
|
export interface DevConfig {
|
|
1425
1426
|
/**
|
|
1426
1427
|
* Whether to enable Hot Module Replacement.
|
|
@@ -1472,7 +1473,7 @@ export interface DevConfig {
|
|
|
1472
1473
|
* Controls whether the build output from development mode is written to disk.
|
|
1473
1474
|
* @default false
|
|
1474
1475
|
*/
|
|
1475
|
-
writeToDisk?:
|
|
1476
|
+
writeToDisk?: WriteToDisk;
|
|
1476
1477
|
/**
|
|
1477
1478
|
* This option allows you to configure a list of globs/directories/files to watch for
|
|
1478
1479
|
* file changes.
|
|
@@ -1531,7 +1532,7 @@ export type RsbuildConfigMeta = {
|
|
|
1531
1532
|
/**
|
|
1532
1533
|
* Only some dev options can be defined in the environment config
|
|
1533
1534
|
*/
|
|
1534
|
-
export type AllowedEnvironmentDevKeys = 'hmr' | 'liveReload' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk';
|
|
1535
|
+
export type AllowedEnvironmentDevKeys = 'hmr' | 'client' | 'liveReload' | 'assetPrefix' | 'progressBar' | 'lazyCompilation' | 'writeToDisk';
|
|
1535
1536
|
/**
|
|
1536
1537
|
* The Rsbuild config to run in the specified environment.
|
|
1537
1538
|
* */
|
|
@@ -45,10 +45,10 @@ export type OnBeforeStartDevServerFn = (params: {
|
|
|
45
45
|
environments: Record<string, EnvironmentContext>;
|
|
46
46
|
}) => MaybePromise<(() => void) | void>;
|
|
47
47
|
export type OnBeforeStartProdServerFn = () => MaybePromise<void>;
|
|
48
|
-
export type Routes =
|
|
48
|
+
export type Routes = {
|
|
49
49
|
entryName: string;
|
|
50
50
|
pathname: string;
|
|
51
|
-
}
|
|
51
|
+
}[];
|
|
52
52
|
export type OnAfterStartDevServerFn = (params: {
|
|
53
53
|
port: number;
|
|
54
54
|
routes: Routes;
|
|
@@ -106,7 +106,7 @@ export type ModifyRsbuildConfigUtils = {
|
|
|
106
106
|
/** Merge multiple Rsbuild config objects into one. */
|
|
107
107
|
mergeRsbuildConfig: (...configs: RsbuildConfig[]) => RsbuildConfig;
|
|
108
108
|
};
|
|
109
|
-
type ArrayAtLeastOne<A, B> = [A, ...
|
|
109
|
+
type ArrayAtLeastOne<A, B> = [A, ...(A | B)[]] | [...(A | B)[], A];
|
|
110
110
|
export type ModifyEnvironmentConfigUtils = {
|
|
111
111
|
/** environment name. */
|
|
112
112
|
name: string;
|
|
@@ -51,6 +51,10 @@ export type EnvironmentAsyncHook<Callback extends (...args: any[]) => T, T = any
|
|
|
51
51
|
* The parameters to pass to each callback
|
|
52
52
|
*/
|
|
53
53
|
args: Parameters<Callback>;
|
|
54
|
+
/**
|
|
55
|
+
* The callback function to be executed after each callback
|
|
56
|
+
*/
|
|
57
|
+
afterEach?: (args: Parameters<Callback>) => void;
|
|
54
58
|
}) => Promise<Parameters<Callback>>;
|
|
55
59
|
/**
|
|
56
60
|
* Executes callbacks in sequence independently and collects all their results into an array.
|
|
@@ -4,7 +4,7 @@ import type * as providerHelpers from '../provider/helpers';
|
|
|
4
4
|
import type { RsbuildDevServer } from '../server/devServer';
|
|
5
5
|
import type { StartServerResult } from '../server/helper';
|
|
6
6
|
import type { NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig } from './config';
|
|
7
|
-
import type { InternalContext } from './context';
|
|
7
|
+
import type { InternalContext, RsbuildContext } from './context';
|
|
8
8
|
import type { PluginManager, RsbuildPlugin, RsbuildPluginAPI } from './plugin';
|
|
9
9
|
import type { Rspack } from './rspack';
|
|
10
10
|
import type { WebpackConfig } from './thirdParty';
|
|
@@ -62,6 +62,7 @@ export type Build = (options?: BuildOptions) => Promise<{
|
|
|
62
62
|
*/
|
|
63
63
|
stats?: Rspack.Stats | Rspack.MultiStats;
|
|
64
64
|
}>;
|
|
65
|
+
export type InitConfigsOptions = Pick<RsbuildContext, 'action'>;
|
|
65
66
|
export type InspectConfigOptions = {
|
|
66
67
|
/**
|
|
67
68
|
* Inspect the config in the specified mode.
|
|
@@ -148,7 +149,7 @@ export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<Rsbu
|
|
|
148
149
|
export type StartDevServer = (options?: StartDevServerOptions) => Promise<StartServerResult>;
|
|
149
150
|
export type ProviderInstance<B extends 'rspack' | 'webpack' = 'rspack'> = Pick<RsbuildInstance, 'build' | 'createCompiler' | 'createDevServer' | 'startDevServer'> & {
|
|
150
151
|
readonly bundler: Bundler;
|
|
151
|
-
initConfigs: () => Promise<B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[]>;
|
|
152
|
+
initConfigs: (options?: InitConfigsOptions) => Promise<B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[]>;
|
|
152
153
|
inspectConfig: (options?: InspectConfigOptions) => Promise<InspectConfigResult<B>>;
|
|
153
154
|
};
|
|
154
155
|
export type RsbuildProviderHelpers = typeof providerHelpers;
|
|
@@ -157,7 +158,7 @@ export type RsbuildProvider<B extends 'rspack' | 'webpack' = 'rspack'> = (option
|
|
|
157
158
|
pluginManager: PluginManager;
|
|
158
159
|
rsbuildOptions: ResolvedCreateRsbuildOptions;
|
|
159
160
|
helpers: RsbuildProviderHelpers;
|
|
160
|
-
}) => Promise<ProviderInstance<B
|
|
161
|
+
}) => Promise<ProviderInstance<B>> | ProviderInstance<B>;
|
|
161
162
|
export type AddPluginsOptions = {
|
|
162
163
|
/**
|
|
163
164
|
* Insert before the specified plugin.
|
|
@@ -170,7 +171,7 @@ export type AddPluginsOptions = {
|
|
|
170
171
|
*/
|
|
171
172
|
environment?: string;
|
|
172
173
|
};
|
|
173
|
-
export type AddPlugins = (plugins:
|
|
174
|
+
export type AddPlugins = (plugins: (RsbuildPlugin | Falsy)[], options?: AddPluginsOptions) => void;
|
|
174
175
|
export type RsbuildInstance = {
|
|
175
176
|
/**
|
|
176
177
|
* Register one or more Rsbuild plugins, which can be called multiple times.
|
|
@@ -217,7 +218,7 @@ export type RsbuildInstance = {
|
|
|
217
218
|
* since it's automatically invoked by methods like `rsbuild.build` and
|
|
218
219
|
* `rsbuild.startDevServer`.
|
|
219
220
|
*/
|
|
220
|
-
initConfigs: () => Promise<Rspack.Configuration[]>;
|
|
221
|
+
initConfigs: (options?: InitConfigsOptions) => Promise<Rspack.Configuration[]>;
|
|
221
222
|
/**
|
|
222
223
|
* Inspect and debug Rsbuild's internal configurations. It provides access to:
|
|
223
224
|
* - The resolved Rsbuild configuration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.15",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -49,18 +49,18 @@
|
|
|
49
49
|
"@rspack/core": "1.4.11",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
|
-
"core-js": "~3.
|
|
52
|
+
"core-js": "~3.45.0",
|
|
53
53
|
"jiti": "^2.5.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.11.
|
|
56
|
+
"@rslib/core": "0.11.2",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
58
|
"@types/cors": "^2.8.19",
|
|
59
59
|
"@types/node": "^22.17.0",
|
|
60
60
|
"@types/on-finished": "2.3.5",
|
|
61
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
63
|
-
"browserslist-load-config": "1.0.
|
|
63
|
+
"browserslist-load-config": "1.0.1",
|
|
64
64
|
"cac": "^6.7.14",
|
|
65
65
|
"chokidar": "^4.0.3",
|
|
66
66
|
"connect": "3.7.0",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"postcss": "^8.5.6",
|
|
79
79
|
"postcss-load-config": "6.0.1",
|
|
80
80
|
"postcss-loader": "8.1.1",
|
|
81
|
-
"prebundle": "1.4.
|
|
82
|
-
"reduce-configs": "^1.1.
|
|
81
|
+
"prebundle": "1.4.1",
|
|
82
|
+
"reduce-configs": "^1.1.1",
|
|
83
83
|
"rsbuild-dev-middleware": "0.3.0",
|
|
84
|
-
"rslog": "^1.2.
|
|
85
|
-
"rspack-chain": "^1.3.
|
|
84
|
+
"rslog": "^1.2.11",
|
|
85
|
+
"rspack-chain": "^1.3.2",
|
|
86
86
|
"rspack-manifest-plugin": "5.0.3",
|
|
87
87
|
"sirv": "^3.0.1",
|
|
88
88
|
"style-loader": "3.3.4",
|
|
@@ -98,7 +98,6 @@
|
|
|
98
98
|
},
|
|
99
99
|
"publishConfig": {
|
|
100
100
|
"access": "public",
|
|
101
|
-
"provenance": true,
|
|
102
101
|
"registry": "https://registry.npmjs.org/"
|
|
103
102
|
},
|
|
104
103
|
"scripts": {
|