@rsbuild/core 2.2.8 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/compiled/css-loader/index.js +2 -2
  2. package/compiled/html-rspack-plugin/htmlLoader.js +8 -17
  3. package/compiled/html-rspack-plugin/index.d.ts +8 -4
  4. package/compiled/html-rspack-plugin/index.js +61 -69
  5. package/compiled/html-rspack-plugin/package.json +1 -1
  6. package/compiled/postcss-loader/index.js +6 -6
  7. package/compiled/ws/index.d.ts +445 -0
  8. package/compiled/ws/license +21 -0
  9. package/compiled/ws/package.json +1 -0
  10. package/dist/1.js +84 -0
  11. package/dist/chokidar.js +1 -1
  12. package/dist/client/hmr.js +1 -1
  13. package/dist/client/overlay.js +1 -1
  14. package/dist/cssUrlLoader.mjs +4 -3
  15. package/dist/helpers/cachedImport.d.ts +2 -0
  16. package/dist/helpers/path.d.ts +9 -0
  17. package/dist/http-proxy-middleware.js +4 -4
  18. package/dist/ignoreCssLoader.mjs +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +2 -1
  21. package/dist/launch-editor-middleware.js +1 -1
  22. package/dist/{626.js → m.js} +162 -286
  23. package/dist/manifest-plugin.js +1 -1
  24. package/dist/memfs.js +1 -1
  25. package/dist/open.js +2 -2
  26. package/dist/r.js +7 -0
  27. package/dist/remapping.js +8 -3
  28. package/dist/rslib-runtime.js +1 -1
  29. package/dist/server/assets-middleware/setupWriteToDisk.d.ts +16 -1
  30. package/dist/server/browserLogs.d.ts +5 -2
  31. package/dist/server/helper.d.ts +2 -2
  32. package/dist/server/runner/asModule.d.ts +1 -1
  33. package/dist/server/runner/basic.d.ts +5 -4
  34. package/dist/server/runner/type.d.ts +1 -1
  35. package/dist/server/socketServer.d.ts +1 -1
  36. package/dist/sirv.js +1 -1
  37. package/dist/tinyglobby.js +1 -1
  38. package/dist/trace-mapping.js +236 -22
  39. package/dist/transformLoader.mjs +3 -2
  40. package/dist/types/config.d.ts +13 -1
  41. package/dist/ws.js +2 -2
  42. package/package.json +7 -7
  43. /package/dist/{252.js → c.js} +0 -0
  44. /package/dist/client/{307~0.js → f~0.js} +0 -0
  45. /package/dist/{626.js.LICENSE.txt → m.js.LICENSE.txt} +0 -0
@@ -1,18 +1,20 @@
1
- /*! LICENSE: 626.js.LICENSE.txt */
1
+ /*! LICENSE: m.js.LICENSE.txt */
2
2
  let runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
3
3
  import { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject } from "./rslib-runtime.js";
4
4
  import { rspack as core_rspack } from "@rspack/core";
5
- import node_util, { stripVTControlCharacters } from "node:util";
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";
5
+ import node_util, { promisify, stripVTControlCharacters } from "node:util";
6
+ import node_path, { dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, resolve as external_node_path_resolve, sep } from "node:path";
7
7
  import { builtinModules, createRequire, createRequire as __rspack_createRequire } from "node:module";
8
8
  import node_fs, { existsSync } from "node:fs";
9
- import node_os, { constants as external_node_os_constants } from "node:os";
9
+ import node_os, { constants } from "node:os";
10
10
  import node_process from "node:process";
11
11
  import { URL as external_node_url_URL, pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
12
12
  import { isPromise, isRegExp } from "node:util/types";
13
13
  import { readFile } from "node:fs/promises";
14
- import node_zlib from "node:zlib";
14
+ import node_zlib, { constants as external_node_zlib_constants } from "node:zlib";
15
15
  import { once } from "node:events";
16
+ import { ALL_INTERFACES_IPV4, IMAGE_EXTENSIONS, ASSETS_DIST_DIR, FONT_DIST_DIR, AUDIO_EXTENSIONS, ensureAbsolutePath, NODE_MODULES_REGEX, FONT_EXTENSIONS, HMR_SOCKET_PATH, WASM_DIST_DIR, VIDEO_EXTENSIONS, BROWSER_LOG_PREFIX, toPosixPath, TRACK_EXTENSIONS, IMAGE_DIST_DIR, RSBUILD_OUTPUTS_PATH, DEFAULT_STACK_TRACE, LOADER_PATH, ASSET_EXTENSIONS, SVG_DIST_DIR, isWindows, COMPILED_PATH, WORKER_QUERY_REGEX, TS_CONFIG_FILE, dedupeNestedPaths, CSS_REGEX, relativeWithin, LAZY_COMPILATION_IDENTIFIER, DEFAULT_BROWSERSLIST, JS_REGEX, MEDIA_DIST_DIR, SCRIPT_REGEX, DEFAULT_WEB_BROWSERSLIST, getCompiledPath, normalizeRuleConditionPath, getPathnameFromUrl, toRelativePath, isDeno, CSS_DIST_DIR, INLINE_QUERY_REGEX, STATIC_PATH, RAW_QUERY_REGEX, PLUGIN_SWC_NAME, CLIENT_PATH, getCommonParentPath, LOCALHOST, JS_DIST_DIR, URL_QUERY_REGEX } from "./1.js";
17
+ import { cachedImport, getTinyglobby } from "./r.js";
16
18
  var superClass, superClass1, __rspack_import_meta_filename__ = __rspack_fileURLToPath(import.meta.url);
17
19
  let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
18
20
  moduleFactories.add({
@@ -152,7 +154,7 @@ moduleFactories.add({
152
154
  };
153
155
  },
154
156
  "../../../../../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;
157
+ let path = __rspack_createRequire_require("path"), fs = __rspack_createRequire_require("fs"), os = __rspack_createRequire_require("os"), url = __rspack_createRequire_require("url"), fsReadFileAsync = fs.promises.readFile;
156
158
  function getDefaultSearchPlaces(name, sync) {
157
159
  return [
158
160
  'package.json',
@@ -388,7 +390,7 @@ moduleFactories.add({
388
390
  }
389
391
  },
390
392
  "../../../../../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");
393
+ let yaml, { resolve } = __rspack_createRequire_require("node:path"), 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
394
  async function processResult(ctx, result) {
393
395
  let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
394
396
  default: obj
@@ -500,7 +502,7 @@ moduleFactories.add({
500
502
  };
501
503
  },
502
504
  "../../../../../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 = [];
505
+ let tsx, jiti, { createRequire } = __rspack_createRequire_require("node:module"), { pathToFileURL } = __rspack_createRequire_require("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
504
506
  module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
505
507
  let url = createRequire(rootFile).resolve(name);
506
508
  try {
@@ -531,77 +533,11 @@ moduleFactories.add({
531
533
  async_hooks (module) {
532
534
  module.exports = __rspack_createRequire_require("async_hooks");
533
535
  },
534
- buffer (module) {
535
- module.exports = __rspack_createRequire_require("buffer");
536
- },
537
- child_process (module) {
538
- module.exports = __rspack_createRequire_require("child_process");
539
- },
540
- crypto (module) {
541
- module.exports = __rspack_createRequire_require("crypto");
542
- },
543
- "fs?cdbd" (module) {
544
- module.exports = __rspack_createRequire_require("fs");
545
- },
546
- http (module) {
547
- module.exports = __rspack_createRequire_require("http");
548
- },
549
- https (module) {
550
- module.exports = __rspack_createRequire_require("https");
551
- },
552
- net (module) {
553
- module.exports = __rspack_createRequire_require("net");
554
- },
555
- "node:buffer?4a79" (module) {
556
- module.exports = __rspack_createRequire_require("node:buffer");
557
- },
558
- events (module) {
559
- module.exports = __rspack_createRequire_require("node:events");
560
- },
561
- "node:fs?31c0" (module) {
562
- module.exports = __rspack_createRequire_require("node:fs");
563
- },
564
- "node:module?f56b" (module) {
565
- module.exports = __rspack_createRequire_require("node:module");
566
- },
567
- "node:path?815c" (module) {
568
- module.exports = __rspack_createRequire_require("node:path");
569
- },
570
- "node:stream?be04" (module) {
571
- module.exports = __rspack_createRequire_require("node:stream");
572
- },
573
- "node:url?5295" (module) {
574
- module.exports = __rspack_createRequire_require("node:url");
575
- },
576
- os (module) {
577
- module.exports = __rspack_createRequire_require("os");
578
- },
579
- "path?37f5" (module) {
580
- module.exports = __rspack_createRequire_require("path");
581
- },
582
536
  process (module) {
583
537
  module.exports = __rspack_createRequire_require("process");
584
538
  },
585
- stream (module) {
586
- module.exports = __rspack_createRequire_require("stream");
587
- },
588
539
  "supports-color" (module) {
589
540
  module.exports = __rspack_createRequire_require("supports-color");
590
- },
591
- tls (module) {
592
- module.exports = __rspack_createRequire_require("tls");
593
- },
594
- tty (module) {
595
- module.exports = __rspack_createRequire_require("tty");
596
- },
597
- "url?5f07" (module) {
598
- module.exports = __rspack_createRequire_require("url");
599
- },
600
- util (module) {
601
- module.exports = __rspack_createRequire_require("util");
602
- },
603
- zlib (module) {
604
- module.exports = __rspack_createRequire_require("zlib");
605
541
  }
606
542
  }), function checkNodeVersion() {
607
543
  let { versions } = process;
@@ -1098,62 +1034,7 @@ var Command = class {
1098
1034
  arg.variadic ? actionArgs.push(args.slice(index)) : actionArgs.push(args[index]);
1099
1035
  }), actionArgs.push(options), command.commandAction.apply(this, actionArgs);
1100
1036
  }
1101
- };
1102
- let isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, dirname = import.meta.dirname, STATIC_PATH = join(dirname, '../static'), CLIENT_PATH = join(dirname, 'client'), COMPILED_PATH = join(dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', LOCALHOST = 'localhost', ALL_INTERFACES_IPV4 = '0.0.0.0', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
1103
- 'chrome >= 107',
1104
- 'edge >= 107',
1105
- 'firefox >= 104',
1106
- 'safari >= 16'
1107
- ], DEFAULT_BROWSERSLIST = {
1108
- web: DEFAULT_WEB_BROWSERSLIST,
1109
- 'web-worker': DEFAULT_WEB_BROWSERSLIST,
1110
- node: [
1111
- 'node >= 20'
1112
- ]
1113
- }, JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/, SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/, CSS_REGEX = /\.css$/, RAW_QUERY_REGEX = /[?&]raw(?:&|=|$)/, INLINE_QUERY_REGEX = /[?&]inline(?:&|=|$)/, URL_QUERY_REGEX = /[?&]url(?:&|=|$)/, WORKER_QUERY_REGEX = /[?&]worker(?:&|=|$)/, NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/, PLUGIN_SWC_NAME = 'rsbuild:swc', PLUGIN_CSS_NAME = 'rsbuild:css', FONT_EXTENSIONS = [
1114
- 'woff',
1115
- 'woff2',
1116
- 'eot',
1117
- 'ttf',
1118
- 'otf',
1119
- 'ttc'
1120
- ], ASSET_EXTENSIONS = [
1121
- 'webmanifest',
1122
- 'pdf',
1123
- 'txt'
1124
- ], IMAGE_EXTENSIONS = [
1125
- 'png',
1126
- 'jpg',
1127
- 'jpeg',
1128
- 'pjpeg',
1129
- 'pjp',
1130
- 'gif',
1131
- 'bmp',
1132
- 'webp',
1133
- 'ico',
1134
- 'apng',
1135
- 'avif',
1136
- 'tif',
1137
- 'tiff',
1138
- 'jfif',
1139
- 'cur',
1140
- 'jxl'
1141
- ], VIDEO_EXTENSIONS = [
1142
- 'mp4',
1143
- 'webm',
1144
- 'ogg',
1145
- 'mov'
1146
- ], AUDIO_EXTENSIONS = [
1147
- 'mp3',
1148
- 'wav',
1149
- 'flac',
1150
- 'aac',
1151
- 'm4a',
1152
- 'opus'
1153
- ], TRACK_EXTENSIONS = [
1154
- 'vtt'
1155
- ], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy';
1156
- var __webpack_modules__ = {}, __webpack_module_cache__ = {};
1037
+ }, __webpack_modules__ = {}, __webpack_module_cache__ = {};
1157
1038
  function dist_webpack_require_(moduleId) {
1158
1039
  var cachedModule = __webpack_module_cache__[moduleId];
1159
1040
  if (void 0 !== cachedModule) return cachedModule.exports;
@@ -1234,8 +1115,8 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1234
1115
  }, {});
1235
1116
  }, module.exports = deepmerge;
1236
1117
  },
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)=>{
1118
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, exports) {
1119
+ exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
1239
1120
  let values = array.map(function(value, index) {
1240
1121
  let result = next(value, index);
1241
1122
  return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
@@ -1243,8 +1124,8 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1243
1124
  return `[${eol}${values}${eol}]`;
1244
1125
  };
1245
1126
  },
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;
1127
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __webpack_require__) {
1128
+ exports.functionToString = exports.USED_METHOD_KEY = void 0;
1248
1129
  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
1130
  " " () {}
1250
1131
  })[" "].toString().charAt(0), FUNCTION_PREFIXES = {
@@ -1268,9 +1149,9 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1268
1149
  }
1269
1150
  return found ? fnString.split(`\n${found}`).join("\n") : fnString;
1270
1151
  }
1271
- __nested_rspack_exports__.USED_METHOD_KEY = new WeakSet(), __nested_rspack_exports__.functionToString = (fn, space, next, key)=>{
1152
+ exports.USED_METHOD_KEY = new WeakSet(), exports.functionToString = (fn, space, next, key)=>{
1272
1153
  let name = "string" == typeof key ? key : void 0;
1273
- return void 0 !== name && __nested_rspack_exports__.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
1154
+ return void 0 !== name && exports.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
1274
1155
  };
1275
1156
  class FunctionParser {
1276
1157
  constructor(fn, indent, next, key){
@@ -1378,13 +1259,13 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1378
1259
  }
1379
1260
  }
1380
1261
  },
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;
1262
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
1263
+ exports.A = void 0;
1383
1264
  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
1265
  function replacerToString(replacer) {
1385
1266
  return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
1386
1267
  }
1387
- __nested_rspack_exports__.A = function stringify(value, replacer, indent, options = {}) {
1268
+ exports.A = function stringify(value, replacer, indent, options = {}) {
1388
1269
  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
1270
  if (++valueCount > maxValues || skipUndefinedProperties && void 0 === value || path.length > maxDepth) return;
1390
1271
  if (void 0 === key) return valueToString(value, space, onNext, key);
@@ -1414,10 +1295,10 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1414
1295
  return result;
1415
1296
  };
1416
1297
  },
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;
1298
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __webpack_require__) {
1299
+ exports.objectToString = void 0;
1419
1300
  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)=>{
1301
+ exports.objectToString = (value, space, next, key)=>{
1421
1302
  if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
1422
1303
  if ("object" == typeof global && value === global) return globalToString(value, space, next);
1423
1304
  let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
@@ -1446,8 +1327,8 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1446
1327
  "[object Window]": globalToString
1447
1328
  };
1448
1329
  },
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;
1330
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, exports) {
1331
+ exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.W = exports.quoteString = void 0;
1451
1332
  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
1333
  [
1453
1334
  "\b",
@@ -1485,23 +1366,23 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1485
1366
  function escapeChar(char) {
1486
1367
  return META_CHARS.get(char) || `\\u${`0000${char.charCodeAt(0).toString(16)}`.slice(-4)}`;
1487
1368
  }
1488
- __nested_rspack_exports__.quoteString = function quoteString(str) {
1369
+ exports.quoteString = function quoteString(str) {
1489
1370
  return `'${str.replace(ESCAPABLE, escapeChar)}'`;
1490
1371
  };
1491
1372
  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
1373
  function isValidVariableName(name) {
1493
- return "string" == typeof name && !RESERVED_WORDS.has(name) && __nested_rspack_exports__.W.test(name);
1374
+ return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.W.test(name);
1494
1375
  }
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) {
1376
+ exports.W = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
1496
1377
  return isValidVariableName(key) ? key : next(key);
1497
- }, __nested_rspack_exports__.stringifyPath = function stringifyPath(path, next) {
1378
+ }, exports.stringifyPath = function stringifyPath(path, next) {
1498
1379
  let result = "";
1499
1380
  for (let key of path)isValidVariableName(key) ? result += `.${key}` : result += `[${next(key)}]`;
1500
1381
  return result;
1501
1382
  };
1502
1383
  },
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;
1384
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __webpack_require__) {
1385
+ exports.toString = void 0;
1505
1386
  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
1387
  string: quote_1.quoteString,
1507
1388
  number: (value)=>Object.is(value, -0) ? "-0" : String(value),
@@ -1515,7 +1396,7 @@ dist_webpack_require_.m = __webpack_modules__, dist_webpack_require_.add = funct
1515
1396
  object: object_1.objectToString,
1516
1397
  function: function_1.functionToString
1517
1398
  };
1518
- __nested_rspack_exports__.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
1399
+ exports.toString = (value, space, next, key)=>null === value ? "null" : PRIMITIVE_TYPES[typeof value](value, space, next, key);
1519
1400
  }
1520
1401
  });
1521
1402
  let cjs = dist_webpack_require_("./node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
@@ -2267,9 +2148,9 @@ function pick(obj, keys) {
2267
2148
  for (let key of keys)void 0 !== obj[key] && (result[key] = obj[key]);
2268
2149
  return result;
2269
2150
  }
2270
- let isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
2151
+ let isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI, getCrypto = cachedImport(()=>import("node:crypto"));
2271
2152
  async function helpers_hash(data) {
2272
- let crypto = await import("node:crypto");
2153
+ let crypto = await getCrypto();
2273
2154
  return crypto.hash ? crypto.hash('sha256', data, 'hex').slice(0, 16) : crypto.createHash('sha256').update(data).digest('hex').slice(0, 16);
2274
2155
  }
2275
2156
  let compiler_isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers), getPublicPathFromCompiler = (compiler)=>{
@@ -2574,9 +2455,14 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWa
2574
2455
  !compilerDone && (compilerDone = !0, doneCompilers++), compilerStats[compilerIndex] = stats;
2575
2456
  let lastCompilerDone = doneCompilers === compilers.length;
2576
2457
  await onEnvironmentDone(index, stats), lastCompilerDone && await onDone(new MultiStatsCtor(compilerStats));
2577
- }), compiler.hooks.invalid.tap('rsbuild:done', ()=>{
2578
- compilerDone && (compilerDone = !1, doneCompilers--);
2579
2458
  });
2459
+ let resetDoneState = ()=>{
2460
+ compilerDone && (compilerDone = !1, doneCompilers--);
2461
+ };
2462
+ compiler.hooks.invalid.tap('rsbuild:done', resetDoneState), compiler.hooks.watchRun.tap({
2463
+ name: 'rsbuild:done',
2464
+ stage: -1 / 0
2465
+ }, resetDoneState);
2580
2466
  }
2581
2467
  } else compiler.hooks.done.tapPromise('rsbuild:done', async (stats)=>{
2582
2468
  await onEnvironmentDone(0, stats), await onDone(stats);
@@ -2684,30 +2570,7 @@ function loadConfig(opts) {
2684
2570
  return pickEnv(config, opts);
2685
2571
  }
2686
2572
  }
2687
- function toRelativePath(base, filepath) {
2688
- let relativePath = relative(base, filepath);
2689
- return '' === relativePath ? `.${sep}` : relativePath.startsWith('.') ? relativePath : `.${sep}${relativePath}`;
2690
- }
2691
- function getCommonParentPath(paths) {
2692
- let uniquePaths = [
2693
- ...new Set(paths)
2694
- ];
2695
- if (1 === uniquePaths.length) return uniquePaths[0];
2696
- let [first, ...rest] = uniquePaths.map((p)=>p.split(sep)), common = [];
2697
- for(let i = 0; i < first.length; i++){
2698
- let segment = first[i];
2699
- if (rest.every((p)=>p[i] === segment)) common.push(segment);
2700
- else break;
2701
- }
2702
- return common.join(sep);
2703
- }
2704
- let ensureAbsolutePath = (base, filePath)=>external_node_path_isAbsolute(filePath) ? filePath : join(base, filePath), getPathnameFromUrl = (url)=>{
2705
- try {
2706
- return url ? new URL(url, 'http://localhost').pathname : url;
2707
- } catch {
2708
- return url;
2709
- }
2710
- }, 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)=>{
2573
+ let isFileSync = (filePath)=>{
2711
2574
  try {
2712
2575
  return node_fs.statSync(filePath, {
2713
2576
  throwIfNoEntry: !1
@@ -2849,7 +2712,7 @@ let OVERRIDE_PATHS = new Set([
2849
2712
  writeToDisk: !1,
2850
2713
  cliShortcuts: !1,
2851
2714
  client: {
2852
- path: '/rsbuild-hmr',
2715
+ path: HMR_SOCKET_PATH,
2853
2716
  port: '',
2854
2717
  host: '',
2855
2718
  overlay: !0,
@@ -2886,7 +2749,7 @@ let OVERRIDE_PATHS = new Set([
2886
2749
  scriptLoading: 'defer',
2887
2750
  implementation: 'js'
2888
2751
  },
2889
- resolve: (swcHelpersPath || (swcHelpersPath = external_node_path_dirname(vendors_require.resolve('@swc/helpers/package.json'))), {
2752
+ resolve: (swcHelpersPath || (swcHelpersPath = dirname(vendors_require.resolve('@swc/helpers/package.json'))), {
2890
2753
  alias: {
2891
2754
  '@swc/helpers': swcHelpersPath
2892
2755
  },
@@ -2912,14 +2775,14 @@ let OVERRIDE_PATHS = new Set([
2912
2775
  cleanDistPath: 'auto',
2913
2776
  distPath: {
2914
2777
  root: "dist",
2915
- css: 'static/css',
2916
- svg: 'static/svg',
2917
- font: 'static/font',
2778
+ css: CSS_DIST_DIR,
2779
+ svg: SVG_DIST_DIR,
2780
+ font: FONT_DIST_DIR,
2918
2781
  html: "./",
2919
- wasm: 'static/wasm',
2920
- image: 'static/image',
2921
- media: 'static/media',
2922
- assets: 'static/assets',
2782
+ wasm: WASM_DIST_DIR,
2783
+ image: IMAGE_DIST_DIR,
2784
+ media: MEDIA_DIST_DIR,
2785
+ assets: ASSETS_DIST_DIR,
2923
2786
  favicon: "./"
2924
2787
  },
2925
2788
  assetPrefix: "/",
@@ -2995,7 +2858,7 @@ let withDefaultConfig = async (rootPath, userConfig)=>{
2995
2858
  imports: !0,
2996
2859
  entries: !1
2997
2860
  }), !config.source.tsconfigPath) {
2998
- let tsconfigPath = join(rootPath, 'tsconfig.json');
2861
+ let tsconfigPath = join(rootPath, TS_CONFIG_FILE);
2999
2862
  await isFileExists(tsconfigPath) && (config.source.tsconfigPath = tsconfigPath);
3000
2863
  }
3001
2864
  return config;
@@ -3011,9 +2874,9 @@ function exit(exitCode, type) {
3011
2874
  }
3012
2875
  function exitHook(onExit) {
3013
2876
  return exitHook_callbacks.add(onExit), isRegistered || (isRegistered = !0, node_process.on('SIGINT', ()=>{
3014
- exit(external_node_os_constants.signals.SIGINT + 128, 'SIGINT');
2877
+ exit(constants.signals.SIGINT + 128, 'SIGINT');
3015
2878
  }), node_process.once('SIGTERM', ()=>{
3016
- exit(external_node_os_constants.signals.SIGTERM + 128, 'SIGTERM');
2879
+ exit(constants.signals.SIGTERM + 128, 'SIGTERM');
3017
2880
  }), node_process.once('exit', (exitCode)=>{
3018
2881
  exit(exitCode, 'exit');
3019
2882
  })), ()=>{
@@ -3266,7 +3129,7 @@ function initPluginAPI({ context, pluginManager }) {
3266
3129
  if (descriptor.targets && !descriptor.targets.includes(target) || descriptor.environments && !descriptor.environments.includes(environmentContext.name)) return;
3267
3130
  let rule = chain.module.rule(id);
3268
3131
  descriptor.test && rule.test(descriptor.test), descriptor.resourceQuery && rule.resourceQuery(descriptor.resourceQuery), descriptor.layer && rule.layer(descriptor.layer), descriptor.issuerLayer && rule.issuerLayer(descriptor.issuerLayer), descriptor.issuer && rule.issuer(descriptor.issuer), descriptor.with && rule.with(descriptor.with), descriptor.mimetype && rule.mimetype(descriptor.mimetype), descriptor.order && 'default' !== descriptor.order ? rule.enforce(descriptor.order) : descriptor.enforce && rule.enforce(descriptor.enforce);
3269
- let loaderPath = join(dirname, descriptor.raw ? 'transformRawLoader.mjs' : 'transformLoader.mjs');
3132
+ let loaderPath = join(LOADER_PATH, descriptor.raw ? 'transformRawLoader.mjs' : 'transformLoader.mjs');
3270
3133
  rule.use(id).loader(loaderPath).options({
3271
3134
  id,
3272
3135
  getEnvironment: ()=>environmentContext
@@ -3428,7 +3291,7 @@ function createPublicContext(context) {
3428
3291
  async function createContext(options, userConfig, logger, loadConfigResult) {
3429
3292
  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();
3430
3293
  return {
3431
- version: "2.2.8",
3294
+ version: "2.2.10",
3432
3295
  rootPath,
3433
3296
  configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
3434
3297
  configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
@@ -3967,7 +3830,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
3967
3830
  }, applyEnvironmentDefaultConfig = (config)=>{
3968
3831
  config.source.entry && 0 !== Object.keys(config.source.entry).length || (config.source.entry = (defaultEntry || (defaultEntry = getDefaultEntry(rootPath)), defaultEntry));
3969
3832
  let isServer = 'node' === config.output.target;
3970
- return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : 'static/js'), void 0 === config.output.module && (config.output.module = isServer), void 0 === config.output.minify && (config.output.minify = !isServer), config;
3833
+ return void 0 === config.output.distPath.js && (config.output.distPath.js = isServer ? '' : JS_DIST_DIR), void 0 === config.output.module && (config.output.module = isServer), void 0 === config.output.minify && (config.output.minify = !isServer), config;
3971
3834
  };
3972
3835
  if (environments && Object.keys(environments).length > 0) {
3973
3836
  let resolvedEnvironments = Object.fromEntries(Object.entries(environments).filter(([name])=>isEnvironmentEnabled(name)).map(([name, config])=>[
@@ -4112,9 +3975,9 @@ async function createCompiler_createCompiler(options) {
4112
3975
  if ('LazyCompilation' === name && 'string' == typeof log && log.startsWith(LAZY_COMPILATION_IDENTIFIER)) {
4113
3976
  let resource = log.split(' ')[0];
4114
3977
  if (!resource) return;
4115
- let { rootPath } = context, absolutePath = resource.split('!').pop();
4116
- if (absolutePath?.startsWith(rootPath)) {
4117
- let relativePath = absolutePath.replace(rootPath, '');
3978
+ let { rootPath } = context, rootPrefix = rootPath.endsWith(sep) ? rootPath : rootPath + sep, absolutePath = resource.split('!').pop();
3979
+ if (absolutePath?.startsWith(rootPrefix)) {
3980
+ let relativePath = absolutePath.slice(rootPrefix.length);
4118
3981
  lazyModules.add(relativePath);
4119
3982
  }
4120
3983
  }
@@ -4144,8 +4007,9 @@ async function createCompiler_createCompiler(options) {
4144
4007
  let digits = seconds >= 0.01 ? 2 : 3;
4145
4008
  return format(seconds.toFixed(digits), 's');
4146
4009
  }
4147
- if (seconds < 60) return format(seconds.toFixed(1), 's');
4148
- let minutesLabel = format(Math.floor(seconds / 60).toFixed(0), 'm'), remainingSeconds = seconds % 60;
4010
+ let roundedSeconds = Math.round(10 * seconds) / 10;
4011
+ if (roundedSeconds < 60) return format(roundedSeconds.toFixed(1), 's');
4012
+ let minutesLabel = format(Math.floor(roundedSeconds / 60).toFixed(0), 'm'), remainingSeconds = roundedSeconds % 60;
4149
4013
  if (0 === remainingSeconds) return minutesLabel;
4150
4014
  let secondsLabel = format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)), 's');
4151
4015
  return `${minutesLabel} ${secondsLabel}`;
@@ -4232,7 +4096,7 @@ async function createCompiler_createCompiler(options) {
4232
4096
  rspackConfigs
4233
4097
  };
4234
4098
  }
4235
- let DEFAULT_WATCH_FILE_EVENTS = [
4099
+ let getChokidar = cachedImport(()=>import("./chokidar.js").then((m)=>m.chokidar_namespaceObject)), DEFAULT_WATCH_FILE_EVENTS = [
4236
4100
  'add',
4237
4101
  'change',
4238
4102
  'unlink'
@@ -4279,9 +4143,9 @@ function prepareWatchOptions(paths, options = {}, type, events) {
4279
4143
  }
4280
4144
  let GLOB_REGEX = /[*?{}[\]()!+|]/;
4281
4145
  async function createChokidar(pathOrGlobs, root, options) {
4282
- let { default: chokidar } = await import("./chokidar.js"), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
4146
+ let { default: chokidar } = await getChokidar(), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
4283
4147
  if (globPatterns.length) {
4284
- let { glob } = await import("./tinyglobby.js");
4148
+ let { glob } = await getTinyglobby();
4285
4149
  for (let file of (await glob(globPatterns, {
4286
4150
  cwd: root,
4287
4151
  absolute: !0
@@ -5003,10 +4867,7 @@ async function getBuildDependencies(context, environmentContext, additionalDepen
5003
4867
  tailwindConfig
5004
4868
  ]), additionalDependencies && (buildDependencies.additional = additionalDependencies), buildDependencies;
5005
4869
  }
5006
- let addTrailingSep = (dir)=>dir.endsWith(sep) ? dir : dir + sep, isStrictSubdir = (parent, child)=>{
5007
- let parentDir = addTrailingSep(parent), childDir = addTrailingSep(child);
5008
- return parentDir !== childDir && childDir.startsWith(parentDir);
5009
- }, normalizeCleanDistPath = (userOptions)=>{
4870
+ let normalizeCleanDistPath = (userOptions)=>{
5010
4871
  let defaultOptions = {
5011
4872
  enable: 'auto'
5012
4873
  };
@@ -5110,7 +4971,7 @@ let getPostcssLoaderOptions = async ({ config, root, postcssrcCache })=>{
5110
4971
  let extraPlugins = [], userOptions = await loadUserPostcssrc(root, postcssrcCache);
5111
4972
  userOptions.plugins ||= [];
5112
4973
  let defaultOptions = {
5113
- implementation: join(COMPILED_PATH, 'postcss', 'index.js'),
4974
+ implementation: getCompiledPath('postcss'),
5114
4975
  postcssOptions: userOptions,
5115
4976
  sourceMap: getCSSSourceMap(config)
5116
4977
  }, finalOptions = await reduceConfigsWithContext({
@@ -6043,7 +5904,7 @@ let supportedChromiumBrowsers = [
6043
5904
  async function openBrowser(url, logger) {
6044
5905
  let browser = process.env.BROWSER, browserArgs = process.env.BROWSER_ARGS;
6045
5906
  if ('darwin' === process.platform && (!browser || !browserArgs) && (!browser || supportedChromiumBrowsers.includes(mapChromiumBrowserName(browser)))) {
6046
- let { execFile } = await import("node:child_process"), { promisify } = await import("node:util"), execFileAsync = promisify(execFile), getDefaultBrowserForAppleScript = async ()=>{
5907
+ let { execFile } = await import("node:child_process"), execFileAsync = promisify(execFile), getDefaultBrowserForAppleScript = async ()=>{
6047
5908
  let { stdout: ps } = await execFileAsync('ps', [
6048
5909
  'cax'
6049
5910
  ]);
@@ -6139,7 +6000,7 @@ function doesChunkBelongToHtml({ chunk, htmlPluginData }) {
6139
6000
  let { options } = htmlPluginData.plugin;
6140
6001
  return recursiveChunkEntryNames(chunk).some((chunkName)=>isChunksFiltered(chunkName, options?.chunks, options?.excludeChunks));
6141
6002
  }
6142
- let isCSSPath = (filePath)=>filePath.endsWith('.css');
6003
+ let getManifestPlugin = cachedImport(()=>import("./manifest-plugin.js").then(rspackRequire.bind(rspackRequire, "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/rspack-manifest-plugin/5.2.2/54ceb7b806dc8c324f87415cf04dd80d28fa7d41470a3b40d83aaf488c0a5cb8/node_modules/rspack-manifest-plugin/dist/index.js"))), isCSSPath = (filePath)=>filePath.endsWith('.css');
6143
6004
  function normalizeManifestObjectConfig(manifest) {
6144
6005
  let defaultOptions = {
6145
6006
  prefix: !0,
@@ -6203,7 +6064,7 @@ async function applyAlias({ chain, config, rootPath, logger }) {
6203
6064
  continue;
6204
6065
  }
6205
6066
  try {
6206
- pkgPath = external_node_path_dirname(vendors_require.resolve(`${pkgName}/package.json`, {
6067
+ pkgPath = dirname(vendors_require.resolve(`${pkgName}/package.json`, {
6207
6068
  paths: [
6208
6069
  rootPath
6209
6070
  ]
@@ -6219,7 +6080,7 @@ async function applyAlias({ chain, config, rootPath, logger }) {
6219
6080
  'node_modules',
6220
6081
  ...pkgName.split('/')
6221
6082
  ].join(sep);
6222
- for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = external_node_path_dirname(pkgPath);
6083
+ for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = dirname(pkgPath);
6223
6084
  } catch {
6224
6085
  logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is not resolved in the project, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
6225
6086
  continue;
@@ -6825,8 +6686,8 @@ function destroyStream(stream, suppress) {
6825
6686
  'number' == typeof fd && this.close();
6826
6687
  }), 'function' == typeof stream.addListener && suppress && (stream.removeAllListeners('error'), stream.addListener('error', ()=>{}));
6827
6688
  }
6828
- let parseRangeHeaders = async (value)=>{
6829
- 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('|');
6689
+ let getRangeParser = cachedImport(()=>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))), parseRangeHeaders = async (value)=>{
6690
+ let { default: rangeParser } = await getRangeParser(), [len, rangeHeader] = value.split('|');
6830
6691
  return rangeParser(Number(len), rangeHeader, {
6831
6692
  combine: !0
6832
6693
  });
@@ -6947,8 +6808,9 @@ async function setupOutputFileSystem(writeToDisk, compilers) {
6947
6808
  function setupWriteToDisk(compilers, writeToDisk, logger) {
6948
6809
  for (let compiler of compilers)compiler.hooks.emit.tap('DevMiddleware', ()=>{
6949
6810
  compiler.__hasRsbuildAssetEmittedCallback || (compiler.hooks.assetEmitted.tapAsync('DevMiddleware', (_file, info, callback)=>{
6811
+ if (compiler.outputFileSystem === node_fs) return void callback();
6950
6812
  let { targetPath, content, compilation } = info;
6951
- if (!(!writeToDisk || 'function' != typeof writeToDisk || writeToDisk(targetPath, compilation.name))) return void callback();
6813
+ if (!('function' != typeof writeToDisk || writeToDisk(targetPath, compilation.name))) return void callback();
6952
6814
  let dir = node_path.dirname(targetPath), name = compiler.options.name ? `Child "${compiler.options.name}": ` : '';
6953
6815
  node_fs.mkdir(dir, {
6954
6816
  recursive: !0
@@ -7158,15 +7020,17 @@ function parseNode(line) {
7158
7020
  column: parts[4] ? +parts[4] : null
7159
7021
  } : null;
7160
7022
  }
7161
- let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), isRspackRuntimeStack = (value)=>!!value && (value.includes('__webpack_require__') || value.startsWith('webpack/runtime/')), parseFrame = async (frame, fs, context, cachedTraceMap)=>{
7162
- let { file, column, lineNumber } = frame, sourceMapInfo = await getFileFromUrl(`${file}.map`, fs, context);
7163
- if (!sourceMapInfo || 'errorCode' in sourceMapInfo) return;
7164
- let { TraceMap, originalPositionFor } = await import("./trace-mapping.js"), sourceMapPath = sourceMapInfo.filename;
7023
+ let getTraceMapping = cachedImport(()=>import("./trace-mapping.js").then((m)=>m.trace_mapping_namespaceObject)), isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.test(methodName), isRspackRuntimeStack = (value)=>!!value && (value.includes('__webpack_require__') || value.startsWith('webpack/runtime/')), parseFrame = async (frame, fs, context, cache)=>{
7024
+ let { file, column, lineNumber } = frame, sourceMapUrl = `${file}.map`, sourceMapPathPromise = cache.sourceMapPaths.get(sourceMapUrl);
7025
+ sourceMapPathPromise || (sourceMapPathPromise = getFileFromUrl(sourceMapUrl, fs, context).then((info)=>!info || 'errorCode' in info ? void 0 : info.filename), cache.sourceMapPaths.set(sourceMapUrl, sourceMapPathPromise));
7026
+ let sourceMapPath = await sourceMapPathPromise;
7027
+ if (!sourceMapPath) return;
7028
+ let { TraceMap, originalPositionFor } = await getTraceMapping();
7165
7029
  try {
7166
- let tracer = cachedTraceMap.get(sourceMapPath);
7030
+ let tracer = cache.traceMaps.get(sourceMapPath);
7167
7031
  if (!tracer) {
7168
7032
  let sourceMap = await readFileAsync(fs, sourceMapPath);
7169
- tracer = new TraceMap(sourceMap.toString()), cachedTraceMap.set(sourceMapPath, tracer);
7033
+ tracer = new TraceMap(sourceMap.toString()), cache.traceMaps.set(sourceMapPath, tracer);
7170
7034
  }
7171
7035
  let originalPosition = originalPositionFor(tracer, {
7172
7036
  line: lineNumber ?? 0,
@@ -7179,10 +7043,10 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7179
7043
  } catch (error) {
7180
7044
  error instanceof Error && context.logger.debug('failed to map source map position:', error);
7181
7045
  }
7182
- }, resolveOriginalLocation = async (stackFrames, fs, context, cachedTraceMap)=>{
7046
+ }, resolveOriginalLocation = async (stackFrames, fs, context, cache)=>{
7183
7047
  let frame = stackFrames.find((frame)=>null !== frame.file && null !== frame.column && null !== frame.lineNumber && SCRIPT_REGEX.test(frame.file));
7184
7048
  if (!frame) return;
7185
- let parsedFrame = await parseFrame(frame, fs, context, cachedTraceMap);
7049
+ let parsedFrame = await parseFrame(frame, fs, context, cache);
7186
7050
  if (!parsedFrame) return;
7187
7051
  let { sourceMapPath, originalPosition } = parsedFrame;
7188
7052
  return {
@@ -7201,10 +7065,10 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7201
7065
  }, formatFrameLocation = (frame)=>{
7202
7066
  let { file, lineNumber, column } = frame;
7203
7067
  if (file) return null !== lineNumber ? null !== column ? `${file}:${lineNumber}:${column}` : `${file}:${lineNumber}` : file;
7204
- }, formatFullStack = async (stackFrames, context, fs, cachedTraceMap)=>{
7068
+ }, formatFullStack = async (stackFrames, context, fs, cache)=>{
7205
7069
  let formattedFrames = [];
7206
7070
  for (let frame of stackFrames){
7207
- let location, parsedFrame = await parseFrame(frame, fs, context, cachedTraceMap), { methodName } = frame, parts = [];
7071
+ let location, parsedFrame = await parseFrame(frame, fs, context, cache), { methodName } = frame, parts = [];
7208
7072
  isValidMethodName(methodName) && parts.push(methodName);
7209
7073
  let parsed = !1;
7210
7074
  if (parsedFrame) {
@@ -7227,13 +7091,13 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7227
7091
  }
7228
7092
  let shouldFilterRspackRuntime = formattedFrames.some((frame)=>!frame.isRspackRuntime && frame.hasLocation);
7229
7093
  return formattedFrames.filter((frame)=>!(shouldFilterRspackRuntime && frame.isRspackRuntime)).map((frame)=>frame.text).join('');
7230
- }, formatBrowserErrorLog = async (message, context, fs, stackTrace, stackFrames, cachedTraceMap)=>{
7094
+ }, formatBrowserErrorLog = async (message, context, fs, stackTrace, stackFrames, cache)=>{
7231
7095
  var log;
7232
7096
  let log1 = color.red(message);
7233
7097
  if (stackFrames?.length) switch(stackTrace){
7234
7098
  case 'summary':
7235
7099
  {
7236
- let resolved = await resolveOriginalLocation(stackFrames, fs, context, cachedTraceMap);
7100
+ let resolved = await resolveOriginalLocation(stackFrames, fs, context, cache);
7237
7101
  if (!resolved) break;
7238
7102
  let { frame, location } = resolved, { methodName } = frame, suffix = '';
7239
7103
  isValidMethodName(methodName) && (suffix += ` at ${methodName}`), location && (suffix += ` (${location})`), log1 += suffix ? color.dim(suffix) : '';
@@ -7241,7 +7105,7 @@ let isValidMethodName = (methodName)=>'<unknown>' !== methodName && !/[\\/]/.tes
7241
7105
  }
7242
7106
  case 'full':
7243
7107
  {
7244
- let fullStack = await formatFullStack(stackFrames, context, fs, cachedTraceMap);
7108
+ let fullStack = await formatFullStack(stackFrames, context, fs, cache);
7245
7109
  fullStack && (log1 += fullStack);
7246
7110
  }
7247
7111
  }
@@ -7421,8 +7285,11 @@ class SocketServer {
7421
7285
  if (!environment) return;
7422
7286
  let { browserLogs, client } = environment.config.dev;
7423
7287
  if ('client-error' === payload.type && !context.buildState.hasErrors && browserLogs) {
7424
- let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null, cachedTraceMap = new Map(), log = await formatBrowserErrorLog(payload.message, context, outputFs, stackTrace, stackFrames, cachedTraceMap);
7425
- if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan('[browser]')} ${log}`)), ((overlay, payload)=>{
7288
+ let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, outputFs = this.getOutputFileSystem(), stackFrames = payload.stack ? stack_trace_parser_esm_parse(payload.stack) : null, cache = {
7289
+ sourceMapPaths: new Map(),
7290
+ traceMaps: new Map()
7291
+ }, log = await formatBrowserErrorLog(payload.message, context, outputFs, stackTrace, stackFrames, cache);
7292
+ if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan(BROWSER_LOG_PREFIX)} ${log}`)), ((overlay, payload)=>{
7426
7293
  if (!isRuntimeOverlayEnabled(overlay)) return !1;
7427
7294
  if ('object' == typeof overlay && 'function' == typeof overlay.runtime) {
7428
7295
  let error;
@@ -7430,7 +7297,7 @@ class SocketServer {
7430
7297
  }
7431
7298
  return !0;
7432
7299
  })(client.overlay, payload)) {
7433
- let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames, cachedTraceMap);
7300
+ let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames, cache);
7434
7301
  this.sendMessage({
7435
7302
  type: 'resolved-client-error',
7436
7303
  data: {
@@ -7622,7 +7489,11 @@ function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_B
7622
7489
  if (filter && !filter(req, res)) return void next();
7623
7490
  let accept = req.headers['accept-encoding'], encoding = 'string' == typeof accept && ENCODING_REGEX.test(accept);
7624
7491
  if ('HEAD' === req.method || !encoding) return void next();
7625
- let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = [], start = ()=>{
7492
+ let started = !1, on = res.on.bind(res), end = res.end.bind(res), write = res.write.bind(res), writeHead = res.writeHead.bind(res), listeners = [];
7493
+ res.flush = ()=>{
7494
+ gzip?.flush(node_zlib.constants.Z_SYNC_FLUSH);
7495
+ };
7496
+ let start = ()=>{
7626
7497
  if (started) return;
7627
7498
  if (started = !0, ((res)=>{
7628
7499
  if (res.getHeader('Content-Encoding')) return !1;
@@ -7932,7 +7803,10 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7932
7803
  environments: devServer.environments,
7933
7804
  logger
7934
7805
  })), buildManager && (middlewares.use(buildManager.assetsMiddleware), upgradeEvents.push(buildManager.socketServer.upgrade), middlewares.use(function hotUpdateJsonFallbackMiddleware(req, res, next) {
7935
- req.url?.endsWith('.hot-update.json') && 'OPTIONS' !== req.method ? notFoundMiddleware(req, res, next) : next();
7806
+ let url = req.url;
7807
+ if (!url || 'OPTIONS' === req.method) return void next();
7808
+ let queryIndex = url.indexOf('?'), end = -1 === queryIndex ? url.length : queryIndex;
7809
+ url.endsWith('.hot-update.json', end) || url.endsWith('.hot-update.json.mjs', end) ? notFoundMiddleware(req, res, next) : next();
7936
7810
  })), buildManager && middlewares.use(getHtmlCompletionMiddleware({
7937
7811
  assetsMiddleware: buildManager.assetsMiddleware,
7938
7812
  distPaths: [
@@ -7995,18 +7869,18 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7995
7869
  },
7996
7870
  onUpgrade
7997
7871
  };
7998
- }, isModuleNamespaceObject = (moduleExports)=>'[object Module]' === Object.prototype.toString.call(moduleExports), asModule = async (moduleExports, context, unlinked)=>{
7999
- let { Module, SyntheticModule } = await import("node:vm");
7872
+ }, isModuleNamespaceObject = (moduleExports)=>'[object Module]' === Object.prototype.toString.call(moduleExports), asModule = async (vm, moduleExports, context, unlinked)=>{
7873
+ let { Module, SyntheticModule } = vm;
8000
7874
  if (moduleExports instanceof Module) return moduleExports;
8001
7875
  let normalizedModuleExports = null !== moduleExports && ('object' == typeof moduleExports || 'function' == typeof moduleExports) ? moduleExports : {
8002
7876
  default: moduleExports
8003
- }, __nested_rspack_exports__ = [
7877
+ }, exports = [
8004
7878
  ...new Set([
8005
7879
  'default',
8006
7880
  ...Object.keys(normalizedModuleExports)
8007
7881
  ])
8008
- ], syntheticModule = new SyntheticModule(__nested_rspack_exports__, ()=>{
8009
- for (let name of __nested_rspack_exports__)if ('default' === name) {
7882
+ ], syntheticModule = new SyntheticModule(exports, ()=>{
7883
+ for (let name of exports)if ('default' === name) {
8010
7884
  let defaultExport = isModuleNamespaceObject(normalizedModuleExports) && 'default' in normalizedModuleExports ? normalizedModuleExports.default : moduleExports;
8011
7885
  syntheticModule.setExport(name, defaultExport);
8012
7886
  } else syntheticModule.setExport(name, normalizedModuleExports[name]);
@@ -8016,16 +7890,16 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
8016
7890
  return unlinked || (await syntheticModule.link(()=>{}), await syntheticModule.evaluate()), syntheticModule;
8017
7891
  };
8018
7892
  class BasicRunner {
8019
- _options;
7893
+ options;
8020
7894
  globalContext = null;
8021
7895
  baseModuleScope = null;
8022
7896
  requirers = new Map();
8023
- constructor(_options){
8024
- this._options = _options;
7897
+ constructor(options){
7898
+ this.options = options;
8025
7899
  }
8026
7900
  run(file) {
8027
7901
  this.globalContext || (this.globalContext = this.createGlobalContext()), this.baseModuleScope = this.createBaseModuleScope(), this.createRunner();
8028
- let res = this.getRequire()(this._options.dist, file.startsWith('./') ? file : `./${file}`);
7902
+ let res = this.getRequire()(this.options.dist, file.startsWith('./') ? file : `./${file}`);
8029
7903
  return res && 'object' == typeof res && 'then' in res ? res : Promise.resolve(res);
8030
7904
  }
8031
7905
  getRequire() {
@@ -8039,9 +7913,8 @@ class BasicRunner {
8039
7913
  subPath: ''
8040
7914
  };
8041
7915
  let joinedPath = /^\.\.?\//.test(modulePath) ? node_path.join(currentDirectory, modulePath) : modulePath;
8042
- return this._options.isOutputFile(joinedPath) ? {
7916
+ return this.options.isOutputFile(joinedPath) ? {
8043
7917
  path: joinedPath,
8044
- content: this._options.readFileSync(joinedPath),
8045
7918
  subPath: ((p)=>{
8046
7919
  let lastSlash = p.lastIndexOf('/'), firstSlash = p.indexOf('/');
8047
7920
  if (-1 !== lastSlash && firstSlash !== lastSlash) {
@@ -8055,6 +7928,9 @@ class BasicRunner {
8055
7928
  })(modulePath)
8056
7929
  } : null;
8057
7930
  }
7931
+ getFileContent(file) {
7932
+ return file.content ??= this.options.readFileSync(file.path);
7933
+ }
8058
7934
  preExecute(_code, _file) {}
8059
7935
  postExecute(_m, _file) {}
8060
7936
  createRunner() {
@@ -8114,21 +7990,21 @@ class CommonJsRunner extends BasicRunner {
8114
7990
  };
8115
7991
  }
8116
7992
  createCjsRequirer() {
8117
- let requireCache = Object.create(null), vm = vendors_require('node:vm');
7993
+ let cachedDynamicImport, requireCache = Object.create(null), vm = vendors_require('node:vm');
8118
7994
  return (currentDirectory, modulePath, context = {})=>{
8119
7995
  let file = context.file || this.getFile(modulePath, currentDirectory);
8120
7996
  if (!file) return this.requirers.get('miss')(currentDirectory, modulePath);
8121
7997
  if (file.path in requireCache) return requireCache[file.path].exports;
8122
- let m = {
7998
+ let content = this.getFileContent(file), m = {
8123
7999
  exports: {}
8124
8000
  };
8125
8001
  requireCache[file.path] = m;
8126
8002
  let currentModuleScope = this.createModuleScope(this.getRequire(), m, file), args = Object.keys(currentModuleScope), argValues = args.map((arg)=>currentModuleScope[arg]);
8127
- this.preExecute(file.content, file);
8128
- let dynamicImport = Function('specifier', 'return import(specifier)');
8129
- return vm.compileFunction(file.content, args, {
8003
+ this.preExecute(content, file);
8004
+ let dynamicImport = cachedDynamicImport ??= Function('specifier', 'return import(specifier)');
8005
+ return vm.compileFunction(content, args, {
8130
8006
  filename: file.path,
8131
- importModuleDynamically: async (specifier)=>await dynamicImport(specifier)
8007
+ importModuleDynamically: dynamicImport
8132
8008
  }).call(m.exports, ...argValues), this.postExecute(m, file), m.exports;
8133
8009
  };
8134
8010
  }
@@ -8136,7 +8012,7 @@ class CommonJsRunner extends BasicRunner {
8136
8012
  class EsmRunner extends CommonJsRunner {
8137
8013
  createRunner() {
8138
8014
  super.createRunner(), this.requirers.set('cjs', this.getRequire()), this.requirers.set('esm', this.createEsmRequirer());
8139
- let outputModule = this._options.compilerOptions.output.module;
8015
+ let outputModule = this.options.compilerOptions.output.module;
8140
8016
  this.requirers.set('entry', (currentDirectory, modulePath, context)=>{
8141
8017
  let file = this.getFile(modulePath, currentDirectory);
8142
8018
  return file ? outputModule && !file.path.endsWith('.cjs') ? this.requirers.get('esm')(currentDirectory, modulePath, {
@@ -8149,7 +8025,7 @@ class EsmRunner extends CommonJsRunner {
8149
8025
  });
8150
8026
  }
8151
8027
  createEsmRequirer() {
8152
- let esmCache = new Map(), esmIdentifier = this._options.name, vm = vendors_require('node:vm');
8028
+ let esmCache = new Map(), esmIdentifier = this.options.name, vm = vendors_require('node:vm');
8153
8029
  return (currentDirectory, modulePath, context = {})=>{
8154
8030
  if (!vm.SourceTextModule) throw Error(`${color.dim('[rsbuild:runner]')} Running ESM bundle needs add Node.js option ${color.yellow('--experimental-vm-modules')}.`);
8155
8031
  let _require = this.getRequire(), file = context.file || this.getFile(modulePath, currentDirectory);
@@ -8162,14 +8038,14 @@ class EsmRunner extends CommonJsRunner {
8162
8038
  initializeImportMeta: (meta)=>{
8163
8039
  meta.url = pathToFileURL(file.path).href;
8164
8040
  },
8165
- importModuleDynamically: async (specifier, module)=>asModule(await _require(node_path.dirname(file.path), specifier, {
8041
+ importModuleDynamically: async (specifier, module)=>asModule(vm, await _require(node_path.dirname(file.path), specifier, {
8166
8042
  esmMode: 1
8167
8043
  }), module.context)
8168
8044
  };
8169
- esm = new vm.SourceTextModule(file.content, sourceTextModuleOptions), esmCache.set(file.path, esm);
8045
+ esm = new vm.SourceTextModule(this.getFileContent(file), sourceTextModuleOptions), esmCache.set(file.path, esm);
8170
8046
  }
8171
8047
  return 2 === context.esmMode ? esm : (async ()=>{
8172
- if (await esm.link(async (specifier, referencingModule)=>asModule(await _require(node_path.dirname(referencingModule.identifier), specifier, {
8048
+ if (await esm.link(async (specifier, referencingModule)=>asModule(vm, await _require(node_path.dirname(referencingModule.identifier), specifier, {
8173
8049
  esmMode: 2
8174
8050
  }), referencingModule.context, !0)), await esm.evaluate(), 1 === context.esmMode) return esm;
8175
8051
  let ns = esm.namespace;
@@ -8256,7 +8132,7 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>{
8256
8132
  }, shutdownRefCount = 0, setupGracefulShutdown = ()=>{
8257
8133
  shutdownRefCount++;
8258
8134
  let onSigterm = ()=>{
8259
- handleTermination(external_node_os_constants.signals.SIGTERM + 128);
8135
+ handleTermination(constants.signals.SIGTERM + 128);
8260
8136
  };
8261
8137
  process.once('SIGTERM', onSigterm);
8262
8138
  let isCI = 'true' === process.env.CI, onStdinEnd = ()=>{
@@ -8381,12 +8257,18 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
8381
8257
  protocol,
8382
8258
  clearCache: !0,
8383
8259
  logger
8384
- }), state = {}, cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServerResources = ()=>(closingPromise || (hotConnectCallbacks = void 0, unregisterRestart?.(), unregisterRestart = void 0, closingPromise = (async ()=>{
8260
+ }), state = {}, webSocketServers = new Set(), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closeServerResources = ()=>{
8261
+ if (closingPromise) return closingPromise;
8262
+ hotConnectCallbacks = void 0;
8263
+ let onUpgrade = state.devMiddlewares?.onUpgrade;
8264
+ if (onUpgrade && webSocketServers) for (let server of webSocketServers)server.removeListener('upgrade', onUpgrade);
8265
+ return webSocketServers = void 0, unregisterRestart?.(), unregisterRestart = void 0, closingPromise = (async ()=>{
8385
8266
  removeCleanup(closeServer), cleanupGracefulShutdown?.(), await context.hooks.onCloseDevServer.callBatch(), await Promise.all([
8386
8267
  state.devMiddlewares?.close(),
8387
8268
  state.fileWatcher?.close()
8388
8269
  ]);
8389
- })()), closingPromise), closeServer = async ()=>{
8270
+ })();
8271
+ }, closeServer = async ()=>{
8390
8272
  await state.restartWatcher?.close(), await closeServerResources();
8391
8273
  }, restartServer = async ()=>{
8392
8274
  let restarted = await requestRestart({
@@ -8473,7 +8355,9 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
8473
8355
  return httpServer.listen({
8474
8356
  host,
8475
8357
  port
8476
- }), await once(httpServer, 'listening'), middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), state.devMiddlewares && httpServer.on('upgrade', state.devMiddlewares.onUpgrade), logger.debug('listen dev server done'), await devServer.afterListen(), {
8358
+ }), await once(httpServer, 'listening'), middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devServer.connectWebSocket({
8359
+ server: httpServer
8360
+ }), logger.debug('listen dev server done'), await devServer.afterListen(), {
8477
8361
  port,
8478
8362
  urls: urls.map((item)=>item.url),
8479
8363
  server: devServer
@@ -8495,7 +8379,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
8495
8379
  });
8496
8380
  },
8497
8381
  connectWebSocket: ({ server })=>{
8498
- state.devMiddlewares && server.on('upgrade', state.devMiddlewares.onUpgrade);
8382
+ state.devMiddlewares && webSocketServers && !webSocketServers.has(server) && (server.on('upgrade', state.devMiddlewares.onUpgrade), webSocketServers.add(server));
8499
8383
  },
8500
8384
  close: closeServer,
8501
8385
  printUrls,
@@ -8589,14 +8473,10 @@ async function startPreviewServer(context, config, { getPortSilently } = {}) {
8589
8473
  for (let middleware of proxyMiddlewares)middlewares.use(middleware);
8590
8474
  httpServer.on('upgrade', upgrade);
8591
8475
  }
8592
- if (compress) {
8593
- let { constants } = await import("node:zlib");
8594
- middlewares.use(gzipMiddleware_gzipMiddleware({
8595
- level: constants.Z_DEFAULT_COMPRESSION,
8596
- ...'object' == typeof compress ? compress : void 0
8597
- }));
8598
- }
8599
- for (let callback of (base && '/' !== base && middlewares.use(getBaseUrlMiddleware({
8476
+ for (let callback of (compress && middlewares.use(gzipMiddleware_gzipMiddleware({
8477
+ level: external_node_zlib_constants.Z_DEFAULT_COMPRESSION,
8478
+ ...'object' == typeof compress ? compress : void 0
8479
+ })), base && '/' !== base && middlewares.use(getBaseUrlMiddleware({
8600
8480
  base
8601
8481
  })), middlewares.use(assetsMiddleware), middlewares.use(getHtmlCompletionMiddleware(htmlMiddlewareOptions)), historyApiFallback && (middlewares.use(historyApiFallback_historyApiFallbackMiddleware(logger, !0 === historyApiFallback ? {} : historyApiFallback)), middlewares.use(assetsMiddleware)), postSetupCallbacks))await callback();
8602
8482
  serverConfig.htmlFallback && middlewares.use(getHtmlFallbackMiddleware({
@@ -8824,11 +8704,7 @@ function applyDefaultPlugins(pluginManager, context) {
8824
8704
  library: {
8825
8705
  type: isESM ? 'module' : 'commonjs2'
8826
8706
  }
8827
- }), isESM) {
8828
- if ('web-worker' === target) throw Error('[rsbuild:config] `output.module: true` is not supported for web-worker target.');
8829
- chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
8830
- }
8831
- if (config.output.copy) {
8707
+ }), isESM && (chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import')), config.output.copy) {
8832
8708
  let { copy } = config.output, options = Array.isArray(copy) ? {
8833
8709
  patterns: copy
8834
8710
  } : copy;
@@ -8913,7 +8789,7 @@ function applyDefaultPlugins(pluginManager, context) {
8913
8789
  for (let pathInfo of [
8914
8790
  ...Object.values(params.environments).reduce((result, curr)=>(result.some((item)=>item.distPath === curr.distPath) || result.push(curr), result), []).map((environment)=>((environment, isDev)=>{
8915
8791
  let { rootPath } = api.context, { config, distPath } = environment, { enable, keep } = normalizeCleanDistPath(config.output.cleanDistPath);
8916
- return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
8792
+ return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : relativeWithin(rootPath, distPath) ? {
8917
8793
  path: distPath,
8918
8794
  keep
8919
8795
  } : (api.logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), api.logger.warn(`Please set ${color.yellow('`output.cleanDistPath`')} config manually.`), api.logger.warn(`Current root path: ${color.dim(rootPath)}`), void api.logger.warn(`Current dist path: ${color.dim(distPath)}`)) : !0 === enable ? {
@@ -8923,7 +8799,7 @@ function applyDefaultPlugins(pluginManager, context) {
8923
8799
  })(environment, params.isDev)),
8924
8800
  (()=>{
8925
8801
  let { rootPath, distPath } = api.context, config = api.getNormalizedConfig(), targetPath = join(distPath, RSBUILD_OUTPUTS_PATH), { enable } = normalizeCleanDistPath(config.output.cleanDistPath);
8926
- if (!0 === enable || 'auto' === enable && isStrictSubdir(rootPath, targetPath)) return {
8802
+ if (!0 === enable || 'auto' === enable && relativeWithin(rootPath, targetPath)) return {
8927
8803
  path: targetPath
8928
8804
  };
8929
8805
  })()
@@ -9279,7 +9155,7 @@ try {
9279
9155
  type: 'text'
9280
9156
  }).type('asset/source');
9281
9157
  let urlRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_URL).resourceQuery(URL_QUERY_REGEX);
9282
- urlRule.use(CHAIN_ID.USE.CSS_URL).loader(node_path.join(dirname, 'cssUrlLoader.mjs'));
9158
+ urlRule.use(CHAIN_ID.USE.CSS_URL).loader(node_path.join(LOADER_PATH, 'cssUrlLoader.mjs'));
9283
9159
  let inlineRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_INLINE).resourceQuery(INLINE_QUERY_REGEX);
9284
9160
  cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_RAW).type('asset/source').resourceQuery(RAW_QUERY_REGEX);
9285
9161
  let mainRule = cssRule.oneOf(CHAIN_ID.ONE_OF.CSS_MAIN), emitCss = config.output.emitCss ?? 'web' === target;
@@ -9288,15 +9164,15 @@ try {
9288
9164
  initial: {},
9289
9165
  config: config.tools.styleLoader
9290
9166
  });
9291
- mainRule.use(CHAIN_ID.USE.STYLE).loader(join(COMPILED_PATH, 'style-loader', 'index.js')).options(styleLoaderOptions);
9167
+ mainRule.use(CHAIN_ID.USE.STYLE).loader(getCompiledPath('style-loader')).options(styleLoaderOptions);
9292
9168
  } else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(core_rspack.CssExtractRspackPlugin.loader).options(config.tools.cssExtract.loaderOptions);
9293
- else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(dirname, 'ignoreCssLoader.mjs'));
9169
+ else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(LOADER_PATH, 'ignoreCssLoader.mjs'));
9294
9170
  let importLoaders = {
9295
9171
  normal: 0,
9296
9172
  inline: 0
9297
9173
  }, updateRules = async (callback, options = {})=>{
9298
9174
  options.skipMain || await callback(mainRule, 'main'), await callback(inlineRule, 'inline'), await callback(urlRule, 'url');
9299
- }, cssLoaderPath = join(COMPILED_PATH, 'css-loader', 'index.js');
9175
+ }, cssLoaderPath = getCompiledPath('css-loader');
9300
9176
  if (await updateRules((rule)=>{
9301
9177
  rule.use(CHAIN_ID.USE.CSS).loader(cssLoaderPath);
9302
9178
  }), !1 !== config.tools.lightningcssLoader) {
@@ -9320,7 +9196,7 @@ try {
9320
9196
  });
9321
9197
  if ('function' == typeof postcssLoaderOptions.postcssOptions || postcssLoaderOptions.postcssOptions?.plugins?.length) {
9322
9198
  emitCss && importLoaders.normal++, importLoaders.inline++;
9323
- let postcssLoaderPath = join(COMPILED_PATH, 'postcss-loader', 'index.js');
9199
+ let postcssLoaderPath = getCompiledPath('postcss-loader');
9324
9200
  await updateRules((rule)=>{
9325
9201
  rule.use(CHAIN_ID.USE.POSTCSS).loader(postcssLoaderPath).options(postcssLoaderOptions);
9326
9202
  }, {
@@ -9433,7 +9309,7 @@ try {
9433
9309
  api.modifyBundlerChain({
9434
9310
  order: 'pre',
9435
9311
  handler: (chain, { CHAIN_ID })=>{
9436
- chain.module.rule(CHAIN_ID.RULE.JS).oneOf(CHAIN_ID.ONE_OF.JS_WORKER).resourceQuery(WORKER_QUERY_REGEX).type("javascript/auto").use(CHAIN_ID.USE.WORKER_QUERY).loader(node_path.join(dirname, 'workerLoader.mjs'));
9312
+ chain.module.rule(CHAIN_ID.RULE.JS).oneOf(CHAIN_ID.ONE_OF.JS_WORKER).resourceQuery(WORKER_QUERY_REGEX).type("javascript/auto").use(CHAIN_ID.USE.WORKER_QUERY).loader(node_path.join(LOADER_PATH, 'workerLoader.mjs'));
9437
9313
  }
9438
9314
  });
9439
9315
  }
@@ -9735,7 +9611,7 @@ try {
9735
9611
  if (!1 === copyOnBuild || !node_fs.existsSync(publicDir)) continue;
9736
9612
  let distPaths = dedupeNestedPaths(Object.values(environments).filter(({ config })=>!0 === copyOnBuild || 'auto' === copyOnBuild && 'node' !== config.output.target).map(({ distPath })=>distPath));
9737
9613
  if (ignore?.length) {
9738
- let { globSync } = await import("./tinyglobby.js"), ignoredSet = new Set(globSync(ignore, {
9614
+ let { globSync } = await getTinyglobby(), ignoredSet = new Set(globSync(ignore, {
9739
9615
  cwd: publicDir,
9740
9616
  absolute: !1,
9741
9617
  dot: !0,
@@ -9774,7 +9650,7 @@ try {
9774
9650
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
9775
9651
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
9776
9652
  if (!1 === manifest) return;
9777
- 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/1f3f562ddb8083fac622ca40ded94ef3b6176a9e92e60794b933efa49d8172b6/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9653
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await getManifestPlugin(), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
9778
9654
  manifestFilenames.set(environment.name, manifestOptions.filename);
9779
9655
  let pluginOptions = {
9780
9656
  fileName: manifestOptions.filename,
@@ -10324,7 +10200,7 @@ let applyServerOptions = (command)=>{
10324
10200
  };
10325
10201
  function setupCommands(argv) {
10326
10202
  let cli = ((name = "")=>new CAC(name))('rsbuild');
10327
- cli.version("2.2.8"), 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)', {
10203
+ cli.version("2.2.10"), 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)', {
10328
10204
  default: 'auto'
10329
10205
  }).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', {
10330
10206
  type: [
@@ -10389,7 +10265,7 @@ function setupCommands(argv) {
10389
10265
  }
10390
10266
  function showGreeting() {
10391
10267
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
10392
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.8\n`);
10268
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.10\n`);
10393
10269
  }
10394
10270
  function setupLogLevel(argv) {
10395
10271
  if (argv.length <= 3) return;
@@ -10411,5 +10287,5 @@ function runCLI({ argv = process.argv } = {}) {
10411
10287
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
10412
10288
  }
10413
10289
  }
10414
- let src_version = "2.2.8";
10415
- 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 };
10290
+ let src_version = "2.2.10";
10291
+ export { 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 };