@rsbuild/core 1.3.5 → 1.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -102,8 +102,8 @@ var __webpack_modules__ = {
102
102
  return options;
103
103
  };
104
104
  },
105
- "../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js": function(module, __unused_webpack_exports, __webpack_require__) {
106
- let fs = __webpack_require__("fs"), path = __webpack_require__("path"), os = __webpack_require__("os"), crypto = __webpack_require__("crypto"), version = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/package.json").version, LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
105
+ "../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/lib/main.js": function(module, __unused_webpack_exports, __webpack_require__) {
106
+ let fs = __webpack_require__("fs"), path = __webpack_require__("path"), os = __webpack_require__("os"), crypto = __webpack_require__("crypto"), version = __webpack_require__("../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json").version, LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
107
107
  function _debug(message) {
108
108
  console.log(`[dotenv@${version}][DEBUG] ${message}`);
109
109
  }
@@ -149,7 +149,7 @@ var __webpack_modules__ = {
149
149
  };
150
150
  },
151
151
  _configVault: function(options) {
152
- console.log(`[dotenv@${version}][INFO] Loading env from encrypted .env.vault`);
152
+ options && options.debug && _debug('Loading env from encrypted .env.vault');
153
153
  let parsed = DotenvModule._parseVault(options), processEnv = process.env;
154
154
  return options && null != options.processEnv && (processEnv = options.processEnv), DotenvModule.populate(processEnv, parsed, options), {
155
155
  parsed
@@ -838,7 +838,7 @@ var __webpack_modules__ = {
838
838
  return k1 < k2 ? -1 : k1 > k2 ? 1 : v1 < v2 ? -1 : +(v1 > v2);
839
839
  }
840
840
  if (entriesA.sort(cmp), entriesB.sort(cmp), entriesA.length !== entriesB.length) return !1;
841
- for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null === (_a = entriesA[i][1]) || void 0 === _a ? void 0 : _a.toString()) !== (null === (_b = entriesB[i][1]) || void 0 === _b ? void 0 : _b.toString())) return !1;
841
+ for(var i = 0; i < entriesA.length; i++)if (entriesA[i][0] !== entriesB[i][0] || (null == (_a = entriesA[i][1]) ? void 0 : _a.toString()) !== (null == (_b = entriesB[i][1]) ? void 0 : _b.toString())) return !1;
842
842
  return !0;
843
843
  };
844
844
  },
@@ -959,9 +959,9 @@ var __webpack_modules__ = {
959
959
  "use strict";
960
960
  module.exports = import("node:https");
961
961
  },
962
- "../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/package.json": function(module) {
962
+ "../../node_modules/.pnpm/dotenv@16.5.0/node_modules/dotenv/package.json": function(module) {
963
963
  "use strict";
964
- module.exports = JSON.parse('{"name":"dotenv","version":"16.4.7","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"},"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}}');
964
+ 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}}');
965
965
  }
966
966
  }, __webpack_module_cache__ = {};
967
967
  function __webpack_require__(moduleId) {
@@ -1000,7 +1000,7 @@ for(var __webpack_i__ in (()=>{
1000
1000
  defineConfig: ()=>defineConfig,
1001
1001
  mergeRsbuildConfig: ()=>mergeRsbuildConfig,
1002
1002
  runCLI: ()=>runCLI,
1003
- version: ()=>src_rslib_entry_version,
1003
+ version: ()=>src_version,
1004
1004
  PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
1005
1005
  PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
1006
1006
  loadConfig: ()=>config_loadConfig,
@@ -1031,7 +1031,7 @@ for(var __webpack_i__ in (()=>{
1031
1031
  let external_node_fs_namespaceObject = require("node:fs");
1032
1032
  var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
1033
1033
  let external_node_path_namespaceObject = require("node:path");
1034
- var external_node_path_default = __webpack_require__.n(external_node_path_namespaceObject), main = __webpack_require__("../../node_modules/.pnpm/dotenv@16.4.7/node_modules/dotenv/lib/main.js"), lib_main = __webpack_require__("../../node_modules/.pnpm/dotenv-expand@12.0.1/node_modules/dotenv-expand/lib/main.js");
1034
+ 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.1/node_modules/dotenv-expand/lib/main.js");
1035
1035
  let external_node_url_namespaceObject = require("node:url");
1036
1036
  var cjs = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js"), cjs_default = __webpack_require__.n(cjs);
1037
1037
  let index_js_namespaceObject = require("../compiled/picocolors/index.js");
@@ -1113,9 +1113,9 @@ for(var __webpack_i__ in (()=>{
1113
1113
  }, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.find((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === external_node_path_namespaceObject.sep ? filepath : filepath.replace(/\\/g, '/'), isFileSync = (filePath)=>{
1114
1114
  try {
1115
1115
  var _fs_statSync;
1116
- return null === (_fs_statSync = external_node_fs_default().statSync(filePath, {
1116
+ return null == (_fs_statSync = external_node_fs_default().statSync(filePath, {
1117
1117
  throwIfNoEntry: !1
1118
- })) || void 0 === _fs_statSync ? void 0 : _fs_statSync.isFile();
1118
+ })) ? void 0 : _fs_statSync.isFile();
1119
1119
  } catch (_) {
1120
1120
  return !1;
1121
1121
  }
@@ -1131,10 +1131,7 @@ for(var __webpack_i__ in (()=>{
1131
1131
  }
1132
1132
  async function fileExistsByCompilation({ inputFileSystem }, filePath) {
1133
1133
  return new Promise((resolve)=>{
1134
- if (!inputFileSystem) {
1135
- resolve(!1);
1136
- return;
1137
- }
1134
+ if (!inputFileSystem) return void resolve(!1);
1138
1135
  inputFileSystem.stat(filePath, (err, stats)=>{
1139
1136
  err ? resolve(!1) : resolve(!!(null == stats ? void 0 : stats.isFile()));
1140
1137
  });
@@ -1271,18 +1268,18 @@ for(var __webpack_i__ in (()=>{
1271
1268
  }
1272
1269
  function formatStatsMessages(stats, verbose) {
1273
1270
  var _stats_errors, _stats_warnings;
1274
- let formattedErrors = (null === (_stats_errors = stats.errors) || void 0 === _stats_errors ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
1271
+ let formattedErrors = (null == (_stats_errors = stats.errors) ? void 0 : _stats_errors.map((error)=>formatMessage(error, verbose))) || [];
1275
1272
  return {
1276
1273
  errors: formattedErrors,
1277
- warnings: (null === (_stats_warnings = stats.warnings) || void 0 === _stats_warnings ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
1274
+ warnings: (null == (_stats_warnings = stats.warnings) ? void 0 : _stats_warnings.map((warning)=>formatMessage(warning, verbose))) || []
1278
1275
  };
1279
1276
  }
1280
1277
  let getAllStatsErrors = (statsData)=>{
1281
1278
  var _statsData_errors, _statsData_children;
1282
- return statsData.errorsCount && (null === (_statsData_errors = statsData.errors) || void 0 === _statsData_errors ? void 0 : _statsData_errors.length) === 0 ? null === (_statsData_children = statsData.children) || void 0 === _statsData_children ? void 0 : _statsData_children.reduce((errors, curr)=>errors.concat(curr.errors || []), []) : statsData.errors;
1279
+ return statsData.errorsCount && (null == (_statsData_errors = statsData.errors) ? void 0 : _statsData_errors.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((errors, curr)=>errors.concat(curr.errors || []), []) : statsData.errors;
1283
1280
  }, getAllStatsWarnings = (statsData)=>{
1284
1281
  var _statsData_warnings, _statsData_children;
1285
- return statsData.warningsCount && (null === (_statsData_warnings = statsData.warnings) || void 0 === _statsData_warnings ? void 0 : _statsData_warnings.length) === 0 ? null === (_statsData_children = statsData.children) || void 0 === _statsData_children ? void 0 : _statsData_children.reduce((warnings, curr)=>warnings.concat(curr.warnings || []), []) : statsData.warnings;
1282
+ return statsData.warningsCount && (null == (_statsData_warnings = statsData.warnings) ? void 0 : _statsData_warnings.length) === 0 ? null == (_statsData_children = statsData.children) ? void 0 : _statsData_children.reduce((warnings, curr)=>warnings.concat(curr.warnings || []), []) : statsData.warnings;
1286
1283
  };
1287
1284
  function getStatsOptions(compiler) {
1288
1285
  if (helpers_isMultiCompiler(compiler)) return {
@@ -1514,7 +1511,7 @@ for(var __webpack_i__ in (()=>{
1514
1511
  let realKey = key.split('.').slice(2).join('.');
1515
1512
  return OVERRIDE_PATHS.includes(realKey);
1516
1513
  }
1517
- return OVERRIDE_PATHS.includes(key);
1514
+ return OVERRIDE_PATHS.includes(key) || key.startsWith('output.filename.');
1518
1515
  }, merge = (x, y, path = '')=>{
1519
1516
  if (isOverridePath(path)) return y ?? x;
1520
1517
  if (void 0 === x) return isPlainObject(y) ? cloneDeep(y) : y;
@@ -1679,7 +1676,7 @@ for(var __webpack_i__ in (()=>{
1679
1676
  }), withDefaultConfig = async (rootPath, config)=>{
1680
1677
  var _merged_server, _config_dev, _config_output;
1681
1678
  let merged = mergeRsbuildConfig(createDefaultConfig(), config);
1682
- if (merged.root ||= rootPath, merged.source ||= {}, (null === (_merged_server = merged.server) || void 0 === _merged_server ? void 0 : _merged_server.base) && ((null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.assetPrefix) === void 0 && (merged.dev ||= {}, merged.dev.assetPrefix = merged.server.base), (null === (_config_output = config.output) || void 0 === _config_output ? void 0 : _config_output.assetPrefix) === void 0 && (merged.output ||= {}, merged.output.assetPrefix = merged.server.base)), !merged.source.tsconfigPath) {
1679
+ if (merged.root ||= rootPath, merged.source ||= {}, (null == (_merged_server = merged.server) ? void 0 : _merged_server.base) && ((null == (_config_dev = config.dev) ? void 0 : _config_dev.assetPrefix) === void 0 && (merged.dev ||= {}, merged.dev.assetPrefix = merged.server.base), (null == (_config_output = config.output) ? void 0 : _config_output.assetPrefix) === void 0 && (merged.output ||= {}, merged.output.assetPrefix = merged.server.base)), !merged.source.tsconfigPath) {
1683
1680
  let tsconfigPath = (0, external_node_path_namespaceObject.join)(rootPath, 'tsconfig.json');
1684
1681
  await isFileExists(tsconfigPath) && (merged.source.tsconfigPath = tsconfigPath);
1685
1682
  }
@@ -1884,7 +1881,7 @@ for(var __webpack_i__ in (()=>{
1884
1881
  for (let plugin of plugins){
1885
1882
  var _removedPlugins_plugin_environment, _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL;
1886
1883
  let isGlobalPlugin = 'RSBUILD_ALL_ENVIRONMENT_SYMBOL' === plugin.environment;
1887
- if ((null === (_removedPlugins_plugin_environment = removedPlugins[plugin.environment]) || void 0 === _removedPlugins_plugin_environment ? void 0 : _removedPlugins_plugin_environment.includes(plugin.instance.name)) || !isGlobalPlugin && (null === (_removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL = removedPlugins[RSBUILD_ALL_ENVIRONMENT_SYMBOL]) || void 0 === _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL ? void 0 : _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL.includes(plugin.instance.name))) continue;
1884
+ if ((null == (_removedPlugins_plugin_environment = removedPlugins[plugin.environment]) ? void 0 : _removedPlugins_plugin_environment.includes(plugin.instance.name)) || !isGlobalPlugin && (null == (_removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL = removedPlugins[RSBUILD_ALL_ENVIRONMENT_SYMBOL]) ? void 0 : _removedPlugins_RSBUILD_ALL_ENVIRONMENT_SYMBOL.includes(plugin.instance.name))) continue;
1888
1885
  let { instance, environment } = plugin;
1889
1886
  await instance.setup(getPluginAPI(environment));
1890
1887
  }
@@ -2089,7 +2086,21 @@ for(var __webpack_i__ in (()=>{
2089
2086
  onEnvironmentDone,
2090
2087
  MultiStatsCtor
2091
2088
  });
2092
- }, mapProcessAssetsStage = (compiler, stage)=>{
2089
+ }, external_node_os_namespaceObject = require("node:os");
2090
+ var external_node_os_default = __webpack_require__.n(external_node_os_namespaceObject);
2091
+ let external_node_process_namespaceObject = require("node:process");
2092
+ var external_node_process_default = __webpack_require__.n(external_node_process_namespaceObject);
2093
+ let exitHook_callbacks = new Set(), isCalled = !1, isRegistered = !1;
2094
+ function exit(exitCode, type) {
2095
+ if (!isCalled) {
2096
+ for (let callback of (isCalled = !0, exitHook_callbacks))callback(exitCode);
2097
+ if ('SIGINT' === type) {
2098
+ let listeners = external_node_process_default().listeners('SIGINT');
2099
+ Array.isArray(listeners) && listeners.length <= 1 && external_node_process_default().exit(exitCode);
2100
+ }
2101
+ }
2102
+ }
2103
+ let mapProcessAssetsStage = (compiler, stage)=>{
2093
2104
  let { Compilation } = compiler.webpack;
2094
2105
  switch(stage){
2095
2106
  case 'additional':
@@ -2190,7 +2201,7 @@ for(var __webpack_i__ in (()=>{
2190
2201
  name,
2191
2202
  distPath: function(cwd, config) {
2192
2203
  var _config_output_distPath, _config_output;
2193
- return getAbsolutePath(cwd, (null === (_config_output = config.output) || void 0 === _config_output || null === (_config_output_distPath = _config_output.distPath) || void 0 === _config_output_distPath ? void 0 : _config_output_distPath.root) ?? ROOT_DIST_DIR);
2204
+ return getAbsolutePath(cwd, (null == (_config_output = config.output) || null == (_config_output_distPath = _config_output.distPath) ? void 0 : _config_output_distPath.root) ?? ROOT_DIST_DIR);
2194
2205
  }(context.rootPath, config),
2195
2206
  entry,
2196
2207
  browserslist,
@@ -2207,7 +2218,7 @@ for(var __webpack_i__ in (()=>{
2207
2218
  async function createContext(options, userConfig) {
2208
2219
  let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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;
2209
2220
  return {
2210
- version: "1.3.5",
2221
+ version: "1.3.7",
2211
2222
  rootPath,
2212
2223
  distPath: '',
2213
2224
  cachePath,
@@ -2353,7 +2364,7 @@ for(var __webpack_i__ in (()=>{
2353
2364
  utils
2354
2365
  ]
2355
2366
  });
2356
- if (null === (_utils_environment_config_tools = utils.environment.config.tools) || void 0 === _utils_environment_config_tools ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
2367
+ if (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.bundlerChain) for (let item of castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
2357
2368
  return rslog_index_js_namespaceObject.logger.debug('modify bundler chain done'), modifiedBundlerChain;
2358
2369
  }
2359
2370
  let configChain_CHAIN_ID = {
@@ -2528,7 +2539,7 @@ for(var __webpack_i__ in (()=>{
2528
2539
  }
2529
2540
  }), isUseAnalyzer = (config)=>{
2530
2541
  var _config_performance;
2531
- return process.env.BUNDLE_ANALYZE || (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.bundleAnalyze);
2542
+ return process.env.BUNDLE_ANALYZE || (null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze);
2532
2543
  }, external_node_crypto_namespaceObject = require("node:crypto");
2533
2544
  var external_node_crypto_default = __webpack_require__.n(external_node_crypto_namespaceObject);
2534
2545
  async function validateWebpackCache(cacheDirectory, buildDependencies) {
@@ -2559,7 +2570,7 @@ for(var __webpack_i__ in (()=>{
2559
2570
  let { tsconfigPath } = environmentContext;
2560
2571
  tsconfigPath && (buildDependencies.tsconfig = [
2561
2572
  tsconfigPath
2562
- ]), (null === (_config__privateMeta = config._privateMeta) || void 0 === _config__privateMeta ? void 0 : _config__privateMeta.configFilePath) && (buildDependencies.rsbuildConfig = [
2573
+ ]), (null == (_config__privateMeta = config._privateMeta) ? void 0 : _config__privateMeta.configFilePath) && (buildDependencies.rsbuildConfig = [
2563
2574
  config._privateMeta.configFilePath
2564
2575
  ]), await isFileExists(browserslistConfig) && (buildDependencies.browserslistrc = [
2565
2576
  browserslistConfig
@@ -2641,7 +2652,7 @@ for(var __webpack_i__ in (()=>{
2641
2652
  return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
2642
2653
  path: distPath,
2643
2654
  keep
2644
- } : void (rslog_index_js_namespaceObject.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), rslog_index_js_namespaceObject.logger.warn(`Please set ${index_js_default().yellow('`output.cleanDistPath`')} config manually.`), rslog_index_js_namespaceObject.logger.warn(`Current root path: ${index_js_default().dim(rootPath)}`), rslog_index_js_namespaceObject.logger.warn(`Current dist path: ${index_js_default().dim(distPath)}`)) : !0 === enable ? {
2655
+ } : (rslog_index_js_namespaceObject.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), rslog_index_js_namespaceObject.logger.warn(`Please set ${index_js_default().yellow('`output.cleanDistPath`')} config manually.`), rslog_index_js_namespaceObject.logger.warn(`Current root path: ${index_js_default().dim(rootPath)}`), void rslog_index_js_namespaceObject.logger.warn(`Current dist path: ${index_js_default().dim(distPath)}`)) : !0 === enable ? {
2645
2656
  path: distPath,
2646
2657
  keep
2647
2658
  } : void 0;
@@ -2807,7 +2818,7 @@ for(var __webpack_i__ in (()=>{
2807
2818
  if (cached) return clonePostCSSConfig(await cached);
2808
2819
  let { default: postcssrc } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/postcss-load-config/index.js")), promise = postcssrc({}, root).catch((err)=>{
2809
2820
  var _err_message;
2810
- if (null === (_err_message = err.message) || void 0 === _err_message ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
2821
+ if (null == (_err_message = err.message) ? void 0 : _err_message.includes('No PostCSS Config found')) return {};
2811
2822
  throw err;
2812
2823
  });
2813
2824
  return postcssrcCache.set(root, promise), promise.then((config)=>(postcssrcCache.set(root, config), clonePostCSSConfig(config)));
@@ -2905,7 +2916,7 @@ for(var __webpack_i__ in (()=>{
2905
2916
  root: api.context.rootPath,
2906
2917
  postcssrcCache
2907
2918
  });
2908
- if ('function' == typeof postcssLoaderOptions.postcssOptions || (null === (_postcssLoaderOptions_postcssOptions = postcssLoaderOptions.postcssOptions) || void 0 === _postcssLoaderOptions_postcssOptions || null === (_postcssLoaderOptions_postcssOptions_plugins = _postcssLoaderOptions_postcssOptions.plugins) || void 0 === _postcssLoaderOptions_postcssOptions_plugins ? void 0 : _postcssLoaderOptions_postcssOptions_plugins.length)) {
2919
+ if ('function' == typeof postcssLoaderOptions.postcssOptions || (null == (_postcssLoaderOptions_postcssOptions = postcssLoaderOptions.postcssOptions) || null == (_postcssLoaderOptions_postcssOptions_plugins = _postcssLoaderOptions_postcssOptions.plugins) ? void 0 : _postcssLoaderOptions_postcssOptions_plugins.length)) {
2909
2920
  importLoaders++;
2910
2921
  let postcssLoaderPath = getCompiledPath('postcss-loader');
2911
2922
  updateRules((rule)=>{
@@ -2969,10 +2980,7 @@ for(var __webpack_i__ in (()=>{
2969
2980
  let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
2970
2981
  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.`));
2971
2982
  };
2972
- if ('object' == typeof value) {
2973
- check(value);
2974
- return;
2975
- }
2983
+ if ('object' == typeof value) return check(value);
2976
2984
  if ('string' == typeof value) try {
2977
2985
  check(JSON.parse(value));
2978
2986
  } catch (error) {}
@@ -3046,32 +3054,32 @@ for(var __webpack_i__ in (()=>{
3046
3054
  }, assets = await getAssets();
3047
3055
  if (0 === assets.length) return logs;
3048
3056
  logs.push(''), assets.sort((a, b)=>a.size - b.size);
3049
- let longestLabelLength = Math.max(...assets.map((a)=>a.sizeLabel.length)), longestFileLength = Math.max(...assets.map((a)=>(a.folder + external_node_path_default().sep + a.name).length));
3057
+ let fileHeader = `File (${environmentName})`, maxFileLength = Math.max(...assets.map((a)=>(a.folder + external_node_path_default().sep + a.name).length), fileHeader.length), maxSizeLength = Math.max(...assets.map((a)=>a.sizeLabel.length));
3050
3058
  if (!1 !== options.detail) {
3051
3059
  let showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
3052
- logs.push(function(longestFileLength, longestLabelLength, environmentName, showGzipHeader) {
3053
- let longestLengths = [
3054
- longestFileLength,
3055
- longestLabelLength
3060
+ logs.push(function(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
3061
+ let lengths = [
3062
+ maxFileLength,
3063
+ maxSizeLength
3056
3064
  ], rowTypes = [
3057
- `File (${environmentName})`,
3065
+ fileHeader,
3058
3066
  'Size'
3059
3067
  ];
3060
3068
  showGzipHeader && rowTypes.push('Gzip');
3061
3069
  let headerRow = rowTypes.reduce((prev, cur, index)=>{
3062
- let length = longestLengths[index], curLabel = cur;
3070
+ let length = lengths[index], curLabel = cur;
3063
3071
  return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
3064
3072
  }, ' ');
3065
3073
  return index_js_default().blue(headerRow);
3066
- }(longestFileLength, longestLabelLength, environmentName, showGzipHeader));
3074
+ }(maxFileLength, maxSizeLength, fileHeader, showGzipHeader));
3067
3075
  }
3068
3076
  let totalSize = 0, totalGzipSize = 0;
3069
3077
  for (let asset of assets){
3070
3078
  let { sizeLabel } = asset, { name, folder, gzipSizeLabel } = asset, fileNameLength = (folder + external_node_path_default().sep + name).length, sizeLength = sizeLabel.length;
3071
3079
  if (totalSize += asset.size, options.compressed && (totalGzipSize += asset.gzippedSize ?? asset.size), !1 !== options.detail) {
3072
- sizeLength < longestLabelLength && (sizeLabel += ' '.repeat(longestLabelLength - sizeLength));
3080
+ sizeLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLength));
3073
3081
  let fileNameLabel = index_js_default().dim(asset.folder + external_node_path_default().sep) + coloringAssetName(asset.name);
3074
- fileNameLength < longestFileLength && (fileNameLabel += ' '.repeat(longestFileLength - fileNameLength));
3082
+ fileNameLength < maxFileLength && (fileNameLabel += ' '.repeat(maxFileLength - fileNameLength));
3075
3083
  let log = ` ${fileNameLabel} ${sizeLabel}`;
3076
3084
  gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
3077
3085
  }
@@ -3163,7 +3171,7 @@ for(var __webpack_i__ in (()=>{
3163
3171
  ...override
3164
3172
  })), applyTagConfig = (data, tagConfig, compilationHash, entryName)=>{
3165
3173
  var _tagConfig_tags;
3166
- if (!(null === (_tagConfig_tags = tagConfig.tags) || void 0 === _tagConfig_tags ? void 0 : _tagConfig_tags.length)) return data;
3174
+ if (!(null == (_tagConfig_tags = tagConfig.tags) ? void 0 : _tagConfig_tags.length)) return data;
3167
3175
  let fromInjectTags = (tags)=>{
3168
3176
  let ret = [];
3169
3177
  for (let tag of tags){
@@ -3246,10 +3254,10 @@ for(var __webpack_i__ in (()=>{
3246
3254
  compiler.hooks.compilation.tap(this.name, (compilation)=>{
3247
3255
  getHTMLPlugin().getCompilationHooks(compilation).alterAssetTagGroups.tapPromise(this.name, async (data)=>{
3248
3256
  var _data_plugin_options, _data_plugin_options1;
3249
- let entryName = null === (_data_plugin_options = data.plugin.options) || void 0 === _data_plugin_options ? void 0 : _data_plugin_options.entryName;
3257
+ let entryName = null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.entryName;
3250
3258
  if (!entryName) return data;
3251
3259
  let { headTags, bodyTags } = data, { favicon, tagConfig, templateContent } = this.options[entryName];
3252
- hasTitle(templateContent) || addTitleTag(headTags, null === (_data_plugin_options1 = data.plugin.options) || void 0 === _data_plugin_options1 ? void 0 : _data_plugin_options1.title), favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
3260
+ hasTitle(templateContent) || addTitleTag(headTags, null == (_data_plugin_options1 = data.plugin.options) ? void 0 : _data_plugin_options1.title), favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
3253
3261
  let tags = {
3254
3262
  headTags: headTags.map(formatBasicTag),
3255
3263
  bodyTags: bodyTags.map(formatBasicTag)
@@ -3419,7 +3427,7 @@ for(var __webpack_i__ in (()=>{
3419
3427
  let formattedCrossorigin = !0 === crossorigin ? 'anonymous' : crossorigin;
3420
3428
  for (let tag of allTags){
3421
3429
  var _tag_attrs, _tag_attrs1;
3422
- ("script" === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.src) || 'link' === tag.tag && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.rel) === 'stylesheet') && (tag.attrs.crossorigin ??= formattedCrossorigin);
3430
+ ("script" === tag.tag && (null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) || 'link' === tag.tag && (null == (_tag_attrs1 = tag.attrs) ? void 0 : _tag_attrs1.rel) === 'stylesheet') && (tag.attrs.crossorigin ??= formattedCrossorigin);
3423
3431
  }
3424
3432
  }
3425
3433
  return {
@@ -3450,7 +3458,7 @@ for(var __webpack_i__ in (()=>{
3450
3458
  let inlinedAssets = new Set(), getInlinedScriptTag = (publicPath, tag, compilation, scriptTests, config)=>{
3451
3459
  var _tag_attrs;
3452
3460
  let { assets } = compilation;
3453
- if (!((null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
3461
+ if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.src) && 'string' == typeof tag.attrs.src)) return tag;
3454
3462
  let { src, ...otherAttrs } = tag.attrs, scriptName = publicPath ? src.replace(publicPath, '') : src, asset = assets[scriptName];
3455
3463
  if (null == asset) return tag;
3456
3464
  let source = asset.source().toString();
@@ -3472,7 +3480,7 @@ for(var __webpack_i__ in (()=>{
3472
3480
  }, getInlinedCSSTag = (publicPath, tag, compilation, styleTests, config)=>{
3473
3481
  var _tag_attrs;
3474
3482
  let { assets } = compilation;
3475
- if (!((null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
3483
+ if (!((null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.href) && 'string' == typeof tag.attrs.href)) return tag;
3476
3484
  let linkName = publicPath ? tag.attrs.href.replace(publicPath, '') : tag.attrs.href, asset = assets[linkName];
3477
3485
  if (null == asset) return tag;
3478
3486
  let source = asset.source().toString();
@@ -3551,7 +3559,7 @@ for(var __webpack_i__ in (()=>{
3551
3559
  }
3552
3560
  let entryManifest = {};
3553
3561
  assets.size && (entryManifest.assets = Array.from(assets));
3554
- let htmlPath = null === (_files_find = files.find((f)=>f.name === htmlPaths[name])) || void 0 === _files_find ? void 0 : _files_find.path;
3562
+ let htmlPath = null == (_files_find = files.find((f)=>f.name === htmlPaths[name])) ? void 0 : _files_find.path;
3555
3563
  htmlPath && (entryManifest.html = [
3556
3564
  htmlPath
3557
3565
  ]), initialJS.length && (entryManifest.initial = {
@@ -3714,7 +3722,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3714
3722
  ];
3715
3723
  if (nonce) for (let tag of allTags){
3716
3724
  var _tag_attrs, _tag_attrs1;
3717
- ("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null === (_tag_attrs = tag.attrs) || void 0 === _tag_attrs ? void 0 : _tag_attrs.rel) === 'preload' && (null === (_tag_attrs1 = tag.attrs) || void 0 === _tag_attrs1 ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
3725
+ ("script" === tag.tag || 'style' === tag.tag || 'link' === tag.tag && (null == (_tag_attrs = tag.attrs) ? void 0 : _tag_attrs.rel) === 'preload' && (null == (_tag_attrs1 = tag.attrs) ? void 0 : _tag_attrs1.as) === "script") && (tag.attrs ??= {}, tag.attrs.nonce = nonce);
3718
3726
  }
3719
3727
  return {
3720
3728
  headTags,
@@ -3725,8 +3733,6 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3725
3733
  }
3726
3734
  }), external_node_child_process_namespaceObject = require("node:child_process"), external_node_net_namespaceObject = require("node:net");
3727
3735
  var external_node_net_default = __webpack_require__.n(external_node_net_namespaceObject);
3728
- let external_node_os_namespaceObject = require("node:os");
3729
- var external_node_os_default = __webpack_require__.n(external_node_os_namespaceObject);
3730
3736
  let normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1'), formatPrefix = (input)=>{
3731
3737
  let prefix = input;
3732
3738
  if ((null == prefix ? void 0 : prefix.startsWith('./')) && (prefix = prefix.replace('./', '')), !prefix) return '/';
@@ -3954,11 +3960,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3954
3960
  api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd, isServer, environment })=>{
3955
3961
  let { distPath, config } = environment, publicPath = function({ isProd, config, context }) {
3956
3962
  var _context_devServer, _context_devServer1, _context_devServer2;
3957
- let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null === (_context_devServer = context.devServer) || void 0 === _context_devServer ? void 0 : _context_devServer.port) || server.port || 3000;
3963
+ let { dev, output, server } = config, publicPath = DEFAULT_ASSET_PREFIX, port = (null == (_context_devServer = context.devServer) ? void 0 : _context_devServer.port) || server.port || 3000;
3958
3964
  if (isProd) 'string' == typeof output.assetPrefix && (publicPath = output.assetPrefix);
3959
3965
  else if ('string' == typeof dev.assetPrefix) publicPath = dev.assetPrefix;
3960
3966
  else if (!0 === dev.assetPrefix) {
3961
- let protocol = (null === (_context_devServer1 = context.devServer) || void 0 === _context_devServer1 ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null === (_context_devServer2 = context.devServer) || void 0 === _context_devServer2 ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3967
+ let protocol = (null == (_context_devServer1 = context.devServer) ? void 0 : _context_devServer1.https) ? 'https' : 'http', hostname = (null == (_context_devServer2 = context.devServer) ? void 0 : _context_devServer2.hostname) || DEFAULT_DEV_HOST;
3962
3968
  publicPath = hostname === DEFAULT_DEV_HOST ? `${protocol}://localhost:<port>/` : `${protocol}://${hostname}:<port>/`, server.base && '/' !== server.base && (publicPath = urlJoin(publicPath, server.base));
3963
3969
  }
3964
3970
  return formatPublicPath(replacePortPlaceholder(publicPath, port));
@@ -3995,7 +4001,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
3995
4001
  var _rsbuildConfig_performance, _config_performance;
3996
4002
  let applyBundleAnalyzeConfig = (config)=>{
3997
4003
  var _config_performance;
3998
- (null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.bundleAnalyze) ? config.performance.bundleAnalyze = {
4004
+ (null == (_config_performance = config.performance) ? void 0 : _config_performance.bundleAnalyze) ? config.performance.bundleAnalyze = {
3999
4005
  generateStatsFile: !0,
4000
4006
  ...config.performance.bundleAnalyze || {}
4001
4007
  } : (config.performance ??= {}, config.performance.bundleAnalyze = {
@@ -4003,8 +4009,8 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4003
4009
  generateStatsFile: !0
4004
4010
  });
4005
4011
  };
4006
- if (null === (_rsbuildConfig_performance = rsbuildConfig.performance) || void 0 === _rsbuildConfig_performance ? void 0 : _rsbuildConfig_performance.profile) applyBundleAnalyzeConfig(rsbuildConfig);
4007
- else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null === (_config_performance = config.performance) || void 0 === _config_performance ? void 0 : _config_performance.profile) && applyBundleAnalyzeConfig(config);
4012
+ if (null == (_rsbuildConfig_performance = rsbuildConfig.performance) ? void 0 : _rsbuildConfig_performance.profile) applyBundleAnalyzeConfig(rsbuildConfig);
4013
+ else if (rsbuildConfig.environments) for (let config of Object.values(rsbuildConfig.environments))(null == (_config_performance = config.performance) ? void 0 : _config_performance.profile) && applyBundleAnalyzeConfig(config);
4008
4014
  }
4009
4015
  }), api.modifyBundlerChain((chain, { environment })=>{
4010
4016
  let { config } = environment, { profile } = config.performance;
@@ -4124,10 +4130,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4124
4130
  if ('all-assets' === includeType) {
4125
4131
  var _compilation_assetsInfo;
4126
4132
  let licenseAssets = [
4127
- ...(null === (_compilation_assetsInfo = compilation.assetsInfo) || void 0 === _compilation_assetsInfo ? void 0 : _compilation_assetsInfo.values()) || []
4133
+ ...(null == (_compilation_assetsInfo = compilation.assetsInfo) ? void 0 : _compilation_assetsInfo.values()) || []
4128
4134
  ].map((info)=>{
4129
4135
  var _info_related;
4130
- return null !== (_info_related = info.related) && void 0 !== _info_related && !!_info_related.license && info.related.license;
4136
+ return null != (_info_related = info.related) && !!_info_related.license && info.related.license;
4131
4137
  }).filter(Boolean);
4132
4138
  return [
4133
4139
  {
@@ -4182,14 +4188,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4182
4188
  }
4183
4189
  return links;
4184
4190
  }(this.options, this.type, compilation, htmlPluginData, this.HTMLCount), htmlPluginData)), getHTMLPlugin().getHooks(compilation).alterAssetTags.tap(`HTML${upperFirst(this.type)}Plugin`, (htmlPluginData)=>{
4185
- if (this.resourceHints) {
4186
- var resourceHints, scripts;
4187
- htmlPluginData.assetTags.styles = [
4188
- ...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
4189
- ...htmlPluginData.assetTags.styles
4190
- ];
4191
- }
4192
- return htmlPluginData;
4191
+ var resourceHints, scripts;
4192
+ return this.resourceHints && (htmlPluginData.assetTags.styles = [
4193
+ ...this.options.dedupe ? (resourceHints = this.resourceHints, scripts = htmlPluginData.assetTags.scripts, resourceHints.filter((resourceHint)=>!scripts.find((script)=>script.attributes.src === resourceHint.attributes.href))) : this.resourceHints,
4194
+ ...htmlPluginData.assetTags.styles
4195
+ ]), htmlPluginData;
4193
4196
  });
4194
4197
  });
4195
4198
  }
@@ -4250,11 +4253,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4250
4253
  if ('true' !== process.env.RSDOCTOR) return;
4251
4254
  let isRspack = 'rspack' === api.context.bundlerType, pluginName = isRspack ? 'RsdoctorRspackPlugin' : 'RsdoctorWebpackPlugin', isRsdoctorPlugin = (plugin)=>{
4252
4255
  var _plugin_constructor;
4253
- return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null === (_plugin_constructor = plugin.constructor) || void 0 === _plugin_constructor ? void 0 : _plugin_constructor.name) === pluginName;
4256
+ return (null == plugin ? void 0 : plugin.isRsdoctorPlugin) === !0 || (null == plugin || null == (_plugin_constructor = plugin.constructor) ? void 0 : _plugin_constructor.name) === pluginName;
4254
4257
  };
4255
4258
  for (let config of bundlerConfigs){
4256
4259
  var _config_plugins;
4257
- if (null === (_config_plugins = config.plugins) || void 0 === _config_plugins ? void 0 : _config_plugins.some((plugin)=>isRsdoctorPlugin(plugin))) return;
4260
+ if (null == (_config_plugins = config.plugins) ? void 0 : _config_plugins.some((plugin)=>isRsdoctorPlugin(plugin))) return;
4258
4261
  }
4259
4262
  let packageName = isRspack ? '@rsdoctor/rspack-plugin' : '@rsdoctor/webpack-plugin';
4260
4263
  try {
@@ -4284,10 +4287,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4284
4287
  var external_node_inspector_default = __webpack_require__.n(external_node_inspector_namespaceObject);
4285
4288
  let stopProfiler = (output, profileSession)=>{
4286
4289
  profileSession && profileSession.post('Profiler.stop', (error, param)=>{
4287
- if (error) {
4288
- rslog_index_js_namespaceObject.logger.error('Failed to generate JS CPU profile:', error);
4289
- return;
4290
- }
4290
+ if (error) return void rslog_index_js_namespaceObject.logger.error('Failed to generate JavaScript CPU profile:', error);
4291
4291
  external_node_fs_default().writeFileSync(output, JSON.stringify(param.profile));
4292
4292
  });
4293
4293
  }, pluginRspackProfile = ()=>({
@@ -4296,11 +4296,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4296
4296
  var _process_env_RSPACK_PROFILE;
4297
4297
  let profileSession;
4298
4298
  if ('webpack' === api.context.bundlerType) return;
4299
- let RSPACK_PROFILE = null === (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) || void 0 === _process_env_RSPACK_PROFILE ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
4299
+ let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
4300
4300
  if (!RSPACK_PROFILE) return;
4301
- let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), enableCPUProfile = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('CPU'), enableLogging = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('LOGGING'), onStart = ()=>{
4301
+ let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), enableCPUProfile = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('CPU'), enableLogging = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('LOGGING'), onStart = async ()=>{
4302
4302
  let profileDir = external_node_path_default().join(api.context.distPath, profileDirName), traceFilePath = external_node_path_default().join(profileDir, 'trace.json');
4303
- external_node_fs_default().existsSync(profileDir) || external_node_fs_default().mkdirSync(profileDir, {
4303
+ await isFileExists(profileDir) || await external_node_fs_default().promises.mkdir(profileDir, {
4304
4304
  recursive: !0
4305
4305
  }), enableProfileTrace && core_default().experiments.globalTrace.register('trace', 'chrome', traceFilePath), enableCPUProfile && ((profileSession = new (external_node_inspector_default()).Session()).connect(), profileSession.post('Profiler.enable'), profileSession.post('Profiler.start'));
4306
4306
  };
@@ -4314,12 +4314,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4314
4314
  logging: 'verbose',
4315
4315
  loggingTrace: !0
4316
4316
  });
4317
- external_node_fs_default().writeFileSync(loggingFilePath, JSON.stringify(logging));
4317
+ await external_node_fs_default().promises.writeFile(loggingFilePath, JSON.stringify(logging));
4318
4318
  }
4319
4319
  }), api.onExit(()=>{
4320
4320
  enableProfileTrace && core_default().experiments.globalTrace.cleanup();
4321
4321
  let profileDir = external_node_path_default().join(api.context.distPath, profileDirName);
4322
- stopProfiler(external_node_path_default().join(profileDir, 'jscpuprofile.json'), profileSession), rslog_index_js_namespaceObject.logger.info(`saved Rspack profile file to ${profileDir}`);
4322
+ stopProfiler(external_node_path_default().join(profileDir, 'jscpuprofile.json'), profileSession), rslog_index_js_namespaceObject.logger.info(`profile files saved to ${index_js_default().cyan(profileDir)}`);
4323
4323
  });
4324
4324
  }
4325
4325
  }), pluginServer = ()=>({
@@ -4330,7 +4330,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4330
4330
  if (config.server.open) {
4331
4331
  var _api_context_devServer;
4332
4332
  open_open({
4333
- https: null === (_api_context_devServer = api.context.devServer) || void 0 === _api_context_devServer ? void 0 : _api_context_devServer.https,
4333
+ https: null == (_api_context_devServer = api.context.devServer) ? void 0 : _api_context_devServer.https,
4334
4334
  port,
4335
4335
  routes,
4336
4336
  config
@@ -4471,7 +4471,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4471
4471
  return;
4472
4472
  }
4473
4473
  let { config } = environment, defaultConfig = {
4474
- chunks: (null === (_config_moduleFederation = config.moduleFederation) || void 0 === _config_moduleFederation || null === (_config_moduleFederation_options = _config_moduleFederation.options) || void 0 === _config_moduleFederation_options ? void 0 : _config_moduleFederation_options.exposes) ? 'async' : 'all',
4474
+ chunks: (null == (_config_moduleFederation = config.moduleFederation) || null == (_config_moduleFederation_options = _config_moduleFederation.options) ? void 0 : _config_moduleFederation_options.exposes) ? 'async' : 'all',
4475
4475
  cacheGroups: {}
4476
4476
  };
4477
4477
  'webpack' === api.context.bundlerType && (defaultConfig.enforceSizeThreshold = 50000);
@@ -4634,21 +4634,15 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4634
4634
  api.modifyBundlerChain({
4635
4635
  order: 'pre',
4636
4636
  handler: async (chain, { target, environment })=>{
4637
- if ('node' === target) {
4638
- chain.target('node');
4639
- return;
4640
- }
4637
+ if ('node' === target) return void chain.target('node');
4641
4638
  let { browserslist } = environment, isDefaultBrowserslist = browserslist.join(',') === DEFAULT_WEB_BROWSERSLIST.join(',');
4642
- if ('web-worker' === target) {
4643
- chain.target(isDefaultBrowserslist ? [
4644
- 'webworker',
4645
- 'es2017'
4646
- ] : [
4647
- 'webworker',
4648
- 'es5'
4649
- ]);
4650
- return;
4651
- }
4639
+ if ('web-worker' === target) return void chain.target(isDefaultBrowserslist ? [
4640
+ 'webworker',
4641
+ 'es2017'
4642
+ ] : [
4643
+ 'webworker',
4644
+ 'es5'
4645
+ ]);
4652
4646
  let esQuery = isDefaultBrowserslist ? 'es2017' : `browserslist:${browserslist.join(',')}`;
4653
4647
  chain.target([
4654
4648
  'web',
@@ -4720,7 +4714,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4720
4714
  rspackConfig,
4721
4715
  utils
4722
4716
  ]
4723
- }), (null === (_utils_environment_config_tools = utils.environment.config.tools) || void 0 === _utils_environment_config_tools ? void 0 : _utils_environment_config_tools.rspack) && (currentConfig = await reduceConfigsAsyncWithContext({
4717
+ }), (null == (_utils_environment_config_tools = utils.environment.config.tools) ? void 0 : _utils_environment_config_tools.rspack) && (currentConfig = await reduceConfigsAsyncWithContext({
4724
4718
  initial: currentConfig,
4725
4719
  config: utils.environment.config.tools.rspack,
4726
4720
  ctx: utils,
@@ -4730,7 +4724,6 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4730
4724
  async function getConfigUtils(config, chainUtils) {
4731
4725
  return {
4732
4726
  ...chainUtils,
4733
- rspack: core_namespaceObject.rspack,
4734
4727
  mergeConfig: dist.merge,
4735
4728
  addRules (rules) {
4736
4729
  let ruleArr = castArray(rules);
@@ -4754,9 +4747,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4754
4747
  };
4755
4748
  }
4756
4749
  function getChainUtils(target, environment) {
4750
+ let nodeEnv = getNodeEnv();
4757
4751
  return {
4752
+ rspack: core_namespaceObject.rspack,
4758
4753
  environment,
4759
- env: getNodeEnv(),
4754
+ env: nodeEnv,
4760
4755
  target,
4761
4756
  isDev: 'development' === environment.config.mode,
4762
4757
  isProd: 'production' === environment.config.mode,
@@ -4940,7 +4935,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4940
4935
  envMode: commonOpts.envMode,
4941
4936
  loader: commonOpts.configLoader
4942
4937
  });
4943
- return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
4938
+ return config.dev ||= {}, config.source ||= {}, config.server ||= {}, commonOpts.base && (config.server.base = commonOpts.base), commonOpts.root && (config.root = root), commonOpts.mode && (config.mode = commonOpts.mode), !commonOpts.open || (null == (_config_server = config.server) ? void 0 : _config_server.open) || (config.server.open = commonOpts.open), commonOpts.host && (config.server.host = commonOpts.host), commonOpts.port && (config.server.port = commonOpts.port), void 0 === config.dev.cliShortcuts && (config.dev.cliShortcuts = !0), filePath && (config.dev.watchFiles = [
4944
4939
  ...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
4945
4940
  {
4946
4941
  paths: filePath,
@@ -4964,7 +4959,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
4964
4959
  var _config_dev;
4965
4960
  if ('dev' !== rsbuild.context.action && !isBuildWatch) return;
4966
4961
  let files = [], config = rsbuild.getNormalizedConfig();
4967
- if (null === (_config_dev = config.dev) || void 0 === _config_dev ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
4962
+ if (null == (_config_dev = config.dev) ? void 0 : _config_dev.watchFiles) for (let watchFilesConfig of castArray(config.dev.watchFiles)){
4968
4963
  if ('reload-server' !== watchFilesConfig.type) continue;
4969
4964
  let paths = castArray(watchFilesConfig.paths);
4970
4965
  watchFilesConfig.options ? watchFilesForRestart({
@@ -5145,10 +5140,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5145
5140
  for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
5146
5141
  rslog_index_js_namespaceObject.logger.log(message);
5147
5142
  }
5148
- for (let shortcut of shortcuts)if (input === shortcut.key) {
5149
- shortcut.action();
5150
- return;
5151
- }
5143
+ for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
5152
5144
  }), ()=>{
5153
5145
  rl.close();
5154
5146
  };
@@ -5272,7 +5264,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5272
5264
  let { default: ws } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/ws/index.js"));
5273
5265
  this.wsServer = new ws.Server({
5274
5266
  noServer: !0,
5275
- path: null === (_this_options_client = this.options.client) || void 0 === _this_options_client ? void 0 : _this_options_client.path
5267
+ path: null == (_this_options_client = this.options.client) ? void 0 : _this_options_client.path
5276
5268
  }), this.wsServer.on('error', (err)=>{
5277
5269
  rslog_index_js_namespaceObject.logger.error(err);
5278
5270
  }), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
@@ -5382,14 +5374,17 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5382
5374
  html: function(errors, root) {
5383
5375
  let htmlItems = errors.map((item)=>{
5384
5376
  var text, text1 = server_ansiHTML((text = item) ? text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;') : ''), root1 = root;
5385
- let pathRegex = /(?:\.\.?[\/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g;
5386
- return text1.split('\n').map((line)=>line.replace(pathRegex, (file)=>{
5377
+ let pathRegex = /(?:\.\.?[\/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g, urlRegex = /(https?:\/\/(?:[\w-]+\.)+[a-z0-9](?:[\w-.~:/?#[\]@!$&'*+,;=])*)/gi;
5378
+ return text1.split('\n').map((line)=>{
5379
+ let replacedLine = line.replace(pathRegex, (file)=>{
5387
5380
  let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = external_node_path_default().isAbsolute(filePath), absolutePath = root1 && !isAbsolute ? external_node_path_default().join(root1, filePath) : filePath, relativePath = root1 && isAbsolute ? function(base, filepath) {
5388
5381
  let relativePath = (0, external_node_path_namespaceObject.relative)(base, filepath);
5389
5382
  return '' === relativePath ? `.${external_node_path_namespaceObject.sep}` : relativePath.startsWith('.') ? relativePath : `.${external_node_path_namespaceObject.sep}${relativePath}`;
5390
5383
  }(root1, filePath) : filePath;
5391
5384
  return `<a class="file-link" data-file="${absolutePath}">${relativePath}</a>${hasClosingSpan ? '</span>' : ''}`;
5392
- })).join('\n');
5385
+ });
5386
+ return replacedLine = replacedLine.replace(urlRegex, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
5387
+ }).join('\n');
5393
5388
  });
5394
5389
  return `
5395
5390
  <style>
@@ -5441,9 +5436,9 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5441
5436
  .content::-webkit-scrollbar {
5442
5437
  display: none;
5443
5438
  }
5444
- .file-link {
5439
+ .file-link,
5440
+ .url-link {
5445
5441
  cursor: pointer;
5446
- color: #6eecf7;
5447
5442
  text-decoration: underline;
5448
5443
  text-underline-offset: 3px;
5449
5444
  &:hover {
@@ -5453,6 +5448,12 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5453
5448
  opacity: 0.6;
5454
5449
  }
5455
5450
  }
5451
+ .file-link {
5452
+ color: #6eecf7;
5453
+ }
5454
+ .url-link {
5455
+ color: #eff986;
5456
+ }
5456
5457
  .close {
5457
5458
  position: absolute;
5458
5459
  top: 27px;
@@ -5589,17 +5590,14 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5589
5590
  let { devConfig, serverConfig, publicPaths } = this, clientPaths = function(devConfig) {
5590
5591
  var _devConfig_client;
5591
5592
  let clientPaths = [];
5592
- return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null === (_devConfig_client = devConfig.client) || void 0 === _devConfig_client ? void 0 : _devConfig_client.overlay) && clientPaths.push(`${compilationManager_require.resolve('@rsbuild/core/client/overlay')}`)), clientPaths;
5593
+ return (devConfig.hmr || devConfig.liveReload) && (clientPaths.push(compilationManager_require.resolve('@rsbuild/core/client/hmr')), (null == (_devConfig_client = devConfig.client) ? void 0 : _devConfig_client.overlay) && clientPaths.push(`${compilationManager_require.resolve('@rsbuild/core/client/overlay')}`)), clientPaths;
5593
5594
  }(devConfig), middleware = await getCompilationMiddleware(this.compiler, {
5594
5595
  callbacks: {
5595
5596
  onInvalid: (compilationId, fileName)=>{
5596
- if ('string' == typeof fileName && HTML_REGEX.test(fileName)) {
5597
- this.socketServer.sockWrite({
5598
- type: 'static-changed',
5599
- compilationId
5600
- });
5601
- return;
5602
- }
5597
+ if ('string' == typeof fileName && HTML_REGEX.test(fileName)) return void this.socketServer.sockWrite({
5598
+ type: 'static-changed',
5599
+ compilationId
5600
+ });
5603
5601
  this.socketServer.sockWrite({
5604
5602
  type: 'invalid',
5605
5603
  compilationId
@@ -5632,10 +5630,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5632
5630
  return void 0 === size || Number(size) > 1024;
5633
5631
  }, gzipMiddleware = ({ level = external_node_zlib_default().constants.Z_BEST_SPEED } = {})=>(req, res, next)=>{
5634
5632
  let gzip, writeHeadStatus, accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
5635
- if ('HEAD' === req.method || !encoding) {
5636
- next();
5637
- return;
5638
- }
5633
+ if ('HEAD' === req.method || !encoding) return void next();
5639
5634
  let started = !1, { end, write, on, writeHead } = res, listeners = [], start = ()=>{
5640
5635
  if (!started) {
5641
5636
  if (started = !0, shouldCompress(res)) for (let listener of (res.setHeader('Content-Encoding', 'gzip'), res.removeHeader('Content-Length'), (gzip = external_node_zlib_default().createGzip({
@@ -5707,7 +5702,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5707
5702
  }), res.end();
5708
5703
  return;
5709
5704
  }
5710
- if (null === (_req_headers_accept = req.headers.accept) || void 0 === _req_headers_accept ? void 0 : _req_headers_accept.includes('text/html')) {
5705
+ if (null == (_req_headers_accept = req.headers.accept) ? void 0 : _req_headers_accept.includes('text/html')) {
5711
5706
  res.writeHead(404, {
5712
5707
  'Content-Type': 'text/html'
5713
5708
  }), res.end(`The server is configured with a base URL of ${base} - did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
@@ -5858,7 +5853,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5858
5853
  environments
5859
5854
  })), compilationManager && (middlewares.push(compilationManager.middleware), upgradeEvents.push(compilationManager.socketServer.upgrade), middlewares.push((req, res, next)=>{
5860
5855
  var _req_url;
5861
- (null === (_req_url = req.url) || void 0 === _req_url ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
5856
+ (null == (_req_url = req.url) ? void 0 : _req_url.endsWith('.hot-update.json')) && 'OPTIONS' !== req.method ? (res.statusCode = 404, res.end()) : next();
5862
5857
  })), compilationManager && middlewares.push(getHtmlCompletionMiddleware({
5863
5858
  compilationManager,
5864
5859
  distPath: context.distPath
@@ -6047,7 +6042,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6047
6042
  createRunner() {
6048
6043
  var _this__options_compilerOptions_experiments;
6049
6044
  super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
6050
- let outputModule = null === (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) || void 0 === _this__options_compilerOptions_experiments ? void 0 : _this__options_compilerOptions_experiments.outputModule;
6045
+ let outputModule = null == (_this__options_compilerOptions_experiments = this._options.compilerOptions.experiments) ? void 0 : _this__options_compilerOptions_experiments.outputModule;
6051
6046
  this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
6052
6047
  let file = this.getFile(modulePath, currentDirectory);
6053
6048
  return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
@@ -6122,7 +6117,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6122
6117
  let { chunks: entryChunks = [] } = entrypoints[entryName], files = entryChunks.reduce((prev, entryChunkName)=>{
6123
6118
  let chunk = null == chunks ? void 0 : chunks.find((chunk)=>{
6124
6119
  var _chunk_names;
6125
- return chunk.entry && (null === (_chunk_names = chunk.names) || void 0 === _chunk_names ? void 0 : _chunk_names.includes(String(entryChunkName)));
6120
+ return chunk.entry && (null == (_chunk_names = chunk.names) ? void 0 : _chunk_names.includes(String(entryChunkName)));
6126
6121
  });
6127
6122
  return (null == chunk ? void 0 : chunk.files) ? prev.concat(chunk.files.filter((file)=>!file.endsWith('.css'))) : prev;
6128
6123
  }, []);
@@ -6152,23 +6147,29 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6152
6147
  [entryName]: res
6153
6148
  }), res;
6154
6149
  };
6155
- }, cleanupCallbacks = new Set(), handleTermination = async (_, exitCode)=>{
6150
+ }, cleanupCallbacks = new Set(), handleTermination = async (exitCode)=>{
6156
6151
  try {
6157
6152
  await Promise.all([
6158
6153
  ...cleanupCallbacks
6159
6154
  ].map((cb)=>cb()));
6160
6155
  } finally{
6161
- process.exitCode ??= exitCode ? 128 + exitCode : void 0, process.exit();
6156
+ process.exitCode ??= exitCode, process.exit();
6162
6157
  }
6163
6158
  }, registerCleanup = (callback)=>{
6164
6159
  cleanupCallbacks.add(callback);
6165
6160
  }, removeCleanup = (callback)=>{
6166
6161
  cleanupCallbacks.delete(callback);
6167
6162
  }, shutdownRefCount = 0, setupGracefulShutdown = ()=>{
6168
- shutdownRefCount++, process.once('SIGTERM', handleTermination);
6169
- let isCI = 'true' === process.env.CI;
6170
- return isCI || process.stdin.on('end', handleTermination), ()=>{
6171
- !(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', handleTermination), isCI || process.stdin.removeListener('end', handleTermination));
6163
+ shutdownRefCount++;
6164
+ let onSigterm = ()=>{
6165
+ handleTermination(external_node_os_namespaceObject.constants.signals.SIGTERM + 128);
6166
+ };
6167
+ process.once('SIGTERM', onSigterm);
6168
+ let isCI = 'true' === process.env.CI, onStdinEnd = ()=>{
6169
+ handleTermination(0);
6170
+ };
6171
+ return isCI || process.stdin.on('end', onStdinEnd), ()=>{
6172
+ !(--shutdownRefCount > 0) && (process.removeListener('SIGTERM', onSigterm), isCI || process.stdin.removeListener('end', onStdinEnd));
6172
6173
  };
6173
6174
  }, createHttpServer = async ({ serverConfig, middlewares })=>{
6174
6175
  if (serverConfig.https) {
@@ -6400,7 +6401,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6400
6401
  }, hasErrors = stats.hasErrors();
6401
6402
  if (!hasErrors) {
6402
6403
  var _statsJson_children;
6403
- isMultiCompiler && (null === (_statsJson_children = statsJson.children) || void 0 === _statsJson_children ? void 0 : _statsJson_children.length) ? statsJson.children.forEach((c, index)=>{
6404
+ isMultiCompiler && (null == (_statsJson_children = statsJson.children) ? void 0 : _statsJson_children.length) ? statsJson.children.forEach((c, index)=>{
6404
6405
  printTime(c, index);
6405
6406
  }) : printTime(statsJson, 0);
6406
6407
  }
@@ -6710,11 +6711,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6710
6711
  let { moduleFederation } = config;
6711
6712
  if (api.isPluginExists('rsbuild:module-federation-enhanced') && (config.server ||= {}, config.server.cors = !0), (null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
6712
6713
  var _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
6713
- config.dev ||= {}, config.server ||= {}, config.server.cors = !0, (null === (_config_server = config.server) || void 0 === _config_server ? void 0 : _config_server.port) && !(null === (_config_dev_client = config.dev.client) || void 0 === _config_dev_client ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null === (_originalConfig_dev = api.getRsbuildConfig('original').dev) || void 0 === _originalConfig_dev ? void 0 : _originalConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null === (_config_server1 = config.server) || void 0 === _config_server1 ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
6714
+ config.dev ||= {}, config.server ||= {}, config.server.cors = !0, (null == (_config_server = config.server) ? void 0 : _config_server.port) && !(null == (_config_dev_client = config.dev.client) ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null == (_originalConfig_dev = api.getRsbuildConfig('original').dev) ? void 0 : _originalConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null == (_config_server1 = config.server) ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
6714
6715
  }
6715
6716
  }), api.modifyEnvironmentConfig((config)=>{
6716
6717
  var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
6717
- (null === (_config_moduleFederation = config.moduleFederation) || void 0 === _config_moduleFederation ? void 0 : _config_moduleFederation.options) && ((null === (_config_performance = config.performance) || void 0 === _config_performance || null === (_config_performance_chunkSplit = _config_performance.chunkSplit) || void 0 === _config_performance_chunkSplit ? void 0 : _config_performance_chunkSplit.strategy) === 'split-by-experience' && (config.performance.chunkSplit = {
6718
+ (null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) && ((null == (_config_performance = config.performance) || null == (_config_performance_chunkSplit = _config_performance.chunkSplit) ? void 0 : _config_performance_chunkSplit.strategy) === 'split-by-experience' && (config.performance.chunkSplit = {
6718
6719
  ...config.performance.chunkSplit,
6719
6720
  strategy: 'custom'
6720
6721
  }), config.source.include = [
@@ -6724,7 +6725,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6724
6725
  }), api.modifyBundlerChain(async (chain, { CHAIN_ID, target, environment })=>{
6725
6726
  var _config_moduleFederation;
6726
6727
  let { config } = environment;
6727
- if (!(null === (_config_moduleFederation = config.moduleFederation) || void 0 === _config_moduleFederation ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
6728
+ if (!(null == (_config_moduleFederation = config.moduleFederation) ? void 0 : _config_moduleFederation.options) || 'web' !== target) return;
6728
6729
  let { options } = config.moduleFederation;
6729
6730
  chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(core_namespaceObject.rspack.container.ModuleFederationPlugin, [
6730
6731
  options
@@ -6754,7 +6755,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6754
6755
  paths: envs1.filePaths,
6755
6756
  type: 'reload-server'
6756
6757
  }
6757
- ], null === (_config_performance = config1.performance) || void 0 === _config_performance ? void 0 : _config_performance.buildCache))) {
6758
+ ], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
6758
6759
  let { buildCache } = config1.performance;
6759
6760
  !0 === buildCache ? config1.performance.buildCache = {
6760
6761
  buildDependencies: envs1.filePaths
@@ -6930,9 +6931,21 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6930
6931
  handler
6931
6932
  });
6932
6933
  }, onExitListened = !1, onExit = (cb)=>{
6933
- onExitListened || (process.on('exit', ()=>{
6934
- hooks.onExit.callBatch();
6935
- }), onExitListened = !0), hooks.onExit.tap(cb);
6934
+ if (!onExitListened) {
6935
+ var onExit;
6936
+ onExit = (exitCode)=>{
6937
+ hooks.onExit.callBatch({
6938
+ exitCode
6939
+ });
6940
+ }, exitHook_callbacks.add(onExit), isRegistered || (isRegistered = !0, external_node_process_default().on('SIGINT', ()=>{
6941
+ exit(external_node_os_namespaceObject.constants.signals.SIGINT + 128, 'SIGINT');
6942
+ }), external_node_process_default().once('SIGTERM', ()=>{
6943
+ exit(external_node_os_namespaceObject.constants.signals.SIGTERM + 128, 'SIGTERM');
6944
+ }), external_node_process_default().once('exit', (exitCode)=>{
6945
+ exit(exitCode, 'exit');
6946
+ })), onExitListened = !0;
6947
+ }
6948
+ hooks.onExit.tap(cb);
6936
6949
  };
6937
6950
  return (environment)=>({
6938
6951
  context: publicContext,
@@ -7403,11 +7416,11 @@ ${section.body}` : section.body).join("\n\n"));
7403
7416
  }
7404
7417
  process.title = 'rsbuild-node';
7405
7418
  let { npm_execpath } = process.env;
7406
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.5\n`);
7419
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.7\n`);
7407
7420
  try {
7408
7421
  !function() {
7409
7422
  let cli = cac_dist('rsbuild');
7410
- cli.help(), cli.version("1.3.5"), applyCommonOptions(cli);
7423
+ cli.help(), cli.version("1.3.7"), applyCommonOptions(cli);
7411
7424
  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');
7412
7425
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7413
7426
  try {
@@ -7458,7 +7471,7 @@ ${section.body}` : section.body).join("\n\n"));
7458
7471
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7459
7472
  }
7460
7473
  }
7461
- let src_rslib_entry_version = "1.3.5";
7474
+ let src_version = "1.3.7";
7462
7475
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, 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 === [
7463
7476
  "PLUGIN_CSS_NAME",
7464
7477
  "PLUGIN_SWC_NAME",