@rsbuild/core 1.4.15 → 1.5.0-beta.1

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.
@@ -17,4 +17,18 @@
17
17
  *
18
18
  * Copyright (c) 2015-present, Jon Schlinkert.
19
19
  * Released under the MIT License.
20
+ */
21
+
22
+ /**
23
+ * Autoload Config for PostCSS
24
+ *
25
+ * @author Michael Ciniawsky @michael-ciniawsky <michael.ciniawsky@gmail.com>
26
+ * @license MIT
27
+ *
28
+ * @module postcss-load-config
29
+ * @version 2.1.0
30
+ *
31
+ * @requires comsiconfig
32
+ * @requires ./options
33
+ * @requires ./plugins
20
34
  */
@@ -1,10 +1,9 @@
1
1
  async function transformLoader_transform(source, map) {
2
- var _this__compiler___rsbuildTransformer, _this__compiler;
3
2
  let callback = this.async(), bypass = ()=>{
4
3
  callback(null, source, map);
5
4
  }, { id: transformId, getEnvironment } = this.getOptions();
6
5
  if (!transformId) return void bypass();
7
- let transform = null == (_this__compiler = this._compiler) || null == (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) ? void 0 : _this__compiler___rsbuildTransformer[transformId];
6
+ let transform = this._compiler?.__rsbuildTransformer?.[transformId];
8
7
  if (!transform) return void bypass();
9
8
  try {
10
9
  let result = await transform({
@@ -1,10 +1,9 @@
1
1
  let transformRawLoader = async function(source, map) {
2
- var _this__compiler___rsbuildTransformer, _this__compiler;
3
2
  let callback = this.async(), bypass = ()=>{
4
3
  callback(null, source, map);
5
4
  }, { id: transformId, getEnvironment } = this.getOptions();
6
5
  if (!transformId) return void bypass();
7
- let transform = null == (_this__compiler = this._compiler) || null == (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) ? void 0 : _this__compiler___rsbuildTransformer[transformId];
6
+ let transform = this._compiler?.__rsbuildTransformer?.[transformId];
8
7
  if (!transform) return void bypass();
9
8
  try {
10
9
  let result = await transform({
@@ -31,6 +31,7 @@ export declare const canParse: (url: string) => boolean;
31
31
  export declare const ensureAssetPrefix: (url: string, assetPrefix?: Rspack.PublicPath) => string;
32
32
  export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'js', isProd: boolean, isServer?: boolean): Rspack.Filename;
33
33
  export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'css', isProd: boolean): Rspack.CssFilename;
34
+ export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'html', isProd?: boolean): string;
34
35
  export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: 'wasm', isProd: boolean): Rspack.WebassemblyModuleFilename;
35
36
  export declare function getFilename(config: NormalizedConfig | NormalizedEnvironmentConfig, type: Exclude<keyof FilenameConfig, 'js' | 'css'>, isProd: boolean, isServer?: boolean): Rspack.AssetModuleFilename;
36
37
  export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
@@ -1,4 +1,4 @@
1
- import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, Rspack } from './types';
1
+ import type { AsyncHook, EnvironmentAsyncHook, InternalContext, ModifyBundlerChainFn, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRspackConfigFn, ModifyWebpackChainFn, ModifyWebpackConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, Rspack } from './types';
2
2
  export declare function createEnvironmentAsyncHook<Callback extends (...args: any[]) => any>(): EnvironmentAsyncHook<Callback>;
3
3
  export declare function createAsyncHook<Callback extends (...args: any[]) => any>(): AsyncHook<Callback>;
4
4
  export declare function initHooks(): {
@@ -7,6 +7,7 @@ export declare function initHooks(): {
7
7
  onAfterBuild: AsyncHook<OnAfterBuildFn>;
8
8
  onCloseBuild: AsyncHook<OnCloseBuildFn>;
9
9
  onBeforeBuild: AsyncHook<OnBeforeBuildFn>;
10
+ onBeforeDevCompile: AsyncHook<OnBeforeDevCompileFn>;
10
11
  onDevCompileDone: AsyncHook<OnDevCompileDoneFn>;
11
12
  onCloseDevServer: AsyncHook<OnCloseDevServerFn>;
12
13
  onAfterStartDevServer: AsyncHook<OnAfterStartDevServerFn>;
@@ -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, 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';
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, OnBeforeDevCompileFn, 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';
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginEsm: () => RsbuildPlugin;
@@ -1014,6 +1014,13 @@ export interface OutputConfig {
1014
1014
  * @default false
1015
1015
  */
1016
1016
  manifest?: ManifestConfig;
1017
+ /**
1018
+ * Whether to output JavaScript files in ES modules format. This feature is currently
1019
+ * experimental and only available when `output.target` is `'node'`.
1020
+ * @experimental
1021
+ * @default false
1022
+ */
1023
+ module?: boolean;
1017
1024
  /**
1018
1025
  * Whether to generate source map files, and which format of source map to generate.
1019
1026
  *
@@ -1088,6 +1095,7 @@ export interface NormalizedOutputConfig extends OutputConfig {
1088
1095
  assetPrefix: string;
1089
1096
  dataUriLimit: number | NormalizedDataUriLimit;
1090
1097
  manifest: ManifestConfig;
1098
+ module: boolean;
1091
1099
  minify: Minify;
1092
1100
  inlineScripts: InlineChunkConfig;
1093
1101
  inlineStyles: InlineChunkConfig;
@@ -20,6 +20,10 @@ export type OnBeforeBuildFn<B = 'rspack'> = (params: CompileCommonParams & {
20
20
  environments: Record<string, EnvironmentContext>;
21
21
  bundlerConfigs?: B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[];
22
22
  }) => MaybePromise<void>;
23
+ export type OnBeforeDevCompileFn<B = 'rspack'> = (params: CompileCommonParams & {
24
+ environments: Record<string, EnvironmentContext>;
25
+ bundlerConfigs?: B extends 'rspack' ? Rspack.Configuration[] : WebpackConfig[];
26
+ }) => MaybePromise<void>;
23
27
  export type OnAfterEnvironmentCompileFn = (params: CompileCommonParams & {
24
28
  stats?: Rspack.Stats;
25
29
  environment: EnvironmentContext;
@@ -4,7 +4,7 @@ import type { ChainIdentifier } from '../configChain';
4
4
  import type { Logger } from '../logger';
5
5
  import type { ModifyRspackConfigUtils, NarrowedRspackConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildConfig, RspackMerge } from './config';
6
6
  import type { RsbuildContext } from './context';
7
- import type { EnvironmentContext, ModifyBundlerChainFn, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './hooks';
7
+ import type { EnvironmentContext, ModifyBundlerChainFn, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyHTMLFn, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeDevCompileFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn } from './hooks';
8
8
  import type { AddPluginsOptions, RsbuildInstance, RsbuildTarget } from './rsbuild';
9
9
  import type { Rspack, RspackChain } from './rspack';
10
10
  import type { HtmlRspackPlugin } from './thirdParty';
@@ -494,6 +494,10 @@ export type RsbuildPluginAPI = Readonly<{
494
494
  * A callback function that is triggered before the production build is executed.
495
495
  */
496
496
  onBeforeBuild: PluginHook<OnBeforeBuildFn>;
497
+ /**
498
+ * A callback function that is triggered before the dev build is executed.
499
+ */
500
+ onBeforeDevCompile: PluginHook<OnBeforeDevCompileFn>;
497
501
  /**
498
502
  * A callback function that is triggered after the Compiler instance has been
499
503
  * created, but before the build process begins. This hook is called when you
@@ -256,7 +256,7 @@ export type RsbuildInstance = {
256
256
  * 2. Watch for file changes and trigger recompilation.
257
257
  */
258
258
  startDevServer: StartDevServer;
259
- } & Pick<RsbuildPluginAPI, 'context' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterStartDevServer' | 'onAfterStartProdServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeStartDevServer' | 'onBeforeStartProdServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onDevCompileDone' | 'onExit'>;
259
+ } & Pick<RsbuildPluginAPI, 'context' | 'getNormalizedConfig' | 'getRsbuildConfig' | 'isPluginExists' | 'onAfterBuild' | 'onAfterCreateCompiler' | 'onAfterStartDevServer' | 'onAfterStartProdServer' | 'onBeforeBuild' | 'onBeforeCreateCompiler' | 'onBeforeStartDevServer' | 'onBeforeStartProdServer' | 'onCloseBuild' | 'onCloseDevServer' | 'onBeforeDevCompile' | 'onDevCompileDone' | 'onExit'>;
260
260
  export type RsbuildTarget = 'web' | 'node' | 'web-worker';
261
261
  export type RsbuildEntryDescription = Rspack.EntryDescription & {
262
262
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.15",
3
+ "version": "1.5.0-beta.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.4.11",
49
+ "@rspack/core": "1.5.0-beta.0",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.45.0",
@@ -56,7 +56,7 @@
56
56
  "@rslib/core": "0.11.2",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.19",
59
- "@types/node": "^22.17.0",
59
+ "@types/node": "^22.17.1",
60
60
  "@types/on-finished": "2.3.5",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
62
  "@types/ws": "^8.18.1",
@@ -70,7 +70,7 @@
70
70
  "dotenv-expand": "12.0.2",
71
71
  "html-rspack-plugin": "6.1.2",
72
72
  "http-proxy-middleware": "^2.0.9",
73
- "launch-editor-middleware": "^2.11.0",
73
+ "launch-editor-middleware": "^2.11.1",
74
74
  "mrmime": "^2.0.1",
75
75
  "on-finished": "2.4.1",
76
76
  "open": "^10.2.0",
@@ -82,7 +82,7 @@
82
82
  "reduce-configs": "^1.1.1",
83
83
  "rsbuild-dev-middleware": "0.3.0",
84
84
  "rslog": "^1.2.11",
85
- "rspack-chain": "^1.3.2",
85
+ "rspack-chain": "^1.4.0",
86
86
  "rspack-manifest-plugin": "5.0.3",
87
87
  "sirv": "^3.0.1",
88
88
  "style-loader": "3.3.4",
@@ -94,7 +94,7 @@
94
94
  "ws": "^8.18.3"
95
95
  },
96
96
  "engines": {
97
- "node": ">=16.10.0"
97
+ "node": ">=18.12.0"
98
98
  },
99
99
  "publishConfig": {
100
100
  "access": "public",
@@ -104,6 +104,6 @@
104
104
  "build": "rslib build",
105
105
  "dev": "rslib build --watch",
106
106
  "prebundle": "prebundle",
107
- "bump": "npx bumpp --no-tag"
107
+ "bump": "pnpx bumpp --no-tag"
108
108
  }
109
109
  }
@@ -1 +0,0 @@
1
- export = any;