@rsbuild/core 1.3.21 → 1.4.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +2 -2
  2. package/compiled/css-loader/index.js +44 -44
  3. package/compiled/html-rspack-plugin/index.js +14 -14
  4. package/compiled/postcss/index.js +189 -144
  5. package/compiled/postcss/lib/input.d.ts +24 -3
  6. package/compiled/postcss/lib/node.d.ts +17 -2
  7. package/compiled/postcss/lib/stringifier.d.ts +2 -2
  8. package/compiled/postcss/package.json +1 -1
  9. package/compiled/postcss-load-config/index.js +10 -10
  10. package/compiled/postcss-loader/index.js +6 -6
  11. package/compiled/rsbuild-dev-middleware/index.js +115 -125
  12. package/compiled/rspack-chain/index.js +67 -67
  13. package/compiled/rspack-chain/package.json +1 -1
  14. package/compiled/rspack-chain/types/index.d.ts +1 -0
  15. package/compiled/rspack-manifest-plugin/index.js +4 -4
  16. package/compiled/sirv/index.js +12 -6
  17. package/compiled/style-loader/index.js +10 -10
  18. package/compiled/tinyglobby/index.d.ts +35 -16
  19. package/compiled/tinyglobby/index.js +517 -531
  20. package/compiled/tinyglobby/package.json +1 -1
  21. package/compiled/webpack-bundle-analyzer/index.js +62 -46
  22. package/dist/index.cjs +274 -236
  23. package/dist/index.js +233 -227
  24. package/dist-types/cli/commands.d.ts +1 -1
  25. package/dist-types/defaultConfig.d.ts +26 -0
  26. package/dist-types/index.d.ts +2 -2
  27. package/dist-types/{config.d.ts → loadConfig.d.ts} +9 -34
  28. package/dist-types/pluginHelper.d.ts +1 -1
  29. package/dist-types/plugins/minimize.d.ts +1 -1
  30. package/dist-types/server/cliShortcuts.d.ts +2 -2
  31. package/dist-types/server/helper.d.ts +2 -2
  32. package/dist-types/server/runner/asModule.d.ts +2 -2
  33. package/dist-types/types/config.d.ts +41 -20
  34. package/dist-types/types/hooks.d.ts +1 -1
  35. package/dist-types/types/plugin.d.ts +18 -18
  36. package/dist-types/types/rsbuild.d.ts +2 -2
  37. package/package.json +11 -10
package/dist/index.cjs CHANGED
@@ -979,6 +979,18 @@ var __webpack_modules__ = {
979
979
  return module;
980
980
  });
981
981
  },
982
+ "node:child_process": function(module) {
983
+ "use strict";
984
+ module.exports = import("node:child_process").then(function(module) {
985
+ return module;
986
+ });
987
+ },
988
+ "node:dns": function(module) {
989
+ "use strict";
990
+ module.exports = import("node:dns").then(function(module) {
991
+ return module;
992
+ });
993
+ },
982
994
  "node:http": function(module) {
983
995
  "use strict";
984
996
  module.exports = import("node:http").then(function(module) {
@@ -997,6 +1009,30 @@ var __webpack_modules__ = {
997
1009
  return module;
998
1010
  });
999
1011
  },
1012
+ "node:net": function(module) {
1013
+ "use strict";
1014
+ module.exports = import("node:net").then(function(module) {
1015
+ return module;
1016
+ });
1017
+ },
1018
+ "node:readline": function(module) {
1019
+ "use strict";
1020
+ module.exports = import("node:readline").then(function(module) {
1021
+ return module;
1022
+ });
1023
+ },
1024
+ "node:util": function(module) {
1025
+ "use strict";
1026
+ module.exports = import("node:util").then(function(module) {
1027
+ return module;
1028
+ });
1029
+ },
1030
+ "node:vm": function(module) {
1031
+ "use strict";
1032
+ module.exports = import("node:vm").then(function(module) {
1033
+ return module;
1034
+ });
1035
+ },
1000
1036
  "../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json": function(module) {
1001
1037
  "use strict";
1002
1038
  module.exports = JSON.parse('{"name":"dotenv","version":"16.5.0","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}');
@@ -1043,7 +1079,7 @@ for(var __webpack_i__ in (()=>{
1043
1079
  PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
1044
1080
  PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
1045
1081
  ensureAssetPrefix: ()=>ensureAssetPrefix,
1046
- loadConfig: ()=>config_loadConfig,
1082
+ loadConfig: ()=>loadConfig_loadConfig,
1047
1083
  defaultAllowedOrigins: ()=>defaultAllowedOrigins
1048
1084
  });
1049
1085
  var provider_helpers_namespaceObject = {};
@@ -1063,9 +1099,7 @@ for(var __webpack_i__ in (()=>{
1063
1099
  setCssExtractPlugin: ()=>setCssExtractPlugin,
1064
1100
  setHTMLPlugin: ()=>setHTMLPlugin
1065
1101
  });
1066
- let core_namespaceObject = require("@rspack/core");
1067
- var core_default = __webpack_require__.n(core_namespaceObject);
1068
- let external_node_fs_namespaceObject = require("node:fs");
1102
+ let core_namespaceObject = require("@rspack/core"), external_node_fs_namespaceObject = require("node:fs");
1069
1103
  var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
1070
1104
  let external_node_path_namespaceObject = require("node:path");
1071
1105
  var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.2/node_modules/dotenv-expand/lib/main.js");
@@ -1409,7 +1443,7 @@ for(var __webpack_i__ in (()=>{
1409
1443
  case 'assets':
1410
1444
  return filename.assets ?? `[name]${hash}[ext]`;
1411
1445
  default:
1412
- throw Error(`[rsbuild:config] unknown key ${type} in "output.filename"`);
1446
+ throw Error(`${index_js_default().dim('[rsbuild:config]')} unknown key ${index_js_default().yellow(type)} in ${index_js_default().yellow('output.filename')}`);
1413
1447
  }
1414
1448
  }
1415
1449
  let applyToCompiler = (compiler, apply)=>{
@@ -1433,7 +1467,7 @@ for(var __webpack_i__ in (()=>{
1433
1467
  function loadEnv({ cwd = process.cwd(), mode = getNodeEnv(), prefixes = [
1434
1468
  'PUBLIC_'
1435
1469
  ], processEnv = process.env } = {}) {
1436
- if ('local' === mode) throw Error("[rsbuild:loadEnv] 'local' cannot be used as a value for env mode, because \".env.local\" represents a temporary local file. Please use another value.");
1470
+ if ('local' === mode) throw Error(`${index_js_default().dim('[rsbuild:loadEnv]')} ${index_js_default().yellow('local')} cannot be used as a value for env mode, because ${index_js_default().yellow('.env.local')} represents a temporary local file. Please use another value.`);
1437
1471
  let filePaths = [
1438
1472
  '.env',
1439
1473
  '.env.local',
@@ -1576,7 +1610,7 @@ for(var __webpack_i__ in (()=>{
1576
1610
  merged[key] = merge(x[key], y[key], childPath);
1577
1611
  }
1578
1612
  return merged;
1579
- }, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), config_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), getDefaultDevConfig = ()=>({
1613
+ }, mergeRsbuildConfig = (...configs)=>2 === configs.length ? merge(configs[0], configs[1]) : configs.length < 2 ? configs[0] : configs.reduce((result, config)=>merge(result, config), {}), defaultConfig_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), getDefaultDevConfig = ()=>({
1580
1614
  hmr: !0,
1581
1615
  liveReload: !0,
1582
1616
  watchFiles: [],
@@ -1604,7 +1638,6 @@ for(var __webpack_i__ in (()=>{
1604
1638
  },
1605
1639
  middlewareMode: !1
1606
1640
  }), getDefaultSourceConfig = ()=>({
1607
- alias: {},
1608
1641
  define: {},
1609
1642
  preEntry: [],
1610
1643
  decorators: {
@@ -1686,7 +1719,7 @@ for(var __webpack_i__ in (()=>{
1686
1719
  exportLocalsConvention: 'camelCase'
1687
1720
  },
1688
1721
  emitAssets: !0
1689
- }), getDefaultResolveConfig = ()=>(swcHelpersPath || (swcHelpersPath = (0, external_node_path_namespaceObject.dirname)(config_require.resolve('@swc/helpers/package.json'))), {
1722
+ }), getDefaultResolveConfig = ()=>(swcHelpersPath || (swcHelpersPath = (0, external_node_path_namespaceObject.dirname)(defaultConfig_require.resolve('@swc/helpers/package.json'))), {
1690
1723
  alias: {
1691
1724
  '@swc/helpers': swcHelpersPath
1692
1725
  },
@@ -1730,82 +1763,7 @@ for(var __webpack_i__ in (()=>{
1730
1763
  return Array.isArray(watchFiles) || (mergedConfig.dev.watchFiles = [
1731
1764
  watchFiles
1732
1765
  ]), mergedConfig;
1733
- };
1734
- function defineConfig(config) {
1735
- return config;
1736
- }
1737
- let resolveConfigPath = (root, customConfig)=>{
1738
- if (customConfig) {
1739
- let customConfigPath = (0, external_node_path_namespaceObject.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_namespaceObject.join)(root, customConfig);
1740
- if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
1741
- rslog_index_js_namespaceObject.logger.warn(`Cannot find config file: ${index_js_default().dim(customConfigPath)}\n`);
1742
- }
1743
- for (let file of [
1744
- 'rsbuild.config.mjs',
1745
- 'rsbuild.config.ts',
1746
- 'rsbuild.config.js',
1747
- 'rsbuild.config.cjs',
1748
- 'rsbuild.config.mts',
1749
- 'rsbuild.config.cts'
1750
- ]){
1751
- let configFile = (0, external_node_path_namespaceObject.join)(root, file);
1752
- if (external_node_fs_default().existsSync(configFile)) return configFile;
1753
- }
1754
- return null;
1755
- };
1756
- async function config_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'jiti' } = {}) {
1757
- let configExport, configFilePath = resolveConfigPath(cwd, path);
1758
- if (!configFilePath) return rslog_index_js_namespaceObject.logger.debug('no config file found.'), {
1759
- content: {},
1760
- filePath: configFilePath
1761
- };
1762
- let applyMetaInfo = (config)=>(config._privateMeta = {
1763
- configFilePath
1764
- }, config);
1765
- if ('native' === loader || /\.(?:js|mjs|cjs)$/.test(configFilePath)) try {
1766
- let configFileURL = (0, external_node_url_namespaceObject.pathToFileURL)(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
1767
- configExport = exportModule.default ? exportModule.default : exportModule;
1768
- } catch (err) {
1769
- if ('native' === loader) throw rslog_index_js_namespaceObject.logger.error(`Failed to load file with native loader: ${index_js_default().dim(configFilePath)}`), err;
1770
- rslog_index_js_namespaceObject.logger.debug(`failed to load file with dynamic import: ${index_js_default().dim(configFilePath)}`);
1771
- }
1772
- try {
1773
- if (void 0 === configExport) {
1774
- let { createJiti } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "jiti")), jiti = createJiti(constants_filename, {
1775
- moduleCache: !1,
1776
- interopDefault: !0,
1777
- nativeModules: [
1778
- '@rspack/core',
1779
- "typescript"
1780
- ]
1781
- });
1782
- configExport = await jiti.import(configFilePath, {
1783
- default: !0
1784
- });
1785
- }
1786
- } catch (err) {
1787
- throw rslog_index_js_namespaceObject.logger.error(`Failed to load file with jiti: ${index_js_default().dim(configFilePath)}`), err;
1788
- }
1789
- if ('function' == typeof configExport) {
1790
- let command = process.argv[2], nodeEnv = getNodeEnv(), result = await configExport({
1791
- env: nodeEnv,
1792
- command,
1793
- envMode: envMode || nodeEnv,
1794
- meta
1795
- });
1796
- if (void 0 === result) throw Error('[rsbuild:loadConfig] The config function must return a config object.');
1797
- return {
1798
- content: applyMetaInfo(result),
1799
- filePath: configFilePath
1800
- };
1801
- }
1802
- if (!isObject(configExport)) throw Error(`[rsbuild:loadConfig] The config must be an object or a function that returns an object, get ${index_js_default().yellow(configExport)}`);
1803
- return rslog_index_js_namespaceObject.logger.debug('loaded config file:', configFilePath), {
1804
- content: applyMetaInfo(configExport),
1805
- filePath: configFilePath
1806
- };
1807
- }
1808
- let normalizePublicDirs = (publicDir)=>{
1766
+ }, normalizePublicDirs = (publicDir)=>{
1809
1767
  if (!1 === publicDir) return [];
1810
1768
  let defaultConfig = {
1811
1769
  name: 'public',
@@ -1827,7 +1785,7 @@ for(var __webpack_i__ in (()=>{
1827
1785
  let allLines = [];
1828
1786
  function getPlugin(name) {
1829
1787
  let targets = plugins.filter((item)=>item.instance.name === name);
1830
- if (!targets.length) throw Error(`[rsbuild:plugin] Plugin "${name}" not existed`);
1788
+ if (!targets.length) throw Error(`${index_js_default().dim('[rsbuild:plugin]')} Plugin "${index_js_default().yellow(name)}" not existed`);
1831
1789
  return targets;
1832
1790
  }
1833
1791
  for (let plugin of plugins){
@@ -1848,7 +1806,7 @@ for(var __webpack_i__ in (()=>{
1848
1806
  if (allLines.length) {
1849
1807
  let restInRingPoints = {};
1850
1808
  for (let l of allLines)restInRingPoints[l[0]] = !0, restInRingPoints[l[1]] = !0;
1851
- throw Error(`[rsbuild:plugin] Plugins dependencies has loop: ${Object.keys(restInRingPoints).join(',')}`);
1809
+ throw Error(`${index_js_default().dim('[rsbuild:plugin]')} Plugins dependencies has loop: ${index_js_default().yellow(Object.keys(restInRingPoints).join(','))}`);
1852
1810
  }
1853
1811
  return sortedPoint;
1854
1812
  };
@@ -2113,7 +2071,7 @@ for(var __webpack_i__ in (()=>{
2113
2071
  case 'report':
2114
2072
  return Compilation.PROCESS_ASSETS_STAGE_REPORT;
2115
2073
  default:
2116
- throw Error(`[rsbuild] Invalid process assets stage: ${stage}`);
2074
+ throw Error(`${index_js_default().dim('[rsbuild]')} Invalid process assets stage: ${stage}`);
2117
2075
  }
2118
2076
  }, browsersListCache = new Map();
2119
2077
  async function getBrowserslist(path) {
@@ -2168,7 +2126,7 @@ for(var __webpack_i__ in (()=>{
2168
2126
  let filename;
2169
2127
  filename = config.output.filename.html ? config.output.filename.html.replace('[name]', entryName) : 'flat' === config.html.outputStructure ? `${entryName}.html` : `${entryName}/index.html`;
2170
2128
  let prefix = config.output.distPath.html;
2171
- return prefix.startsWith('/') && rslog_index_js_namespaceObject.logger.warn(`Absolute path is not recommended at \`output.distPath.html\`: "${prefix}", please use relative path instead.`), removeLeadingSlash(external_node_path_namespaceObject.posix.join(prefix, filename));
2129
+ return prefix.startsWith('/') && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} Absolute path is not recommended at ${index_js_default().yellow(`output.distPath.html: "${prefix}"`)}, use relative path instead.`), removeLeadingSlash(external_node_path_namespaceObject.posix.join(prefix, filename));
2172
2130
  }(key, config)), prev;
2173
2131
  }, {});
2174
2132
  async function updateEnvironmentContext(context, configs) {
@@ -2195,7 +2153,7 @@ for(var __webpack_i__ in (()=>{
2195
2153
  async function createContext(options, userConfig) {
2196
2154
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2197
2155
  return {
2198
- version: "1.3.21",
2156
+ version: "1.4.0-beta.0",
2199
2157
  rootPath,
2200
2158
  distPath: '',
2201
2159
  cachePath,
@@ -2269,21 +2227,21 @@ for(var __webpack_i__ in (()=>{
2269
2227
  let distDir = config.output.distPath.image, manifestFile = appIcon.filename ?? 'manifest.webmanifest', publicPath = getPublicPathFromCompiler(compilation), icons = appIcon.icons.map((icon)=>formatIcon(icon, distDir, publicPath)), tags = [];
2270
2228
  for (let icon of icons){
2271
2229
  if ('web-app-manifest' === icon.target && !appIcon.name) {
2272
- addCompilationError(compilation, '[rsbuild:app-icon] "appIcon.name" is required when "target" is "web-app-manifest".');
2230
+ addCompilationError(compilation, `${index_js_default().dim('[rsbuild:app-icon]')} ${index_js_default().yellow('"appIcon.name"')} is required when ${index_js_default().yellow('"target"')} is ${index_js_default().yellow('"web-app-manifest"')}.`);
2273
2231
  continue;
2274
2232
  }
2275
2233
  if (!icon.isURL) {
2276
2234
  if (!compilation.inputFileSystem) {
2277
- addCompilationError(compilation, '[rsbuild:app-icon] Failed to read the icon file as "compilation.inputFileSystem" is not available.');
2235
+ addCompilationError(compilation, `${index_js_default().dim('[rsbuild:app-icon]')} Failed to read the icon file as ${index_js_default().yellow('"compilation.inputFileSystem"')} is not available.`);
2278
2236
  continue;
2279
2237
  }
2280
2238
  if (!await fileExistsByCompilation(compilation, icon.absolutePath)) {
2281
- addCompilationError(compilation, `[rsbuild:app-icon] Failed to find the icon file at "${index_js_default().cyan(icon.absolutePath)}".`);
2239
+ addCompilationError(compilation, `${index_js_default().dim('[rsbuild:app-icon]')} Failed to find the icon file at ${index_js_default().yellow(icon.absolutePath)}.`);
2282
2240
  continue;
2283
2241
  }
2284
2242
  let source = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(icon.absolutePath);
2285
2243
  if (!source) {
2286
- addCompilationError(compilation, `[rsbuild:app-icon] Failed to read the icon file at "${index_js_default().cyan(icon.absolutePath)}".`);
2244
+ addCompilationError(compilation, `${index_js_default().dim('[rsbuild:app-icon]')} Failed to read the icon file at ${index_js_default().yellow(icon.absolutePath)}.`);
2287
2245
  continue;
2288
2246
  }
2289
2247
  compilation.emitAsset(icon.relativePath, new sources.RawSource(source));
@@ -2690,7 +2648,7 @@ for(var __webpack_i__ in (()=>{
2690
2648
  plugin && (pluginHelper_htmlPlugin = plugin);
2691
2649
  }, getHTMLPlugin = ()=>(pluginHelper_htmlPlugin || (pluginHelper_htmlPlugin = pluginHelper_require('../compiled/html-rspack-plugin/index.js')), pluginHelper_htmlPlugin), setCssExtractPlugin = (plugin)=>{
2692
2650
  cssExtractPlugin = plugin;
2693
- }, getCssExtractPlugin = ()=>cssExtractPlugin || core_default().CssExtractRspackPlugin, getSwcMinimizerOptions = (config, jsOptions)=>{
2651
+ }, getCssExtractPlugin = ()=>cssExtractPlugin || core_namespaceObject.rspack.CssExtractRspackPlugin, getSwcMinimizerOptions = (config, jsOptions)=>{
2694
2652
  let options = {};
2695
2653
  options.minimizerOptions ||= {}, options.minimizerOptions.format ||= {};
2696
2654
  let { removeConsole } = config.performance;
@@ -2714,26 +2672,27 @@ for(var __webpack_i__ in (()=>{
2714
2672
  options.minimizerOptions.format.comments = !1, options.extractComments = !1;
2715
2673
  }
2716
2674
  return (options.minimizerOptions.format.asciiOnly = 'ascii' === config.output.charset, jsOptions) ? cjs_default()(options, jsOptions) : options;
2717
- }, parseMinifyOptions = (config, isProd)=>{
2718
- let { minify } = config.output;
2719
- return !1 !== minify && isProd ? !0 === minify ? {
2720
- minifyJs: !0,
2721
- minifyCss: !0
2722
- } : {
2723
- minifyJs: !1 !== minify.js,
2724
- minifyCss: !1 !== minify.css,
2675
+ }, parseMinifyOptions = (config)=>{
2676
+ let isProd = 'production' === config.mode, { minify } = config.output;
2677
+ if ('boolean' == typeof minify) {
2678
+ let shouldMinify = !0 === minify && isProd;
2679
+ return {
2680
+ minifyJs: shouldMinify,
2681
+ minifyCss: shouldMinify
2682
+ };
2683
+ }
2684
+ return {
2685
+ minifyJs: !1 !== minify.js && ('always' === minify.js || isProd),
2686
+ minifyCss: !1 !== minify.css && ('always' === minify.css || isProd),
2725
2687
  jsOptions: minify.jsOptions,
2726
2688
  cssOptions: minify.cssOptions
2727
- } : {
2728
- minifyJs: !1,
2729
- minifyCss: !1
2730
2689
  };
2731
2690
  }, pluginMinimize = ()=>({
2732
2691
  name: 'rsbuild:minimize',
2733
2692
  setup (api) {
2734
2693
  let isRspack = 'rspack' === api.context.bundlerType;
2735
- api.modifyBundlerChain(async (chain, { isProd, environment, CHAIN_ID })=>{
2736
- let { config } = environment, { minifyJs, minifyCss, jsOptions, cssOptions } = parseMinifyOptions(config, isProd);
2694
+ api.modifyBundlerChain(async (chain, { environment, CHAIN_ID })=>{
2695
+ let { config } = environment, { minifyJs, minifyCss, jsOptions, cssOptions } = parseMinifyOptions(config);
2737
2696
  if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && isRspack && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(core_namespaceObject.rspack.SwcJsMinimizerRspackPlugin, [
2738
2697
  getSwcMinimizerOptions(config, jsOptions)
2739
2698
  ]).end(), minifyCss && isRspack) {
@@ -2823,7 +2782,7 @@ for(var __webpack_i__ in (()=>{
2823
2782
  if ('function' == typeof postcssOptions) {
2824
2783
  let postcssOptionsWrapper = (loaderContext)=>{
2825
2784
  let options = postcssOptions(loaderContext);
2826
- if ('object' != typeof options || null === options) throw Error(`[rsbuild:css] \`postcssOptions\` function must return a PostCSSOptions object, got "${typeof options}".`);
2785
+ if ('object' != typeof options || null === options) throw Error(`${index_js_default().dim('[rsbuild:css]')} \`postcssOptions\` function must return a PostCSSOptions object, got ${index_js_default().yellow(typeof options)}.`);
2827
2786
  return updatePostcssOptions({
2828
2787
  ...userOptions,
2829
2788
  ...options,
@@ -2884,9 +2843,9 @@ for(var __webpack_i__ in (()=>{
2884
2843
  var _postcssLoaderOptions_postcssOptions_plugins, _postcssLoaderOptions_postcssOptions;
2885
2844
  if ('rspack' === api.context.bundlerType && !1 !== config.tools.lightningcssLoader) {
2886
2845
  importLoaders++;
2887
- let { minifyCss } = parseMinifyOptions(config, isProd);
2846
+ let { minifyCss } = parseMinifyOptions(config);
2888
2847
  updateRules((rule, type)=>{
2889
- let minify = ('inline' === type || config.output.injectStyles) && isProd && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, environment.browserslist, minify);
2848
+ let inlineStyle = 'inline' === type || config.output.injectStyles, lightningcssOptions = getLightningCSSLoaderOptions(config, environment.browserslist, inlineStyle && minifyCss);
2890
2849
  rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
2891
2850
  });
2892
2851
  }
@@ -2957,7 +2916,7 @@ for(var __webpack_i__ in (()=>{
2957
2916
  if (!value) return;
2958
2917
  let check = (value)=>{
2959
2918
  let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
2960
- pathKey && rslog_index_js_namespaceObject.logger.warn(index_js_default().yellow(`[rsbuild:config] The "source.define" option includes an object with the key ${JSON.stringify(pathKey)} under "process.env", indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`));
2919
+ pathKey && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} The ${index_js_default().yellow('"source.define"')} option includes an object with the key ${index_js_default().yellow(JSON.stringify(pathKey))} under ${index_js_default().yellow('"process.env"')}, indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`);
2961
2920
  };
2962
2921
  if ('object' == typeof value) return check(value);
2963
2922
  if ('string' == typeof value) try {
@@ -2983,7 +2942,7 @@ for(var __webpack_i__ in (()=>{
2983
2942
  preEntry.forEach(addEntry), injectCoreJsEntry && addEntry(createVirtualModule('import "core-js";')), castArray(entry[entryName]).forEach(addEntry);
2984
2943
  }
2985
2944
  }), api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
2986
- if (bundlerConfigs.every((config)=>!config.entry)) throw Error(`[rsbuild:config] Could not find any entry module, please make sure that ${index_js_default().cyan('src/index.(ts|js|tsx|jsx|mts|cts|mjs|cjs)')} exists, or customize entry through the ${index_js_default().cyan('source.entry')} configuration.`);
2945
+ if (bundlerConfigs.every((config)=>!config.entry)) throw Error(`${index_js_default().dim('[rsbuild:config]')} Could not find any entry module, please make sure that ${index_js_default().yellow('src/index.(ts|js|tsx|jsx|mts|cts|mjs|cjs)')} exists, or customize entry through the ${index_js_default().yellow('source.entry')} configuration.`);
2987
2946
  });
2988
2947
  }
2989
2948
  }), external_node_zlib_namespaceObject = require("node:zlib");
@@ -2996,7 +2955,7 @@ for(var __webpack_i__ in (()=>{
2996
2955
  let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), getAssetColor = (size)=>size > 300000 ? index_js_default().red : size > 100000 ? index_js_default().yellow : index_js_default().green, calcFileSize = (len)=>{
2997
2956
  let val = len / 1000;
2998
2957
  return `${val.toFixed(val < 1 ? 2 : 1)} kB`;
2999
- }, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? index_js_default().cyan(assetName) : CSS_REGEX.test(assetName) ? index_js_default().yellow(assetName) : HTML_REGEX.test(assetName) ? index_js_default().green(assetName) : index_js_default().magenta(assetName), COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest)$/i, isCompressible = (assetName)=>COMPRESSIBLE_REGEX.test(assetName);
2958
+ }, coloringAssetName = (assetName)=>JS_REGEX.test(assetName) ? index_js_default().cyan(assetName) : CSS_REGEX.test(assetName) ? index_js_default().yellow(assetName) : HTML_REGEX.test(assetName) ? index_js_default().green(assetName) : index_js_default().magenta(assetName), COMPRESSIBLE_REGEX = /\.(?:js|css|html|json|svg|txt|xml|xhtml|wasm|manifest|md)$/i, isCompressible = (assetName)=>COMPRESSIBLE_REGEX.test(assetName);
3000
2959
  async function printFileSizes(options, stats, rootPath, environmentName) {
3001
2960
  let logs = [], showTotal = !1 !== options.total, showDetail = !1 !== options.detail, exclude = options.exclude ?? excludeAsset;
3002
2961
  if (!showTotal && !showDetail) return logs;
@@ -3209,12 +3168,12 @@ for(var __webpack_i__ in (()=>{
3209
3168
  let emitFavicon = async (compilation, favicon)=>{
3210
3169
  let buffer, name = external_node_path_default().basename(favicon);
3211
3170
  if (compilation.assets[name]) return name;
3212
- if (!compilation.inputFileSystem) return addCompilationError(compilation, '[rsbuild:html] Failed to read the favicon file as "compilation.inputFileSystem" is not available.'), null;
3171
+ if (!compilation.inputFileSystem) return addCompilationError(compilation, `${index_js_default().dim('[rsbuild:html]')} Failed to read the favicon file as ${index_js_default().yellow('compilation.inputFileSystem')} is not available.`), null;
3213
3172
  let filename = external_node_path_default().isAbsolute(favicon) ? favicon : external_node_path_default().join(compilation.compiler.context, favicon);
3214
3173
  try {
3215
3174
  if (!(buffer = await (0, external_node_util_namespaceObject.promisify)(compilation.inputFileSystem.readFile)(filename))) throw Error('Buffer is undefined');
3216
3175
  } catch (error) {
3217
- return rslog_index_js_namespaceObject.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `[rsbuild:html] Failed to read the favicon file at "${index_js_default().cyan(filename)}".`), null;
3176
+ return rslog_index_js_namespaceObject.logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${index_js_default().dim('[rsbuild:html]')} Failed to read the favicon file at ${index_js_default().yellow(filename)}.`), null;
3218
3177
  }
3219
3178
  let source = new compiler.webpack.sources.RawSource(buffer, !1);
3220
3179
  return compilation.emitAsset(name, source), name;
@@ -3312,7 +3271,7 @@ for(var __webpack_i__ in (()=>{
3312
3271
  };
3313
3272
  let absolutePath = (0, external_node_path_namespaceObject.isAbsolute)(templatePath) ? templatePath : external_node_path_default().join(rootPath, templatePath);
3314
3273
  if (!existTemplatePath.has(absolutePath)) {
3315
- if (!await isFileExists(absolutePath)) throw Error(`[rsbuild:html] Failed to resolve HTML template, please check if the file exists: ${index_js_default().cyan(absolutePath)}`);
3274
+ if (!await isFileExists(absolutePath)) throw Error(`${index_js_default().dim('[rsbuild:html]')} Failed to resolve HTML template, check if the file exists: ${index_js_default().yellow(absolutePath)}`);
3316
3275
  existTemplatePath.add(absolutePath);
3317
3276
  }
3318
3277
  let templateContent = await external_node_fs_default().promises.readFile(absolutePath, 'utf-8');
@@ -3608,7 +3567,7 @@ for(var __webpack_i__ in (()=>{
3608
3567
  manifestData
3609
3568
  });
3610
3569
  if (isObject(generatedManifest)) return environment.manifest = generatedManifest, generatedManifest;
3611
- throw Error('[rsbuild:manifest] `manifest.generate` function must return a valid manifest object.');
3570
+ throw Error(`${index_js_default().dim('[rsbuild:manifest]')} \`manifest.generate\` function must return a valid manifest object.`);
3612
3571
  }
3613
3572
  return environment.manifest = manifestData, manifestData;
3614
3573
  }, pluginManifest = ()=>({
@@ -3641,7 +3600,7 @@ for(var __webpack_i__ in (()=>{
3641
3600
  }), api.onAfterCreateCompiler(()=>{
3642
3601
  if (manifestFilenames.size <= 1) return void manifestFilenames.clear();
3643
3602
  let environmentNames = Array.from(manifestFilenames.keys()), filenames = Array.from(manifestFilenames.values());
3644
- new Set(filenames).size !== filenames.length && rslog_index_js_namespaceObject.logger.warn(`[rsbuild:manifest] The \`manifest.filename\` option must be unique when there are multiple environments (${environmentNames.join(', ')}), otherwise the manifest file will be overwritten.`), manifestFilenames.clear();
3603
+ new Set(filenames).size !== filenames.length && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:manifest]')} The ${index_js_default().yellow('"manifest.filename"')} option must be unique when there are multiple environments (${environmentNames.join(', ')}), otherwise the manifest file will be overwritten.`), manifestFilenames.clear();
3645
3604
  });
3646
3605
  }
3647
3606
  });
@@ -3713,7 +3672,7 @@ for(var __webpack_i__ in (()=>{
3713
3672
  raw: !0
3714
3673
  }, ({ code, emitFile, resourcePath })=>{
3715
3674
  let name = nodeAddons_getFilename(resourcePath);
3716
- if (null === name) throw Error(`[rsbuild:node-addons] Failed to load Node.js addon: "${resourcePath}"`);
3675
+ if (null === name) throw Error(`${index_js_default().dim('[rsbuild:node-addons]')} Failed to load Node.js addon: ${index_js_default().yellow(resourcePath)}`);
3717
3676
  return emitFile(name, code), `
3718
3677
  try {
3719
3678
  const path = require("path");
@@ -3760,9 +3719,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3760
3719
  }
3761
3720
  });
3762
3721
  }
3763
- }), external_node_child_process_namespaceObject = require("node:child_process"), external_node_net_namespaceObject = require("node:net");
3764
- var external_node_net_default = __webpack_require__.n(external_node_net_namespaceObject);
3765
- let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (input)=>{
3722
+ }), normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (input)=>{
3766
3723
  let prefix = input;
3767
3724
  if ((null == prefix ? void 0 : prefix.startsWith('./')) && (prefix = prefix.replace('./', '')), !prefix) return '/';
3768
3725
  let hasLeadingSlash = prefix.startsWith('/'), hasTailSlash = prefix.endsWith('/');
@@ -3792,7 +3749,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3792
3749
  protocol
3793
3750
  });
3794
3751
  if (!newUrls) return null;
3795
- if (!Array.isArray(newUrls)) throw Error(`[rsbuild:config] "server.printUrls" must return an array, but got ${typeof newUrls}.`);
3752
+ if (!Array.isArray(newUrls)) throw Error(`${index_js_default().dim('[rsbuild:config]')} "server.printUrls" must return an array, but got ${typeof newUrls}.`);
3796
3753
  urls = newUrls.map((url)=>({
3797
3754
  url,
3798
3755
  label: getUrlLabel(url)
@@ -3816,10 +3773,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3816
3773
  }
3817
3774
  let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
3818
3775
  'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
3819
- let original = port, found = !1, attempts = 0;
3776
+ let { createServer } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:net")), original = port, found = !1, attempts = 0;
3820
3777
  for(; !found && attempts <= tryLimits;)try {
3821
3778
  await new Promise((resolve, reject)=>{
3822
- let server = external_node_net_default().createServer();
3779
+ let server = createServer();
3823
3780
  server.unref(), server.on('error', reject), server.listen({
3824
3781
  port,
3825
3782
  host
@@ -3831,7 +3788,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3831
3788
  if ('EADDRINUSE' !== e.code) throw e;
3832
3789
  port++, attempts++;
3833
3790
  }
3834
- if (port !== original && strictPort) throw Error(`[rsbuild:server] Port "${original}" is occupied, please choose another one.`);
3791
+ if (port !== original && strictPort) throw Error(`${index_js_default().dim('[rsbuild:server]')} Port ${index_js_default().yellow(original)} is occupied, please choose another one.`);
3835
3792
  return port;
3836
3793
  }, getServerConfig = async ({ config })=>{
3837
3794
  let { host, port: originalPort, strictPort } = config.server, port = await getPort({
@@ -3861,24 +3818,31 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3861
3818
  '127.0.0.1',
3862
3819
  '::1',
3863
3820
  '0000:0000:0000:0000:0000:0000:0000:0001'
3864
- ]).has(host), getHostInUrl = (host)=>host === DEFAULT_DEV_HOST ? 'localhost' : external_node_net_default().isIPv6(host) ? '::' === host ? '[::1]' : `[${host}]` : host, concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getUrlLabel = (url)=>{
3821
+ ]).has(host), getHostInUrl = async (host)=>{
3822
+ if (host === DEFAULT_DEV_HOST) return 'localhost';
3823
+ let { isIPv6 } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:net"));
3824
+ return isIPv6(host) ? '::' === host ? '[::1]' : `[${host}]` : host;
3825
+ }, concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getUrlLabel = (url)=>{
3865
3826
  try {
3866
3827
  let { host } = new URL(url);
3867
3828
  return isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL;
3868
3829
  } catch (err) {
3869
3830
  return NETWORK_LABEL;
3870
3831
  }
3871
- }, getAddressUrls = ({ protocol = 'http', port, host })=>{
3872
- if (host && host !== DEFAULT_DEV_HOST) return [
3873
- {
3874
- label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
3875
- url: concatUrl({
3876
- port,
3877
- host: getHostInUrl(host),
3878
- protocol
3879
- })
3880
- }
3881
- ];
3832
+ }, getAddressUrls = async ({ protocol = 'http', port, host })=>{
3833
+ if (host && host !== DEFAULT_DEV_HOST) {
3834
+ let url = concatUrl({
3835
+ port,
3836
+ host: await getHostInUrl(host),
3837
+ protocol
3838
+ });
3839
+ return [
3840
+ {
3841
+ label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
3842
+ url
3843
+ }
3844
+ ];
3845
+ }
3882
3846
  let ipv4Interfaces = getIpv4Interfaces(), addressUrls = [], hasLocalUrl = !1;
3883
3847
  for (let detail of ipv4Interfaces)if (isLoopbackHost(detail.address) || detail.internal) {
3884
3848
  if (hasLocalUrl) continue;
@@ -3916,7 +3880,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3916
3880
  listened ? server.close((err)=>err ? reject(err) : resolve()) : resolve();
3917
3881
  });
3918
3882
  }
3919
- let execAsync = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.exec), supportedChromiumBrowsers = [
3883
+ let supportedChromiumBrowsers = [
3920
3884
  'Google Chrome Canary',
3921
3885
  'Google Chrome Dev',
3922
3886
  'Google Chrome Beta',
@@ -3925,20 +3889,23 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3925
3889
  'Brave Browser',
3926
3890
  'Vivaldi',
3927
3891
  'Chromium'
3928
- ], getDefaultBrowserForAppleScript = async ()=>{
3929
- let { stdout: ps } = await execAsync('ps cax');
3930
- return supportedChromiumBrowsers.find((b)=>ps.includes(b));
3931
- }, mapChromiumBrowserName = (browser)=>'chrome' === browser || 'google chrome' === browser ? 'Google Chrome' : browser, shouldTryAppleScript = (browser, browserArgs)=>'darwin' === process.platform && (!browser || !browserArgs) && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)));
3892
+ ], mapChromiumBrowserName = (browser)=>'chrome' === browser || 'google chrome' === browser ? 'Google Chrome' : browser, shouldTryAppleScript = (browser, browserArgs)=>'darwin' === process.platform && (!browser || !browserArgs) && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)));
3932
3893
  async function openBrowser(url) {
3933
3894
  let browser = process.env.BROWSER, browserArgs = process.env.BROWSER_ARGS;
3934
- if (shouldTryAppleScript(browser, browserArgs)) try {
3935
- let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
3936
- if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
3937
- cwd: STATIC_PATH
3938
- }), !0;
3939
- rslog_index_js_namespaceObject.logger.debug('failed to find the target browser.');
3940
- } catch (err) {
3941
- rslog_index_js_namespaceObject.logger.debug("failed to open start URL with apple script."), rslog_index_js_namespaceObject.logger.debug(err);
3895
+ if (shouldTryAppleScript(browser, browserArgs)) {
3896
+ let { exec } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:child_process")), { promisify } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:util")), execAsync = promisify(exec), getDefaultBrowserForAppleScript = async ()=>{
3897
+ let { stdout: ps } = await execAsync('ps cax');
3898
+ return supportedChromiumBrowsers.find((b)=>ps.includes(b));
3899
+ };
3900
+ try {
3901
+ let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
3902
+ if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
3903
+ cwd: STATIC_PATH
3904
+ }), !0;
3905
+ rslog_index_js_namespaceObject.logger.debug('failed to find the target browser.');
3906
+ } catch (err) {
3907
+ rslog_index_js_namespaceObject.logger.debug("failed to open start URL with apple script."), rslog_index_js_namespaceObject.logger.debug(err);
3908
+ }
3942
3909
  }
3943
3910
  try {
3944
3911
  let { default: open } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/open/index.js")), { apps } = open, options = browser ? {
@@ -3973,13 +3940,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3973
3940
  let { targets, before } = normalizeOpenConfig(config);
3974
3941
  if ('true' === process.env.CSB) return;
3975
3942
  clearCache && clearOpenedURLs();
3976
- let urls = [], host = getHostInUrl(config.server.host), baseUrl = `${https ? 'https' : 'http'}://${host}:${port}`;
3943
+ let urls = [], host = await getHostInUrl(config.server.host), baseUrl = `${https ? 'https' : 'http'}://${host}:${port}`;
3977
3944
  for (let url of (targets.length ? urls.push(...targets.map((target)=>(function(str, base) {
3978
3945
  if (canParse(str)) return str;
3979
3946
  try {
3980
3947
  return new URL(str, base).href;
3981
3948
  } catch (e) {
3982
- throw Error('[rsbuild:open]: Invalid input: not a valid URL or pathname');
3949
+ throw Error(`${index_js_default().dim('[rsbuild:open]')} Invalid input: ${index_js_default().yellow(str)} is not a valid URL or pathname`);
3983
3950
  }
3984
3951
  })(replacePortPlaceholder(target, port), baseUrl))) : routes.length && urls.push(`${baseUrl}${routes[0].pathname}`), before && await before(), urls))openedURLs.includes(url) || (openBrowser(url), openedURLs.push(url));
3985
3952
  }
@@ -4051,7 +4018,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4051
4018
  name: 'rsbuild:progress',
4052
4019
  setup (api) {
4053
4020
  'webpack' !== api.context.bundlerType && api.modifyBundlerChain(async (chain, { CHAIN_ID, environment })=>{
4054
- let { config } = environment, options = config.dev.progressBar ?? 'production' === config.mode;
4021
+ let { config } = environment, options = config.dev.progressBar;
4055
4022
  if (!options) return;
4056
4023
  let prefix = !0 !== options && void 0 !== options.id ? options.id : environment.name;
4057
4024
  chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(core_namespaceObject.rspack.ProgressPlugin, [
@@ -4083,13 +4050,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4083
4050
  initial: {},
4084
4051
  config: config.resolve.alias
4085
4052
  });
4086
- if (mergedAlias = reduceConfigs({
4053
+ if (config.source.alias && (rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} The ${index_js_default().yellow('"source.alias"')} config is deprecated, use ${index_js_default().yellow('"resolve.alias"')} instead.`), mergedAlias = reduceConfigs({
4087
4054
  initial: mergedAlias,
4088
4055
  config: config.source.alias
4089
- }), config.resolve.dedupe) for (let pkgName of config.resolve.dedupe){
4056
+ })), config.resolve.dedupe) for (let pkgName of config.resolve.dedupe){
4090
4057
  let pkgPath;
4091
4058
  if (mergedAlias[pkgName]) {
4092
- rslog_index_js_namespaceObject.logger.debug(`[rsbuild:resolve] The package "${pkgName}" is already in the alias config, dedupe option for "${pkgName}" will be ignored.`);
4059
+ rslog_index_js_namespaceObject.logger.debug(`${index_js_default().dim('[rsbuild:resolve]')} The package ${index_js_default().yellow(pkgName)} is already in the alias config, dedupe option for ${index_js_default().yellow(pkgName)} will be ignored.`);
4093
4060
  continue;
4094
4061
  }
4095
4062
  try {
@@ -4111,7 +4078,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4111
4078
  ].join(external_node_path_namespaceObject.sep);
4112
4079
  for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = (0, external_node_path_namespaceObject.dirname)(pkgPath);
4113
4080
  } catch (e) {
4114
- rslog_index_js_namespaceObject.logger.debug(`[rsbuild:resolve] The package "${pkgName}" is not resolved in the project, dedupe option for "${pkgName}" will be ignored.`);
4081
+ rslog_index_js_namespaceObject.logger.debug(`${index_js_default().dim('[rsbuild:resolve]')} The package ${index_js_default().yellow(pkgName)} is not resolved in the project, dedupe option for ${index_js_default().yellow(pkgName)} will be ignored.`);
4115
4082
  continue;
4116
4083
  }
4117
4084
  mergedAlias[pkgName] = pkgPath;
@@ -4124,7 +4091,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4124
4091
  chain,
4125
4092
  config,
4126
4093
  rootPath: api.context.rootPath
4127
- }), chain.module.rule(CHAIN_ID.RULE.MJS).test(/\.m?js/).resolve.set('fullySpecified', !1);
4094
+ }), chain.module.rule(CHAIN_ID.RULE.MJS).test(/\.m?js/).resolve.set('fullySpecified', !1), config.source.aliasStrategy && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} The ${index_js_default().yellow('"source.aliasStrategy"')} config is deprecated, use ${index_js_default().yellow('"resolve.aliasStrategy"')} instead.`);
4128
4095
  let aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
4129
4096
  tsconfigPath && 'rspack' === api.context.bundlerType && 'prefer-tsconfig' === aliasStrategy && chain.resolve.tsConfig({
4130
4097
  configFile: tsconfigPath,
@@ -4359,7 +4326,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4359
4326
  traceOutput = 'chrome' === traceLayer ? defaultRustTraceChromeOutput : 'stdout';
4360
4327
  }
4361
4328
  let filter = "OVERVIEW" === (value = filterValue) ? 'info' : "ALL" === value ? 'trace' : value;
4362
- return await ensureFileDir(traceOutput), await core_default().experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
4329
+ return await ensureFileDir(traceOutput), await core_namespaceObject.rspack.experiments.globalTrace.register(filter, traceLayer, traceOutput), traceOutput;
4363
4330
  }
4364
4331
  let pluginRspackProfile = ()=>({
4365
4332
  name: 'rsbuild:rspack-profile',
@@ -4374,7 +4341,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4374
4341
  api.onBeforeBuild(({ isFirstCompile })=>{
4375
4342
  isFirstCompile && onStart();
4376
4343
  }), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
4377
- traceOutput && (core_default().experiments.globalTrace.cleanup(), rslog_index_js_namespaceObject.logger.info(`profile file saved to ${index_js_default().cyan(traceOutput)}`));
4344
+ traceOutput && (core_namespaceObject.rspack.experiments.globalTrace.cleanup(), rslog_index_js_namespaceObject.logger.info(`profile file saved to ${index_js_default().cyan(traceOutput)}`));
4378
4345
  });
4379
4346
  }
4380
4347
  }), pluginServer = ()=>({
@@ -4410,9 +4377,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4410
4377
  }
4411
4378
  });
4412
4379
  }
4413
- }), external_node_assert_namespaceObject = require("node:assert");
4414
- var external_node_assert_default = __webpack_require__.n(external_node_assert_namespaceObject);
4415
- let MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/, SPLIT_STRATEGY_DISPATCHER = {
4380
+ }), MODULE_PATH_REGEX = /.*[\\/]node_modules[\\/](?!\.pnpm[\\/])(?:(@[^\\/]+)[\\/])?([^\\/]+)/, SPLIT_STRATEGY_DISPATCHER = {
4416
4381
  'split-by-experience': function(ctx) {
4417
4382
  let { override, polyfill, defaultConfig, forceSplittingGroups } = ctx, experienceCacheGroup = {}, packageRegExps = {
4418
4383
  axios: /node_modules[\\/]axios(-.+)?[\\/]/
@@ -4466,7 +4431,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4466
4431
  },
4467
4432
  'split-by-size': function(ctx) {
4468
4433
  let { override, forceSplittingGroups, defaultConfig, userConfig } = ctx;
4469
- return external_node_assert_default()('split-by-size' === userConfig.strategy), {
4434
+ return {
4470
4435
  ...defaultConfig,
4471
4436
  minSize: userConfig.minSize ?? 0,
4472
4437
  maxSize: userConfig.maxSize ?? Number.POSITIVE_INFINITY,
@@ -4594,21 +4559,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4594
4559
  "application/javascript"
4595
4560
  ]
4596
4561
  });
4597
- if (!function({ rule, isDev, config, context, rsbuildTarget }) {
4562
+ if (!function({ rule, isDev, config, rsbuildTarget }) {
4598
4563
  for (let condition of (rule.include.add({
4599
- and: [
4600
- context.rootPath,
4601
- {
4602
- not: NODE_MODULES_REGEX
4603
- }
4604
- ]
4564
+ not: NODE_MODULES_REGEX
4605
4565
  }), rule.include.add(/\.(?:ts|tsx|jsx|mts|cts)$/), 'web' === rsbuildTarget && isDev && rule.include.add(/[\\/]@rsbuild[\\/]core[\\/]dist[\\/]/), config.source.include || []))rule.include.add(condition);
4606
4566
  for (let condition of config.source.exclude || [])rule.exclude.add(condition);
4607
4567
  }({
4608
4568
  rule,
4609
4569
  isDev,
4610
4570
  config,
4611
- context: api.context,
4612
4571
  rsbuildTarget: target
4613
4572
  }), 'webpack' === api.context.bundlerType) return;
4614
4573
  let swcConfig = {
@@ -4643,7 +4602,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4643
4602
  swcConfig.jsc.transform.legacyDecorator = !1, swcConfig.jsc.transform.decoratorVersion = '2022-03';
4644
4603
  break;
4645
4604
  default:
4646
- throw Error(`[rsbuild:swc] Unknown decorators version: ${version}`);
4605
+ throw Error(`${index_js_default().dim('[rsbuild:swc]')} Unknown decorators version: ${index_js_default().yellow(version)}`);
4647
4606
  }
4648
4607
  }(swcConfig, config), castArray(target1 = target).includes('web') || target1.includes('web-worker')) {
4649
4608
  let polyfillMode = config.output.polyfill;
@@ -4897,17 +4856,18 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4897
4856
  if (config.plugins) {
4898
4857
  for (let plugin of config.plugins)if (plugin && void 0 === plugin.apply && 'name' in plugin && 'setup' in plugin) {
4899
4858
  let name = index_js_default().bold(index_js_default().yellow(plugin.name));
4900
- throw Error(`[rsbuild:plugin] "${name}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
4859
+ throw Error(`${index_js_default().dim('[rsbuild:plugin]')} "${index_js_default().yellow(name)}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
4901
4860
  }
4902
4861
  }
4903
- return config.devServer && rslog_index_js_namespaceObject.logger.warn(`[rsbuild:config] Find invalid Rspack config: "${index_js_default().yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`), rspackConfig;
4862
+ return config.devServer && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} Find invalid Rspack config: "${index_js_default().yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`), rspackConfig;
4904
4863
  }
4905
4864
  async function modifyRsbuildConfig(context) {
4865
+ var _context_config_plugins, _modified_plugins;
4906
4866
  rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config');
4907
- let [modified] = await context.hooks.modifyRsbuildConfig.callChain(context.config, {
4867
+ let pluginsCount = (null == (_context_config_plugins = context.config.plugins) ? void 0 : _context_config_plugins.length) ?? 0, [modified] = await context.hooks.modifyRsbuildConfig.callChain(context.config, {
4908
4868
  mergeRsbuildConfig: mergeRsbuildConfig
4909
4869
  });
4910
- context.config = modified, rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config done');
4870
+ context.config = modified, ((null == (_modified_plugins = modified.plugins) ? void 0 : _modified_plugins.length) ?? 0) !== pluginsCount && rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild]')} Cannot change plugins via ${index_js_default().yellow('modifyRsbuildConfig')} as plugins are already initialized when it executes.`), rslog_index_js_namespaceObject.logger.debug('modify Rsbuild config done');
4911
4871
  }
4912
4872
  async function modifyEnvironmentConfig(context, config, name) {
4913
4873
  rslog_index_js_namespaceObject.logger.debug(`modify Rsbuild environment(${name}) config`);
@@ -4959,11 +4919,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4959
4919
  }, config)
4960
4920
  })
4961
4921
  ]));
4962
- if (!Object.keys(resolvedEnvironments).length) throw Error(`[rsbuild:config] The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
4922
+ if (!Object.keys(resolvedEnvironments).length) throw Error(`${index_js_default().dim('[rsbuild:config]')} The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
4963
4923
  return resolvedEnvironments;
4964
4924
  }
4965
4925
  let defaultEnvironmentName = camelCase(rsbuildSharedConfig.output.target);
4966
- if (!isEnvironmentEnabled(defaultEnvironmentName)) throw Error(`[rsbuild:config] The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
4926
+ if (!isEnvironmentEnabled(defaultEnvironmentName)) throw Error(`${index_js_default().dim('[rsbuild:config]')} The current build is specified to run only in the ${index_js_default().yellow(null == specifiedEnvironments ? void 0 : specifiedEnvironments.join(','))} environment, but the configuration of the specified environment was not found.`);
4967
4927
  return {
4968
4928
  [defaultEnvironmentName]: applyEnvironmentDefaultConfig({
4969
4929
  ...rsbuildSharedConfig,
@@ -4977,7 +4937,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4977
4937
  })
4978
4938
  };
4979
4939
  }, validateRsbuildConfig = (config)=>{
4980
- if (config.server.base && !config.server.base.startsWith('/')) throw Error('[rsbuild:config] The "server.base" option should start with a slash, for example: "/base"');
4940
+ if (config.server.base && !config.server.base.startsWith('/')) throw Error(`${index_js_default().dim('[rsbuild:config]')} The ${index_js_default().yellow('"server.base"')} option should start with a slash, for example: "/base"`);
4941
+ if (config.environments) {
4942
+ let names = Object.keys(config.environments), regexp = /^[\w$-]+$/;
4943
+ for (let name of names)regexp.test(name) || rslog_index_js_namespaceObject.logger.warn(`${index_js_default().dim('[rsbuild:config]')} Environment name "${index_js_default().yellow(name)}" contains invalid characters. Only letters, numbers, "-", "_", and "$" are allowed.`);
4944
+ }
4981
4945
  };
4982
4946
  async function initRsbuildConfig({ context, pluginManager }) {
4983
4947
  if (context.normalizedConfig) return context.normalizedConfig;
@@ -5054,9 +5018,83 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5054
5018
  rspackConfigs
5055
5019
  };
5056
5020
  }
5021
+ function defineConfig(config) {
5022
+ return config;
5023
+ }
5024
+ let resolveConfigPath = (root, customConfig)=>{
5025
+ if (customConfig) {
5026
+ let customConfigPath = (0, external_node_path_namespaceObject.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_namespaceObject.join)(root, customConfig);
5027
+ if (external_node_fs_default().existsSync(customConfigPath)) return customConfigPath;
5028
+ rslog_index_js_namespaceObject.logger.warn(`Cannot find config file: ${index_js_default().dim(customConfigPath)}\n`);
5029
+ }
5030
+ for (let file of [
5031
+ 'rsbuild.config.mjs',
5032
+ 'rsbuild.config.ts',
5033
+ 'rsbuild.config.js',
5034
+ 'rsbuild.config.cjs',
5035
+ 'rsbuild.config.mts',
5036
+ 'rsbuild.config.cts'
5037
+ ]){
5038
+ let configFile = (0, external_node_path_namespaceObject.join)(root, file);
5039
+ if (external_node_fs_default().existsSync(configFile)) return configFile;
5040
+ }
5041
+ return null;
5042
+ };
5043
+ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta, loader = 'jiti' } = {}) {
5044
+ let configExport, configFilePath = resolveConfigPath(cwd, path);
5045
+ if (!configFilePath) return rslog_index_js_namespaceObject.logger.debug('no config file found.'), {
5046
+ content: {},
5047
+ filePath: configFilePath
5048
+ };
5049
+ let applyMetaInfo = (config)=>(config._privateMeta = {
5050
+ configFilePath
5051
+ }, config);
5052
+ if ('native' === loader || /\.(?:js|mjs|cjs)$/.test(configFilePath)) try {
5053
+ let configFileURL = (0, external_node_url_namespaceObject.pathToFileURL)(configFilePath).href, exportModule = await import(`${configFileURL}?t=${Date.now()}`);
5054
+ configExport = exportModule.default ? exportModule.default : exportModule;
5055
+ } catch (err) {
5056
+ if ('native' === loader) throw rslog_index_js_namespaceObject.logger.error(`Failed to load file with native loader: ${index_js_default().dim(configFilePath)}`), err;
5057
+ rslog_index_js_namespaceObject.logger.debug(`failed to load file with dynamic import: ${index_js_default().dim(configFilePath)}`);
5058
+ }
5059
+ try {
5060
+ if (void 0 === configExport) {
5061
+ let { createJiti } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "jiti")), jiti = createJiti(constants_filename, {
5062
+ moduleCache: !1,
5063
+ interopDefault: !0,
5064
+ nativeModules: [
5065
+ '@rspack/core',
5066
+ "typescript"
5067
+ ]
5068
+ });
5069
+ configExport = await jiti.import(configFilePath, {
5070
+ default: !0
5071
+ });
5072
+ }
5073
+ } catch (err) {
5074
+ throw rslog_index_js_namespaceObject.logger.error(`Failed to load file with jiti: ${index_js_default().dim(configFilePath)}`), err;
5075
+ }
5076
+ if ('function' == typeof configExport) {
5077
+ let command = process.argv[2], nodeEnv = getNodeEnv(), result = await configExport({
5078
+ env: nodeEnv,
5079
+ command,
5080
+ envMode: envMode || nodeEnv,
5081
+ meta
5082
+ });
5083
+ if (void 0 === result) throw Error(`${index_js_default().dim('[rsbuild:loadConfig]')} The config function must return a config object.`);
5084
+ return {
5085
+ content: applyMetaInfo(result),
5086
+ filePath: configFilePath
5087
+ };
5088
+ }
5089
+ if (!isObject(configExport)) throw Error(`${index_js_default().dim('[rsbuild:loadConfig]')} The config must be an object or a function that returns an object, get ${index_js_default().yellow(configExport)}`);
5090
+ return rslog_index_js_namespaceObject.logger.debug('loaded config file:', configFilePath), {
5091
+ content: applyMetaInfo(configExport),
5092
+ filePath: configFilePath
5093
+ };
5094
+ }
5057
5095
  let commonOpts = {}, getEnvDir = (cwd, envDir)=>envDir ? external_node_path_default().isAbsolute(envDir) ? envDir : external_node_path_default().join(cwd, envDir) : cwd, init_loadConfig = async (root)=>{
5058
5096
  var _config_server;
5059
- let { content: config, filePath } = await config_loadConfig({
5097
+ let { content: config, filePath } = await loadConfig_loadConfig({
5060
5098
  cwd: root,
5061
5099
  path: commonOpts.config,
5062
5100
  envMode: commonOpts.envMode,
@@ -5216,10 +5254,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5216
5254
  };
5217
5255
  watcher.on('add', onChange), watcher.on('change', onChange), watcher.on('unlink', onChange);
5218
5256
  }
5219
- let external_node_readline_namespaceObject = require("node:readline");
5220
- var external_node_readline_default = __webpack_require__.n(external_node_readline_namespaceObject);
5221
5257
  let isCliShortcutsEnabled = (devConfig)=>devConfig.cliShortcuts && isTTY('stdin');
5222
- function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer, customShortcuts }) {
5258
+ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls, restartServer, customShortcuts }) {
5223
5259
  let shortcuts = [
5224
5260
  {
5225
5261
  key: 'c',
@@ -5255,9 +5291,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5255
5291
  action: printUrls
5256
5292
  }
5257
5293
  ].filter(Boolean);
5258
- if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error('[rsbuild:config] `dev.cliShortcuts` must return an array of shortcuts.');
5259
- help && rslog_index_js_namespaceObject.logger.log(` \u{279C} ${index_js_default().dim('press')} ${index_js_default().bold('h + enter')} ${index_js_default().dim('to show shortcuts')}\n`);
5260
- let rl = external_node_readline_default().createInterface({
5294
+ if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error(`${index_js_default().dim('[rsbuild:config]')} ${index_js_default().yellow('dev.cliShortcuts')} option must return an array of shortcuts.`);
5295
+ help && rslog_index_js_namespaceObject.logger.log(!0 === help ? ` \u{279C} ${index_js_default().dim('press')} ${index_js_default().bold('h + enter')} ${index_js_default().dim('to show shortcuts')}\n` : ` \u{279C} ${help}\n`);
5296
+ let { createInterface } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:readline")), rl = createInterface({
5261
5297
  input: process.stdin
5262
5298
  });
5263
5299
  return rl.on('line', (input)=>{
@@ -5271,11 +5307,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5271
5307
  rl.close();
5272
5308
  };
5273
5309
  }
5274
- let external_node_dns_namespaceObject = require("node:dns");
5275
5310
  async function getLocalhostResolvedAddress() {
5276
- let [defaultLookup, explicitLookup] = await Promise.all([
5277
- external_node_dns_namespaceObject.promises.lookup('localhost'),
5278
- external_node_dns_namespaceObject.promises.lookup('localhost', {
5311
+ let { promises: dns } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:dns")), [defaultLookup, explicitLookup] = await Promise.all([
5312
+ dns.lookup('localhost'),
5313
+ dns.lookup('localhost', {
5279
5314
  verbatim: !0
5280
5315
  })
5281
5316
  ]);
@@ -5335,7 +5370,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5335
5370
  serverSideRender: !0,
5336
5371
  writeToDisk: devConfig.writeToDisk
5337
5372
  });
5338
- }, external_node_querystring_namespaceObject = require("node:querystring"), styles = {
5373
+ }, styles = {
5339
5374
  1: 'font-weight:bold',
5340
5375
  2: 'opacity:0.5',
5341
5376
  3: 'font-style:italic',
@@ -5388,7 +5423,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5388
5423
  rslog_index_js_namespaceObject.logger.error(err);
5389
5424
  }), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
5390
5425
  let queryStr = req.url ? req.url.split('?')[1] : '';
5391
- this.onConnect(socket, queryStr ? (0, external_node_querystring_namespaceObject.parse)(queryStr) : {});
5426
+ this.onConnect(socket, queryStr ? Object.fromEntries(new URLSearchParams(queryStr)) : {});
5392
5427
  });
5393
5428
  }
5394
5429
  updateStats(stats) {
@@ -5638,7 +5673,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5638
5673
  <pre class="content">${htmlItems.join('\n\n').trim()}</pre>
5639
5674
  <footer class="footer">
5640
5675
  <p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>
5641
- <p>Disable overlay by setting Rsbuild's <span><a class="config-link" target="_blank" rel="noopener noreferrer" href="https://rsbuild.dev/config/dev/client">dev.client.overlay</a></span> config to false.<p>
5676
+ <p>Disable overlay by setting Rsbuild's <span><a class="config-link" target="_blank" rel="noopener noreferrer" href="https://rsbuild.rs/config/dev/client">dev.client.overlay</a></span> config to false.<p>
5642
5677
  </footer>
5643
5678
  </div>
5644
5679
  </div>
@@ -5974,7 +6009,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5974
6009
  }
5975
6010
  if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager) {
5976
6011
  let { compiler } = compilationManager;
5977
- 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(core_default().experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
6012
+ 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
5978
6013
  }
5979
6014
  server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
5980
6015
  base: server.base
@@ -6028,16 +6063,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6028
6063
  onUpgrade,
6029
6064
  middlewares
6030
6065
  };
6031
- }, external_node_vm_namespaceObject = require("node:vm");
6032
- var external_node_vm_default = __webpack_require__.n(external_node_vm_namespaceObject);
6033
- let asModule = async (something, context, unlinked)=>{
6034
- if (something instanceof external_node_vm_default().Module) return something;
6066
+ }, asModule = async (something, context, unlinked)=>{
6067
+ let { Module, SyntheticModule } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:vm"));
6068
+ if (something instanceof Module) return something;
6035
6069
  let exports1 = [
6036
6070
  ...new Set([
6037
6071
  'default',
6038
6072
  ...Object.keys(something)
6039
6073
  ])
6040
- ], m = new (external_node_vm_default()).SyntheticModule(exports1, ()=>{
6074
+ ], m = new SyntheticModule(exports1, ()=>{
6041
6075
  for (let name of exports1)m.setExport(name, 'default' === name ? something : something[name]);
6042
6076
  }, {
6043
6077
  context
@@ -6090,7 +6124,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6090
6124
  postExecute(_m, _file) {}
6091
6125
  createRunner() {
6092
6126
  this.requirers.set('entry', (_currentDirectory, _modulePath, _context = {})=>{
6093
- throw Error('[rsbuild:runner] Not implement');
6127
+ throw Error(`${index_js_default().dim('[rsbuild:runner]')} Not implemented`);
6094
6128
  });
6095
6129
  }
6096
6130
  constructor(_options){
@@ -6148,7 +6182,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6148
6182
  };
6149
6183
  }
6150
6184
  createCjsRequirer() {
6151
- let requireCache = Object.create(null);
6185
+ let requireCache = Object.create(null), vm = cjs_require('node:vm');
6152
6186
  return (currentDirectory, modulePath, context = {})=>{
6153
6187
  let file = context.file || this.getFile(modulePath, currentDirectory);
6154
6188
  if (!file) return this.requirers.get('miss')(currentDirectory, modulePath);
@@ -6162,7 +6196,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6162
6196
  })`;
6163
6197
  this.preExecute(code, file);
6164
6198
  let dynamicImport = Function('specifier', 'return import(specifier)');
6165
- return external_node_vm_default().runInThisContext(code, {
6199
+ return vm.runInThisContext(code, {
6166
6200
  filename: file.path,
6167
6201
  importModuleDynamically: async (specifier)=>await dynamicImport(specifier)
6168
6202
  }).call(m.exports, ...argValues), this.postExecute(m, file), m.exports;
@@ -6172,6 +6206,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6172
6206
  var type_EsmMode = function(EsmMode) {
6173
6207
  return EsmMode[EsmMode.Unknown = 0] = "Unknown", EsmMode[EsmMode.Evaluated = 1] = "Evaluated", EsmMode[EsmMode.Unlinked = 2] = "Unlinked", EsmMode;
6174
6208
  }({});
6209
+ let esm_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
6175
6210
  class EsmRunner extends CommonJsRunner {
6176
6211
  createRunner() {
6177
6212
  var _this__options_compilerOptions_experiments;
@@ -6189,13 +6224,13 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6189
6224
  });
6190
6225
  }
6191
6226
  createEsmRequirer() {
6192
- let esmCache = new Map(), esmIdentifier = this._options.name;
6227
+ let esmCache = new Map(), esmIdentifier = this._options.name, vm = esm_require('node:vm');
6193
6228
  return (currentDirectory, modulePath, context = {})=>{
6194
- if (!external_node_vm_default().SourceTextModule) throw Error('[rsbuild:runner] Running ESM bundle needs add Node.js option "--experimental-vm-modules".');
6229
+ if (!vm.SourceTextModule) throw Error(`${index_js_default().dim('[rsbuild:runner]')} Running ESM bundle needs add Node.js option ${index_js_default().yellow('--experimental-vm-modules')}.`);
6195
6230
  let _require = this.getRequire(), file = context.file || this.getFile(modulePath, currentDirectory);
6196
6231
  if (!file) return this.requirers.get('miss')(currentDirectory, modulePath);
6197
6232
  let esm = esmCache.get(file.path);
6198
- return (esm || (esm = new (external_node_vm_default()).SourceTextModule(file.content, {
6233
+ return (esm || (esm = new vm.SourceTextModule(file.content, {
6199
6234
  identifier: `${esmIdentifier}-${file.path}`,
6200
6235
  url: `${(0, external_node_url_namespaceObject.pathToFileURL)(file.path).href}?${esmIdentifier}`,
6201
6236
  initializeImportMeta: (meta, _)=>{
@@ -6226,7 +6261,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6226
6261
  name: this.name,
6227
6262
  ...options
6228
6263
  }, { compilerOptions } = options;
6229
- if ('web' === compilerOptions.target || 'webworker' === compilerOptions.target) throw Error(`[rsbuild:runner] Not support run "${compilerOptions.target}" resource in Rsbuild server`);
6264
+ if ('web' === compilerOptions.target || 'webworker' === compilerOptions.target) throw Error(`${index_js_default().dim('[rsbuild:runner]')} Not support run ${index_js_default().yellow(compilerOptions.target)} resource in Rsbuild server`);
6230
6265
  return new EsmRunner(runnerOptions);
6231
6266
  }
6232
6267
  constructor(name){
@@ -6247,7 +6282,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6247
6282
  entrypoints: !0,
6248
6283
  outputPath: !0
6249
6284
  });
6250
- if (!(null == entrypoints ? void 0 : entrypoints[entryName])) throw Error(`[rsbuild:loadBundle] Can't find entry: "${entryName}"`);
6285
+ if (!(null == entrypoints ? void 0 : entrypoints[entryName])) throw Error(`${index_js_default().dim('[rsbuild:loadBundle]')} Can't find entry: ${index_js_default().yellow(entryName)}`);
6251
6286
  let { chunks: entryChunks = [] } = entrypoints[entryName], files = entryChunks.reduce((prev, entryChunkName)=>{
6252
6287
  let chunk = null == chunks ? void 0 : chunks.find((chunk)=>{
6253
6288
  var _chunk_names;
@@ -6255,8 +6290,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6255
6290
  });
6256
6291
  return (null == chunk ? void 0 : chunk.files) ? prev.concat(chunk.files.filter((file)=>!file.endsWith('.css'))) : prev;
6257
6292
  }, []);
6258
- if (0 === files.length) throw Error(`[rsbuild:loadBundle] Failed to get bundle by entryName: "${entryName}"`);
6259
- if (files.length > 1) throw Error(`[rsbuild:loadBundle] Only support load single entry chunk, but got ${files.length}: ${files.join(',')}`);
6293
+ if (0 === files.length) throw Error(`${index_js_default().dim('[rsbuild:loadBundle]')} Failed to get bundle by entryName: ${index_js_default().yellow(entryName)}`);
6294
+ if (files.length > 1) throw Error(`${index_js_default().dim('[rsbuild:loadBundle]')} Only support load single entry chunk, but got ${index_js_default().yellow(files.length)}: ${files.join(',')}`);
6260
6295
  let allChunkFiles = (null == chunks ? void 0 : chunks.flatMap((c)=>c.files).map((file)=>(0, external_node_path_namespaceObject.join)(outputPath, file))) || [];
6261
6296
  return await runner_run({
6262
6297
  bundlePath: files[0],
@@ -6267,7 +6302,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6267
6302
  });
6268
6303
  }, getTransformedHtml = async (entryName, utils)=>{
6269
6304
  let { htmlPaths, distPath } = utils.environment, htmlPath = htmlPaths[entryName];
6270
- if (!htmlPath) throw Error(`[rsbuild:getTransformedHtml] Failed to get HTML file by entryName: "${entryName}"`);
6305
+ if (!htmlPath) throw Error(`${index_js_default().dim('[rsbuild:getTransformedHtml]')} Failed to get HTML file by entryName: ${index_js_default().yellow(entryName)}`);
6271
6306
  let fileName = (0, external_node_path_namespaceObject.join)(distPath, htmlPath);
6272
6307
  return utils.readFileSync(fileName);
6273
6308
  }, createCacheableFunction = (getter)=>{
@@ -6340,7 +6375,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6340
6375
  });
6341
6376
  }) : Promise.resolve(), startCompile = async ()=>{
6342
6377
  let compiler = customCompiler || await createCompiler();
6343
- if (!compiler) throw Error('[rsbuild:server] Failed to get compiler instance.');
6378
+ if (!compiler) throw Error(`${index_js_default().dim('[rsbuild:server]')} Failed to get compiler instance.`);
6344
6379
  let publicPaths = helpers_isMultiCompiler(compiler) ? compiler.compilers.map(getPublicPathFromCompiler) : [
6345
6380
  getPublicPathFromCompiler(compiler)
6346
6381
  ], compilationManager = new CompilationManager({
@@ -6354,7 +6389,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6354
6389
  environments: context.environments
6355
6390
  });
6356
6391
  return await compilationManager.init(), compilationManager;
6357
- }, protocol = https ? 'https' : 'http', urls = getAddressUrls({
6392
+ }, protocol = https ? 'https' : 'http', urls = await getAddressUrls({
6358
6393
  protocol,
6359
6394
  port,
6360
6395
  host
@@ -6378,9 +6413,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6378
6413
  ]);
6379
6414
  };
6380
6415
  middlewareMode || registerCleanup(closeServer);
6381
- let beforeCreateCompiler = ()=>{
6416
+ let beforeCreateCompiler = async ()=>{
6382
6417
  if (printUrls(), cliShortcutsEnabled) {
6383
- let shortcutsOptions = 'boolean' == typeof devConfig.cliShortcuts ? {} : devConfig.cliShortcuts, cleanup = setupCliShortcuts({
6418
+ let shortcutsOptions = 'boolean' == typeof devConfig.cliShortcuts ? {} : devConfig.cliShortcuts, cleanup = await setupCliShortcuts({
6384
6419
  openPage,
6385
6420
  closeServer,
6386
6421
  printUrls,
@@ -6397,18 +6432,19 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6397
6432
  name,
6398
6433
  {
6399
6434
  getStats: async ()=>{
6400
- if (!compilationManager) throw Error('[rsbuild:server] Can not call `getStats` when `runCompile` is false');
6435
+ if (!compilationManager) throw Error(`${index_js_default().dim('[rsbuild:server]')} Can not call ${index_js_default().yellow('getStats')} when ${index_js_default().yellow('runCompile')} is false`);
6401
6436
  return await waitFirstCompileDone, lastStats[environment.index];
6402
6437
  },
6438
+ context: environment,
6403
6439
  loadBundle: async (entryName)=>{
6404
- if (!compilationManager) throw Error('[rsbuild:server] Can not call `loadBundle` when `runCompile` is false');
6440
+ if (!compilationManager) throw Error(`${index_js_default().dim('[rsbuild:server]')} Can not call ${index_js_default().yellow('loadBundle')} when ${index_js_default().yellow('runCompile')} is false`);
6405
6441
  return await waitFirstCompileDone, cacheableLoadBundle(lastStats[environment.index], entryName, {
6406
6442
  readFileSync: compilationManager.readFileSync,
6407
6443
  environment
6408
6444
  });
6409
6445
  },
6410
6446
  getTransformedHtml: async (entryName)=>{
6411
- if (!compilationManager) throw Error('[rsbuild:server] Can not call `getTransformedHtml` when `runCompile` is false');
6447
+ if (!compilationManager) throw Error(`${index_js_default().dim('[rsbuild:server]')} Can not call ${index_js_default().yellow('getTransformedHtml')} when ${index_js_default().yellow('runCompile')} is false`);
6412
6448
  return await waitFirstCompileDone, cacheableTransformedHtml(lastStats[environment.index], entryName, {
6413
6449
  readFileSync: compilationManager.readFileSync,
6414
6450
  environment
@@ -6428,7 +6464,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6428
6464
  data
6429
6465
  }),
6430
6466
  listen: async ()=>{
6431
- if (!httpServer) throw Error('[rsbuild:server] Can not listen dev server as `server.middlewareMode` is enabled.');
6467
+ if (!httpServer) throw Error(`${index_js_default().dim('[rsbuild:server]')} Can not listen dev server as ${index_js_default().yellow('server.middlewareMode')} is enabled.`);
6432
6468
  let serverTerminator = getServerTerminator(httpServer);
6433
6469
  return rslog_index_js_namespaceObject.logger.debug('listen dev server'), context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
6434
6470
  httpServer.listen({
@@ -6463,7 +6499,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6463
6499
  server: devServerAPI,
6464
6500
  environments: context.environments
6465
6501
  })).filter((item)=>'function' == typeof item);
6466
- runCompile ? context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : beforeCreateCompiler();
6502
+ runCompile ? context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : await beforeCreateCompiler();
6467
6503
  let compilationManager = runCompile ? await startCompile() : void 0;
6468
6504
  for (let item of (fileWatcher = await setupWatchFiles({
6469
6505
  dev: devConfig,
@@ -6503,7 +6539,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6503
6539
  if (await context.hooks.onBeforeCreateCompiler.callBatch({
6504
6540
  bundlerConfigs: rspackConfigs,
6505
6541
  environments: context.environments
6506
- }), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`[rsbuild] The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${index_js_default().green(rspackMinVersion)}`);
6542
+ }), !await isSatisfyRspackVersion(core_namespaceObject.rspack.rspackVersion)) throw Error(`${index_js_default().dim('[rsbuild]')} The current Rspack version does not meet the requirements, the minimum supported version of Rspack is ${index_js_default().green(rspackMinVersion)}`);
6507
6543
  let isMultiCompiler = rspackConfigs.length > 1, compiler = isMultiCompiler ? (0, core_namespaceObject.rspack)(rspackConfigs) : (0, core_namespaceObject.rspack)(rspackConfigs[0]), isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
6508
6544
  isVersionLogged || (rslog_index_js_namespaceObject.logger.debug(`use Rspack v${core_namespaceObject.rspack.rspackVersion}`), isVersionLogged = !0);
6509
6545
  };
@@ -6523,7 +6559,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6523
6559
  }
6524
6560
  rslog_index_js_namespaceObject.logger.start('build started...');
6525
6561
  }(compiler, context), isCompiling = !0;
6526
- }), 'build' === context.action && compiler.hooks.run.tap('rsbuild:run', logRspackVersion);
6562
+ }), 'build' === context.action && compiler.hooks.run.tap('rsbuild:run', ()=>{
6563
+ rslog_index_js_namespaceObject.logger.info('build started...'), logRspackVersion();
6564
+ });
6527
6565
  let done = (stats)=>{
6528
6566
  let statsOptions = getStatsOptions(compiler), statsJson = stats.toJson({
6529
6567
  children: !0,
@@ -6740,7 +6778,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6740
6778
  routes,
6741
6779
  environments: context.environments
6742
6780
  });
6743
- let protocol = https ? 'https' : 'http', urls = getAddressUrls({
6781
+ let protocol = https ? 'https' : 'http', urls = await getAddressUrls({
6744
6782
  protocol,
6745
6783
  port,
6746
6784
  host
@@ -6767,7 +6805,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6767
6805
  });
6768
6806
  if (printUrls(), cliShortcutsEnabled) {
6769
6807
  let shortcutsOptions = 'boolean' == typeof config.dev.cliShortcuts ? {} : config.dev.cliShortcuts;
6770
- setupCliShortcuts({
6808
+ await setupCliShortcuts({
6771
6809
  openPage,
6772
6810
  closeServer,
6773
6811
  printUrls,
@@ -6920,7 +6958,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6920
6958
  for (let newPlugin of newPlugins)if (newPlugin) {
6921
6959
  var plugin = newPlugin;
6922
6960
  let type = typeof plugin;
6923
- if ('object' !== type || null === plugin) throw Error(`[rsbuild:plugin] Expect Rsbuild plugin instance to be an object, but got ${type}.`);
6961
+ if ('object' !== type || null === plugin) throw Error(`${index_js_default().dim('[rsbuild:plugin]')} Expect Rsbuild plugin instance to be an object, but got ${index_js_default().yellow(type)}.`);
6924
6962
  if (!isFunction(plugin.setup)) {
6925
6963
  if (isFunction(plugin.apply)) {
6926
6964
  let { name = 'SomeWebpackPlugin' } = plugin.constructor || {};
@@ -6938,7 +6976,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6938
6976
  `)
6939
6977
  ].join('\n'));
6940
6978
  }
6941
- throw Error(`[rsbuild:plugin] Expect the setup function of Rsbuild plugin to be a function, but got ${type}.`);
6979
+ throw Error(`${index_js_default().dim('[rsbuild:plugin]')} Expect the setup function of Rsbuild plugin to be a function, but got ${index_js_default().yellow(type)}.`);
6942
6980
  }
6943
6981
  if (before) {
6944
6982
  let index = plugins.findIndex((item)=>item.instance.name === before);
@@ -6984,12 +7022,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6984
7022
  if (context.normalizedConfig) {
6985
7023
  if (null == options ? void 0 : options.environment) {
6986
7024
  let config = context.normalizedConfig.environments[options.environment];
6987
- if (!config) throw Error(`[rsbuild] Cannot find normalized config by environment: ${options.environment}.`);
7025
+ if (!config) throw Error(`${index_js_default().dim('[rsbuild]')} Cannot find normalized config by environment: ${options.environment}.`);
6988
7026
  return config;
6989
7027
  }
6990
7028
  return context.normalizedConfig;
6991
7029
  }
6992
- throw Error('[rsbuild] Cannot access normalized config until modifyRsbuildConfig is called.');
7030
+ throw Error(`${index_js_default().dim('[rsbuild]')} Cannot access normalized config until ${index_js_default().yellow('modifyRsbuildConfig')} is called.`);
6993
7031
  }
6994
7032
  let getRsbuildConfig = (type = 'current')=>{
6995
7033
  switch(type){
@@ -7000,7 +7038,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7000
7038
  case 'normalized':
7001
7039
  return getNormalizedConfig();
7002
7040
  }
7003
- throw Error('[rsbuild] `getRsbuildConfig` get an invalid type param.');
7041
+ throw Error(`${index_js_default().dim('[rsbuild]')} ${index_js_default().yellow('getRsbuildConfig')} get an invalid type param.`);
7004
7042
  }, exposed = [], expose = (id, api)=>{
7005
7043
  exposed.push({
7006
7044
  id,
@@ -7172,11 +7210,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7172
7210
  pluginManager
7173
7211
  }), { distPath } = context, { checkDistDir = !0 } = options;
7174
7212
  if (checkDistDir) {
7175
- if (!(0, external_node_fs_namespaceObject.existsSync)(distPath)) throw Error(`[rsbuild:preview] The output directory ${index_js_default().yellow(distPath)} does not exist, please build the project before previewing.`);
7213
+ if (!(0, external_node_fs_namespaceObject.existsSync)(distPath)) throw Error(`${index_js_default().dim('[rsbuild:preview]')} The output directory ${index_js_default().yellow(distPath)} does not exist, please build the project before previewing.`);
7176
7214
  if (function(path) {
7177
7215
  let files = external_node_fs_default().readdirSync(path);
7178
7216
  return 0 === files.length || 1 === files.length && '.git' === files[0];
7179
- }(distPath)) throw Error(`[rsbuild:preview] The output directory ${index_js_default().yellow(distPath)} is empty, please build the project before previewing.`);
7217
+ }(distPath)) throw Error(`${index_js_default().dim('[rsbuild:preview]')} The output directory ${index_js_default().yellow(distPath)} is empty, please build the project before previewing.`);
7180
7218
  }
7181
7219
  return startProdServer(context, config, options);
7182
7220
  }, build = async (...args)=>{
@@ -7566,11 +7604,11 @@ ${section.body}` : section.body).join("\n\n"));
7566
7604
  }
7567
7605
  process.title = 'rsbuild-node';
7568
7606
  let { npm_execpath } = process.env;
7569
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.21\n`);
7607
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-beta.0\n`);
7570
7608
  try {
7571
7609
  !function() {
7572
7610
  let cli = cac_dist('rsbuild');
7573
- cli.help(), cli.version("1.3.21"), applyCommonOptions(cli);
7611
+ cli.help(), cli.version("1.4.0-beta.0"), applyCommonOptions(cli);
7574
7612
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7575
7613
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7576
7614
  try {
@@ -7621,7 +7659,7 @@ ${section.body}` : section.body).join("\n\n"));
7621
7659
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7622
7660
  }
7623
7661
  }
7624
- let src_version = "1.3.21";
7662
+ let src_version = "1.4.0-beta.0";
7625
7663
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7626
7664
  "PLUGIN_CSS_NAME",
7627
7665
  "PLUGIN_SWC_NAME",