@rsbuild/core 2.2.3 → 2.2.5

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/626.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /*! LICENSE: 626.js.LICENSE.txt */
2
2
  let runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
3
+ import { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject } from "./rslib-runtime.js";
3
4
  import { rspack as core_rspack } from "@rspack/core";
4
5
  import node_util, { stripVTControlCharacters } from "node:util";
5
6
  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";
@@ -12,10 +13,9 @@ import { isPromise, isRegExp } from "node:util/types";
12
13
  import { readFile } from "node:fs/promises";
13
14
  import node_zlib from "node:zlib";
14
15
  import { once } from "node:events";
15
- import { __webpack_require__ } from "./rslib-runtime.js";
16
16
  var superClass, superClass1, __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
17
17
  let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
18
- __webpack_require__.add({
18
+ moduleFactories.add({
19
19
  "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/deepmerge/4.3.1/56471899410038644780b3527c5076e78d3f57091a0da3ac0daf6d994929353d/node_modules/deepmerge/dist/cjs.js" (module) {
20
20
  var isMergeableObject = function isMergeableObject(value) {
21
21
  return isNonNullObject(value) && !isSpecial(value);
@@ -151,8 +151,8 @@ __webpack_require__.add({
151
151
  return thunk.cancel = cleanup, thunk;
152
152
  };
153
153
  },
154
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
155
- let path = __webpack_require__("path?37f5"), fs = __webpack_require__("fs?cdbd"), os = __webpack_require__("os"), url = __webpack_require__("url?5f07"), fsReadFileAsync = fs.promises.readFile;
154
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js" (module) {
155
+ let path = rspackRequire("path?37f5"), fs = rspackRequire("fs?cdbd"), os = rspackRequire("os"), url = rspackRequire("url?5f07"), fsReadFileAsync = fs.promises.readFile;
156
156
  function getDefaultSearchPlaces(name, sync) {
157
157
  return [
158
158
  'package.json',
@@ -321,9 +321,9 @@ __webpack_require__.add({
321
321
  };
322
322
  };
323
323
  },
324
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js" (module, __unused_rspack_exports, __webpack_require__) {
324
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js" (module) {
325
325
  module.exports = onFinished, module.exports.isFinished = isFinished;
326
- var asyncHooks = tryRequireAsyncHooks(), first = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ee-first/1.1.1/7d7aff2abffb03f454b885edc2f03bd078376c8cde75af0c324753fee26268de/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
326
+ var asyncHooks = tryRequireAsyncHooks(), first = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/ee-first/1.1.1/7d7aff2abffb03f454b885edc2f03bd078376c8cde75af0c324753fee26268de/node_modules/ee-first/index.js"), defer = 'function' == typeof setImmediate ? setImmediate : function(fn) {
327
327
  process.nextTick(fn.bind.apply(fn, arguments));
328
328
  };
329
329
  function onFinished(msg, listener) {
@@ -377,7 +377,7 @@ __webpack_require__.add({
377
377
  }
378
378
  function tryRequireAsyncHooks() {
379
379
  try {
380
- return __webpack_require__("async_hooks");
380
+ return rspackRequire("async_hooks");
381
381
  } catch (e) {
382
382
  return {};
383
383
  }
@@ -387,8 +387,8 @@ __webpack_require__.add({
387
387
  return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
388
388
  }
389
389
  },
390
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
391
- let yaml, { resolve } = __webpack_require__("node:path?815c"), config = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/req.js");
390
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/index.js" (module) {
391
+ let yaml, { resolve } = rspackRequire("node:path?815c"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
392
392
  async function processResult(ctx, result) {
393
393
  let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
394
394
  default: obj
@@ -461,8 +461,8 @@ __webpack_require__.add({
461
461
  });
462
462
  };
463
463
  },
464
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
465
- let req = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/req.js");
464
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/options.js" (module) {
465
+ let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
466
466
  module.exports = async function options(config, file) {
467
467
  if (config.parser && 'string' == typeof config.parser) try {
468
468
  config.parser = await req(config.parser, file);
@@ -482,8 +482,8 @@ __webpack_require__.add({
482
482
  return config;
483
483
  };
484
484
  },
485
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
486
- let req = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/req.js");
485
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/plugins.js" (module) {
486
+ let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js");
487
487
  async function load(plugin, options, file) {
488
488
  try {
489
489
  if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
@@ -499,8 +499,8 @@ __webpack_require__.add({
499
499
  }), list;
500
500
  };
501
501
  },
502
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
503
- let tsx, jiti, { createRequire } = __webpack_require__("node:module?f56b"), { pathToFileURL } = __webpack_require__("node:url?5295"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
502
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/req.js" (module) {
503
+ let tsx, jiti, { createRequire } = rspackRequire("node:module?f56b"), { pathToFileURL } = rspackRequire("node:url?5295"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
504
504
  module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
505
505
  let url = createRequire(rootFile).resolve(name);
506
506
  try {
@@ -707,8 +707,8 @@ function applyDebugOverride(targetLogger) {
707
707
  targetLogger.override({
708
708
  debug: (message, ...args)=>{
709
709
  if ('verbose' !== targetLogger.level) return;
710
- let time = color.gray(getTime());
711
- (targetLogger.options.console ?? console).log(` ${color.magenta('rsbuild')} ${time} ${message}`, ...args);
710
+ let time = color.gray(getTime()), loggerConsole = targetLogger.options.console ?? console, prefix = ` ${color.magenta('rsbuild')} ${time}`;
711
+ 'string' == typeof message ? loggerConsole.log(`${prefix} ${message}`, ...args) : loggerConsole.log(prefix, message, ...args);
712
712
  }
713
713
  });
714
714
  }
@@ -1154,17 +1154,17 @@ let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirnam
1154
1154
  'vtt'
1155
1155
  ], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
1156
1156
  var __webpack_modules__ = {}, __webpack_module_cache__ = {};
1157
- function __nested_rspack_require_65__(moduleId) {
1157
+ function dist_webpack_require_(moduleId) {
1158
1158
  var cachedModule = __webpack_module_cache__[moduleId];
1159
1159
  if (void 0 !== cachedModule) return cachedModule.exports;
1160
1160
  var module = __webpack_module_cache__[moduleId] = {
1161
1161
  exports: {}
1162
1162
  };
1163
- return __webpack_modules__[moduleId](module, module.exports, __nested_rspack_require_65__), module.exports;
1163
+ return __webpack_modules__[moduleId](module, module.exports, dist_webpack_require_), module.exports;
1164
1164
  }
1165
- __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65__.add = function(modules) {
1166
- Object.assign(__nested_rspack_require_65__.m, modules);
1167
- }, __nested_rspack_require_65__.add({
1165
+ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = function(modules) {
1166
+ Object.assign(dist_webpack_require_.m, modules);
1167
+ }, dist_webpack_require_.add({
1168
1168
  "./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js" (module) {
1169
1169
  var isMergeableObject = function(value) {
1170
1170
  return isNonNullObject(value) && !isSpecial(value);
@@ -1234,8 +1234,8 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1234
1234
  }, {});
1235
1235
  }, module.exports = deepmerge;
1236
1236
  },
1237
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, exports) {
1238
- exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
1237
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, __nested_rspack_exports__) {
1238
+ __nested_rspack_exports__.arrayToString = void 0, __nested_rspack_exports__.arrayToString = (array, space, next)=>{
1239
1239
  let values = array.map(function(value, index) {
1240
1240
  let result = next(value, index);
1241
1241
  return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
@@ -1243,9 +1243,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1243
1243
  return `[${eol}${values}${eol}]`;
1244
1244
  };
1245
1245
  },
1246
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __nested_rspack_require_5714_5733__) {
1247
- exports.functionToString = exports.USED_METHOD_KEY = void 0;
1248
- let quote_1 = __nested_rspack_require_5714_5733__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
1246
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
1247
+ __nested_rspack_exports__.functionToString = __nested_rspack_exports__.USED_METHOD_KEY = void 0;
1248
+ let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
1249
1249
  " " () {}
1250
1250
  })[" "].toString().charAt(0), FUNCTION_PREFIXES = {
1251
1251
  Function: "function ",
@@ -1268,9 +1268,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1268
1268
  }
1269
1269
  return found ? fnString.split(`\n${found}`).join("\n") : fnString;
1270
1270
  }
1271
- exports.USED_METHOD_KEY = new WeakSet(), exports.functionToString = (fn, space, next, key)=>{
1271
+ __nested_rspack_exports__.USED_METHOD_KEY = new WeakSet(), __nested_rspack_exports__.functionToString = (fn, space, next, key)=>{
1272
1272
  let name = "string" == typeof key ? key : void 0;
1273
- return void 0 !== name && exports.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
1273
+ return void 0 !== name && __nested_rspack_exports__.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
1274
1274
  };
1275
1275
  class FunctionParser {
1276
1276
  constructor(fn, indent, next, key){
@@ -1378,13 +1378,13 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1378
1378
  }
1379
1379
  }
1380
1380
  },
1381
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __nested_rspack_require_14714_14733__) {
1382
- exports.A = void 0;
1383
- let stringify_1 = __nested_rspack_require_14714_14733__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __nested_rspack_require_14714_14733__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
1381
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
1382
+ __nested_rspack_exports__.A = void 0;
1383
+ let stringify_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
1384
1384
  function replacerToString(replacer) {
1385
1385
  return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
1386
1386
  }
1387
- exports.A = function stringify(value, replacer, indent, options = {}) {
1387
+ __nested_rspack_exports__.A = function stringify(value, replacer, indent, options = {}) {
1388
1388
  let space = "string" == typeof indent ? indent : " ".repeat(indent || 0), path = [], stack = new Set(), tracking = new Map(), unpack = new Map(), valueCount = 0, { maxDepth = 100, references = !1, skipUndefinedProperties = !1, maxValues = 100000 } = options, valueToString = replacerToString(replacer), onNext = (value, key)=>{
1389
1389
  if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
1390
1390
  if (void 0 === key) return valueToString(value, space, onNext, key);
@@ -1414,10 +1414,10 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1414
1414
  return result;
1415
1415
  };
1416
1416
  },
1417
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __nested_rspack_require_18029_18048__) {
1418
- exports.objectToString = void 0;
1419
- let quote_1 = __nested_rspack_require_18029_18048__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __nested_rspack_require_18029_18048__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __nested_rspack_require_18029_18048__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
1420
- exports.objectToString = (value, space, next, key)=>{
1417
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
1418
+ __nested_rspack_exports__.objectToString = void 0;
1419
+ let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
1420
+ __nested_rspack_exports__.objectToString = (value, space, next, key)=>{
1421
1421
  if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
1422
1422
  if ("object" == typeof global && value === global) return globalToString(value, space, next);
1423
1423
  let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
@@ -1446,8 +1446,8 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1446
1446
  "[object Window]": globalToString
1447
1447
  };
1448
1448
  },
1449
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, exports) {
1450
- exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.W = exports.quoteString = void 0;
1449
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, __nested_rspack_exports__) {
1450
+ __nested_rspack_exports__.stringifyPath = __nested_rspack_exports__.quoteKey = __nested_rspack_exports__.isValidVariableName = __nested_rspack_exports__.W = __nested_rspack_exports__.quoteString = void 0;
1451
1451
  let ESCAPABLE = /[\\\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, META_CHARS = new Map([
1452
1452
  [
1453
1453
  "\b",
@@ -1485,24 +1485,24 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1485
1485
  function escapeChar(char) {
1486
1486
  return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
1487
1487
  }
1488
- exports.quoteString = function quoteString(str) {
1488
+ __nested_rspack_exports__.quoteString = function quoteString(str) {
1489
1489
  return `'${str.replace(ESCAPABLE, escapeChar)}'`;
1490
1490
  };
1491
1491
  let RESERVED_WORDS = new Set("break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "));
1492
1492
  function isValidVariableName(name) {
1493
- return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.W.test(name);
1493
+ return "string" == typeof name && !RESERVED_WORDS.has(name) && __nested_rspack_exports__.W.test(name);
1494
1494
  }
1495
- exports.W = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
1495
+ __nested_rspack_exports__.W = /^[A-Za-z_$][A-Za-z0-9_$]*$/, __nested_rspack_exports__.isValidVariableName = isValidVariableName, __nested_rspack_exports__.quoteKey = function quoteKey(key, next) {
1496
1496
  return isValidVariableName(key) ? key : next(key);
1497
- }, exports.stringifyPath = function stringifyPath(path, next) {
1497
+ }, __nested_rspack_exports__.stringifyPath = function stringifyPath(path, next) {
1498
1498
  let result = "";
1499
1499
  for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
1500
1500
  return result;
1501
1501
  };
1502
1502
  },
1503
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __nested_rspack_require_23448_23467__) {
1504
- exports.toString = void 0;
1505
- let quote_1 = __nested_rspack_require_23448_23467__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __nested_rspack_require_23448_23467__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __nested_rspack_require_23448_23467__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
1503
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, __nested_rspack_exports__, __webpack_require__) {
1504
+ __nested_rspack_exports__.toString = void 0;
1505
+ let quote_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __webpack_require__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
1506
1506
  string: quote_1.quoteString,
1507
1507
  number: (value)=>Object.is(value, -0) ? "-0" : String(value),
1508
1508
  boolean: String,
@@ -1515,10 +1515,10 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1515
1515
  object: object_1.objectToString,
1516
1516
  function: function_1.functionToString
1517
1517
  };
1518
- exports.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
1518
+ __nested_rspack_exports__.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
1519
1519
  }
1520
1520
  });
1521
- let cjs = __nested_rspack_require_65__("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
1521
+ let cjs = dist_webpack_require_("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
1522
1522
  function createMap(superClass) {
1523
1523
  return class extends superClass {
1524
1524
  constructor(...args){
@@ -2088,7 +2088,7 @@ let Rule = Orderable(class extends ChainedMap {
2088
2088
  'maxEntrypointSize'
2089
2089
  ]);
2090
2090
  }
2091
- }, dist = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"), castArray = (value)=>Array.isArray(value) ? value : [
2091
+ }, dist = dist_webpack_require_("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js"), castArray = (value)=>Array.isArray(value) ? value : [
2092
2092
  value
2093
2093
  ];
2094
2094
  class RspackChain extends ChainedMap {
@@ -2205,11 +2205,11 @@ class RspackChain extends ChainedMap {
2205
2205
  ]);
2206
2206
  }
2207
2207
  }
2208
- let vendors_require = createRequire(import.meta.url), cjs_0 = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/deepmerge/4.3.1/56471899410038644780b3527c5076e78d3f57091a0da3ac0daf6d994929353d/node_modules/deepmerge/dist/cjs.js");
2209
- var cjs_0_default = __webpack_require__.n(cjs_0);
2208
+ let vendors_require = createRequire(import.meta.url);
2209
+ var cjs_0_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/deepmerge/4.3.1/56471899410038644780b3527c5076e78d3f57091a0da3ac0daf6d994929353d/node_modules/deepmerge/dist/cjs.js"));
2210
2210
  let setNodeEnv = (env)=>{
2211
2211
  process.env.NODE_ENV = env;
2212
- }, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), objectPrototype = Object.prototype, getProto = Object.getPrototypeOf, isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && getProto(obj) === objectPrototype, helpers_castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
2212
+ }, isFunction = (func)=>'function' == typeof func, isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj), objectPrototype = Object.prototype, helpers_getProto = Object.getPrototypeOf, isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && helpers_getProto(obj) === objectPrototype, helpers_castArray = (arr)=>void 0 === arr ? [] : Array.isArray(arr) ? arr : [
2213
2213
  arr
2214
2214
  ], cloneDeep = (value)=>null == value ? value : cjs_0_default()({}, value, {
2215
2215
  isMergeableObject: isPlainObject
@@ -2704,7 +2704,7 @@ let ensureAbsolutePath = (base, filePath)=>external_node_path_isAbsolute(filePat
2704
2704
  } catch {
2705
2705
  return url;
2706
2706
  }
2707
- }, 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)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath, isFileSync = (filePath)=>{
2707
+ }, dedupeNestedPaths = (paths)=>paths.sort((p1, p2)=>p2.length > p1.length ? -1 : 1).reduce((prev, curr)=>prev.some((p)=>curr.startsWith(p) || curr === p) ? prev : prev.concat(curr), []), toPosixPath = (filepath)=>'/' === sep ? filepath : filepath.replace(/\\/g, '/'), normalizeRuleConditionPath = (filepath)=>isWindows && 'string' == typeof filepath && filepath.includes('/') && win32.isAbsolute(filepath) ? filepath.replace(/\//g, '\\') : filepath, isFileSync = (filePath)=>{
2708
2708
  try {
2709
2709
  return node_fs.statSync(filePath, {
2710
2710
  throwIfNoEntry: !1
@@ -3181,7 +3181,7 @@ let mapProcessAssetsStage = (stage)=>{
3181
3181
  case 'report':
3182
3182
  return Compilation.PROCESS_ASSETS_STAGE_REPORT;
3183
3183
  default:
3184
- throw Error(`${color.dim('[rsbuild]')} Invalid process assets stage: ${stage}`);
3184
+ throw Error(`${color.dim('[rsbuild]')} Invalid process assets stage: ${String(stage)}`);
3185
3185
  }
3186
3186
  };
3187
3187
  function initPluginAPI({ context, pluginManager }) {
@@ -3425,7 +3425,7 @@ function createPublicContext(context) {
3425
3425
  async function createContext(options, userConfig, logger, loadConfigResult) {
3426
3426
  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, hooks = initHooks();
3427
3427
  return {
3428
- version: "2.2.3",
3428
+ version: "2.2.5",
3429
3429
  rootPath,
3430
3430
  configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
3431
3431
  configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
@@ -4099,8 +4099,8 @@ async function createCompiler_createCompiler(options) {
4099
4099
  'true' === process.env.RSPACK_UNSAFE_FAST_DROP && (compiler.unsafeFastDrop = !0);
4100
4100
  let isVersionLogged = !1, isCompiling = !1, hasFatalError = !1, compilers = isMultiCompiler ? compiler.compilers : [
4101
4101
  compiler
4102
- ], finishFatalBuild = ()=>{
4103
- !hasFatalError || compilers.some((item)=>item.watching ? item.watching.running : item.running) || (context.buildState.status = 'failed', context.buildState.hasErrors = !0, isCompiling = !1);
4102
+ ], deferBuildLogs = isMultiCompiler && context.environmentList.some(({ config })=>config.dev.progressBar), pendingBuildLogs = [], finishFatalBuild = ()=>{
4103
+ !hasFatalError || compilers.some((item)=>item.watching ? item.watching.running : item.running) || (context.buildState.status = 'failed', context.buildState.hasErrors = !0, isCompiling = !1, pendingBuildLogs.length = 0);
4104
4104
  }, logRspackVersion = ()=>{
4105
4105
  isVersionLogged || (logger.debug(`using Rspack v${core_rspack.rspackVersion}`), isVersionLogged = !0);
4106
4106
  }, lazyModules = new Set();
@@ -4126,7 +4126,9 @@ async function createCompiler_createCompiler(options) {
4126
4126
  }), compilers))item.hooks.failed.tap(HOOK_NAME, ()=>{
4127
4127
  hasFatalError = !0, context.buildState.hasErrors = !0, finishFatalBuild();
4128
4128
  }), item.hooks.afterDone.tap(HOOK_NAME, finishFatalBuild), item.hooks.watchClose.tap(HOOK_NAME, finishFatalBuild);
4129
- 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap(HOOK_NAME, ()=>{
4129
+ compiler.hooks.shutdown.tap(HOOK_NAME, ()=>{
4130
+ pendingBuildLogs.length = 0;
4131
+ }), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap(HOOK_NAME, ()=>{
4130
4132
  logger.info('build started...'), logRspackVersion();
4131
4133
  });
4132
4134
  let printTime = (index, hasErrors)=>{
@@ -4144,15 +4146,20 @@ async function createCompiler_createCompiler(options) {
4144
4146
  if (0 === remainingSeconds) return minutesLabel;
4145
4147
  let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
4146
4148
  return `${minutesLabel} ${secondsLabel}`;
4147
- })(time / 1000)}${suffix}`;
4148
- hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
4149
+ })(time / 1000)}${suffix}`, log = ()=>{
4150
+ hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
4151
+ };
4152
+ deferBuildLogs ? pendingBuildLogs.push(log) : log();
4149
4153
  };
4150
4154
  return isMultiCompiler && compiler.compilers.forEach((item, index)=>{
4151
- item.hooks.done.tap(HOOK_NAME, (stats)=>{
4155
+ item.hooks.done.tap({
4156
+ name: HOOK_NAME,
4157
+ stage: -1
4158
+ }, (stats)=>{
4152
4159
  printTime(index, stats.hasErrors());
4153
4160
  });
4154
4161
  }), compiler.hooks.done.tap(HOOK_NAME, (statsInstance)=>{
4155
- hasFatalError = !1;
4162
+ for (let log of (hasFatalError = !1, pendingBuildLogs.splice(0)))log();
4156
4163
  let stats = getRsbuildStats(statsInstance, compiler, logger, context.action), hasErrors = statsInstance.hasErrors();
4157
4164
  context.buildState.stats = stats, context.buildState.status = 'done', context.buildState.hasErrors = hasErrors, context.socketServer?.onBuildDone();
4158
4165
  let { message, level } = formatStats(stats, hasErrors, options.context.rootPath, logger);
@@ -4363,13 +4370,13 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
4363
4370
  let stats, closeCompiler, closingPromise, unregisterRestart, restartWatcher, { watch } = buildOptions, { context } = initOptions, { logger } = context, { compiler, rspackConfigs } = await createCompiler_createCompiler(initOptions);
4364
4371
  if ((({ context, isWatch, compiler, rspackConfigs, MultiStatsCtor })=>{
4365
4372
  let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
4366
- let promise = context.hooks.onAfterBuild.callBatch({
4373
+ let shouldLogWatching = isWatch && isFirstCompile, promise = context.hooks.onAfterBuild.callBatch({
4367
4374
  isFirstCompile,
4368
4375
  stats,
4369
4376
  environments: context.environments,
4370
4377
  isWatch
4371
4378
  });
4372
- isFirstCompile = !1, await promise;
4379
+ isFirstCompile = !1, await promise, shouldLogWatching && context.logger.info('watching for changes...');
4373
4380
  }, onEnvironmentDone = async (index, stats)=>{
4374
4381
  let environment = environmentList[index], time = context.buildState.time[environment.name] ?? 0;
4375
4382
  await context.hooks.onAfterEnvironmentCompile.callBatch({
@@ -4452,7 +4459,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
4452
4459
  await restartWatcher?.close(), await closeBuild();
4453
4460
  }
4454
4461
  };
4455
- }, main = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/dotenv-expand/13.0.0/1d3d360f4c41ed89366b79ec2c361d16e6aee7ab6c47163ea4f3718f7f78cc4c/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
4462
+ }, main = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/dotenv-expand/13.0.0/1d3d360f4c41ed89366b79ec2c361d16e6aee7ab6c47163ea4f3718f7f78cc4c/node_modules/dotenv-expand/lib/main.js"), DOTENV_LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
4456
4463
  function loadEnv_parse(src) {
4457
4464
  let match, obj = {}, lines = src.toString();
4458
4465
  for(lines = lines.replace(/\r\n?/gm, '\n'); null != (match = DOTENV_LINE.exec(lines));){
@@ -5067,8 +5074,7 @@ function parseMinifyOptions(config) {
5067
5074
  cssOptions: minify.cssOptions
5068
5075
  };
5069
5076
  }
5070
- let postcss_load_config_src = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/c9e6a20d11428465888ab8b3a063f9903a46c9842bd45d6dfecb2a0964575256/node_modules/postcss-load-config/src/index.js");
5071
- var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
5077
+ var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/d0e1ffed59e3d657674e04f8f91182ccde1db31e7c7c0f00dd625e998ab50180/node_modules/postcss-load-config/src/index.js"));
5072
5078
  async function getLightningCSSLoaderOptions(config, targets, minify) {
5073
5079
  let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
5074
5080
  targets,
@@ -5255,11 +5261,36 @@ function pluginExternals() {
5255
5261
  }
5256
5262
  };
5257
5263
  }
5258
- async function gzipSize(input) {
5264
+ function getCompression(compressed) {
5265
+ let { type = 'gzip', level = 6 } = 'object' == typeof compressed ? compressed : {};
5266
+ return 'brotli' === type ? {
5267
+ type,
5268
+ level,
5269
+ header: 'Br',
5270
+ label: 'brotli',
5271
+ sizeKey: 'brotliSize',
5272
+ totalKey: 'totalBrotliSize'
5273
+ } : {
5274
+ type,
5275
+ level,
5276
+ header: 'Gzip',
5277
+ label: 'gzipped',
5278
+ sizeKey: 'gzippedSize',
5279
+ totalKey: 'totalGzipSize'
5280
+ };
5281
+ }
5282
+ async function calcCompressedSize(input, type, level) {
5259
5283
  return (await new Promise((resolve, reject)=>{
5260
- node_zlib.gzip(input, (err, result)=>{
5284
+ let callback = (err, result)=>{
5261
5285
  err ? reject(err) : resolve(result);
5262
- });
5286
+ };
5287
+ 'brotli' === type ? node_zlib.brotliCompress(input, {
5288
+ params: {
5289
+ [node_zlib.constants.BROTLI_PARAM_QUALITY]: level
5290
+ }
5291
+ }, callback) : node_zlib.gzip(input, {
5292
+ level
5293
+ }, callback);
5263
5294
  })).length;
5264
5295
  }
5265
5296
  function getSnapshotPath(dir, snapshotHash) {
@@ -5292,7 +5323,7 @@ let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.(?:ts|mts|cts))$/, isSignifi
5292
5323
  length: label.length
5293
5324
  };
5294
5325
  }, getAssetColor = (size)=>size > 300000 ? color.red : size > 100000 ? color.yellow : (input)=>input;
5295
- function getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
5326
+ function getHeader(maxFileLength, maxSizeLength, fileHeader, compressionHeader) {
5296
5327
  let lengths = [
5297
5328
  maxFileLength,
5298
5329
  maxSizeLength
@@ -5300,7 +5331,7 @@ function getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader) {
5300
5331
  fileHeader,
5301
5332
  'Size'
5302
5333
  ];
5303
- showGzipHeader && rowTypes.push('Gzip');
5334
+ compressionHeader && rowTypes.push(compressionHeader);
5304
5335
  let headerRow = rowTypes.reduce((prev, cur, index)=>{
5305
5336
  let length = lengths[index], curLabel = cur;
5306
5337
  return length && (curLabel = cur.length < length ? cur + ' '.repeat(length - cur.length) : cur), `${prev + curLabel} `;
@@ -5315,30 +5346,31 @@ let calcFileSize = (len)=>{
5315
5346
  return -1 === queryIndex ? assetName : assetName.slice(0, queryIndex);
5316
5347
  };
5317
5348
  async function printFileSizes(options, stats, rootPath, distPath, environmentName, previousSizes, saveSnapshot) {
5318
- let logs = [], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, showTotal = !1 !== options.total;
5349
+ let logs = [], compression = getCompression(options.compressed), prev = previousSizes?.[environmentName], showDetail = !1 !== options.detail, showDiff = !1 !== options.diff && null !== previousSizes, prevType = prev?.compressionType ?? (!!prev?.totalGzipSize && 'gzip'), showCompressedDiff = showDiff && prevType === compression.type, showTotal = !1 !== options.total;
5319
5350
  if (!showTotal && !showDetail) return {
5320
5351
  logs
5321
5352
  };
5322
5353
  let relativeDistPath = node_path.relative(rootPath, distPath), rootFolderLabel = `${relativeDistPath || '.'}${node_path.sep}`, snapshot = saveSnapshot ? {
5323
5354
  files: {},
5324
5355
  totalSize: 0,
5325
- totalGzipSize: 0
5326
- } : null, formatAsset = (filePath, size, gzippedSize)=>{
5356
+ totalGzipSize: 0,
5357
+ compressionType: !!options.compressed && compression.type
5358
+ } : null, formatAsset = (filePath, size, compressedSize)=>{
5327
5359
  let normalizedPath = '';
5328
5360
  (snapshot || showDiff) && (normalizedPath = normalizeFilePath(filePath), snapshot && (snapshot.files[normalizedPath] = {
5329
5361
  size,
5330
- gzippedSize: gzippedSize ?? void 0
5362
+ [compression.sizeKey]: compressedSize ?? void 0
5331
5363
  }));
5332
- let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, gzipSizeLabel = gzippedSize ? getAssetColor(gzippedSize)(calcFileSize(gzippedSize)) : null;
5364
+ let sizeLabel = calcFileSize(size), sizeLabelLength = sizeLabel.length, compressedSizeLabel = compressedSize ? getAssetColor(compressedSize)(calcFileSize(compressedSize)) : null;
5333
5365
  if (showDiff) {
5334
- let sizeData = previousSizes[environmentName]?.files[normalizedPath], sizeDiff = size - (sizeData?.size ?? 0);
5366
+ let sizeData = prev?.files[normalizedPath], sizeDiff = size - (sizeData?.size ?? 0);
5335
5367
  if (isSignificantDiff(sizeDiff)) {
5336
5368
  let { label, length } = formatDiff(sizeDiff);
5337
5369
  sizeLabel += ` ${label}`, sizeLabelLength += length + 1;
5338
5370
  }
5339
- if (null !== gzippedSize) {
5340
- let gzipDiff = gzippedSize - (sizeData?.gzippedSize ?? 0);
5341
- isSignificantDiff(gzipDiff) && (gzipSizeLabel += ` ${formatDiff(gzipDiff).label}`);
5371
+ if (null !== compressedSize && showCompressedDiff) {
5372
+ let compressedDiff = compressedSize - (sizeData?.[compression.sizeKey] ?? 0);
5373
+ isSignificantDiff(compressedDiff) && (compressedSizeLabel += ` ${formatDiff(compressedDiff).label}`);
5342
5374
  }
5343
5375
  }
5344
5376
  let separatorIndex = filePath.lastIndexOf('/'), folderLabel = -1 === separatorIndex ? rootFolderLabel : `${node_path.join(relativeDistPath, filePath.slice(0, separatorIndex))}${node_path.sep}`, filename = -1 === separatorIndex ? filePath : filePath.slice(separatorIndex + 1);
@@ -5349,8 +5381,8 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5349
5381
  size,
5350
5382
  sizeLabel,
5351
5383
  sizeLabelLength,
5352
- gzippedSize,
5353
- gzipSizeLabel
5384
+ compressedSize,
5385
+ compressedSizeLabel
5354
5386
  };
5355
5387
  }, getAssets = async ()=>{
5356
5388
  let { exclude, include } = options, formattedAssets = [], compilationAssets = stats.compilation.assets;
@@ -5365,7 +5397,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5365
5397
  };
5366
5398
  if (exclude?.(publicAsset) || include && !include(publicAsset)) continue;
5367
5399
  }
5368
- void 0 === content ? formattedAssets.push(formatAsset(filePath, size, null)) : formattedAssets.push(gzipSize(content).then((gzippedSize)=>formatAsset(filePath, size, gzippedSize)));
5400
+ void 0 === content ? formattedAssets.push(formatAsset(filePath, size, null)) : formattedAssets.push(calcCompressedSize(content, compression.type, compression.level).then((compressedSize)=>formatAsset(filePath, size, compressedSize)));
5369
5401
  }
5370
5402
  return (await Promise.all(formattedAssets)).sort((a, b)=>a.size - b.size);
5371
5403
  }, assets = await getAssets();
@@ -5373,15 +5405,15 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5373
5405
  logs
5374
5406
  };
5375
5407
  logs.push(''), showDetail && 1 === assets.length && (showTotal = !1);
5376
- let { totalSize, totalGzipSize } = ((assets, compressed)=>{
5377
- let totalSize = 0, totalGzipSize = 0;
5378
- for (let { size, gzippedSize } of assets)totalSize += size, compressed && (totalGzipSize += gzippedSize ?? size);
5408
+ let { totalSize, totalCompressedSize } = ((assets, compressed)=>{
5409
+ let totalSize = 0, totalCompressedSize = 0;
5410
+ for (let { size, compressedSize } of assets)totalSize += size, compressed && (totalCompressedSize += compressedSize ?? size);
5379
5411
  return {
5380
5412
  totalSize,
5381
- totalGzipSize
5413
+ totalCompressedSize
5382
5414
  };
5383
- })(assets, options.compressed);
5384
- snapshot && (snapshot.totalSize = totalSize, snapshot.totalGzipSize = totalGzipSize);
5415
+ })(assets, !!options.compressed);
5416
+ snapshot && (snapshot.totalSize = totalSize, options.compressed && (snapshot[compression.totalKey] = totalCompressedSize));
5385
5417
  let fileHeader = showDetail ? `File (${environmentName})` : '', { totalSizeTitle, totalSizeLabel, totalSizeLabelLength } = (()=>{
5386
5418
  if (!showTotal) return {
5387
5419
  totalSizeTitle: '',
@@ -5390,7 +5422,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5390
5422
  };
5391
5423
  let totalSizeTitle = showDetail ? 'Total:' : `Total size (${environmentName}):`, totalSizeLabel = calcFileSize(totalSize), totalSizeLabelLength = totalSizeLabel.length;
5392
5424
  if (showDiff) {
5393
- let totalSizeDiff = totalSize - (previousSizes[environmentName]?.totalSize ?? 0);
5425
+ let totalSizeDiff = totalSize - (prev?.totalSize ?? 0);
5394
5426
  if (isSignificantDiff(totalSizeDiff)) {
5395
5427
  let { label, length } = formatDiff(totalSizeDiff);
5396
5428
  totalSizeLabel += ` ${label}`, totalSizeLabelLength += length + 1;
@@ -5401,7 +5433,11 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5401
5433
  totalSizeLabel,
5402
5434
  totalSizeLabelLength
5403
5435
  };
5404
- })(), getCustomTotal = ()=>'function' == typeof options.total ? options.total({
5436
+ })(), getCompressedTotalDiff = ()=>{
5437
+ if (!showCompressedDiff) return '';
5438
+ let diff = totalCompressedSize - (prev?.[compression.totalKey] ?? 0);
5439
+ return isSignificantDiff(diff) ? ` ${formatDiff(diff).label}` : '';
5440
+ }, getCustomTotal = ()=>'function' == typeof options.total ? options.total({
5405
5441
  environmentName,
5406
5442
  distPath: relativeDistPath,
5407
5443
  assets: assets.map((asset)=>({
@@ -5409,17 +5445,18 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5409
5445
  size: asset.size
5410
5446
  })),
5411
5447
  totalSize,
5412
- totalGzipSize
5448
+ totalGzipSize: 'gzip' === compression.type ? totalCompressedSize : 0,
5449
+ totalBrotliSize: options.compressed && 'brotli' === compression.type ? totalCompressedSize : void 0
5413
5450
  }) : null;
5414
5451
  if (showDetail) {
5415
- let maxFileLength = Math.max(showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = totalSizeLabelLength, hasGzipSize = !1;
5416
- for (let asset of assets)asset.filenameLength > maxFileLength && (maxFileLength = asset.filenameLength), asset.sizeLabelLength > maxSizeLength && (maxSizeLength = asset.sizeLabelLength), null !== asset.gzippedSize && (hasGzipSize = !0);
5417
- let showGzipHeader = !!(options.compressed && hasGzipSize);
5418
- for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
5419
- let { sizeLabel, filenameLabel } = asset, { sizeLabelLength, gzipSizeLabel, filenameLength } = asset;
5452
+ let maxFileLength = Math.max(showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = totalSizeLabelLength, hasCompressedSize = !1;
5453
+ for (let asset of assets)asset.filenameLength > maxFileLength && (maxFileLength = asset.filenameLength), asset.sizeLabelLength > maxSizeLength && (maxSizeLength = asset.sizeLabelLength), null !== asset.compressedSize && (hasCompressedSize = !0);
5454
+ let showCompressedHeader = !!(options.compressed && hasCompressedSize);
5455
+ for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showCompressedHeader && compression.header)), assets)){
5456
+ let { sizeLabel, filenameLabel } = asset, { sizeLabelLength, compressedSizeLabel, filenameLength } = asset;
5420
5457
  sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
5421
5458
  let log = `${filenameLabel} ${sizeLabel}`;
5422
- gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
5459
+ compressedSizeLabel && (log += ` ${compressedSizeLabel}`), logs.push(log);
5423
5460
  }
5424
5461
  if (showTotal) {
5425
5462
  logs.push('');
@@ -5428,11 +5465,8 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5428
5465
  else {
5429
5466
  let log = '';
5430
5467
  if (log += ' '.repeat(maxFileLength - totalSizeTitle.length), log += color.magenta(totalSizeTitle), log += ` ${totalSizeLabel}`, options.compressed) {
5431
- let colorFn = getAssetColor(totalGzipSize / assets.length);
5432
- if (log += ' '.repeat(maxSizeLength - totalSizeLabelLength), log += ` ${colorFn(calcFileSize(totalGzipSize))}`, showDiff) {
5433
- let totalGzipSizeDiff = totalGzipSize - (previousSizes[environmentName]?.totalGzipSize ?? 0);
5434
- isSignificantDiff(totalGzipSizeDiff) && (log += ` ${formatDiff(totalGzipSizeDiff).label}`);
5435
- }
5468
+ let colorFn = getAssetColor(totalCompressedSize / assets.length);
5469
+ log += ' '.repeat(maxSizeLength - totalSizeLabelLength), log += ` ${colorFn(calcFileSize(totalCompressedSize))}${getCompressedTotalDiff()}`;
5436
5470
  }
5437
5471
  logs.push(log);
5438
5472
  }
@@ -5442,7 +5476,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
5442
5476
  if (customTotal) logs.push(customTotal);
5443
5477
  else {
5444
5478
  let log = `${color.magenta(totalSizeTitle)} ${totalSizeLabel}`;
5445
- options.compressed && (log += color.green(` (${calcFileSize(totalGzipSize)} gzipped)`)), logs.push(log);
5479
+ options.compressed && (log += color.green(` (${calcFileSize(totalCompressedSize)}${getCompressedTotalDiff()} ${compression.label})`)), logs.push(log);
5446
5480
  }
5447
5481
  }
5448
5482
  return logs.push(''), {
@@ -5514,7 +5548,7 @@ class RsbuildHtmlPlugin {
5514
5548
  try {
5515
5549
  fileContent = await readFileAsync(inputFs, inputFilename);
5516
5550
  } catch (error) {
5517
- return logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
5551
+ return logger.debug('read favicon error:', error), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
5518
5552
  }
5519
5553
  let source = new core_rspack.sources.RawSource(fileContent, !1);
5520
5554
  return compilation.emitAsset(outputFilename, source), outputFilename;
@@ -6312,7 +6346,7 @@ async function ensureFileDir(outputFilePath) {
6312
6346
  });
6313
6347
  }
6314
6348
  async function applyProfile(root, filterValue, traceLayer, traceOutput) {
6315
- if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${traceLayer}`);
6349
+ if ('perfetto' !== traceLayer && 'logger' !== traceLayer) throw Error(`unsupported trace layer: ${String(traceLayer)}`);
6316
6350
  if (traceOutput && 'perfetto' === traceLayer && isTerminalTraceOutput(traceOutput)) throw Error('RSPACK_TRACE_OUTPUT=stdout|stderr is only supported for the logger trace layer. The perfetto trace layer requires a file path.');
6317
6351
  let timestamp = Date.now(), defaultOutputDir = node_path.join(root, `.rspack-profile-${timestamp}-${process.pid}`);
6318
6352
  traceOutput ? isTerminalTraceOutput(traceOutput) || (traceOutput = node_path.resolve(defaultOutputDir, traceOutput)) : traceOutput = node_path.resolve(defaultOutputDir, 'perfetto' === traceLayer ? 'rspack.pftrace' : 'rspack.log');
@@ -6476,7 +6510,7 @@ function getSplitChunksByPreset(config, preset) {
6476
6510
  case 'none':
6477
6511
  return {};
6478
6512
  default:
6479
- throw Error(`[rsbuild] Unknown splitChunks preset: ${preset}`);
6513
+ throw Error(`[rsbuild] Unknown splitChunks preset: ${String(preset)}`);
6480
6514
  }
6481
6515
  }
6482
6516
  let builtinSwcLoaderName = 'builtin:swc-loader';
@@ -6654,8 +6688,7 @@ function parseTokenList(str) {
6654
6688
  }
6655
6689
  return start !== end && list.push(str.substring(start, end)), list;
6656
6690
  }
6657
- let on_finished = __webpack_require__("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js");
6658
- var on_finished_default = __webpack_require__.n(on_finished);
6691
+ var on_finished_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/on-finished/2.4.1/cf4b90e733493a0ce70ba421a5b37153ad39360f9513e36b25d2e49f57047a9b/node_modules/on-finished/index.js"));
6659
6692
  function getEtag(stat) {
6660
6693
  let mtime = stat.mtime.getTime().toString(16), size = stat.size.toString(16);
6661
6694
  return `W/"${size}-${mtime}"`;
@@ -6691,7 +6724,7 @@ function isPreconditionFailure(headers, res) {
6691
6724
  let ifMatch = getRequestHeader(headers, 'if-match');
6692
6725
  if (ifMatch) {
6693
6726
  let etag = res.getHeader('ETag');
6694
- return !etag || '*' !== ifMatch && parseTokenList(ifMatch).every((match)=>match !== etag && match !== `W/${etag}` && `W/${match}` !== etag);
6727
+ return !etag || '*' !== ifMatch && parseTokenList(ifMatch).every((match)=>match !== etag && match !== `W/${String(etag)}` && `W/${match}` !== etag);
6695
6728
  }
6696
6729
  let ifUnmodifiedSince = getRequestHeader(headers, 'if-unmodified-since');
6697
6730
  if (ifUnmodifiedSince) {
@@ -6764,7 +6797,7 @@ function destroyStream(stream, suppress) {
6764
6797
  }), 'function' == typeof stream.addListener && suppress && (stream.removeAllListeners('error'), stream.addListener('error', ()=>{}));
6765
6798
  }
6766
6799
  let parseRangeHeaders = async (value)=>{
6767
- let { default: rangeParser } = await import("./range-parser.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/range-parser/1.3.0/d49e5dcb9d0e39475844e240fad8cd1db6a58f4144f7ede43d9755e2fce5babc/node_modules/range-parser/index.js", 23)), [len, rangeHeader] = value.split('|');
6800
+ let { default: rangeParser } = await import("./range-parser.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/range-parser/1.3.0/d49e5dcb9d0e39475844e240fad8cd1db6a58f4144f7ede43d9755e2fce5babc/node_modules/range-parser/index.js", 23)), [len, rangeHeader] = value.split('|');
6768
6801
  return rangeParser(Number(len), rangeHeader, {
6769
6802
  combine: !0
6770
6803
  });
@@ -6876,7 +6909,7 @@ function createAssetsMiddleware(context, ready, outputFileSystem) {
6876
6909
  }
6877
6910
  async function setupOutputFileSystem(writeToDisk, compilers) {
6878
6911
  if (!0 !== writeToDisk) {
6879
- let { createFsFromVolume, Volume } = await import("./memfs.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/memfs/4.68.2/d8cc16a375363b8e2c9837aec01c984bbb0e063db42b6702d64d750c65cbb1ff/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
6912
+ let { createFsFromVolume, Volume } = await import("./memfs.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/memfs/4.71.0/717d01ef4d84cedabdf3b728d1862a444e82bbbcc379d834c8006e341a87f7d9/node_modules/memfs/lib/index.js", 23)), outputFileSystem = createFsFromVolume(new Volume());
6880
6913
  for (let compiler of compilers)compiler.outputFileSystem = outputFileSystem;
6881
6914
  }
6882
6915
  let compiler = compilers.find((compiler)=>!!compiler.outputFileSystem);
@@ -7115,7 +7148,7 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7115
7148
  originalPosition
7116
7149
  };
7117
7150
  } catch (error) {
7118
- error instanceof Error && context.logger.debug(`failed to map source map position: ${error.message}`);
7151
+ error instanceof Error && context.logger.debug('failed to map source map position:', error);
7119
7152
  }
7120
7153
  }, resolveOriginalLocation = async (stackFrames, fs, context, cachedTraceMap)=>{
7121
7154
  let frame = stackFrames.find((frame)=>null !== frame.file && null !== frame.column && null !== frame.lineNumber && SCRIPT_REGEX.test(frame.file));
@@ -7135,7 +7168,7 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7135
7168
  let absoluteSourcePath = node_path.isAbsolute(source) ? source : node_path.join(node_path.dirname(sourceMapPath), source);
7136
7169
  return node_path.relative(context.rootPath, absoluteSourcePath);
7137
7170
  })(source, sourceMapPath, context);
7138
- return null !== line && (result += null === column ? `:${line}` : `:${line}:${column}`), result;
7171
+ return `${result}:${line}:${column}`;
7139
7172
  }, formatFrameLocation = (frame)=>{
7140
7173
  let { file, lineNumber, column } = frame;
7141
7174
  if (file) return null !== lineNumber ? null !== column ? `${file}:${lineNumber}:${column}` : `${file}:${lineNumber}` : file;
@@ -7653,7 +7686,7 @@ function historyApiFallback_historyApiFallbackMiddleware(logger, options = {}) {
7653
7686
  function parseReqUrl(req) {
7654
7687
  let proto = req.headers['x-forwarded-proto'] || 'http', host = req.headers['x-forwarded-host'] || req.headers.host || LOCALHOST;
7655
7688
  try {
7656
- return new external_node_url_URL(req.url || '/', `${proto}://${host}`);
7689
+ return new external_node_url_URL(req.url || '/', `${String(proto)}://${String(host)}`);
7657
7690
  } catch {
7658
7691
  return null;
7659
7692
  }
@@ -7778,7 +7811,7 @@ async function createProxyMiddleware(proxyOptions, logger) {
7778
7811
  let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer, middlewares, postCallbacks })=>{
7779
7812
  let launchEditorHandlerPromise, upgradeEvents = [], { server } = config, { logger } = context;
7780
7813
  if (server.cors) {
7781
- let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
7814
+ let { default: corsMiddleware } = await import("./cors.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
7782
7815
  middlewares.use(corsMiddleware('boolean' == typeof server.cors ? {} : server.cors));
7783
7816
  }
7784
7817
  let { headers } = server;
@@ -7799,7 +7832,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7799
7832
  })), middlewares.use('/__open-in-editor', async (req, res, next)=>{
7800
7833
  try {
7801
7834
  (await (launchEditorHandlerPromise ??= (async ()=>{
7802
- let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/launch-editor-middleware/2.14.1/6d555a60526ad6844dc2673e73b564ffd44ca896ac31b809c7cc243f8e135c00/node_modules/launch-editor-middleware/index.js", 23));
7835
+ let { default: launchEditorMiddleware } = await import("./launch-editor-middleware.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/launch-editor-middleware/2.14.1/6d555a60526ad6844dc2673e73b564ffd44ca896ac31b809c7cc243f8e135c00/node_modules/launch-editor-middleware/index.js", 23));
7803
7836
  return launchEditorMiddleware();
7804
7837
  })()))(req, res, next);
7805
7838
  } catch (err) {
@@ -7935,13 +7968,13 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7935
7968
  if (moduleExports instanceof Module) return moduleExports;
7936
7969
  let normalizedModuleExports = null !== moduleExports && ('object' == typeof moduleExports || 'function' == typeof moduleExports) ? moduleExports : {
7937
7970
  default: moduleExports
7938
- }, exports = [
7971
+ }, __nested_rspack_exports__ = [
7939
7972
  ...new Set([
7940
7973
  'default',
7941
7974
  ...Object.keys(normalizedModuleExports)
7942
7975
  ])
7943
- ], syntheticModule = new SyntheticModule(exports, ()=>{
7944
- for (let name of exports)if ('default' === name) {
7976
+ ], syntheticModule = new SyntheticModule(__nested_rspack_exports__, ()=>{
7977
+ for (let name of __nested_rspack_exports__)if ('default' === name) {
7945
7978
  let defaultExport = isModuleNamespaceObject(normalizedModuleExports) && 'default' in normalizedModuleExports ? normalizedModuleExports.default : moduleExports;
7946
7979
  syntheticModule.setExport(name, defaultExport);
7947
7980
  } else syntheticModule.setExport(name, normalizedModuleExports[name]);
@@ -8488,7 +8521,7 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
8488
8521
  outputFileSystem: node_fs
8489
8522
  };
8490
8523
  if (isVerbose(logger) && middlewares.use(getRequestLoggerMiddleware(logger)), cors) {
8491
- let { default: corsMiddleware } = await import("./cors.js").then(__webpack_require__.t.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
8524
+ let { default: corsMiddleware } = await import("./cors.js").then(createFakeNamespaceObject.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/cors/2.8.6/abeeebb4dd5e2293f01aa9f4c01ff28ab19103cfa7a845442d515e16cf051f35/node_modules/cors/lib/index.js", 23));
8492
8525
  middlewares.use(corsMiddleware('boolean' == typeof cors ? {} : cors));
8493
8526
  }
8494
8527
  if (headers && middlewares.use((_req, res, next)=>{
@@ -8730,9 +8763,10 @@ function applyDefaultPlugins(pluginManager, context) {
8730
8763
  }
8731
8764
  });
8732
8765
  let isESM = config.output.module;
8733
- if (isServer && chain.output.library({
8734
- ...chain.output.get('library') || {},
8735
- type: isESM ? 'module' : 'commonjs2'
8766
+ if (isServer && chain.output.merge({
8767
+ library: {
8768
+ type: isESM ? 'module' : 'commonjs2'
8769
+ }
8736
8770
  }), isESM) {
8737
8771
  if ('web-worker' === target) throw Error('[rsbuild:config] `output.module: true` is not supported for web-worker target.');
8738
8772
  chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
@@ -8820,7 +8854,7 @@ function applyDefaultPlugins(pluginManager, context) {
8820
8854
  setup (api) {
8821
8855
  let cleanAll = async (params)=>{
8822
8856
  for (let pathInfo of [
8823
- ...Object.values(params.environments).reduce((result, curr)=>(result.find((item)=>item.distPath === curr.distPath) || result.push(curr), result), []).map((environment)=>((environment, isDev)=>{
8857
+ ...Object.values(params.environments).reduce((result, curr)=>(result.some((item)=>item.distPath === curr.distPath) || result.push(curr), result), []).map((environment)=>((environment, isDev)=>{
8824
8858
  let { rootPath } = api.context, { config, distPath } = environment, { enable, keep } = normalizeCleanDistPath(config.output.cleanDistPath);
8825
8859
  return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
8826
8860
  path: distPath,
@@ -9677,7 +9711,7 @@ try {
9677
9711
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
9678
9712
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
9679
9713
  if (!1 === manifest) return;
9680
- let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/e1ec5d4691c84b8859f27aa9fc2f39b9334ca010b826474dc51dc2d479e68b43/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9714
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/0e24beaf1b234a114f5305075e91a7e73b51041985d9a6da39afa17869758a5c/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9681
9715
  manifestFilenames.set(environment.name, manifestOptions.filename);
9682
9716
  let pluginOptions = {
9683
9717
  fileName: manifestOptions.filename,
@@ -10062,7 +10096,11 @@ let canReadExport = (module)=>null !== module && ('object' == typeof module || '
10062
10096
  configExport: getConfigExport(await jiti.import(configPath), exportName, configPath),
10063
10097
  dependencies: []
10064
10098
  };
10065
- }, JS_CONFIG_REGEXP = /\.(?:js|mjs|cjs)$/, loadWithNative = async (configPath, fresh)=>{
10099
+ }, CONFIG_META = Symbol.for('@rstackjs/load-config/meta');
10100
+ function getConfigMeta(config) {
10101
+ if (null !== config && 'object' == typeof config && Object.hasOwn(config, CONFIG_META)) return config[CONFIG_META];
10102
+ }
10103
+ let JS_CONFIG_REGEXP = /\.(?:js|mjs|cjs)$/, loadWithNative = async (configPath, fresh)=>{
10066
10104
  let configFileURL = pathToFileURL(configPath).href;
10067
10105
  if (!fresh) return {
10068
10106
  configModule: await import(configFileURL),
@@ -10078,7 +10116,7 @@ let canReadExport = (module)=>null !== module && ('object' == typeof module || '
10078
10116
  };
10079
10117
  };
10080
10118
  async function dist_loadConfig({ cwd = process.cwd(), path, configFileNames = [], loader = 'auto', exportName = 'default', configParams = [], fresh = !1 } = {}) {
10081
- let loadedConfig;
10119
+ let loadedConfig, content;
10082
10120
  if (!path && 0 === configFileNames.length) throw Error('Either `path` or at least one `configFileNames` entry must be provided.');
10083
10121
  let configPath = ((root, customConfig, configFileNames = [])=>{
10084
10122
  if (customConfig) {
@@ -10114,17 +10152,20 @@ async function dist_loadConfig({ cwd = process.cwd(), path, configFileNames = []
10114
10152
  if ('function' == typeof configExport) {
10115
10153
  let result = await configExport(...configParams);
10116
10154
  if (void 0 === result) throw Error('The config function must return a config object.');
10117
- return {
10118
- content: result,
10119
- filePath: configPath,
10120
- dependencies
10121
- };
10122
- }
10123
- return {
10124
- content: configExport,
10155
+ content = result;
10156
+ } else content = configExport;
10157
+ let meta = getConfigMeta(content), result = {
10158
+ content,
10125
10159
  filePath: configPath,
10126
10160
  dependencies
10127
10161
  };
10162
+ return meta && (result.filePath = meta.filePath, result.dependencies = [
10163
+ ...new Set([
10164
+ ...meta.dependencies ?? [],
10165
+ configPath,
10166
+ ...dependencies
10167
+ ])
10168
+ ]), result;
10128
10169
  }
10129
10170
  function defineConfig(config) {
10130
10171
  return config;
@@ -10220,7 +10261,7 @@ let applyServerOptions = (command)=>{
10220
10261
  };
10221
10262
  function setupCommands(argv) {
10222
10263
  let cli = ((name = "")=>new CAC(name))('rsbuild');
10223
- cli.version("2.2.3"), 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)', {
10264
+ cli.version("2.2.5"), 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)', {
10224
10265
  default: 'auto'
10225
10266
  }).option('--dist-path <dir>', 'Set the root directory of output files').option('--source-map', 'Enable source map').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', {
10226
10267
  type: [
@@ -10285,7 +10326,7 @@ function setupCommands(argv) {
10285
10326
  }
10286
10327
  function showGreeting() {
10287
10328
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
10288
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.3\n`);
10329
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.5\n`);
10289
10330
  }
10290
10331
  function setupLogLevel(argv) {
10291
10332
  if (argv.length <= 3) return;
@@ -10307,5 +10348,5 @@ function runCLI({ argv = process.argv } = {}) {
10307
10348
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
10308
10349
  }
10309
10350
  }
10310
- let src_version = "2.2.3";
10351
+ let src_version = "2.2.5";
10311
10352
  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, mrmime_lookup, runCLI, src_logger as logger, src_version as version };