@rsbuild/core 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
Files changed (98) hide show
  1. package/compiled/autoprefixer/index.d.ts +95 -0
  2. package/compiled/autoprefixer/index.js +10217 -0
  3. package/compiled/autoprefixer/license +20 -0
  4. package/compiled/autoprefixer/package.json +1 -0
  5. package/compiled/browserslist/index.d.ts +201 -0
  6. package/compiled/browserslist/index.js +2017 -0
  7. package/compiled/browserslist/license +20 -0
  8. package/compiled/browserslist/package.json +1 -0
  9. package/compiled/chokidar/index.d.ts +198 -0
  10. package/compiled/chokidar/index.js +6692 -0
  11. package/compiled/chokidar/license +21 -0
  12. package/compiled/chokidar/package.json +1 -0
  13. package/compiled/css-loader/index.js +20 -20
  14. package/compiled/gzip-size/index.d.ts +1 -0
  15. package/compiled/gzip-size/index.js +242 -0
  16. package/compiled/gzip-size/package.json +1 -0
  17. package/compiled/http-proxy-middleware/index.d.ts +315 -0
  18. package/compiled/http-proxy-middleware/index.js +7503 -0
  19. package/compiled/http-proxy-middleware/license +22 -0
  20. package/compiled/http-proxy-middleware/package.json +1 -0
  21. package/compiled/launch-editor-middleware/index.js +9 -9
  22. package/compiled/postcss-loader/index.js +8 -8
  23. package/compiled/rspack-chain/index.d.ts +600 -0
  24. package/compiled/rspack-chain/index.js +2192 -0
  25. package/compiled/rspack-chain/license +373 -0
  26. package/compiled/rspack-chain/package.json +1 -0
  27. package/compiled/rspack-manifest-plugin/index.js +4 -4
  28. package/compiled/webpack-bundle-analyzer/index.d.ts +160 -0
  29. package/compiled/webpack-bundle-analyzer/index.js +14968 -0
  30. package/compiled/webpack-bundle-analyzer/license +20 -0
  31. package/compiled/webpack-bundle-analyzer/package.json +1 -0
  32. package/compiled/webpack-bundle-analyzer/public/viewer.js +16 -0
  33. package/compiled/webpack-bundle-analyzer/public/viewer.js.LICENSE.txt +10 -0
  34. package/compiled/webpack-merge/index.d.ts +31 -0
  35. package/compiled/webpack-merge/index.js +1239 -0
  36. package/compiled/webpack-merge/license +20 -0
  37. package/compiled/webpack-merge/package.json +1 -0
  38. package/compiled/ws/index.js +295 -110
  39. package/compiled/ws/package.json +1 -1
  40. package/dist/index.cjs +915 -2539
  41. package/dist/index.js +1033 -2701
  42. package/dist-types/cli/commands.d.ts +1 -1
  43. package/dist-types/config.d.ts +1 -1
  44. package/dist-types/configChain.d.ts +158 -2
  45. package/dist-types/constants.d.ts +1 -0
  46. package/dist-types/createContext.d.ts +1 -2
  47. package/dist-types/helpers.d.ts +7 -4
  48. package/dist-types/index.d.ts +2 -2
  49. package/dist-types/initHooks.d.ts +1 -1
  50. package/dist-types/initPlugins.d.ts +1 -2
  51. package/dist-types/internal.d.ts +1 -1
  52. package/dist-types/loader/transformLoader.d.ts +1 -1
  53. package/dist-types/mergeConfig.d.ts +1 -1
  54. package/dist-types/pluginManager.d.ts +1 -1
  55. package/dist-types/plugins/css.d.ts +1 -2
  56. package/dist-types/plugins/html.d.ts +1 -2
  57. package/dist-types/plugins/minimize.d.ts +1 -2
  58. package/dist-types/provider/build.d.ts +1 -1
  59. package/dist-types/provider/createCompiler.d.ts +1 -2
  60. package/dist-types/provider/initConfigs.d.ts +1 -2
  61. package/dist-types/provider/inspectConfig.d.ts +1 -1
  62. package/dist-types/provider/rspackConfig.d.ts +2 -2
  63. package/dist-types/rspack/HtmlBasicPlugin.d.ts +1 -1
  64. package/dist-types/rspack/InlineChunkHtmlPlugin.d.ts +1 -1
  65. package/dist-types/rspack/preload/HtmlPreloadOrPrefetchPlugin.d.ts +1 -1
  66. package/dist-types/rspack/preload/helpers/doesChunkBelongToHtml.d.ts +1 -1
  67. package/dist-types/rspack/preload/helpers/extractChunks.d.ts +1 -1
  68. package/dist-types/server/compilerDevMiddleware.d.ts +1 -1
  69. package/dist-types/server/devMiddleware.d.ts +4 -1
  70. package/dist-types/server/devServer.d.ts +1 -2
  71. package/dist-types/server/environment.d.ts +1 -1
  72. package/dist-types/server/getDevMiddlewares.d.ts +1 -1
  73. package/dist-types/server/helper.d.ts +1 -2
  74. package/dist-types/server/httpServer.d.ts +1 -1
  75. package/dist-types/server/middlewares.d.ts +1 -1
  76. package/dist-types/server/prodServer.d.ts +1 -2
  77. package/dist-types/server/proxy.d.ts +3 -3
  78. package/dist-types/server/socketServer.d.ts +1 -1
  79. package/dist-types/server/watchFiles.d.ts +1 -1
  80. package/dist-types/types/config/dev.d.ts +85 -0
  81. package/dist-types/types/config/html.d.ts +107 -0
  82. package/dist-types/types/config/index.d.ts +134 -0
  83. package/dist-types/types/config/output.d.ts +301 -0
  84. package/dist-types/types/config/performance.d.ts +122 -0
  85. package/dist-types/types/config/security.d.ts +18 -0
  86. package/dist-types/types/config/server.d.ts +106 -0
  87. package/dist-types/types/config/source.d.ts +79 -0
  88. package/dist-types/types/config/tools.d.ts +86 -0
  89. package/dist-types/types/context.d.ts +38 -0
  90. package/dist-types/types/hooks.d.ts +125 -0
  91. package/dist-types/types/index.d.ts +9 -0
  92. package/dist-types/types/plugin.d.ts +194 -0
  93. package/dist-types/{types.d.ts → types/rsbuild.d.ts} +56 -33
  94. package/dist-types/types/rspack.d.ts +28 -0
  95. package/dist-types/types/stats.d.ts +17 -0
  96. package/dist-types/types/thirdParty.d.ts +169 -0
  97. package/dist-types/types/utils.d.ts +14 -0
  98. package/package.json +20 -5
@@ -1,4 +1,4 @@
1
- import { type RsbuildMode } from '@rsbuild/shared';
1
+ import type { RsbuildMode } from '../types';
2
2
  export type CommonOptions = {
3
3
  config?: string;
4
4
  envMode?: string;
@@ -1,4 +1,4 @@
1
- import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from '@rsbuild/shared';
1
+ import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
2
2
  export declare function getDefaultEntry(root: string): RsbuildEntry;
3
3
  export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
4
4
  /** #__PURE__
@@ -1,5 +1,5 @@
1
- import { type CreateAsyncHook, type ModifyBundlerChainFn, type ModifyBundlerChainUtils, type RsbuildContext, RspackChain, type RspackConfig } from '@rsbuild/shared';
2
- import type { RsbuildConfig } from './types';
1
+ import RspackChain from '../compiled/rspack-chain';
2
+ import type { CreateAsyncHook, ModifyBundlerChainFn, ModifyBundlerChainUtils, RsbuildConfig, RsbuildContext, RspackConfig } from './types';
3
3
  export declare function getBundlerChain(): RspackChain;
4
4
  export declare function modifyBundlerChain(context: RsbuildContext & {
5
5
  hooks: {
@@ -8,3 +8,159 @@ export declare function modifyBundlerChain(context: RsbuildContext & {
8
8
  config: Readonly<RsbuildConfig>;
9
9
  }, utils: ModifyBundlerChainUtils): Promise<RspackChain>;
10
10
  export declare function chainToConfig(chain: RspackChain): RspackConfig;
11
+ export declare const CHAIN_ID: {
12
+ /** Predefined rules */
13
+ readonly RULE: {
14
+ /** Rule for .mjs */
15
+ readonly MJS: "mjs";
16
+ /** Rule for fonts */
17
+ readonly FONT: "font";
18
+ /** Rule for images */
19
+ readonly IMAGE: "image";
20
+ /** Rule for media */
21
+ readonly MEDIA: "media";
22
+ /** Rule for js */
23
+ readonly JS: "js";
24
+ /** Rule for data uri encoded javascript */
25
+ readonly JS_DATA_URI: "js-data-uri";
26
+ /** Rule for ts */
27
+ readonly TS: "ts";
28
+ /** Rule for css */
29
+ readonly CSS: "css";
30
+ /** Rule for less */
31
+ readonly LESS: "less";
32
+ /** Rule for sass */
33
+ readonly SASS: "sass";
34
+ /** Rule for stylus */
35
+ readonly STYLUS: "stylus";
36
+ /** Rule for svg */
37
+ readonly SVG: "svg";
38
+ /** Rule for pug */
39
+ readonly PUG: "pug";
40
+ /** Rule for Vue */
41
+ readonly VUE: "vue";
42
+ /** Rule for yaml */
43
+ readonly YAML: "yaml";
44
+ /** Rule for wasm */
45
+ readonly WASM: "wasm";
46
+ /** Rule for svelte */
47
+ readonly SVELTE: "svelte";
48
+ };
49
+ /** Predefined rule groups */
50
+ readonly ONE_OF: {
51
+ readonly SVG: "svg";
52
+ readonly SVG_URL: "svg-asset-url";
53
+ readonly SVG_ASSET: "svg-asset";
54
+ readonly SVG_REACT: "svg-react";
55
+ readonly SVG_INLINE: "svg-asset-inline";
56
+ };
57
+ /** Predefined loaders */
58
+ readonly USE: {
59
+ /** ts-loader */
60
+ readonly TS: "ts";
61
+ /** css-loader */
62
+ readonly CSS: "css";
63
+ /** sass-loader */
64
+ readonly SASS: "sass";
65
+ /** less-loader */
66
+ readonly LESS: "less";
67
+ /** stylus-loader */
68
+ readonly STYLUS: "stylus";
69
+ /** url-loader */
70
+ readonly URL: "url";
71
+ /** pug-loader */
72
+ readonly PUG: "pug";
73
+ /** vue-loader */
74
+ readonly VUE: "vue";
75
+ /** swc-loader */
76
+ readonly SWC: "swc";
77
+ /** svgr */
78
+ readonly SVGR: "svgr";
79
+ /** plugin-image-compress svgo-loader */
80
+ readonly SVGO: "svgo";
81
+ /** yaml-loader */
82
+ readonly YAML: "yaml";
83
+ /** babel-loader */
84
+ readonly BABEL: "babel";
85
+ /** style-loader */
86
+ readonly STYLE: "style-loader";
87
+ /** svelte-loader */
88
+ readonly SVELTE: "svelte";
89
+ /** postcss-loader */
90
+ readonly POSTCSS: "postcss";
91
+ /** lightningcss-loader */
92
+ readonly LIGHTNINGCSS: "lightningcss";
93
+ /** ignore-css-loader */
94
+ readonly IGNORE_CSS: "ignore-css";
95
+ /** css-modules-typescript-loader */
96
+ readonly CSS_MODULES_TS: "css-modules-typescript";
97
+ /** CssExtractRspackPlugin.loader */
98
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
99
+ /** resolve-url-loader */
100
+ readonly RESOLVE_URL: "resolve-url-loader";
101
+ /** plugin-image-compress.loader */
102
+ readonly IMAGE_COMPRESS: "image-compress";
103
+ };
104
+ /** Predefined plugins */
105
+ readonly PLUGIN: {
106
+ /** HotModuleReplacementPlugin */
107
+ readonly HMR: "hmr";
108
+ /** CopyWebpackPlugin */
109
+ readonly COPY: "copy";
110
+ /** HtmlWebpackPlugin */
111
+ readonly HTML: "html";
112
+ /** ESLintWebpackPlugin */
113
+ readonly ESLINT: "eslint";
114
+ /** DefinePlugin */
115
+ readonly DEFINE: "define";
116
+ /** ProgressPlugin */
117
+ readonly PROGRESS: "progress";
118
+ /** AppIconPlugin */
119
+ readonly APP_ICON: "app-icon";
120
+ /** WebpackManifestPlugin */
121
+ readonly MANIFEST: "webpack-manifest";
122
+ /** ForkTsCheckerWebpackPlugin */
123
+ readonly TS_CHECKER: "ts-checker";
124
+ /** InlineChunkHtmlPlugin */
125
+ readonly INLINE_HTML: "inline-html";
126
+ /** WebpackBundleAnalyzer */
127
+ readonly BUNDLE_ANALYZER: "bundle-analyze";
128
+ /** ModuleFederationPlugin */
129
+ readonly MODULE_FEDERATION: "module-federation";
130
+ /** HtmlBasicPlugin */
131
+ readonly HTML_BASIC: "html-basic-plugin";
132
+ /** htmlPrefetchPlugin */
133
+ readonly HTML_PREFETCH: "html-prefetch-plugin";
134
+ /** htmlPreloadPlugin */
135
+ readonly HTML_PRELOAD: "html-preload-plugin";
136
+ /** CssExtractRspackPlugin */
137
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
138
+ /** VueLoaderPlugin */
139
+ readonly VUE_LOADER_PLUGIN: "vue-loader-plugin";
140
+ /** ReactFastRefreshPlugin */
141
+ readonly REACT_FAST_REFRESH: "react-fast-refresh";
142
+ /** ProvidePlugin for node polyfill */
143
+ readonly NODE_POLYFILL_PROVIDE: "node-polyfill-provide";
144
+ /** WebpackSRIPlugin */
145
+ readonly SUBRESOURCE_INTEGRITY: "subresource-integrity";
146
+ /** AssetsRetryPlugin */
147
+ readonly ASSETS_RETRY: "assets-retry";
148
+ /** AsyncChunkRetryPlugin */
149
+ readonly ASYNC_CHUNK_RETRY: "async-chunk-retry";
150
+ /** AutoSetRootFontSizePlugin */
151
+ readonly AUTO_SET_ROOT_SIZE: "auto-set-root-size";
152
+ };
153
+ /** Predefined minimizers */
154
+ readonly MINIMIZER: {
155
+ /** SwcJsMinimizerRspackPlugin */
156
+ readonly JS: "js";
157
+ /** LightningCssMinimizerRspackPlugin */
158
+ readonly CSS: "css";
159
+ };
160
+ /** Predefined resolve plugins */
161
+ readonly RESOLVE_PLUGIN: {
162
+ /** TsConfigPathsPlugin */
163
+ readonly TS_CONFIG_PATHS: "ts-config-paths";
164
+ };
165
+ };
166
+ export type ChainIdentifier = typeof CHAIN_ID;
@@ -21,6 +21,7 @@ export declare const DEFAULT_WEB_BROWSERSLIST: string[];
21
21
  export declare const DEFAULT_BROWSERSLIST: Record<string, string[]>;
22
22
  export declare const HTML_REGEX: RegExp;
23
23
  export declare const JS_REGEX: RegExp;
24
+ export declare const SCRIPT_REGEX: RegExp;
24
25
  export declare const CSS_REGEX: RegExp;
25
26
  export declare const NODE_MODULES_REGEX: RegExp;
26
27
  export declare const PLUGIN_SWC_NAME = "rsbuild:swc";
@@ -1,5 +1,4 @@
1
- import type { BundlerType, NormalizedEnvironmentConfig, RsbuildContext } from '@rsbuild/shared';
2
- import type { CreateRsbuildOptions, InternalContext, RsbuildConfig } from './types';
1
+ import type { BundlerType, CreateRsbuildOptions, InternalContext, NormalizedEnvironmentConfig, RsbuildConfig, RsbuildContext } from './types';
3
2
  export declare function getBrowserslist(path: string): Promise<string[] | null>;
4
3
  export declare function getBrowserslistByEnvironment(path: string, config: NormalizedEnvironmentConfig): Promise<string[]>;
5
4
  export declare function updateEnvironmentContext(context: InternalContext, configs: Record<string, NormalizedEnvironmentConfig>): Promise<void>;
@@ -1,6 +1,7 @@
1
- import { type FilenameConfig, type MultiStats, type NodeEnv, type NormalizedConfig, type NormalizedEnvironmentConfig, type RsbuildTarget, type Rspack, type RspackChain, type Stats } from '@rsbuild/shared';
2
1
  import type { StatsCompilation, StatsValue } from '@rspack/core';
2
+ import type RspackChain from '../compiled/rspack-chain';
3
3
  import type { Compiler as WebpackCompiler, MultiCompiler as WebpackMultiCompiler } from 'webpack';
4
+ import type { FilenameConfig, MultiStats, NodeEnv, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildTarget, Rspack, Stats } from './types';
4
5
  export declare const rspackMinVersion = "0.7.0";
5
6
  export declare const getNodeEnv: () => NodeEnv;
6
7
  export declare const setNodeEnv: (env: NodeEnv) => void;
@@ -10,6 +11,8 @@ export declare const isNil: (o: unknown) => o is undefined | null;
10
11
  export declare const isFunction: (func: unknown) => func is (...args: any[]) => any;
11
12
  export declare const isObject: (obj: unknown) => obj is Record<string, any>;
12
13
  export declare const isPlainObject: (obj: unknown) => obj is Record<string, any>;
14
+ export declare const castArray: <T>(arr?: T | T[]) => T[];
15
+ export declare const cloneDeep: <T>(value: T) => T;
13
16
  export declare const isSatisfyRspackVersion: (originalVersion: string) => Promise<boolean>;
14
17
  export declare const getAllStatsErrors: (statsData: StatsCompilation) => Rspack.StatsError[] | undefined;
15
18
  export declare const getAllStatsWarnings: (statsData: StatsCompilation) => Rspack.StatsError[] | undefined;
@@ -37,8 +40,8 @@ export declare function isFileExists(file: string): Promise<boolean>;
37
40
  export declare function emptyDir(dir: string): Promise<void>;
38
41
  export declare const canParse: (url: string) => boolean;
39
42
  export declare const ensureAssetPrefix: (url: string, assetPrefix?: string) => string;
40
- export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean): NonNullable<FilenameConfig['js']>;
41
- export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js'>, isProd: boolean): string;
43
+ export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): NonNullable<FilenameConfig['js']>;
44
+ export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js'>, isProd: boolean, isServer?: boolean): string;
42
45
  export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
43
46
  export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
44
47
  export declare const upperFirst: (str: string) => string;
@@ -48,7 +51,7 @@ export declare const createVirtualModule: (content: string) => string;
48
51
  export declare const isRegExp: (obj: any) => obj is RegExp;
49
52
  export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
50
53
  export declare const isMultiCompiler: <C extends Rspack.Compiler | WebpackCompiler = Rspack.Compiler, M extends Rspack.MultiCompiler | WebpackMultiCompiler = Rspack.MultiCompiler>(compiler: C | M) => compiler is M;
51
- export declare const onCompileDone: (compiler: Rspack.Compiler | Rspack.MultiCompiler, onDone: (stats: Stats | MultiStats) => Promise<void>, MultiStatsCtor: new (stats: Stats[]) => MultiStats) => void;
54
+ export declare const onCompileDone: (compiler: Rspack.Compiler | Rspack.MultiCompiler, onDone: (stats: Rspack.Stats | Rspack.MultiStats) => Promise<void>, MultiStatsCtor: new (stats: Rspack.Stats[]) => Rspack.MultiStats) => void;
52
55
  export declare function pick<T, U extends keyof T>(obj: T, keys: ReadonlyArray<U>): Pick<T, U>;
53
56
  export declare const camelCase: (input: string) => string;
54
57
  export declare const prettyTime: (seconds: number) => string;
@@ -15,8 +15,8 @@ export { logger } from './logger';
15
15
  export { mergeRsbuildConfig } from './mergeConfig';
16
16
  export { ensureAssetPrefix } from './helpers';
17
17
  export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
18
- export type { RsbuildConfig, DevConfig, HtmlConfig, ToolsConfig, SourceConfig, ServerConfig, OutputConfig, SecurityConfig, PerformanceConfig, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedHtmlConfig, NormalizedToolsConfig, NormalizedSourceConfig, NormalizedServerConfig, NormalizedOutputConfig, NormalizedSecurityConfig, NormalizedPerformanceConfig, NormalizedModuleFederationConfig, NormalizedEnvironmentConfig, RsbuildPlugin, RsbuildPlugins, RsbuildPluginAPI, RsbuildInstance, RsbuildProvider, CreateRsbuildOptions, } from './types';
19
- export type { RsbuildMode, RsbuildEntry, RsbuildTarget, RsbuildContext, EnvironmentContext, InspectConfigResult, InspectConfigOptions, Minify, Polyfill, PrintUrls, PublicDir, Decorators, RspackRule, WatchFiles, CSSModules, CrossOrigin, ConsoleType, SplitChunks, RspackChain, ClientConfig, ScriptInject, ConfigChain, PostCSSPlugin, ScriptLoading, LegalComments, AliasStrategy, FilenameConfig, DistPathConfig, OutputStructure, ChainIdentifier, PublicDirOptions, PreconnectOption, CSSLoaderOptions, ModifyChainUtils, StyleLoaderOptions, PostCSSLoaderOptions, ConfigChainWithContext, ModifyRspackConfigUtils, CSSModulesLocalsConvention, OnExitFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnBeforeCreateCompilerFn, OnCloseDevServerFn, OnDevCompileDoneFn, ModifyBundlerChainFn, ModifyRspackConfigFn, ModifyRsbuildConfigFn, TransformFn, TransformHandler, ServerAPIs, RequestHandler, } from '@rsbuild/shared';
18
+ export type { AliasStrategy, BuildOptions, BundlerPluginInstance, CacheGroup, CacheGroups, ClientConfig, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateCompilerOptions, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, Decorators, DevConfig, DistPathConfig, EnvironmentContext, FilenameConfig, HtmlConfig, InspectConfigOptions, InspectConfigResult, LegalComments, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSPlugin, PreconnectOption, PrintUrls, PublicDir, PublicDirOptions, RequestHandler, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerAPIs, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, ToolsConfig, TransformFn, TransformHandler, TransformImport, WatchFiles, } from './types';
19
+ export type { ChainIdentifier } from './configChain';
20
20
  export {
21
21
  /**
22
22
  * @private
@@ -1,4 +1,4 @@
1
- import type { AsyncHook, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from '@rsbuild/shared';
1
+ import type { AsyncHook, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './types';
2
2
  export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
3
3
  export declare function initHooks(): {
4
4
  onExit: AsyncHook<OnExitFn>;
@@ -1,5 +1,4 @@
1
- import type { NormalizedEnvironmentConfig, PluginManager, RsbuildPluginAPI } from '@rsbuild/shared';
2
- import type { InternalContext } from './types';
1
+ import type { InternalContext, NormalizedEnvironmentConfig, PluginManager, RsbuildPluginAPI } from './types';
3
2
  export declare function getHTMLPathByEntry(entryName: string, config: NormalizedEnvironmentConfig): string;
4
3
  export declare function getPluginAPI({ context, pluginManager, }: {
5
4
  context: InternalContext;
@@ -12,7 +12,7 @@ export { stringifyConfig, getRsbuildInspectConfig, outputInspectConfigFiles, } f
12
12
  export type { InternalContext } from './types';
13
13
  export { setHTMLPlugin, getHTMLPlugin } from './pluginHelper';
14
14
  export { formatStats, getStatsOptions, onCompileDone, prettyTime, } from './helpers';
15
- export { getChainUtils } from './provider/rspackConfig';
15
+ export { getChainUtils, getConfigUtils } from './provider/rspackConfig';
16
16
  export { chainToConfig, modifyBundlerChain } from './configChain';
17
17
  export { applySwcDecoratorConfig } from './plugins/swc';
18
18
  export { getSwcMinimizerOptions } from './plugins/minimize';
@@ -1,5 +1,5 @@
1
- import type { RspackSourceMap } from '@rsbuild/shared';
2
1
  import type { LoaderContext } from '@rspack/core';
2
+ import type { RspackSourceMap } from '../types';
3
3
  export default function transform(this: LoaderContext<{
4
4
  id: string;
5
5
  }>, source: string, map?: string | RspackSourceMap): Promise<void>;
@@ -1,2 +1,2 @@
1
- import { type RsbuildConfig } from '@rsbuild/shared';
1
+ import type { RsbuildConfig } from './types';
2
2
  export declare const mergeRsbuildConfig: <T = RsbuildConfig>(...configs: T[]) => T;
@@ -1,4 +1,4 @@
1
- import type { PluginManager, RsbuildPlugin, RsbuildPluginAPI } from '@rsbuild/shared';
1
+ import type { PluginManager, RsbuildPlugin, RsbuildPluginAPI } from './types';
2
2
  export declare function createPluginManager(): PluginManager;
3
3
  export declare const pluginDagSort: (plugins: RsbuildPlugin[]) => RsbuildPlugin[];
4
4
  export declare function initPlugins({ pluginAPI, pluginManager, }: {
@@ -1,6 +1,5 @@
1
- import { type CSSLoaderOptions, type RsbuildTarget } from '@rsbuild/shared';
2
1
  import type { AcceptedPlugin } from 'postcss';
3
- import type { NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
2
+ import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, RsbuildTarget } from '../types';
4
3
  export declare const isUseCssExtract: (config: NormalizedEnvironmentConfig, target: RsbuildTarget) => boolean;
5
4
  export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
6
5
  /**
@@ -1,5 +1,4 @@
1
- import type { ModifyHTMLTagsFn, NormalizedEnvironmentConfig } from '@rsbuild/shared';
2
- import type { RsbuildPlugin } from '../types';
1
+ import type { ModifyHTMLTagsFn, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
3
2
  export declare function getTemplate(entryName: string, config: NormalizedEnvironmentConfig, rootPath: string): Promise<{
4
3
  templatePath: string;
5
4
  templateContent?: string;
@@ -1,6 +1,5 @@
1
- import { type HTMLPluginOptions, type NormalizedEnvironmentConfig } from '@rsbuild/shared';
2
1
  import type { SwcJsMinimizerRspackPluginOptions } from '@rspack/core';
3
- import type { RsbuildPlugin } from '../types';
2
+ import type { HTMLPluginOptions, NormalizedEnvironmentConfig, RsbuildPlugin } from '../types';
4
3
  export declare const getSwcMinimizerOptions: (config: NormalizedEnvironmentConfig) => SwcJsMinimizerRspackPluginOptions;
5
4
  export declare const parseMinifyOptions: (config: NormalizedEnvironmentConfig, isProd?: boolean) => {
6
5
  minifyJs: boolean;
@@ -1,3 +1,3 @@
1
- import type { BuildOptions } from '@rsbuild/shared';
1
+ import type { BuildOptions } from '../types';
2
2
  import { type InitConfigsOptions } from './initConfigs';
3
3
  export declare const build: (initOptions: InitConfigsOptions, { mode, watch, compiler: customCompiler }?: BuildOptions) => Promise<void>;
@@ -1,6 +1,5 @@
1
- import { type Rspack, type RspackConfig } from '@rsbuild/shared';
2
1
  import type { DevMiddlewareAPI } from '../server/devMiddleware';
3
- import type { DevConfig, InternalContext } from '../types';
2
+ import type { DevConfig, InternalContext, Rspack, RspackConfig } from '../types';
4
3
  import { type InitConfigsOptions } from './initConfigs';
5
4
  export declare function createCompiler({ context, rspackConfigs, }: {
6
5
  context: InternalContext;
@@ -1,5 +1,4 @@
1
- import type { PluginManager, RspackConfig } from '@rsbuild/shared';
2
- import type { CreateRsbuildOptions, InternalContext, NormalizedConfig } from '../types';
1
+ import type { CreateRsbuildOptions, InternalContext, NormalizedConfig, PluginManager, RspackConfig } from '../types';
3
2
  export type InitConfigsOptions = {
4
3
  context: InternalContext;
5
4
  pluginManager: PluginManager;
@@ -1,4 +1,4 @@
1
- import type { InspectConfigOptions, InspectConfigResult, RspackConfig } from '@rsbuild/shared';
1
+ import type { InspectConfigOptions, InspectConfigResult, RspackConfig } from '../types';
2
2
  import { type InitConfigsOptions } from './initConfigs';
3
3
  export declare function inspectConfig({ context, pluginManager, rsbuildOptions, bundlerConfigs, inspectOptions, }: InitConfigsOptions & {
4
4
  inspectOptions?: InspectConfigOptions;
@@ -1,5 +1,5 @@
1
- import { type EnvironmentContext, type ModifyChainUtils, type RsbuildTarget, type RspackConfig } from '@rsbuild/shared';
2
- import type { InternalContext } from '../types';
1
+ import type { EnvironmentContext, InternalContext, ModifyChainUtils, ModifyRspackConfigUtils, RsbuildTarget, Rspack, RspackConfig } from '../types';
2
+ export declare function getConfigUtils(config: Rspack.Configuration, chainUtils: ModifyChainUtils): Promise<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;
@@ -1,7 +1,7 @@
1
- import type { EnvironmentContext, HtmlTag, HtmlTagDescriptor, ModifyHTMLTagsFn } from '@rsbuild/shared';
2
1
  import type { Compiler } from '@rspack/core';
3
2
  import type HtmlWebpackPlugin from 'html-webpack-plugin';
4
3
  import type { HtmlTagObject } from 'html-webpack-plugin';
4
+ import type { EnvironmentContext, HtmlTag, HtmlTagDescriptor, ModifyHTMLTagsFn } from '../types';
5
5
  export type TagConfig = {
6
6
  tags?: HtmlTagDescriptor[];
7
7
  hash?: HtmlTag['hash'];
@@ -1,5 +1,5 @@
1
- import type { InlineChunkTest } from '@rsbuild/shared';
2
1
  import type { Compiler } from '@rspack/core';
2
+ import type { InlineChunkTest } from '../types';
3
3
  export type InlineChunkHtmlPluginOptions = {
4
4
  styleTests: InlineChunkTest[];
5
5
  scriptTests: InlineChunkTest[];
@@ -14,9 +14,9 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { PreloadOrPreFetchOption } from '@rsbuild/shared';
18
17
  import type { Compiler, RspackPluginInstance } from '@rspack/core';
19
18
  import type HtmlWebpackPlugin from 'html-webpack-plugin';
19
+ import type { PreloadOrPreFetchOption } from '../../types';
20
20
  type LinkType = 'preload' | 'prefetch';
21
21
  export declare class HtmlPreloadOrPrefetchPlugin implements RspackPluginInstance {
22
22
  readonly options: PreloadOrPreFetchOption;
@@ -14,8 +14,8 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { PreloadOrPreFetchOption } from '@rsbuild/shared';
18
17
  import type { Chunk, Compilation } from '@rspack/core';
18
+ import type { PreloadOrPreFetchOption } from '../../../types';
19
19
  import type { BeforeAssetTagGenerationHtmlPluginData } from './type';
20
20
  interface DoesChunkBelongToHtmlOptions {
21
21
  chunk: Chunk;
@@ -14,8 +14,8 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { PreloadIncludeType } from '@rsbuild/shared';
18
17
  import type { Chunk, Compilation } from '@rspack/core';
18
+ import type { PreloadIncludeType } from '../../../types';
19
19
  interface ExtractChunks {
20
20
  compilation: Compilation;
21
21
  includeType?: PreloadIncludeType;
@@ -1,6 +1,6 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
2
  import type { Socket } from 'node:net';
3
- import type { DevConfig, ServerConfig } from '@rsbuild/shared';
3
+ import type { DevConfig, ServerConfig } from '../types';
4
4
  import type { DevMiddleware as CustomDevMiddleware, DevMiddlewareAPI } from './devMiddleware';
5
5
  type Options = {
6
6
  publicPaths: string[];
@@ -1,7 +1,7 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
- import type { CompilerTapFn, NextFunction } from '@rsbuild/shared';
3
2
  import type { Compiler, MultiCompiler } from '@rspack/core';
4
3
  import type { DevMiddlewareOptions } from '../provider/createCompiler';
4
+ import type { NextFunction } from '../types';
5
5
  type ServerCallbacks = {
6
6
  onInvalid: () => void;
7
7
  onDone: (stats: any) => void;
@@ -11,6 +11,9 @@ export declare const isClientCompiler: (compiler: {
11
11
  target?: Compiler["options"]["target"];
12
12
  };
13
13
  }) => boolean;
14
+ type CompilerTapFn<CallBack extends (...args: any[]) => void = () => void> = {
15
+ tap: (name: string, cb: CallBack) => void;
16
+ };
14
17
  export declare const setupServerHooks: (compiler: {
15
18
  options: {
16
19
  target?: Compiler["options"]["target"];
@@ -1,7 +1,6 @@
1
- import type { CreateDevServerOptions, EnvironmentAPI, StartDevServerOptions } from '@rsbuild/shared';
2
1
  import type Connect from '../../compiled/connect';
3
2
  import type { CreateDevMiddlewareReturns } from '../provider/createCompiler';
4
- import type { InternalContext, NormalizedConfig } from '../types';
3
+ import type { CreateDevServerOptions, EnvironmentAPI, InternalContext, NormalizedConfig, StartDevServerOptions } from '../types';
5
4
  import { type UpgradeEvent } from './helper';
6
5
  export type RsbuildDevServer = {
7
6
  /**
@@ -1,4 +1,4 @@
1
- import type { EnvironmentContext, Stats } from '@rsbuild/shared';
1
+ import type { EnvironmentContext, Stats } from '../types';
2
2
  export type ServerUtils = {
3
3
  readFileSync: (fileName: string) => string;
4
4
  environment: EnvironmentContext;
@@ -1,4 +1,4 @@
1
- import type { DevConfig, EnvironmentAPI, RequestHandler, Rspack, ServerAPIs, ServerConfig } from '@rsbuild/shared';
1
+ import type { DevConfig, EnvironmentAPI, RequestHandler, Rspack, ServerAPIs, ServerConfig } from '../types';
2
2
  import type { UpgradeEvent } from './helper';
3
3
  export type CompileMiddlewareAPI = {
4
4
  middleware: RequestHandler;
@@ -1,7 +1,6 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
2
  import type { Socket } from 'node:net';
3
- import type { NormalizedConfig, OutputStructure, PrintUrls, Routes, RsbuildEntry } from '@rsbuild/shared';
4
- import type { InternalContext } from '../types';
3
+ import type { InternalContext, NormalizedConfig, OutputStructure, PrintUrls, Routes, RsbuildEntry } from '../types';
5
4
  /**
6
5
  * It used to subscribe http upgrade event
7
6
  */
@@ -1,7 +1,7 @@
1
1
  import type { Server } from 'node:http';
2
2
  import type { Http2SecureServer } from 'node:http2';
3
- import type { ServerConfig } from '@rsbuild/shared';
4
3
  import type Connect from '../../compiled/connect';
4
+ import type { ServerConfig } from '../types';
5
5
  export declare const createHttpServer: ({ serverConfig, middlewares, }: {
6
6
  serverConfig: ServerConfig;
7
7
  middlewares: Connect.Server;
@@ -1,5 +1,5 @@
1
- import { type HtmlFallback, type RequestHandler as Middleware, type Rspack } from '@rsbuild/shared';
2
1
  import type Connect from '../../compiled/connect';
2
+ import type { HtmlFallback, RequestHandler as Middleware, Rspack } from '../types';
3
3
  export declare const faviconFallbackMiddleware: Middleware;
4
4
  export declare const getRequestLoggerMiddleware: () => Promise<Connect.NextHandleFunction>;
5
5
  export declare const notFoundMiddleware: Middleware;
@@ -1,8 +1,7 @@
1
1
  import type { Server } from 'node:http';
2
2
  import type { Http2SecureServer } from 'node:http2';
3
- import type { PreviewServerOptions, ServerConfig } from '@rsbuild/shared';
4
3
  import type Connect from '../../compiled/connect';
5
- import type { InternalContext, NormalizedConfig } from '../types';
4
+ import type { InternalContext, NormalizedConfig, PreviewServerOptions, ServerConfig } from '../types';
6
5
  import { type StartServerResult } from './helper';
7
6
  type RsbuildProdServerOptions = {
8
7
  pwd: string;
@@ -1,6 +1,6 @@
1
- import type { RequestHandler as Middleware, ProxyOptions } from '@rsbuild/shared';
1
+ import type { RequestHandler as Middleware, ProxyOptions } from '../types';
2
2
  import type { UpgradeEvent } from './helper';
3
- export declare const createProxyMiddleware: (proxyOptions: ProxyOptions) => {
3
+ export declare const createProxyMiddleware: (proxyOptions: ProxyOptions) => Promise<{
4
4
  middlewares: Middleware[];
5
5
  upgrade: UpgradeEvent;
6
- };
6
+ }>;
@@ -1,6 +1,6 @@
1
1
  import type { IncomingMessage } from 'node:http';
2
2
  import type { Socket } from 'node:net';
3
- import type { DevConfig, Stats } from '@rsbuild/shared';
3
+ import type { DevConfig, Stats } from '../types';
4
4
  export declare class SocketServer {
5
5
  private wsServer;
6
6
  private readonly sockets;
@@ -1,4 +1,4 @@
1
- import type { DevConfig, ServerConfig } from '@rsbuild/shared';
1
+ import type { DevConfig, ServerConfig } from '../types';
2
2
  import type { CompileMiddlewareAPI } from './getDevMiddlewares';
3
3
  type WatchFilesOptions = {
4
4
  dev: DevConfig;