@rsbuild/core 2.0.7 → 2.0.9

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 (91) hide show
  1. package/compiled/css-loader/index.js +2 -2
  2. package/compiled/html-rspack-plugin/index.js +14 -14
  3. package/compiled/postcss/index.js +1 -1
  4. package/compiled/postcss/package.json +1 -1
  5. package/compiled/postcss-loader/index.js +6 -6
  6. package/dist/1~rslib-runtime.js +8 -5
  7. package/dist/{753.js → 756.js} +157 -128
  8. package/dist/client/hmr.js +1 -1
  9. package/dist/client/overlay.js +1 -1
  10. package/dist/http-proxy-middleware.js +2 -5
  11. package/dist/index.js +1 -1
  12. package/dist/launch-editor-middleware.js +1 -1
  13. package/dist/manifest-plugin.js +7 -7
  14. package/dist/memfs.js +5 -5
  15. package/dist/ws.js +45 -31
  16. package/dist-types/build.d.ts +1 -1
  17. package/dist-types/cli/init.d.ts +1 -1
  18. package/dist-types/configChain.d.ts +59 -118
  19. package/dist-types/constants.d.ts +35 -31
  20. package/dist-types/createContext.d.ts +1 -2
  21. package/dist-types/createRsbuild.d.ts +1 -2
  22. package/dist-types/defaultConfig.d.ts +2 -4
  23. package/dist-types/helpers/exitHook.d.ts +1 -1
  24. package/dist-types/helpers/format.d.ts +2 -1
  25. package/dist-types/helpers/fs.d.ts +2 -4
  26. package/dist-types/helpers/index.d.ts +1 -2
  27. package/dist-types/helpers/packageJson.d.ts +1 -1
  28. package/dist-types/helpers/path.d.ts +4 -8
  29. package/dist-types/helpers/stats.d.ts +3 -5
  30. package/dist-types/helpers/url.d.ts +1 -0
  31. package/dist-types/helpers/vendors.d.ts +2 -3
  32. package/dist-types/helpers/version.d.ts +2 -3
  33. package/dist-types/hooks.d.ts +6 -8
  34. package/dist-types/index.d.ts +10 -5
  35. package/dist-types/initConfigs.d.ts +2 -3
  36. package/dist-types/initPlugins.d.ts +1 -1
  37. package/dist-types/inspectConfig.d.ts +1 -1
  38. package/dist-types/loadConfig.d.ts +24 -32
  39. package/dist-types/loadEnv.d.ts +48 -57
  40. package/dist-types/loader/transformRawLoader.d.ts +1 -0
  41. package/dist-types/logger.d.ts +1 -2
  42. package/dist-types/mergeConfig.d.ts +1 -2
  43. package/dist-types/pluginHelper.d.ts +1 -2
  44. package/dist-types/pluginManager.d.ts +4 -7
  45. package/dist-types/plugins/basic.d.ts +1 -2
  46. package/dist-types/plugins/css.d.ts +5 -1
  47. package/dist-types/plugins/externals.d.ts +1 -1
  48. package/dist-types/plugins/fileSize.d.ts +6 -5
  49. package/dist-types/plugins/rspackProfile.d.ts +2 -0
  50. package/dist-types/plugins/server.d.ts +1 -0
  51. package/dist-types/plugins/swc.d.ts +1 -2
  52. package/dist-types/restart.d.ts +4 -5
  53. package/dist-types/rspack-plugins/RsbuildHtmlPlugin.d.ts +2 -3
  54. package/dist-types/rspack-plugins/resource-hints/HtmlResourceHintsPlugin.d.ts +2 -3
  55. package/dist-types/rspack-plugins/resource-hints/doesChunkBelongToHtml.d.ts +3 -4
  56. package/dist-types/rspack-plugins/resource-hints/extractChunks.d.ts +1 -2
  57. package/dist-types/rspack-plugins/resource-hints/getResourceType.d.ts +2 -3
  58. package/dist-types/rspackConfig.d.ts +1 -1
  59. package/dist-types/server/ansiHTML.d.ts +1 -2
  60. package/dist-types/server/assets-middleware/getFileFromUrl.d.ts +1 -2
  61. package/dist-types/server/assets-middleware/index.d.ts +3 -5
  62. package/dist-types/server/assets-middleware/setupWriteToDisk.d.ts +1 -2
  63. package/dist-types/server/browserLogs.d.ts +1 -2
  64. package/dist-types/server/buildManager.d.ts +4 -6
  65. package/dist-types/server/cliShortcuts.d.ts +3 -1
  66. package/dist-types/server/devMiddlewares.d.ts +2 -3
  67. package/dist-types/server/devServer.d.ts +18 -23
  68. package/dist-types/server/gracefulShutdown.d.ts +2 -4
  69. package/dist-types/server/gzipMiddleware.d.ts +1 -1
  70. package/dist-types/server/helper.d.ts +39 -47
  71. package/dist-types/server/historyApiFallback.d.ts +8 -1
  72. package/dist-types/server/httpServer.d.ts +1 -1
  73. package/dist-types/server/middlewares.d.ts +4 -8
  74. package/dist-types/server/open.d.ts +1 -1
  75. package/dist-types/server/runner/basic.d.ts +4 -5
  76. package/dist-types/server/runner/index.d.ts +3 -1
  77. package/dist-types/server/socketServer.d.ts +24 -18
  78. package/dist-types/server/watchFiles.d.ts +1 -1
  79. package/dist-types/types/config.d.ts +1197 -1457
  80. package/dist-types/types/context.d.ts +63 -92
  81. package/dist-types/types/hooks.d.ts +106 -150
  82. package/dist-types/types/plugin.d.ts +359 -444
  83. package/dist-types/types/rsbuild.d.ts +156 -191
  84. package/dist-types/types/thirdParty.d.ts +101 -132
  85. package/dist-types/types/utils.d.ts +2 -5
  86. package/package.json +10 -10
  87. package/dist-types/client/hmr.d.ts +0 -3
  88. package/dist-types/client/log.d.ts +0 -13
  89. package/dist-types/client/overlay.d.ts +0 -1
  90. /package/dist/{753.js.LICENSE.txt → 756.js.LICENSE.txt} +0 -0
  91. /package/dist/client/{797.js → 60.js} +0 -0
@@ -1,11 +1,11 @@
1
- /*! LICENSE: 753.js.LICENSE.txt */
1
+ /*! LICENSE: 756.js.LICENSE.txt */
2
2
  let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
3
3
  import { rspack as core_rspack } from "@rspack/core";
4
4
  import node_util, { stripVTControlCharacters } from "node:util";
5
5
  import node_process from "node:process";
6
6
  import node_os, { constants as external_node_os_constants } from "node:os";
7
7
  import node_tty from "node:tty";
8
- import node_path, { dirname as external_node_path_dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, sep, win32 } from "node:path";
8
+ import node_path, { dirname as external_node_path_dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, resolve as external_node_path_resolve, sep, win32 } from "node:path";
9
9
  import { builtinModules, createRequire, createRequire as __rspack_createRequire } from "node:module";
10
10
  import node_fs, { existsSync } from "node:fs";
11
11
  import { URL as external_node_url_URL, pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
@@ -385,8 +385,8 @@ __webpack_require__.add({
385
385
  return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
386
386
  }
387
387
  },
388
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
389
- let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/req.js");
388
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
389
+ let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
390
390
  async function processResult(ctx, result) {
391
391
  let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
392
392
  default: obj
@@ -459,8 +459,8 @@ __webpack_require__.add({
459
459
  });
460
460
  };
461
461
  },
462
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
463
- let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/req.js");
462
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
463
+ let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
464
464
  module.exports = async function options(config, file) {
465
465
  if (config.parser && 'string' == typeof config.parser) try {
466
466
  config.parser = await req(config.parser, file);
@@ -480,8 +480,8 @@ __webpack_require__.add({
480
480
  return config;
481
481
  };
482
482
  },
483
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
484
- let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/req.js");
483
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
484
+ let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js");
485
485
  async function load(plugin, options, file) {
486
486
  try {
487
487
  if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
@@ -497,7 +497,7 @@ __webpack_require__.add({
497
497
  }), list;
498
498
  };
499
499
  },
500
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
500
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
501
501
  let tsx, jiti;
502
502
  var __filename = __rspack_fileURLToPath(import.meta.url);
503
503
  let { createRequire } = __webpack_require__("node:module?1bcb"), { pathToFileURL } = __webpack_require__("node:url?b4ec"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
@@ -602,6 +602,9 @@ __webpack_require__.add({
602
602
  },
603
603
  events (module) {
604
604
  module.exports = __rspack_createRequire_require("node:events");
605
+ },
606
+ "supports-color" (module) {
607
+ module.exports = __rspack_createRequire_require("supports-color");
605
608
  }
606
609
  }), function checkNodeVersion() {
607
610
  let { versions } = process;
@@ -3482,7 +3485,7 @@ function createPublicContext(context) {
3482
3485
  async function createContext(options, userConfig, logger) {
3483
3486
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
3484
3487
  return {
3485
- version: "2.0.7",
3488
+ version: "2.0.9",
3486
3489
  rootPath,
3487
3490
  distPath: '',
3488
3491
  cachePath,
@@ -3597,28 +3600,28 @@ async function inspectConfig_inspectConfig({ context, pluginManager, bundlerConf
3597
3600
  };
3598
3601
  }
3599
3602
  let dist_isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
3600
- function reduceConfigs({ initial, config, mergeFn = Object.assign }) {
3601
- return null == config ? initial : dist_isPlainObject(config) ? dist_isPlainObject(initial) ? mergeFn(initial, config) : config : 'function' == typeof config ? config(initial) ?? initial : Array.isArray(config) ? config.reduce((initial, config)=>reduceConfigs({
3602
- initial,
3603
- config,
3604
- mergeFn
3605
- }), initial) : config ?? initial;
3606
- }
3607
- function reduceConfigsWithContext({ initial, config, ctx, mergeFn = Object.assign }) {
3608
- return null == config ? initial : dist_isPlainObject(config) ? dist_isPlainObject(initial) ? mergeFn(initial, config) : config : 'function' == typeof config ? config(initial, ctx) ?? initial : Array.isArray(config) ? config.reduce((initial, config)=>reduceConfigsWithContext({
3609
- initial,
3610
- config,
3611
- ctx,
3603
+ async function reduceConfigs({ initial, config, mergeFn = Object.assign }) {
3604
+ if (null == config) return initial;
3605
+ if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
3606
+ if ('function' == typeof config) return await config(initial) ?? initial;
3607
+ if (Array.isArray(config)) {
3608
+ let result = initial;
3609
+ for (let item of config)result = await reduceConfigs({
3610
+ initial: result,
3611
+ config: item,
3612
3612
  mergeFn
3613
- }), initial) : config ?? initial;
3613
+ });
3614
+ return result;
3615
+ }
3616
+ return config ?? initial;
3614
3617
  }
3615
- async function reduceConfigsAsyncWithContext({ initial, config, ctx, mergeFn = Object.assign }) {
3618
+ async function reduceConfigsWithContext({ initial, config, ctx, mergeFn = Object.assign }) {
3616
3619
  if (null == config) return initial;
3617
3620
  if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
3618
3621
  if ('function' == typeof config) return await config(initial, ctx) ?? initial;
3619
3622
  if (Array.isArray(config)) {
3620
3623
  let result = initial;
3621
- for (let item of config)result = await reduceConfigsAsyncWithContext({
3624
+ for (let item of config)result = await reduceConfigsWithContext({
3622
3625
  initial: result,
3623
3626
  config: item,
3624
3627
  ctx,
@@ -3628,16 +3631,24 @@ async function reduceConfigsAsyncWithContext({ initial, config, ctx, mergeFn = O
3628
3631
  }
3629
3632
  return config ?? initial;
3630
3633
  }
3631
- function reduceConfigsMergeContext({ initial, config, ctx, mergeFn = Object.assign }) {
3632
- return null == config ? initial : dist_isPlainObject(config) ? dist_isPlainObject(initial) ? mergeFn(initial, config) : config : 'function' == typeof config ? config({
3634
+ async function reduceConfigsWithMergedContext({ initial, config, ctx, mergeFn = Object.assign }) {
3635
+ if (null == config) return initial;
3636
+ if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
3637
+ if ('function' == typeof config) return await config({
3633
3638
  value: initial,
3634
3639
  ...ctx
3635
- }) ?? initial : Array.isArray(config) ? config.reduce((initial, config)=>reduceConfigsMergeContext({
3636
- initial,
3637
- config,
3640
+ }) ?? initial;
3641
+ if (Array.isArray(config)) {
3642
+ let result = initial;
3643
+ for (let item of config)result = await reduceConfigsWithMergedContext({
3644
+ initial: result,
3645
+ config: item,
3638
3646
  ctx,
3639
3647
  mergeFn
3640
- }), initial) : config ?? initial;
3648
+ });
3649
+ return result;
3650
+ }
3651
+ return config ?? initial;
3641
3652
  }
3642
3653
  function mergeTo(a, b, customizer) {
3643
3654
  let ret = {};
@@ -3822,7 +3833,7 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
3822
3833
  }
3823
3834
  }), utils.environment.config.tools?.rspack) {
3824
3835
  let toolsRspackConfig = utils.environment.config.tools.rspack;
3825
- currentConfig = await reduceConfigsAsyncWithContext({
3836
+ currentConfig = await reduceConfigsWithContext({
3826
3837
  initial: currentConfig,
3827
3838
  config: toolsRspackConfig,
3828
3839
  ctx: utils,
@@ -4465,9 +4476,9 @@ function parseMinifyOptions(config) {
4465
4476
  cssOptions: minify.cssOptions
4466
4477
  };
4467
4478
  }
4468
- let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.14/node_modules/postcss-load-config/src/index.js");
4479
+ let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.7.0_postcss@8.5.15/node_modules/postcss-load-config/src/index.js");
4469
4480
  var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
4470
- function getLightningCSSLoaderOptions(config, targets, minify) {
4481
+ async function getLightningCSSLoaderOptions(config, targets, minify) {
4471
4482
  let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
4472
4483
  targets,
4473
4484
  errorRecovery: !0
@@ -4498,12 +4509,12 @@ async function loadUserPostcssrc(root, postcssrcCache) {
4498
4509
  let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
4499
4510
  let extraPlugins = [], userOptions = await loadUserPostcssrc(root, postcssrcCache);
4500
4511
  userOptions.plugins ||= [];
4501
- let finalOptions = reduceConfigsWithContext({
4502
- initial: {
4503
- implementation: join(COMPILED_PATH, 'postcss', 'index.js'),
4504
- postcssOptions: userOptions,
4505
- sourceMap: getCSSSourceMap(config)
4506
- },
4512
+ let defaultOptions = {
4513
+ implementation: join(COMPILED_PATH, 'postcss', 'index.js'),
4514
+ postcssOptions: userOptions,
4515
+ sourceMap: getCSSSourceMap(config)
4516
+ }, finalOptions = await reduceConfigsWithContext({
4517
+ initial: defaultOptions,
4507
4518
  config: config.tools.postcss,
4508
4519
  ctx: {
4509
4520
  addPlugins (plugins, options = {}) {
@@ -4533,6 +4544,36 @@ let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
4533
4544
  };
4534
4545
  }
4535
4546
  return finalOptions.postcssOptions = updatePostcssOptions(postcssOptions), finalOptions;
4547
+ }, getCSSLoaderOptions = async ({ config, localIdentName, emitCss })=>{
4548
+ let { cssModules } = config.output, defaultOptions = {
4549
+ modules: {
4550
+ ...cssModules,
4551
+ localIdentName
4552
+ },
4553
+ sourceMap: getCSSSourceMap(config)
4554
+ };
4555
+ return ((options, exportOnlyLocals)=>{
4556
+ if (options.modules && exportOnlyLocals) {
4557
+ let { modules } = options;
4558
+ return modules = !0 === modules ? {
4559
+ exportOnlyLocals: !0
4560
+ } : 'string' == typeof modules ? {
4561
+ mode: modules,
4562
+ exportOnlyLocals: !0
4563
+ } : {
4564
+ ...modules,
4565
+ exportOnlyLocals: !0
4566
+ }, {
4567
+ ...options,
4568
+ modules
4569
+ };
4570
+ }
4571
+ return options;
4572
+ })(await reduceConfigs({
4573
+ initial: defaultOptions,
4574
+ config: config.tools.cssLoader,
4575
+ mergeFn: cjs_0_default()
4576
+ }), !emitCss);
4536
4577
  };
4537
4578
  function checkProcessEnvSecurity(define, logger) {
4538
4579
  let value = define['process.env'];
@@ -4546,8 +4587,7 @@ function checkProcessEnvSecurity(define, logger) {
4546
4587
  check(JSON.parse(value));
4547
4588
  } catch {}
4548
4589
  }
4549
- let readPackageJson = async (rootPath)=>{
4550
- let pkgJsonPath = join(rootPath, 'package.json');
4590
+ let readPackageJsonByPath = async (pkgJsonPath)=>{
4551
4591
  if (await isFileExists(pkgJsonPath)) try {
4552
4592
  return JSON.parse(await readFile(pkgJsonPath, 'utf8'));
4553
4593
  } catch {
@@ -4570,29 +4610,42 @@ let readPackageJson = async (rootPath)=>{
4570
4610
  ...!0 === autoExternal ? {} : autoExternal
4571
4611
  };
4572
4612
  return dependencyTypes.some((type)=>externalOptions[type]) ? externalOptions : void 0;
4613
+ }, readPackageJsonList = async (paths, cache)=>{
4614
+ var packageJsonList = (await Promise.all(paths.map(async (path)=>(cache.has(path) || cache.set(path, await readPackageJsonByPath(path)), cache.get(path))))).filter((pkgJson)=>!!pkgJson);
4615
+ return packageJsonList.length ? dependencyTypes.reduce((merged, type)=>{
4616
+ for (let pkgJson of packageJsonList){
4617
+ let deps = pkgJson[type];
4618
+ isPlainObject(deps) && (merged[type] = {
4619
+ ...merged[type],
4620
+ ...deps
4621
+ });
4622
+ }
4623
+ return merged;
4624
+ }, {}) : void 0;
4573
4625
  };
4574
4626
  function pluginExternals() {
4575
4627
  return {
4576
4628
  name: 'rsbuild:externals',
4577
4629
  setup (api) {
4578
- let pkgJson, hasReadPackageJson = !1, hasWarnedReadPackageJsonFailed = !1;
4630
+ let packageJsonCache = new Map(), hasWarnedReadPackageJsonFailed = !1;
4579
4631
  api.modifyBundlerChain(async (chain, { environment })=>{
4580
- let { autoExternal, externals } = environment.config.output, externalOptions = resolveAutoExternalOptions(autoExternal);
4581
- externalOptions && !hasReadPackageJson && (pkgJson = await readPackageJson(api.context.rootPath), hasReadPackageJson = !0), !externalOptions || pkgJson || hasWarnedReadPackageJsonFailed || (api.logger.warn('The `output.autoExternal` configuration will not be applied because reading package.json failed.'), hasWarnedReadPackageJsonFailed = !0);
4632
+ let pkgJson, { autoExternal, externals } = environment.config.output, externalOptions = resolveAutoExternalOptions(autoExternal);
4633
+ if (externalOptions) {
4634
+ let rootPath, packageJsonPaths = (rootPath = api.context.rootPath, helpers_castArray(externalOptions.packageJson ?? 'package.json').map((path)=>external_node_path_resolve(rootPath, path)));
4635
+ pkgJson = await readPackageJsonList(packageJsonPaths, packageJsonCache);
4636
+ }
4637
+ !externalOptions || pkgJson || hasWarnedReadPackageJsonFailed || (api.logger.warn('The `output.autoExternal` configuration will not be applied because reading package.json failed.'), hasWarnedReadPackageJsonFailed = !0);
4582
4638
  let autoExternalRules = ((options)=>{
4583
4639
  let { autoExternal, pkgJson, userExternals } = options, externalOptions = resolveAutoExternalOptions(autoExternal);
4584
4640
  if (!externalOptions || !pkgJson) return;
4585
- let userExternalKeys = isPlainObject(userExternals) ? Object.keys(userExternals) : [], uniqueExternals = Array.from(new Set(dependencyTypes.reduce((prev, type)=>{
4641
+ let userExternalKeys = isPlainObject(userExternals) ? Object.keys(userExternals) : [], excludeConditions = externalOptions.exclude ? helpers_castArray(externalOptions.exclude) : void 0, uniqueExternals = Array.from(new Set(dependencyTypes.reduce((prev, type)=>{
4586
4642
  if (externalOptions[type]) {
4587
4643
  let deps = pkgJson[type];
4588
4644
  return isPlainObject(deps) ? prev.concat(Object.keys(deps)) : prev;
4589
4645
  }
4590
4646
  return prev;
4591
- }, []).filter((name)=>!userExternalKeys.includes(name))));
4592
- return uniqueExternals.length ? [
4593
- ...uniqueExternals.map((dep)=>RegExp(`^${dep.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')}($|\/|\\\\)`)),
4594
- ...uniqueExternals
4595
- ] : void 0;
4647
+ }, []).filter((name)=>!userExternalKeys.includes(name) && (!excludeConditions || !excludeConditions.some((condition)=>'string' == typeof condition ? condition === name : condition instanceof RegExp && (condition.global || condition.sticky ? new RegExp(condition) : condition).test(name))))));
4648
+ if (uniqueExternals.length) return uniqueExternals.map((dep)=>RegExp(`^${dep.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')}(?:$|[/\\\\])`));
4596
4649
  })({
4597
4650
  autoExternal,
4598
4651
  pkgJson,
@@ -4997,7 +5050,7 @@ class RsbuildHtmlPlugin {
4997
5050
  }
4998
5051
  }
4999
5052
  function getTitle(entryName, config) {
5000
- return reduceConfigsMergeContext({
5053
+ return reduceConfigsWithMergedContext({
5001
5054
  initial: '',
5002
5055
  config: config.html.title,
5003
5056
  ctx: {
@@ -5006,7 +5059,7 @@ function getTitle(entryName, config) {
5006
5059
  });
5007
5060
  }
5008
5061
  function getInject(entryName, config) {
5009
- return reduceConfigsMergeContext({
5062
+ return reduceConfigsWithMergedContext({
5010
5063
  initial: 'head',
5011
5064
  config: config.html.inject,
5012
5065
  ctx: {
@@ -5016,7 +5069,7 @@ function getInject(entryName, config) {
5016
5069
  }
5017
5070
  let existTemplatePath = new Set();
5018
5071
  async function getTemplate(entryName, config, rootPath) {
5019
- let templatePath = reduceConfigsMergeContext({
5072
+ let templatePath = await reduceConfigsWithMergedContext({
5020
5073
  initial: '',
5021
5074
  config: config.html.template,
5022
5075
  ctx: {
@@ -5042,7 +5095,7 @@ async function getTemplate(entryName, config, rootPath) {
5042
5095
  };
5043
5096
  }
5044
5097
  function getFavicon(entryName, config) {
5045
- return reduceConfigsMergeContext({
5098
+ return reduceConfigsWithMergedContext({
5046
5099
  initial: '',
5047
5100
  config: config.html.favicon,
5048
5101
  ctx: {
@@ -5050,8 +5103,8 @@ function getFavicon(entryName, config) {
5050
5103
  }
5051
5104
  });
5052
5105
  }
5053
- function getMetaTags(entryName, config, templateContent) {
5054
- let metaTags = reduceConfigsMergeContext({
5106
+ async function getMetaTags(entryName, config, templateContent) {
5107
+ let metaTags = await reduceConfigsWithMergedContext({
5055
5108
  initial: {},
5056
5109
  config: config.html.meta,
5057
5110
  ctx: {
@@ -5061,7 +5114,7 @@ function getMetaTags(entryName, config, templateContent) {
5061
5114
  return templateContent && metaTags.charset && /<meta[^>]+charset=["'][^>]*>/i.test(templateContent) && delete metaTags.charset, metaTags;
5062
5115
  }
5063
5116
  function getTemplateParameters(entryName, config, assetPrefix) {
5064
- return (compilation, assets, assetTags, pluginOptions)=>{
5117
+ return async (compilation, assets, assetTags, pluginOptions)=>{
5065
5118
  let { mountId, templateParameters } = config.html, rspackConfig = compilation.options;
5066
5119
  return reduceConfigsWithContext({
5067
5120
  initial: {
@@ -5120,10 +5173,9 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
5120
5173
  if (prefix?.startsWith('./') && (prefix = prefix.replace('./', '')), !prefix) return '/';
5121
5174
  let hasLeadingSlash = prefix.startsWith('/'), hasTailSlash = prefix.endsWith('/');
5122
5175
  return `${hasLeadingSlash ? '' : '/'}${prefix}${hasTailSlash ? '' : '/'}`;
5123
- }, joinUrlSegments = (s1, s2)=>s1 && s2 ? addTrailingSlash(s1) + s2.replace(/^\/+/, '') : s1 || s2 || '', stripBase = (path, base)=>{
5124
- if (path === base) return '/';
5125
- let trailingSlashBase = addTrailingSlash(base);
5126
- return path.startsWith(trailingSlashBase) ? path.slice(trailingSlashBase.length - 1) : path;
5176
+ }, joinUrlPath = (basePath, pathname)=>'' === basePath ? pathname : '' === pathname ? basePath : addTrailingSlash(basePath) + pathname.replace(/^\/+/, ''), removeBasePath = (url, base)=>{
5177
+ let basePath = base.replace(/\/+$/, '');
5178
+ return '' === basePath ? url : url === basePath ? '/' : url.startsWith(`${basePath}/`) ? url.slice(basePath.length) : url;
5127
5179
  }, getRoutes = (context)=>{
5128
5180
  let environmentWithHtml = context.environmentList.filter((item)=>Object.keys(item.htmlPaths).length > 0);
5129
5181
  if (0 === environmentWithHtml.length) return [];
@@ -5133,7 +5185,7 @@ let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (inp
5133
5185
  return prev.concat(...routes);
5134
5186
  }, []);
5135
5187
  }, formatRoutes = (entry, base, distPathPrefix, outputStructure)=>{
5136
- let prefix = joinUrlSegments(base, formatPrefix(distPathPrefix));
5188
+ let prefix = joinUrlPath(base, formatPrefix(distPathPrefix));
5137
5189
  return Object.keys(entry).map((entryName)=>({
5138
5190
  entryName,
5139
5191
  pathname: prefix + ('index' === entryName && 'nested' !== outputStructure ? '' : entryName)
@@ -5304,13 +5356,19 @@ let supportedChromiumBrowsers = [
5304
5356
  async function openBrowser(url, logger) {
5305
5357
  let browser = process.env.BROWSER, browserArgs = process.env.BROWSER_ARGS;
5306
5358
  if ('darwin' === process.platform && (!browser || !browserArgs) && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)))) {
5307
- let { exec } = await import("node:child_process"), { promisify } = await import("node:util"), execAsync = promisify(exec), getDefaultBrowserForAppleScript = async ()=>{
5308
- let { stdout: ps } = await execAsync('ps cax');
5359
+ let { execFile } = await import("node:child_process"), { promisify } = await import("node:util"), execFileAsync = promisify(execFile), getDefaultBrowserForAppleScript = async ()=>{
5360
+ let { stdout: ps } = await execFileAsync('ps', [
5361
+ 'cax'
5362
+ ]);
5309
5363
  return supportedChromiumBrowsers.find((b)=>ps.includes(b));
5310
5364
  };
5311
5365
  try {
5312
5366
  let chromiumBrowser = browser ? mapChromiumBrowserName(browser) : await getDefaultBrowserForAppleScript();
5313
- if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
5367
+ if (chromiumBrowser) return await execFileAsync("osascript", [
5368
+ "openChrome.applescript",
5369
+ encodeURI(url),
5370
+ chromiumBrowser
5371
+ ], {
5314
5372
  cwd: STATIC_PATH
5315
5373
  }), !0;
5316
5374
  logger.debug('failed to find the target browser.');
@@ -5436,8 +5494,8 @@ function getPublicPath({ isDev, config, context }) {
5436
5494
  let defaultPort = server.port ?? 3000;
5437
5495
  return formatPublicPath(replacePortPlaceholder(publicPath, isDev ? context.devServer?.port ?? defaultPort : defaultPort));
5438
5496
  }
5439
- function applyAlias({ chain, config, rootPath, logger }) {
5440
- let mergedAlias = reduceConfigs({
5497
+ async function applyAlias({ chain, config, rootPath, logger }) {
5498
+ let mergedAlias = await reduceConfigs({
5441
5499
  initial: {},
5442
5500
  config: config.resolve.alias
5443
5501
  });
@@ -6941,13 +6999,14 @@ let faviconFallbackMiddleware = (req, res, next)=>{
6941
6999
  let { accept } = req.headers;
6942
7000
  return 'string' == typeof accept && (accept.includes('text/html') || accept.includes('*/*'));
6943
7001
  }, postfixRE = /[?#].*$/, getBaseUrlMiddleware = ({ base })=>function baseUrlMiddleware(req, res, next) {
6944
- let url = req.url, pathname = url.replace(postfixRE, '');
6945
- if (pathname.startsWith(base)) {
6946
- req.url = stripBase(url, base), next();
7002
+ var pathname;
7003
+ let basePath, url = req.url, pathname1 = url.replace(postfixRE, '');
7004
+ if (pathname = pathname1, '' === (basePath = base.replace(/\/+$/, '')) || pathname === basePath || pathname.startsWith(`${basePath}/`)) {
7005
+ req.url = removeBasePath(url, base), next();
6947
7006
  return;
6948
7007
  }
6949
- let redirectPath = addTrailingSlash(url) !== base ? joinUrlSegments(base, url) : base;
6950
- if ('/' === pathname || '/index.html' === pathname) {
7008
+ let redirectPath = addTrailingSlash(url) !== base ? joinUrlPath(base, url) : base;
7009
+ if ('/' === pathname1 || '/index.html' === pathname1) {
6951
7010
  res.writeHead(302, {
6952
7011
  Location: redirectPath
6953
7012
  }), res.end();
@@ -7536,7 +7595,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7536
7595
  let publicPaths = compiler_isMultiCompiler(compiler) ? compiler.compilers.map(getPublicPathFromCompiler) : [
7537
7596
  getPublicPathFromCompiler(compiler)
7538
7597
  ], { base } = config.server;
7539
- context.publicPathnames = publicPaths.map(getPathnameFromUrl).map((prefix)=>base && '/' !== base ? stripBase(prefix, base) : prefix), compiler?.hooks.watchRun.tap('rsbuild:watchRun', ()=>{
7598
+ context.publicPathnames = publicPaths.map(getPathnameFromUrl).map((prefix)=>base && '/' !== base ? removeBasePath(prefix, base) : prefix), compiler?.hooks.watchRun.tap('rsbuild:watchRun', ()=>{
7540
7599
  lastStats && (waitLastCompileDoneResolve && (waitLastCompileDoneResolve(), waitLastCompileDoneResolve = null), waitLastCompileDone = new Promise((resolve)=>{
7541
7600
  waitLastCompileDoneResolve = resolve;
7542
7601
  }));
@@ -7998,7 +8057,7 @@ function applyDefaultPlugins(pluginManager, context) {
7998
8057
  setup (api) {
7999
8058
  api.modifyBundlerChain({
8000
8059
  order: 'pre',
8001
- handler: (chain, { environment, CHAIN_ID })=>{
8060
+ handler: async (chain, { environment, CHAIN_ID })=>{
8002
8061
  let { config, tsconfigPath } = environment, { extensions, conditionNames, mainFields } = config.resolve;
8003
8062
  chain.resolve.extensions.merge([
8004
8063
  ...extensions
@@ -8013,7 +8072,7 @@ function applyDefaultPlugins(pluginManager, context) {
8013
8072
  ]).set('.jsx', [
8014
8073
  '.jsx',
8015
8074
  '.tsx'
8016
- ]), applyAlias({
8075
+ ]), await applyAlias({
8017
8076
  chain,
8018
8077
  config,
8019
8078
  rootPath: api.context.rootPath,
@@ -8155,8 +8214,8 @@ function applyDefaultPlugins(pluginManager, context) {
8155
8214
  let { config, htmlPaths } = environment;
8156
8215
  if (0 === Object.keys(htmlPaths).length) return;
8157
8216
  let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]), extraDataMap = new Map(), finalOptions = await Promise.all(entryNames.map(async (entryName)=>{
8158
- let entryValue = entries[entryName].values(), chunks = getChunks(entryName, entryValue), inject = getInject(entryName, config), filename = htmlPaths[entryName], { templatePath, templateContent } = await getTemplate(entryName, config, api.context.rootPath), templateParameters = getTemplateParameters(entryName, config, assetPrefix), pluginOptions = {
8159
- meta: getMetaTags(entryName, config, templateContent),
8217
+ let entryValue = entries[entryName].values(), chunks = getChunks(entryName, entryValue), inject = await getInject(entryName, config), filename = htmlPaths[entryName], { templatePath, templateContent } = await getTemplate(entryName, config, api.context.rootPath), templateParameters = getTemplateParameters(entryName, config, assetPrefix), pluginOptions = {
8218
+ meta: await getMetaTags(entryName, config, templateContent),
8160
8219
  chunks,
8161
8220
  inject,
8162
8221
  filename,
@@ -8181,8 +8240,8 @@ function applyDefaultPlugins(pluginManager, context) {
8181
8240
  tags
8182
8241
  };
8183
8242
  })(environment.config);
8184
- tagConfig && (extraData.tagConfig = tagConfig), pluginOptions.title = getTitle(entryName, config);
8185
- let favicon = getFavicon(entryName, config) || (()=>{
8243
+ tagConfig && (extraData.tagConfig = tagConfig), pluginOptions.title = await getTitle(entryName, config);
8244
+ let favicon = await getFavicon(entryName, config) || (()=>{
8186
8245
  if (defaultFavicon) return defaultFavicon;
8187
8246
  let { publicDir } = api.getNormalizedConfig().server, extensions = [
8188
8247
  'ico',
@@ -8194,7 +8253,7 @@ function applyDefaultPlugins(pluginManager, context) {
8194
8253
  return faviconPath && (defaultFavicon = faviconPath), defaultFavicon;
8195
8254
  })();
8196
8255
  favicon && (extraData.favicon = favicon);
8197
- let finalOptions = reduceConfigsWithContext({
8256
+ let finalOptions = await reduceConfigsWithContext({
8198
8257
  initial: pluginOptions,
8199
8258
  config: 'boolean' == typeof config.tools.htmlPlugin ? {} : config.tools.htmlPlugin,
8200
8259
  ctx: {
@@ -8431,7 +8490,7 @@ try {
8431
8490
  cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
8432
8491
  let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN), emitCss = config.output.emitCss ?? 'web' === target;
8433
8492
  if (emitCss) if (config.output.injectStyles) {
8434
- let styleLoaderOptions = reduceConfigs({
8493
+ let styleLoaderOptions = await reduceConfigs({
8435
8494
  initial: {},
8436
8495
  config: config.tools.styleLoader
8437
8496
  });
@@ -8441,10 +8500,10 @@ try {
8441
8500
  let importLoaders = {
8442
8501
  normal: 0,
8443
8502
  inline: 0
8444
- }, updateRules = (callback, options = {})=>{
8445
- options.skipMain || callback(mainRule, 'main'), callback(inlineRule, 'inline'), callback(urlRule, 'url');
8503
+ }, updateRules = async (callback, options = {})=>{
8504
+ options.skipMain || await callback(mainRule, 'main'), await callback(inlineRule, 'inline'), await callback(urlRule, 'url');
8446
8505
  }, cssLoaderPath = join(COMPILED_PATH, 'css-loader', 'index.js');
8447
- if (updateRules((rule)=>{
8506
+ if (await updateRules((rule)=>{
8448
8507
  rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
8449
8508
  }), !1 !== config.tools.lightningcssLoader) {
8450
8509
  emitCss && importLoaders.normal++, importLoaders.inline++;
@@ -8453,8 +8512,8 @@ try {
8453
8512
  let webEnvironment = Object.values(environments).find((env)=>'web' === env.config.output.target);
8454
8513
  webEnvironment && (browserslist = webEnvironment.browserslist, minifyCss = parseMinifyOptions(webEnvironment.config).minifyCss);
8455
8514
  }
8456
- updateRules((rule, type)=>{
8457
- let minify = ('inline' === type || 'url' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = getLightningCSSLoaderOptions(config, browserslist, minify);
8515
+ await updateRules(async (rule, type)=>{
8516
+ let minify = ('inline' === type || 'url' === type || config.output.injectStyles) && minifyCss, lightningcssOptions = await getLightningCSSLoaderOptions(config, browserslist, minify);
8458
8517
  rule.use(CHAIN_ID.USE.LIGHTNINGCSS).loader('builtin:lightningcss-loader').options(lightningcssOptions);
8459
8518
  }, {
8460
8519
  skipMain: !emitCss
@@ -8468,48 +8527,18 @@ try {
8468
8527
  if ('function' == typeof postcssLoaderOptions.postcssOptions || postcssLoaderOptions.postcssOptions?.plugins?.length) {
8469
8528
  emitCss && importLoaders.normal++, importLoaders.inline++;
8470
8529
  let postcssLoaderPath = join(COMPILED_PATH, 'postcss-loader', 'index.js');
8471
- updateRules((rule)=>{
8530
+ await updateRules((rule)=>{
8472
8531
  rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
8473
8532
  }, {
8474
8533
  skipMain: !emitCss
8475
8534
  });
8476
8535
  }
8477
- let localIdentName = config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), cssLoaderOptions = (({ config, localIdentName, emitCss })=>{
8478
- let { cssModules } = config.output;
8479
- return ((options, exportOnlyLocals)=>{
8480
- if (options.modules && exportOnlyLocals) {
8481
- let { modules } = options;
8482
- return modules = !0 === modules ? {
8483
- exportOnlyLocals: !0
8484
- } : 'string' == typeof modules ? {
8485
- mode: modules,
8486
- exportOnlyLocals: !0
8487
- } : {
8488
- ...modules,
8489
- exportOnlyLocals: !0
8490
- }, {
8491
- ...options,
8492
- modules
8493
- };
8494
- }
8495
- return options;
8496
- })(reduceConfigs({
8497
- initial: {
8498
- modules: {
8499
- ...cssModules,
8500
- localIdentName
8501
- },
8502
- sourceMap: getCSSSourceMap(config)
8503
- },
8504
- config: config.tools.cssLoader,
8505
- mergeFn: cjs_0_default()
8506
- }), !emitCss);
8507
- })({
8536
+ let localIdentName = config.output.cssModules.localIdentName || (isProd ? '[local]-[hash:base64:6]' : '[path][name]__[local]-[hash:base64:6]'), cssLoaderOptions = await getCSSLoaderOptions({
8508
8537
  config,
8509
8538
  localIdentName,
8510
8539
  emitCss
8511
8540
  });
8512
- updateRules((rule, type)=>{
8541
+ await updateRules((rule, type)=>{
8513
8542
  let finalOptions = cssLoaderOptions;
8514
8543
  finalOptions = 'inline' === type || 'url' === type ? {
8515
8544
  ...cssLoaderOptions,
@@ -8550,12 +8579,12 @@ try {
8550
8579
  {
8551
8580
  name: 'rsbuild:minimize',
8552
8581
  setup (api) {
8553
- api.modifyBundlerChain((chain, { environment, CHAIN_ID, rspack })=>{
8582
+ api.modifyBundlerChain(async (chain, { environment, CHAIN_ID, rspack })=>{
8554
8583
  let { config } = environment, { minifyJs, minifyCss, jsOptions, cssOptions } = parseMinifyOptions(config);
8555
8584
  if (chain.optimization.minimize(minifyJs || minifyCss), minifyJs && chain.optimization.minimizer(CHAIN_ID.MINIMIZER.JS).use(rspack.SwcJsMinimizerRspackPlugin, [
8556
8585
  getSwcMinimizerOptions(config, jsOptions)
8557
8586
  ]).end(), minifyCss) {
8558
- let loaderOptions = getLightningCSSLoaderOptions(config, environment.browserslist, !0), defaultOptions = {
8587
+ let loaderOptions = await getLightningCSSLoaderOptions(config, environment.browserslist, !0), defaultOptions = {
8559
8588
  minimizerOptions: {
8560
8589
  targets: isPlainObject(loaderOptions.targets) ? environment.browserslist : loaderOptions.targets,
8561
8590
  ...pick(loaderOptions, [
@@ -8608,7 +8637,7 @@ try {
8608
8637
  setup (api) {
8609
8638
  api.modifyBundlerChain({
8610
8639
  order: 'pre',
8611
- handler: (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
8640
+ handler: async (chain, { CHAIN_ID, isDev, isProd, target, environment })=>{
8612
8641
  let { config, browserslist } = environment, cacheRoot = node_path.join(api.context.cachePath, '.swc'), rule = chain.module.rule(CHAIN_ID.RULE.JS).test(SCRIPT_REGEX).dependency({
8613
8642
  not: 'url'
8614
8643
  });
@@ -8642,7 +8671,7 @@ try {
8642
8671
  ])item.resolve.alias.set('core-js', coreJsDir);
8643
8672
  }
8644
8673
  }
8645
- let mergedConfig = reduceConfigs({
8674
+ let mergedConfig = await reduceConfigs({
8646
8675
  initial: swcConfig,
8647
8676
  config: config.tools.swc,
8648
8677
  mergeFn: cjs_0_default()
@@ -8920,7 +8949,7 @@ try {
8920
8949
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
8921
8950
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
8922
8951
  if (!1 === manifest) return;
8923
- let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.4/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8952
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.5/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8924
8953
  manifestFilenames.set(environment.name, manifestOptions.filename);
8925
8954
  let pluginOptions = {
8926
8955
  fileName: manifestOptions.filename,
@@ -9434,7 +9463,7 @@ let applyServerOptions = (command)=>{
9434
9463
  };
9435
9464
  function setupCommands() {
9436
9465
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9437
- cli.version("2.0.7"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9466
+ cli.version("2.0.9"), cli.option('--base <base>', 'Set the base path of the server').option('-c, --config <config>', 'Set the configuration file (relative or absolute path)').option('--config-loader <loader>', 'Set the config file loader (auto | jiti | native)', {
9438
9467
  default: 'auto'
9439
9468
  }).option('--env-dir <dir>', 'Set the directory for loading `.env` files').option('--env-mode <mode>', 'Set the env mode to load the `.env.[mode]` file').option('--environment <name>', 'Set the environment name(s) to build', {
9440
9469
  type: [
@@ -9505,7 +9534,7 @@ function initNodeEnv(command) {
9505
9534
  }
9506
9535
  function showGreeting() {
9507
9536
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9508
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.7\n`);
9537
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.9\n`);
9509
9538
  }
9510
9539
  function setupLogLevel() {
9511
9540
  if (cli_argv.length <= 3) return;
@@ -9527,5 +9556,5 @@ function runCLI() {
9527
9556
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
9528
9557
  }
9529
9558
  }
9530
- let src_version = "2.0.7";
9559
+ let src_version = "2.0.9";
9531
9560
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };
@@ -1,4 +1,4 @@
1
- import { logger } from "./797.js";
1
+ import { logger } from "./60.js";
2
2
  let createOverlay;
3
3
  let clearOverlay;
4
4
  const getErrorField = (error, field)=>{