@rsbuild/core 2.0.0-rc.0 → 2.0.0-rc.2

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 (58) hide show
  1. package/compiled/connect-next/package.json +1 -1
  2. package/compiled/css-loader/index.js +2 -2
  3. package/compiled/html-rspack-plugin/index.js +14 -14
  4. package/compiled/http-proxy-middleware/index.d.ts +180 -386
  5. package/compiled/http-proxy-middleware/package.json +1 -1
  6. package/compiled/postcss/index.js +1 -1
  7. package/compiled/postcss/lib/at-rule.d.ts +0 -1
  8. package/compiled/postcss/lib/comment.d.ts +0 -1
  9. package/compiled/postcss/lib/container.d.ts +1 -6
  10. package/compiled/postcss/lib/css-syntax-error.d.ts +0 -1
  11. package/compiled/postcss/lib/declaration.d.ts +0 -1
  12. package/compiled/postcss/lib/document.d.ts +0 -1
  13. package/compiled/postcss/lib/fromJSON.d.ts +1 -1
  14. package/compiled/postcss/lib/input.d.ts +0 -1
  15. package/compiled/postcss/lib/lazy-result.d.ts +3 -4
  16. package/compiled/postcss/lib/list.d.ts +1 -1
  17. package/compiled/postcss/lib/no-work-result.d.ts +0 -1
  18. package/compiled/postcss/lib/node.d.ts +0 -1
  19. package/compiled/postcss/lib/parse.d.ts +1 -1
  20. package/compiled/postcss/lib/postcss.d.ts +1 -3
  21. package/compiled/postcss/lib/previous-map.d.ts +0 -1
  22. package/compiled/postcss/lib/processor.d.ts +0 -1
  23. package/compiled/postcss/lib/result.d.ts +0 -1
  24. package/compiled/postcss/lib/root.d.ts +0 -1
  25. package/compiled/postcss/lib/rule.d.ts +12 -12
  26. package/compiled/postcss/lib/stringifier.d.ts +0 -1
  27. package/compiled/postcss/lib/stringify.d.ts +1 -1
  28. package/compiled/postcss/lib/warning.d.ts +0 -1
  29. package/compiled/postcss/license +1 -1
  30. package/compiled/postcss/package.json +1 -1
  31. package/compiled/postcss-loader/index.js +6 -6
  32. package/compiled/rspack-chain/package.json +1 -1
  33. package/compiled/rspack-chain/types/index.d.ts +38 -115
  34. package/dist/1~rslib-runtime.js +1 -1
  35. package/dist/{552.js → 753.js} +143 -196
  36. package/dist/client/hmr.js +23 -10
  37. package/dist/connect-next.js +636 -26
  38. package/dist/connect-next.js.LICENSE.txt +14 -1
  39. package/dist/http-proxy-middleware.js +1169 -1226
  40. package/dist/http-proxy-middleware.js.LICENSE.txt +0 -35
  41. package/dist/index.js +1 -1
  42. package/dist/launch-editor-middleware.js +6 -6
  43. package/dist/manifest-plugin.js +8 -8
  44. package/dist/memfs.js +16 -56
  45. package/dist/tinyglobby.js +279 -127
  46. package/dist/ws.js +2 -2
  47. package/dist-types/client/hmr.d.ts +1 -1
  48. package/dist-types/helpers/index.d.ts +1 -1
  49. package/dist-types/helpers/url.d.ts +1 -1
  50. package/dist-types/pluginHelper.d.ts +1 -8
  51. package/dist-types/server/devServer.d.ts +9 -7
  52. package/dist-types/server/socketServer.d.ts +16 -4
  53. package/dist-types/types/config.d.ts +9 -3
  54. package/dist-types/types/rspack.d.ts +1 -1
  55. package/package.json +11 -11
  56. package/dist/debug.js +0 -503
  57. package/dist-types/plugins/esm.d.ts +0 -2
  58. /package/dist/{552.js.LICENSE.txt → 753.js.LICENSE.txt} +0 -0
@@ -1,5 +1,5 @@
1
- /*! LICENSE: 552.js.LICENSE.txt */
2
- let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
1
+ /*! LICENSE: 753.js.LICENSE.txt */
2
+ let flagForceColor, runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
3
3
  import { rspack as core_rspack } from "@rspack/core";
4
4
  import node_util, { stripVTControlCharacters } from "node:util";
5
5
  import node_process from "node:process";
@@ -149,7 +149,7 @@ __webpack_require__.add({
149
149
  };
150
150
  },
151
151
  "../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
152
- let path = __webpack_require__("path?37f5"), fs = __webpack_require__("fs?cdbd"), os = __webpack_require__("os"), url = __webpack_require__("url?5f07"), fsReadFileAsync = fs.promises.readFile;
152
+ let path = __webpack_require__("path?aeb1"), fs = __webpack_require__("fs?8b28"), os = __webpack_require__("os"), url = __webpack_require__("url?b918"), fsReadFileAsync = fs.promises.readFile;
153
153
  function getDefaultSearchPlaces(name, sync) {
154
154
  return [
155
155
  'package.json',
@@ -469,8 +469,8 @@ __webpack_require__.add({
469
469
  return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
470
470
  }
471
471
  },
472
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
473
- let yaml, { resolve } = __webpack_require__("node:path?815c"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
472
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/index.js" (module, __unused_rspack_exports, __webpack_require__) {
473
+ let yaml, { resolve } = __webpack_require__("node:path?435f"), config = __webpack_require__("../../node_modules/.pnpm/lilconfig@3.1.3/node_modules/lilconfig/src/index.js"), loadOptions = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/options.js"), loadPlugins = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js"), req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
474
474
  async function processResult(ctx, result) {
475
475
  let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
476
476
  default: obj
@@ -543,8 +543,8 @@ __webpack_require__.add({
543
543
  });
544
544
  };
545
545
  },
546
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
547
- let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
546
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/options.js" (module, __unused_rspack_exports, __webpack_require__) {
547
+ let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
548
548
  module.exports = async function options(config, file) {
549
549
  if (config.parser && 'string' == typeof config.parser) try {
550
550
  config.parser = await req(config.parser, file);
@@ -564,8 +564,8 @@ __webpack_require__.add({
564
564
  return config;
565
565
  };
566
566
  },
567
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
568
- let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
567
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/plugins.js" (module, __unused_rspack_exports, __webpack_require__) {
568
+ let req = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/req.js");
569
569
  async function load(plugin, options, file) {
570
570
  try {
571
571
  if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
@@ -581,10 +581,10 @@ __webpack_require__.add({
581
581
  }), list;
582
582
  };
583
583
  },
584
- "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
584
+ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/req.js" (module, __unused_rspack_exports, __webpack_require__) {
585
585
  let tsx, jiti;
586
586
  var __filename = __rspack_fileURLToPath(import.meta.url);
587
- let { createRequire } = __webpack_require__("node:module?f56b"), { pathToFileURL } = __webpack_require__("node:url?5295"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
587
+ let { createRequire } = __webpack_require__("node:module?1bcb"), { pathToFileURL } = __webpack_require__("node:url?b4ec"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
588
588
  module.exports = async function req(name, rootFile = __filename) {
589
589
  let url = createRequire(rootFile).resolve(name);
590
590
  try {
@@ -612,9 +612,6 @@ __webpack_require__.add({
612
612
  throw Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.map((error)=>error.message).join('\n')}`);
613
613
  };
614
614
  },
615
- assert (module) {
616
- module.exports = __rspack_createRequire_require("assert");
617
- },
618
615
  async_hooks (module) {
619
616
  module.exports = __rspack_createRequire_require("async_hooks");
620
617
  },
@@ -627,10 +624,7 @@ __webpack_require__.add({
627
624
  crypto (module) {
628
625
  module.exports = __rspack_createRequire_require("crypto");
629
626
  },
630
- events (module) {
631
- module.exports = __rspack_createRequire_require("events");
632
- },
633
- "fs?cdbd" (module) {
627
+ "fs?8b28" (module) {
634
628
  module.exports = __rspack_createRequire_require("fs");
635
629
  },
636
630
  http (module) {
@@ -642,39 +636,36 @@ __webpack_require__.add({
642
636
  net (module) {
643
637
  module.exports = __rspack_createRequire_require("net");
644
638
  },
645
- "node:buffer?4a79" (module) {
639
+ "node:buffer?1cd0" (module) {
646
640
  module.exports = __rspack_createRequire_require("node:buffer");
647
641
  },
648
- "node:events?5dda" (module) {
642
+ "node:events?3ec9" (module) {
649
643
  module.exports = __rspack_createRequire_require("node:events");
650
644
  },
651
- "node:fs?31c0" (module) {
645
+ "node:fs?9592" (module) {
652
646
  module.exports = __rspack_createRequire_require("node:fs");
653
647
  },
654
- "node:module?f56b" (module) {
648
+ "node:module?1bcb" (module) {
655
649
  module.exports = __rspack_createRequire_require("node:module");
656
650
  },
657
- "node:path?815c" (module) {
651
+ "node:path?435f" (module) {
658
652
  module.exports = __rspack_createRequire_require("node:path");
659
653
  },
660
- "node:stream?be04" (module) {
654
+ "node:stream?3c93" (module) {
661
655
  module.exports = __rspack_createRequire_require("node:stream");
662
656
  },
663
- "node:url?5295" (module) {
657
+ "node:url?b4ec" (module) {
664
658
  module.exports = __rspack_createRequire_require("node:url");
665
659
  },
666
660
  os (module) {
667
661
  module.exports = __rspack_createRequire_require("os");
668
662
  },
669
- "path?37f5" (module) {
663
+ "path?aeb1" (module) {
670
664
  module.exports = __rspack_createRequire_require("path");
671
665
  },
672
666
  process (module) {
673
667
  module.exports = __rspack_createRequire_require("process");
674
668
  },
675
- querystring (module) {
676
- module.exports = __rspack_createRequire_require("querystring");
677
- },
678
669
  stream (module) {
679
670
  module.exports = __rspack_createRequire_require("stream");
680
671
  },
@@ -684,7 +675,7 @@ __webpack_require__.add({
684
675
  tty (module) {
685
676
  module.exports = __rspack_createRequire_require("tty");
686
677
  },
687
- "url?5f07" (module) {
678
+ "url?b918" (module) {
688
679
  module.exports = __rspack_createRequire_require("url");
689
680
  },
690
681
  util (module) {
@@ -692,6 +683,9 @@ __webpack_require__.add({
692
683
  },
693
684
  zlib (module) {
694
685
  module.exports = __rspack_createRequire_require("zlib");
686
+ },
687
+ events (module) {
688
+ module.exports = __rspack_createRequire_require("node:events");
695
689
  }
696
690
  }), function checkNodeVersion() {
697
691
  let { versions } = process;
@@ -1420,9 +1414,7 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1420
1414
  }, module.exports = deepmerge;
1421
1415
  },
1422
1416
  "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js" (__unused_rspack_module, exports) {
1423
- Object.defineProperty(exports, "__esModule", {
1424
- value: !0
1425
- }), exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
1417
+ exports.arrayToString = void 0, exports.arrayToString = (array, space, next)=>{
1426
1418
  let values = array.map(function(value, index) {
1427
1419
  let result = next(value, index);
1428
1420
  return void 0 === result ? String(result) : space + result.split("\n").join(`\n${space}`);
@@ -1430,11 +1422,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1430
1422
  return `[${eol}${values}${eol}]`;
1431
1423
  };
1432
1424
  },
1433
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __webpack_require__) {
1434
- Object.defineProperty(exports, "__esModule", {
1435
- value: !0
1436
- }), exports.FunctionParser = exports.dedentFunction = exports.functionToString = exports.USED_METHOD_KEY = void 0;
1437
- let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), METHOD_NAMES_ARE_QUOTED = '"' === ({
1425
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js" (__unused_rspack_module, exports, __nested_rspack_require_5714_5733__) {
1426
+ exports.functionToString = exports.USED_METHOD_KEY = void 0;
1427
+ 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 = '"' === ({
1438
1428
  " " () {}
1439
1429
  })[" "].toString().charAt(0), FUNCTION_PREFIXES = {
1440
1430
  Function: "function ",
@@ -1460,7 +1450,7 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1460
1450
  exports.USED_METHOD_KEY = new WeakSet(), exports.functionToString = (fn, space, next, key)=>{
1461
1451
  let name = "string" == typeof key ? key : void 0;
1462
1452
  return void 0 !== name && exports.USED_METHOD_KEY.add(fn), new FunctionParser(fn, space, next, name).stringify();
1463
- }, exports.dedentFunction = dedentFunction;
1453
+ };
1464
1454
  class FunctionParser {
1465
1455
  constructor(fn, indent, next, key){
1466
1456
  this.fn = fn, this.indent = indent, this.next = next, this.key = key, this.pos = 0, this.hadKeyword = !1, this.fnString = Function.prototype.toString.call(fn), this.fnType = fn.constructor.name, this.keyQuote = void 0 === key ? "" : quote_1.quoteKey(key, next), this.keyPrefix = void 0 === key ? "" : `${this.keyQuote}:${indent ? " " : ""}`, this.isMethodCandidate = void 0 !== key && ("" === this.fn.name || this.fn.name === key);
@@ -1566,11 +1556,12 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1566
1556
  this.consumeMatch(/^(?:\s|\/\/.*|\/\*[^]*?\*\/)*/);
1567
1557
  }
1568
1558
  }
1569
- exports.FunctionParser = FunctionParser;
1570
1559
  },
1571
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __webpack_require__) {
1572
- exports.stringify = void 0;
1573
- let stringify_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js"), quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), ROOT_SENTINEL = Symbol("root");
1560
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/index.js" (__unused_rspack_module, exports, __nested_rspack_require_14714_14733__) {
1561
+ Object.defineProperty(exports, "__esModule", {
1562
+ value: !0
1563
+ }), exports.stringify = void 0;
1564
+ 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");
1574
1565
  function replacerToString(replacer) {
1575
1566
  return replacer ? (value, space, next, key)=>replacer(value, space, (value)=>stringify_1.toString(value, space, next, key), key) : stringify_1.toString;
1576
1567
  }
@@ -1604,14 +1595,12 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1604
1595
  return result;
1605
1596
  };
1606
1597
  },
1607
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __webpack_require__) {
1608
- Object.defineProperty(exports, "__esModule", {
1609
- value: !0
1610
- }), exports.objectToString = void 0;
1611
- let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
1598
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js" (__unused_rspack_module, exports, __nested_rspack_require_18136_18155__) {
1599
+ exports.objectToString = void 0;
1600
+ let quote_1 = __nested_rspack_require_18136_18155__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), function_1 = __nested_rspack_require_18136_18155__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), array_1 = __nested_rspack_require_18136_18155__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/array.js");
1612
1601
  exports.objectToString = (value, space, next, key)=>{
1613
1602
  if ("function" == typeof Buffer && Buffer.isBuffer(value)) return `Buffer.from(${next(value.toString("base64"))}, 'base64')`;
1614
- if ("object" == typeof global && value === global) return globalToString(value, space, next, key);
1603
+ if ("object" == typeof global && value === global) return globalToString(value, space, next);
1615
1604
  let toString = OBJECT_TYPES[Object.prototype.toString.call(value)];
1616
1605
  return toString ? toString(value, space, next, key) : void 0;
1617
1606
  };
@@ -1639,9 +1628,7 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1639
1628
  };
1640
1629
  },
1641
1630
  "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js" (__unused_rspack_module, exports) {
1642
- Object.defineProperty(exports, "__esModule", {
1643
- value: !0
1644
- }), exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.IS_VALID_IDENTIFIER = exports.quoteString = void 0;
1631
+ exports.stringifyPath = exports.quoteKey = exports.isValidVariableName = exports.W = exports.quoteString = void 0;
1645
1632
  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([
1646
1633
  [
1647
1634
  "\b",
@@ -1684,9 +1671,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1684
1671
  };
1685
1672
  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(" "));
1686
1673
  function isValidVariableName(name) {
1687
- return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.IS_VALID_IDENTIFIER.test(name);
1674
+ return "string" == typeof name && !RESERVED_WORDS.has(name) && exports.W.test(name);
1688
1675
  }
1689
- exports.IS_VALID_IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
1676
+ exports.W = /^[A-Za-z_$][A-Za-z0-9_$]*$/, exports.isValidVariableName = isValidVariableName, exports.quoteKey = function quoteKey(key, next) {
1690
1677
  return isValidVariableName(key) ? key : next(key);
1691
1678
  }, exports.stringifyPath = function stringifyPath(path, next) {
1692
1679
  let result = "";
@@ -1694,11 +1681,9 @@ __nested_rspack_require_65__.m = __webpack_modules__, __nested_rspack_require_65
1694
1681
  return result;
1695
1682
  };
1696
1683
  },
1697
- "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __webpack_require__) {
1698
- Object.defineProperty(exports, "__esModule", {
1699
- value: !0
1700
- }), exports.toString = void 0;
1701
- let quote_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __nested_rspack_require_65__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
1684
+ "./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/stringify.js" (__unused_rspack_module, exports, __nested_rspack_require_23555_23574__) {
1685
+ exports.toString = void 0;
1686
+ let quote_1 = __nested_rspack_require_23555_23574__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/quote.js"), object_1 = __nested_rspack_require_23555_23574__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/object.js"), function_1 = __nested_rspack_require_23555_23574__("./node_modules/.pnpm/javascript-stringify@2.1.0/node_modules/javascript-stringify/dist/function.js"), PRIMITIVE_TYPES = {
1702
1687
  string: quote_1.quoteString,
1703
1688
  number: (value)=>Object.is(value, -0) ? "-0" : String(value),
1704
1689
  boolean: String,
@@ -1988,69 +1973,32 @@ let ChainedMap = createMap(createChainable(Object)), ChainedValueMap = (superCla
1988
1973
  }
1989
1974
  }, DevServer = class extends ChainedMap {
1990
1975
  constructor(parent){
1991
- super(parent), this.allowedHosts = new ChainedSet(this), this.extend([
1992
- 'after',
1993
- 'before',
1994
- 'bonjour',
1995
- 'clientLogLevel',
1976
+ super(parent), this.extend([
1977
+ 'allowedHosts',
1978
+ 'app',
1979
+ 'client',
1996
1980
  'compress',
1997
- 'contentBase',
1998
- 'contentBasePublicPath',
1999
- 'disableHostCheck',
2000
- 'filename',
1981
+ 'devMiddleware',
2001
1982
  'headers',
2002
- 'historyApiFallback',
2003
1983
  'host',
1984
+ 'historyApiFallback',
2004
1985
  'hot',
2005
- 'hotOnly',
2006
- 'http2',
2007
- 'https',
2008
- 'index',
2009
- 'injectClient',
2010
- 'injectHot',
2011
- 'inline',
2012
- 'lazy',
1986
+ 'ipc',
2013
1987
  'liveReload',
2014
- 'mimeTypes',
2015
- 'noInfo',
2016
1988
  'onListening',
2017
1989
  'open',
2018
- 'openPage',
2019
- 'overlay',
2020
- 'pfx',
2021
- 'pfxPassphrase',
2022
1990
  'port',
2023
1991
  'proxy',
2024
- 'progress',
2025
- 'public',
2026
- 'publicPath',
2027
- 'quiet',
2028
- 'serveIndex',
2029
- 'setup',
2030
- 'socket',
2031
- 'sockHost',
2032
- 'sockPath',
2033
- 'sockPort',
2034
- 'staticOptions',
2035
- 'stats',
2036
- 'stdin',
2037
- 'transportMode',
2038
- 'useLocalIp',
2039
- 'watchContentBase',
2040
- 'watchOptions',
2041
- 'writeToDisk'
1992
+ 'server',
1993
+ 'setupExitSignals',
1994
+ 'setupMiddlewares',
1995
+ 'static',
1996
+ 'watchFiles',
1997
+ 'webSocketServer'
2042
1998
  ]);
2043
1999
  }
2044
2000
  toConfig() {
2045
- return this.clean({
2046
- allowedHosts: this.allowedHosts.values(),
2047
- ...this.entries() || {}
2048
- });
2049
- }
2050
- merge(obj, omit = []) {
2051
- return !omit.includes('allowedHosts') && 'allowedHosts' in obj && this.allowedHosts.merge(obj.allowedHosts), super.merge(obj, [
2052
- 'allowedHosts'
2053
- ]);
2001
+ return this.clean(this.entries() || {});
2054
2002
  }
2055
2003
  }, Orderable = (Class)=>class extends Class {
2056
2004
  before(name) {
@@ -2272,7 +2220,7 @@ let Rule = Orderable(class extends ChainedMap {
2272
2220
  ]);
2273
2221
  }
2274
2222
  minimizer(name) {
2275
- if (Array.isArray(name)) throw Error("optimization.minimizer() no longer supports being passed an array. Either switch to the new syntax (https://github.com/neutrinojs/webpack-chain#config-optimization-minimizers-adding) or downgrade to webpack-chain 4. If using Vue this likely means a Vue plugin has not yet been updated to support Vue CLI 4+.");
2223
+ if (Array.isArray(name)) throw Error('optimization.minimizer() no longer supports being passed an array.');
2276
2224
  return this.minimizers.getOrCompute(name, ()=>new src_Plugin(this, name, 'optimization.minimizer'));
2277
2225
  }
2278
2226
  toConfig() {
@@ -2298,7 +2246,8 @@ let Rule = Orderable(class extends ChainedMap {
2298
2246
  }
2299
2247
  }, 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 : [
2300
2248
  value
2301
- ], dist_src = class extends ChainedMap {
2249
+ ];
2250
+ class RspackChain extends ChainedMap {
2302
2251
  constructor(){
2303
2252
  super(), this.entryPoints = new ChainedMap(this), this.output = new Output(this), this.module = new dist_Module(this), this.resolve = new Resolve(this), this.resolveLoader = new ResolveLoader(this), this.optimization = new Optimization(this), this.plugins = new ChainedMap(this), this.devServer = new DevServer(this), this.performance = new Performance(this), this.node = new ChainedValueMap(this), this.extend([
2304
2253
  'context',
@@ -2406,7 +2355,8 @@ let Rule = Orderable(class extends ChainedMap {
2406
2355
  'plugin'
2407
2356
  ]);
2408
2357
  }
2409
- }, vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), cjs_0 = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
2358
+ }
2359
+ let vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), cjs_0 = __webpack_require__("../../node_modules/.pnpm/deepmerge@4.3.1/node_modules/deepmerge/dist/cjs.js");
2410
2360
  var cjs_0_default = __webpack_require__.n(cjs_0);
2411
2361
  let setNodeEnv = (env)=>{
2412
2362
  process.env.NODE_ENV = env;
@@ -3087,7 +3037,7 @@ let OVERRIDE_PATHS = new Set([
3087
3037
  define: {},
3088
3038
  preEntry: [],
3089
3039
  decorators: {
3090
- version: '2022-03'
3040
+ version: '2023-11'
3091
3041
  }
3092
3042
  },
3093
3043
  output: {
@@ -3602,7 +3552,7 @@ function createPublicContext(context) {
3602
3552
  async function createContext(options, userConfig, logger) {
3603
3553
  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;
3604
3554
  return {
3605
- version: "2.0.0-rc.0",
3555
+ version: "2.0.0-rc.2",
3606
3556
  rootPath,
3607
3557
  distPath: '',
3608
3558
  cachePath,
@@ -3664,7 +3614,7 @@ async function emitConfigFiles({ bundlerConfigs, environmentConfigs, extraConfig
3664
3614
  logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
3665
3615
  }
3666
3616
  function stringifyConfig(config, verbose) {
3667
- return dist_src.toString(config, {
3617
+ return RspackChain.toString(config, {
3668
3618
  verbose
3669
3619
  });
3670
3620
  }
@@ -3733,12 +3683,20 @@ function reduceConfigsWithContext({ initial, config, ctx, mergeFn = Object.assig
3733
3683
  }), initial) : config ?? initial;
3734
3684
  }
3735
3685
  async function reduceConfigsAsyncWithContext({ initial, config, ctx, mergeFn = Object.assign }) {
3736
- return null == config ? initial : dist_isPlainObject(config) ? dist_isPlainObject(initial) ? mergeFn(initial, config) : config : 'function' == typeof config ? await config(initial, ctx) ?? initial : Array.isArray(config) ? config.reduce((initial, config)=>reduceConfigsWithContext({
3737
- initial,
3738
- config,
3686
+ if (null == config) return initial;
3687
+ if (dist_isPlainObject(config)) return dist_isPlainObject(initial) ? mergeFn(initial, config) : config;
3688
+ if ('function' == typeof config) return await config(initial, ctx) ?? initial;
3689
+ if (Array.isArray(config)) {
3690
+ let result = initial;
3691
+ for (let item of config)result = await reduceConfigsAsyncWithContext({
3692
+ initial: result,
3693
+ config: item,
3739
3694
  ctx,
3740
3695
  mergeFn
3741
- }), initial) : config ?? initial;
3696
+ });
3697
+ return result;
3698
+ }
3699
+ return config ?? initial;
3742
3700
  }
3743
3701
  function reduceConfigsMergeContext({ initial, config, ctx, mergeFn = Object.assign }) {
3744
3702
  return null == config ? initial : dist_isPlainObject(config) ? dist_isPlainObject(initial) ? mergeFn(initial, config) : config : 'function' == typeof config ? config({
@@ -3753,7 +3711,7 @@ function reduceConfigsMergeContext({ initial, config, ctx, mergeFn = Object.assi
3753
3711
  }
3754
3712
  async function modifyBundlerChain(context, utils) {
3755
3713
  context.logger.debug('applying modifyBundlerChain hook');
3756
- let rspackChain = new dist_src(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
3714
+ let rspackChain = new RspackChain(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
3757
3715
  environment: utils.environment.name,
3758
3716
  args: [
3759
3717
  rspackChain,
@@ -4485,7 +4443,7 @@ function parseMinifyOptions(config) {
4485
4443
  cssOptions: minify.cssOptions
4486
4444
  };
4487
4445
  }
4488
- let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.8_yaml@2.8.2/node_modules/postcss-load-config/src/index.js");
4446
+ let postcss_load_config_src = __webpack_require__("../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.9_yaml@2.8.2/node_modules/postcss-load-config/src/index.js");
4489
4447
  var postcss_load_config_src_default = __webpack_require__.n(postcss_load_config_src);
4490
4448
  function getLightningCSSLoaderOptions(config, targets, minify) {
4491
4449
  let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
@@ -4737,7 +4695,7 @@ async function printFileSizes(options, stats, rootPath, distPath, environmentNam
4737
4695
  if (showDetail) {
4738
4696
  let maxFileLength = Math.max(...assets.map((asset)=>asset.filenameLength), showTotal ? totalSizeTitle.length : 0, fileHeader.length), maxSizeLength = Math.max(...assets.map((a)=>a.sizeLabelLength), totalSizeLabelLength), showGzipHeader = !!(options.compressed && assets.some((item)=>null !== item.gzippedSize));
4739
4697
  for (let asset of (logs.push(getHeader(maxFileLength, maxSizeLength, fileHeader, showGzipHeader)), assets)){
4740
- let { sizeLabel, sizeLabelLength, gzipSizeLabel } = asset, { filenameLength } = asset, { filenameLabel } = asset;
4698
+ let { sizeLabel, filenameLabel } = asset, { sizeLabelLength, gzipSizeLabel, filenameLength } = asset;
4741
4699
  sizeLabelLength < maxSizeLength && (sizeLabel += ' '.repeat(maxSizeLength - sizeLabelLength)), filenameLength < maxFileLength && (filenameLabel += ' '.repeat(maxFileLength - filenameLength));
4742
4700
  let log = `${filenameLabel} ${sizeLabel}`;
4743
4701
  gzipSizeLabel && (log += ` ${gzipSizeLabel}`), logs.push(log);
@@ -6157,6 +6115,7 @@ init(
6157
6115
  ${JSON.stringify(clientConfig)},
6158
6116
  ${JSON.stringify(resolvedHost)},
6159
6117
  ${resolvedPort},
6118
+ ${JSON.stringify(config.server.base)},
6160
6119
  ${liveReloadEnabled},
6161
6120
  ${!!config.dev.browserLogs},
6162
6121
  ${JSON.stringify(config.dev.client.logLevel)}
@@ -6186,8 +6145,8 @@ let assets_middleware_assetsMiddleware = async ({ config, compiler, context, soc
6186
6145
  })(compiler)) return;
6187
6146
  let errorsCount = null, warningsCount = null;
6188
6147
  compiler.hooks.invalid.tap('rsbuild-dev-server', (fileName)=>{
6189
- errorsCount = null, warningsCount = null, 'string' == typeof fileName && fileName.endsWith('.html') && normalizeLiveReload(liveReload).html && socketServer.sockWrite({
6190
- type: 'static-changed'
6148
+ errorsCount = null, warningsCount = null, 'string' == typeof fileName && fileName.endsWith('.html') && normalizeLiveReload(liveReload).html && socketServer.sendMessage({
6149
+ type: 'full-reload'
6191
6150
  }, token);
6192
6151
  }), compiler.hooks.done.tap('rsbuild-dev-server', (stats)=>{
6193
6152
  let { errors, warnings } = stats.compilation;
@@ -6518,7 +6477,7 @@ class SocketServer {
6518
6477
  }
6519
6478
  sendError(errors, token) {
6520
6479
  let { rootPath } = this.context, formattedErrors = errors.map((item)=>formatStatsError(item, rootPath, 'error', this.context.logger)), html = formattedErrors.map((error)=>convertLinksInHtml(ansiHTML(escapeHtml(error)), rootPath)).join('\n\n').trim();
6521
- this.sockWrite({
6480
+ this.sendMessage({
6522
6481
  type: 'errors',
6523
6482
  data: {
6524
6483
  text: formattedErrors,
@@ -6528,16 +6487,16 @@ class SocketServer {
6528
6487
  }
6529
6488
  sendWarning(warnings, token) {
6530
6489
  let formattedWarnings = warnings.map((item)=>formatStatsError(item, this.context.rootPath, 'warning', this.context.logger));
6531
- this.sockWrite({
6490
+ this.sendMessage({
6532
6491
  type: 'warnings',
6533
6492
  data: {
6534
6493
  text: formattedWarnings
6535
6494
  }
6536
6495
  }, token);
6537
6496
  }
6538
- sockWrite(message, token) {
6497
+ sendMessage(message, token) {
6539
6498
  let messageStr = JSON.stringify(message), sendToSockets = (sockets)=>{
6540
- for (let socket of sockets)this.send(socket, messageStr);
6499
+ for (let socket of sockets)this.sendRawMessage(socket, messageStr);
6541
6500
  };
6542
6501
  if (token) {
6543
6502
  let sockets = this.socketsMap.get(token);
@@ -6569,7 +6528,7 @@ class SocketServer {
6569
6528
  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);
6570
6529
  if (this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), this.context.logger.error(`${color.cyan('[browser]')} ${log}`)), 'object' == typeof client.overlay && client.overlay.runtime) {
6571
6530
  let resolvedLog = 'full' === stackTrace ? log : await formatBrowserErrorLog(payload.message, context, outputFs, 'full', stackFrames, cachedTraceMap);
6572
- this.sockWrite({
6531
+ this.sendMessage({
6573
6532
  type: 'resolved-client-error',
6574
6533
  data: {
6575
6534
  id: payload.id,
@@ -6626,24 +6585,24 @@ class SocketServer {
6626
6585
  let result = this.getStats(token);
6627
6586
  if (!result) return null;
6628
6587
  let { stats, errors, warnings } = result, newInitialChunks = this.getInitialChunks(stats), initialChunks = this.initialChunksMap.get(token), shouldReload = stats.entrypoints && initialChunks && !isEqualSet(initialChunks, newInitialChunks);
6629
- if (this.initialChunksMap.set(token, newInitialChunks), shouldReload) return void this.sockWrite({
6630
- type: 'static-changed'
6588
+ if (this.initialChunksMap.set(token, newInitialChunks), shouldReload) return void this.sendMessage({
6589
+ type: 'full-reload'
6631
6590
  }, token);
6632
6591
  if (stats.hash) {
6633
6592
  let prevHash = this.currentHash.get(token);
6634
- if (this.currentHash.set(token, stats.hash), !force && 0 === errors.length && 0 === warnings.length && prevHash === stats.hash) return void this.sockWrite({
6593
+ if (this.currentHash.set(token, stats.hash), !force && 0 === errors.length && 0 === warnings.length && prevHash === stats.hash) return void this.sendMessage({
6635
6594
  type: 'ok'
6636
6595
  }, token);
6637
- this.sockWrite({
6596
+ this.sendMessage({
6638
6597
  type: 'hash',
6639
6598
  data: stats.hash
6640
6599
  }, token);
6641
6600
  }
6642
- errors.length > 0 ? this.sendError(errors, token) : warnings.length > 0 ? this.sendWarning(warnings, token) : this.sockWrite({
6601
+ errors.length > 0 ? this.sendError(errors, token) : warnings.length > 0 ? this.sendWarning(warnings, token) : this.sendMessage({
6643
6602
  type: 'ok'
6644
6603
  }, token);
6645
6604
  }
6646
- send(socket, message) {
6605
+ sendRawMessage(socket, message) {
6647
6606
  socket.readyState === socket.OPEN && socket.send(message);
6648
6607
  }
6649
6608
  }
@@ -6907,7 +6866,7 @@ function formatProxyOptions(proxyOptions, logger) {
6907
6866
  }));
6908
6867
  }
6909
6868
  async function createProxyMiddleware(proxyOptions, logger) {
6910
- let formattedOptions = formatProxyOptions(proxyOptions, logger), proxyMiddlewares = [], middlewares = [], { createProxyMiddleware: baseMiddleware } = await import("./http-proxy-middleware.js").then(__webpack_require__.t.bind(__webpack_require__, "../../node_modules/.pnpm/http-proxy-middleware@3.0.5_supports-color@10.2.2/node_modules/http-proxy-middleware/dist/index.js", 23));
6869
+ let formattedOptions = formatProxyOptions(proxyOptions, logger), proxyMiddlewares = [], middlewares = [], { createProxyMiddleware: baseMiddleware } = await import("./http-proxy-middleware.js");
6911
6870
  for (let opts of formattedOptions){
6912
6871
  let proxyMiddleware = baseMiddleware(opts), middleware = async (req, res, next)=>{
6913
6872
  let bypassUrl = 'function' == typeof opts.bypass ? await opts.bypass(req, res, opts) : null;
@@ -7354,10 +7313,6 @@ let runner_run = async ({ bundlePath, ...runnerFactoryOptions })=>{
7354
7313
  };
7355
7314
  }, createHttpServer = async ({ serverConfig, middlewares })=>{
7356
7315
  if (serverConfig.https) {
7357
- if (serverConfig.proxy) {
7358
- let { createServer } = await import("node:https");
7359
- return createServer(serverConfig.https, middlewares);
7360
- }
7361
7316
  let { createSecureServer } = await import("node:http2");
7362
7317
  return createSecureServer({
7363
7318
  allowHTTP1: !0,
@@ -7431,13 +7386,13 @@ async function startWatchFiles({ paths, options, type = 'reload-page' }, buildMa
7431
7386
  if ('reload-page' !== type) return;
7432
7387
  let watcher = await createChokidar(paths, root, options);
7433
7388
  return watcher.on('change', ()=>{
7434
- buildManager.socketServer.sockWrite({
7435
- type: 'static-changed'
7389
+ buildManager.socketServer.sendMessage({
7390
+ type: 'full-reload'
7436
7391
  });
7437
7392
  }), watcher;
7438
7393
  }
7439
7394
  async function devServer_createDevServer(options, createCompiler, config, { getPortSilently, runCompile = !0 } = {}) {
7440
- let lastStats, fileWatcher, devMiddlewares, buildManager, { context } = options, { logger } = context;
7395
+ let lastStats, { context } = options, { logger } = context;
7441
7396
  logger.debug('create dev server');
7442
7397
  let { port, portTip } = await resolvePort(config), { middlewareMode, host } = config.server, isHttps = !!config.server.https, routes = getRoutes(context);
7443
7398
  context.devServer = {
@@ -7491,10 +7446,10 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7491
7446
  protocol,
7492
7447
  clearCache: !0,
7493
7448
  logger
7494
- }), cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closingPromise = null, closeServer = async ()=>(closingPromise || (closingPromise = (async ()=>{
7449
+ }), state = {}, cleanupGracefulShutdown = middlewareMode ? null : setupGracefulShutdown(), closingPromise = null, closeServer = async ()=>(closingPromise || (closingPromise = (async ()=>{
7495
7450
  removeCleanup(closeServer), cleanupGracefulShutdown?.(), await context.hooks.onCloseDevServer.callBatch(), await Promise.all([
7496
- devMiddlewares?.close(),
7497
- fileWatcher?.close()
7451
+ state.devMiddlewares?.close(),
7452
+ state.fileWatcher?.close()
7498
7453
  ]);
7499
7454
  })()), closingPromise);
7500
7455
  middlewareMode || registerCleanup(closeServer);
@@ -7520,25 +7475,31 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7520
7475
  if (!htmlPath) throw Error(`${color.dim('[rsbuild:getTransformedHtml]')} Failed to get HTML file by entryName: ${color.yellow(entryName)}`);
7521
7476
  let fileName = join(distPath, htmlPath);
7522
7477
  return utils.readFileSync(fileName);
7523
- })(entryName, utils)), environmentAPI = {}, getErrorMsg = (method)=>`${color.dim('[rsbuild:server]')} Can not call ${color.yellow(method)} when ${color.yellow('runCompile')} is false`;
7478
+ })(entryName, utils)), environmentAPI = {}, createHotSend = (token)=>(type, data)=>state.buildManager?.socketServer.sendMessage({
7479
+ type,
7480
+ data
7481
+ }, token), getErrorMsg = (method)=>`${color.dim('[rsbuild:server]')} Can not call ${color.yellow(method)} when ${color.yellow('runCompile')} is false`;
7524
7482
  context.environmentList.forEach((environment, index)=>{
7525
7483
  environmentAPI[environment.name] = {
7526
7484
  context: environment,
7485
+ hot: {
7486
+ send: createHotSend(environment.webSocketToken)
7487
+ },
7527
7488
  getStats: async ()=>{
7528
- if (!buildManager) throw Error(getErrorMsg('getStats'));
7489
+ if (!state.buildManager) throw Error(getErrorMsg('getStats'));
7529
7490
  return await waitLastCompileDone, lastStats[index];
7530
7491
  },
7531
7492
  loadBundle: async (entryName)=>{
7532
- if (!buildManager) throw Error(getErrorMsg('loadBundle'));
7493
+ if (!state.buildManager) throw Error(getErrorMsg('loadBundle'));
7533
7494
  return await waitLastCompileDone, cacheableLoadBundle(lastStats[index], entryName, {
7534
- readFileSync: buildManager.readFileSync,
7495
+ readFileSync: state.buildManager.readFileSync,
7535
7496
  environment
7536
7497
  });
7537
7498
  },
7538
7499
  getTransformedHtml: async (entryName)=>{
7539
- if (!buildManager) throw Error(getErrorMsg('getTransformedHtml'));
7500
+ if (!state.buildManager) throw Error(getErrorMsg('getTransformedHtml'));
7540
7501
  return await waitLastCompileDone, cacheableTransformedHtml(lastStats[index], entryName, {
7541
- readFileSync: buildManager.readFileSync,
7502
+ readFileSync: state.buildManager.readFileSync,
7542
7503
  environment
7543
7504
  });
7544
7505
  }
@@ -7552,10 +7513,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7552
7513
  middlewares,
7553
7514
  environments: environmentAPI,
7554
7515
  httpServer,
7555
- sockWrite: (type, data)=>buildManager?.socketServer.sockWrite({
7556
- type,
7557
- data
7558
- }),
7516
+ sockWrite: createHotSend(),
7559
7517
  listen: async ()=>{
7560
7518
  if (!httpServer) throw Error(`${color.dim('[rsbuild:server]')} Can not listen dev server as ${color.yellow('server.middlewareMode')} is enabled.`);
7561
7519
  let serverTerminator = getServerTerminator(httpServer);
@@ -7565,7 +7523,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7565
7523
  port
7566
7524
  }, async (err)=>{
7567
7525
  if (err) throw err;
7568
- middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), logger.debug('listen dev server done'), await devServer.afterListen(), onBeforeRestartServer(devServer.close), resolve({
7526
+ middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), state.devMiddlewares && httpServer.on('upgrade', state.devMiddlewares.onUpgrade), logger.debug('listen dev server done'), await devServer.afterListen(), onBeforeRestartServer(devServer.close), resolve({
7569
7527
  port,
7570
7528
  urls: urls.map((item)=>item.url),
7571
7529
  server: devServer
@@ -7581,7 +7539,7 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7581
7539
  });
7582
7540
  },
7583
7541
  connectWebSocket: ({ server })=>{
7584
- devMiddlewares && server.on('upgrade', devMiddlewares.onUpgrade);
7542
+ state.devMiddlewares && server.on('upgrade', state.devMiddlewares.onUpgrade);
7585
7543
  },
7586
7544
  close: closeServer,
7587
7545
  printUrls,
@@ -7597,17 +7555,17 @@ async function devServer_createDevServer(options, createCompiler, config, { getP
7597
7555
  })).filter((item)=>'function' == typeof item),
7598
7556
  ...setupPostCallbacks
7599
7557
  ];
7600
- return runCompile ? context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : await beforeCreateCompiler(), buildManager = runCompile ? await startCompile() : void 0, fileWatcher = await setupWatchFiles({
7558
+ return runCompile ? context.hooks.onBeforeCreateCompiler.tap(beforeCreateCompiler) : await beforeCreateCompiler(), state.buildManager = runCompile ? await startCompile() : void 0, state.fileWatcher = await setupWatchFiles({
7601
7559
  config,
7602
- buildManager,
7560
+ buildManager: state.buildManager,
7603
7561
  root: context.rootPath
7604
- }), devMiddlewares = await getDevMiddlewares({
7605
- buildManager,
7562
+ }), state.devMiddlewares = await getDevMiddlewares({
7563
+ buildManager: state.buildManager,
7606
7564
  config,
7607
7565
  devServer,
7608
7566
  context,
7609
7567
  postCallbacks
7610
- }), buildManager?.watch(), logger.debug('create dev server done'), devServer;
7568
+ }), state.buildManager?.watch(), logger.debug('create dev server done'), devServer;
7611
7569
  }
7612
7570
  async function startPreviewServer(context, config, { getPortSilently } = {}) {
7613
7571
  let { logger } = context, { connect } = await import("./connect-next.js"), middlewares = connect(), { port, portTip } = await resolvePort(config), serverConfig = config.server, { host, headers, proxy, historyApiFallback, compress, base, cors } = serverConfig, protocol = serverConfig.https ? 'https' : 'http', routes = getRoutes(context), urls = await getAddressUrls({
@@ -7862,25 +7820,29 @@ function applyDefaultPlugins(pluginManager, context) {
7862
7820
  {
7863
7821
  name: 'rsbuild:output',
7864
7822
  setup (api) {
7865
- api.modifyBundlerChain((chain, { CHAIN_ID, isDev, isProd, isServer, environment, rspack })=>{
7823
+ api.modifyBundlerChain((chain, { CHAIN_ID, isDev, isProd, isServer, environment, rspack, target })=>{
7866
7824
  var jsAsync;
7867
7825
  let { distPath, config } = environment, publicPath = getPublicPath({
7868
7826
  config,
7869
7827
  isDev,
7870
7828
  context: api.context
7871
7829
  }), jsPath = config.output.distPath.js, jsAsyncPath = void 0 !== (jsAsync = config.output.distPath.jsAsync) ? jsAsync : isServer ? jsPath : jsPath ? `${jsPath}/async` : 'async', jsFilename = getFilename(config, 'js', isProd, isServer), isJsFilenameFn = 'function' == typeof jsFilename;
7872
- if (chain.output.path(distPath).filename(isJsFilenameFn ? (...args)=>{
7830
+ chain.output.path(distPath).filename(isJsFilenameFn ? (...args)=>{
7873
7831
  let name = jsFilename(...args);
7874
7832
  return posix.join(jsPath, name);
7875
7833
  } : posix.join(jsPath, jsFilename)).chunkFilename(isJsFilenameFn ? (...args)=>{
7876
7834
  let name = jsFilename(...args);
7877
7835
  return posix.join(jsAsyncPath, name);
7878
- } : posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath).bundlerInfo({
7879
- force: !1
7880
- }), isServer && chain.output.library({
7881
- type: 'commonjs2',
7882
- ...chain.output.get('library') || {}
7883
- }), config.output.copy) {
7836
+ } : posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath);
7837
+ let isESM = config.output.module;
7838
+ if (isServer && chain.output.library({
7839
+ ...chain.output.get('library') || {},
7840
+ type: isESM ? 'module' : 'commonjs2'
7841
+ }), isESM) {
7842
+ if ('web-worker' === target) throw Error('[rsbuild:config] `output.module: true` is not supported for web-worker target.');
7843
+ chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
7844
+ }
7845
+ if (config.output.copy) {
7884
7846
  let { copy } = config.output, options = Array.isArray(copy) ? {
7885
7847
  patterns: copy
7886
7848
  } : copy;
@@ -8331,7 +8293,7 @@ try {
8331
8293
  config: config.tools.styleLoader
8332
8294
  });
8333
8295
  mainRule.use(CHAIN_ID.USE.STYLE).loader(join(COMPILED_PATH, 'style-loader', 'index.js')).options(styleLoaderOptions);
8334
- } else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader((cssExtractPlugin || core_rspack.CssExtractRspackPlugin).loader).options(config.tools.cssExtract.loaderOptions);
8296
+ } else mainRule.use(CHAIN_ID.USE.MINI_CSS_EXTRACT).loader(core_rspack.CssExtractRspackPlugin.loader).options(config.tools.cssExtract.loaderOptions);
8335
8297
  else mainRule.use(CHAIN_ID.USE.IGNORE_CSS).loader(node_path.join(dirname, 'ignoreCssLoader.mjs'));
8336
8298
  let importLoaders = {
8337
8299
  normal: 0,
@@ -8419,7 +8381,7 @@ try {
8419
8381
  let isStringExport = 'string' === cssLoaderOptions.exportType;
8420
8382
  if (isStringExport && mainRule.uses.has(CHAIN_ID.USE.MINI_CSS_EXTRACT) && mainRule.uses.delete(CHAIN_ID.USE.MINI_CSS_EXTRACT), emitCss && !config.output.injectStyles && !isStringExport) {
8421
8383
  let extractPluginOptions = config.tools.cssExtract.pluginOptions, cssPath = config.output.distPath.css, cssFilename = getFilename(config, 'css', isProd), isCssFilenameFn = 'function' == typeof cssFilename, cssAsyncPath = config.output.distPath.cssAsync ?? (cssPath ? `${cssPath}/async` : 'async');
8422
- chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(cssExtractPlugin || core_rspack.CssExtractRspackPlugin, [
8384
+ chain.plugin(CHAIN_ID.PLUGIN.MINI_CSS_EXTRACT).use(core_rspack.CssExtractRspackPlugin, [
8423
8385
  {
8424
8386
  filename: isCssFilenameFn ? (...args)=>{
8425
8387
  let name = cssFilename(...args);
@@ -8531,21 +8493,6 @@ try {
8531
8493
  });
8532
8494
  }
8533
8495
  },
8534
- {
8535
- name: 'rsbuild:esm',
8536
- setup (api) {
8537
- api.modifyBundlerChain((chain, { environment, target })=>{
8538
- let { config } = environment;
8539
- if (config.output.module) {
8540
- if ('node' === target && chain.output.library({
8541
- ...chain.output.get('library'),
8542
- type: 'module'
8543
- }), 'web-worker' === target) throw Error('[rsbuild:config] `output.module` is not supported for web-worker target.');
8544
- chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import');
8545
- }
8546
- });
8547
- }
8548
- },
8549
8496
  pluginExternals(),
8550
8497
  {
8551
8498
  name: 'rsbuild:split-chunks',
@@ -8812,7 +8759,7 @@ try {
8812
8759
  api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, isDev })=>{
8813
8760
  let { output: { manifest }, dev: { writeToDisk } } = environment.config;
8814
8761
  if (!1 === manifest) return;
8815
- let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-rc.0_@emnapi+core@1.8.1_@emnapi+runtime_36ca8bbe9cc8ea53288c7dff23b25fc0/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8762
+ let manifestOptions = normalizeManifestObjectConfig(manifest), { RspackManifestPlugin } = await import("./manifest-plugin.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/rspack-manifest-plugin@5.2.1_@rspack+core@2.0.0-rc.1/node_modules/rspack-manifest-plugin/dist/index.js")), { htmlPaths } = environment, filter = manifestOptions.filter ?? ((file)=>!file.name.endsWith('.LICENSE.txt'));
8816
8763
  manifestFilenames.set(environment.name, manifestOptions.filename);
8817
8764
  let pluginOptions = {
8818
8765
  fileName: manifestOptions.filename,
@@ -9156,12 +9103,12 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9156
9103
  throw Error(`${color.dim('[rsbuild:loadConfig]')} Cannot find config file: ${color.dim(customConfigPath)}`);
9157
9104
  }
9158
9105
  for (let file of [
9159
- 'rsbuild.config.mjs',
9160
9106
  'rsbuild.config.ts',
9161
9107
  'rsbuild.config.js',
9162
- 'rsbuild.config.cjs',
9163
9108
  'rsbuild.config.mts',
9164
- 'rsbuild.config.cts'
9109
+ 'rsbuild.config.mjs',
9110
+ 'rsbuild.config.cts',
9111
+ 'rsbuild.config.cjs'
9165
9112
  ]){
9166
9113
  let configFile = join(root, file);
9167
9114
  if (node_fs.existsSync(configFile)) return configFile;
@@ -9326,7 +9273,7 @@ let applyServerOptions = (command)=>{
9326
9273
  };
9327
9274
  function setupCommands() {
9328
9275
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9329
- cli.version("2.0.0-rc.0"), 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)', {
9276
+ cli.version("2.0.0-rc.2"), 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)', {
9330
9277
  default: 'auto'
9331
9278
  }).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', {
9332
9279
  type: [
@@ -9403,7 +9350,7 @@ function initNodeEnv() {
9403
9350
  }
9404
9351
  function showGreeting() {
9405
9352
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9406
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-rc.0\n`);
9353
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.0-rc.2\n`);
9407
9354
  }
9408
9355
  function setupLogLevel() {
9409
9356
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9424,5 +9371,5 @@ function runCLI() {
9424
9371
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
9425
9372
  }
9426
9373
  }
9427
- let src_version = "2.0.0-rc.0";
9374
+ let src_version = "2.0.0-rc.2";
9428
9375
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };