@rsbuild/core 1.6.8 → 1.6.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.
@@ -1,19 +1,19 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 5422: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 6927: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(8644);
5
+ const loader = __nccwpck_require__(3697);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(6733).defaultGetLocalIdent;
8
+ __nccwpck_require__(5148).defaultGetLocalIdent;
9
9
  },
10
- 8644: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 3697: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(1259));
15
- var _plugins = __nccwpck_require__(6747);
16
- var _utils = __nccwpck_require__(6733);
15
+ var _plugins = __nccwpck_require__(1934);
16
+ var _utils = __nccwpck_require__(5148);
17
17
  function _interopRequireDefault(obj) {
18
18
  return obj && obj.__esModule ? obj : { default: obj };
19
19
  }
@@ -236,7 +236,7 @@
236
236
  callback(null, `${importCode}${moduleCode}${exportCode}`);
237
237
  }
238
238
  },
239
- 6747: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 1934: (__unused_webpack_module, exports, __nccwpck_require__) => {
240
240
  "use strict";
241
241
  Object.defineProperty(exports, "__esModule", { value: true });
242
242
  Object.defineProperty(exports, "icssParser", {
@@ -258,22 +258,22 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(7024),
261
+ __nccwpck_require__(2533),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(6373),
264
+ __nccwpck_require__(6852),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(52));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(2867));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 6373: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 6852: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
272
  "use strict";
273
273
  Object.defineProperty(exports, "__esModule", { value: true });
274
274
  exports["default"] = void 0;
275
275
  var _icssUtils = __nccwpck_require__(229);
276
- var _utils = __nccwpck_require__(6733);
276
+ var _utils = __nccwpck_require__(5148);
277
277
  const plugin = (options = {}) => ({
278
278
  postcssPlugin: "postcss-icss-parser",
279
279
  async OnceExit(root) {
@@ -372,14 +372,14 @@
372
372
  plugin.postcss = true;
373
373
  var _default = (exports["default"] = plugin);
374
374
  },
375
- 7024: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 2533: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
376
  "use strict";
377
377
  Object.defineProperty(exports, "__esModule", { value: true });
378
378
  exports["default"] = void 0;
379
379
  var _postcssValueParser = _interopRequireDefault(
380
380
  __nccwpck_require__(5245),
381
381
  );
382
- var _utils = __nccwpck_require__(6733);
382
+ var _utils = __nccwpck_require__(5148);
383
383
  function _interopRequireDefault(obj) {
384
384
  return obj && obj.__esModule ? obj : { default: obj };
385
385
  }
@@ -684,14 +684,14 @@
684
684
  plugin.postcss = true;
685
685
  var _default = (exports["default"] = plugin);
686
686
  },
687
- 52: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 2867: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
688
  "use strict";
689
689
  Object.defineProperty(exports, "__esModule", { value: true });
690
690
  exports["default"] = void 0;
691
691
  var _postcssValueParser = _interopRequireDefault(
692
692
  __nccwpck_require__(5245),
693
693
  );
694
- var _utils = __nccwpck_require__(6733);
694
+ var _utils = __nccwpck_require__(5148);
695
695
  function _interopRequireDefault(obj) {
696
696
  return obj && obj.__esModule ? obj : { default: obj };
697
697
  }
@@ -1034,7 +1034,7 @@
1034
1034
  plugin.postcss = true;
1035
1035
  var _default = (exports["default"] = plugin);
1036
1036
  },
1037
- 6733: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 5148: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1038
  "use strict";
1039
1039
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1040
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -8098,6 +8098,6 @@
8098
8098
  }
8099
8099
  if (typeof __nccwpck_require__ !== "undefined")
8100
8100
  __nccwpck_require__.ab = __dirname + "/";
8101
- var __webpack_exports__ = __nccwpck_require__(5422);
8101
+ var __webpack_exports__ = __nccwpck_require__(6927);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 301: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 376: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(398);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(893);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -311,7 +311,7 @@
311
311
  }
312
312
  module.exports = { CachedChildCompilation };
313
313
  },
314
- 398: (module) => {
314
+ 893: (module) => {
315
315
  "use strict";
316
316
  class HtmlWebpackChildCompiler {
317
317
  constructor(templates) {
@@ -480,7 +480,7 @@
480
480
  }
481
481
  module.exports = { HtmlWebpackChildCompiler };
482
482
  },
483
- 534: (module) => {
483
+ 139: (module) => {
484
484
  "use strict";
485
485
  module.exports = {};
486
486
  module.exports.none = (chunks) => chunks;
@@ -499,7 +499,7 @@
499
499
  };
500
500
  module.exports.auto = module.exports.none;
501
501
  },
502
- 609: (module) => {
502
+ 334: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -520,7 +520,7 @@
520
520
  };
521
521
  };
522
522
  },
523
- 536: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 917: (module, __unused_webpack_exports, __nccwpck_require__) => {
524
524
  "use strict";
525
525
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
526
526
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -546,7 +546,7 @@
546
546
  }
547
547
  module.exports = { getHtmlRspackPluginHooks };
548
548
  },
549
- 317: (module) => {
549
+ 684: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 472: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 737: (module, __unused_webpack_exports, __nccwpck_require__) => {
618
618
  "use strict";
619
619
  const promisify = __nccwpck_require__(23).promisify;
620
620
  const vm = __nccwpck_require__(154);
621
621
  const fs = __nccwpck_require__(896);
622
622
  const path = __nccwpck_require__(928);
623
- const { CachedChildCompilation } = __nccwpck_require__(301);
623
+ const { CachedChildCompilation } = __nccwpck_require__(376);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(317);
626
- const prettyError = __nccwpck_require__(609);
627
- const chunkSorter = __nccwpck_require__(534);
625
+ __nccwpck_require__(684);
626
+ const prettyError = __nccwpck_require__(334);
627
+ const chunkSorter = __nccwpck_require__(139);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(536).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(917).getHtmlRspackPluginHooks;
630
630
  const WITH_PLACEHOLDER = "function __with_placeholder__";
631
631
  class HtmlRspackPlugin {
632
632
  constructor(userOptions = {}) {
@@ -1597,6 +1597,6 @@
1597
1597
  }
1598
1598
  if (typeof __nccwpck_require__ !== "undefined")
1599
1599
  __nccwpck_require__.ab = __dirname + "/";
1600
- var __webpack_exports__ = __nccwpck_require__(472);
1600
+ var __webpack_exports__ = __nccwpck_require__(737);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 867: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(45)["default"];
4
+ 371: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(53)["default"];
6
6
  },
7
- 45: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 53: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _nodePath = _interopRequireDefault(__nccwpck_require__(760));
12
- var _utils = __nccwpck_require__(496);
12
+ var _utils = __nccwpck_require__(544);
13
13
  function _interopRequireDefault(e) {
14
14
  return e && e.__esModule ? e : { default: e };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 496: (module, exports, __nccwpck_require__) => {
182
+ 544: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -715,6 +715,6 @@
715
715
  })();
716
716
  if (typeof __nccwpck_require__ !== "undefined")
717
717
  __nccwpck_require__.ab = __dirname + "/";
718
- var __webpack_exports__ = __nccwpck_require__(867);
718
+ var __webpack_exports__ = __nccwpck_require__(371);
719
719
  module.exports = __webpack_exports__;
720
720
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 336: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 999: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
7
7
  exports.reduceChunk =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 185: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 178: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const node_fs_1 = __nccwpck_require__(24);
131
131
  const node_path_1 = __nccwpck_require__(760);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(336);
133
+ const helpers_1 = __nccwpck_require__(999);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -327,7 +327,7 @@
327
327
  exports.getCompilerHooks =
328
328
  void 0;
329
329
  const node_path_1 = __nccwpck_require__(760);
330
- const hooks_1 = __nccwpck_require__(185);
330
+ const hooks_1 = __nccwpck_require__(178);
331
331
  Object.defineProperty(exports, "getCompilerHooks", {
332
332
  enumerable: true,
333
333
  get: function () {
package/dist/0~open.js CHANGED
@@ -3,7 +3,7 @@ import { __webpack_require__ } from "./rslib-runtime.js";
3
3
  import node_child_process, { execFile } from "node:child_process";
4
4
  import promises, { constants } from "node:fs/promises";
5
5
  import { Buffer } from "node:buffer";
6
- import { node_fs, node_process, node_os, external_node_util_promisify } from "./506.js";
6
+ import { node_fs, node_process, node_os, external_node_util_promisify } from "./131.js";
7
7
  function hasDockerEnv() {
8
8
  try {
9
9
  return node_fs.statSync('/.dockerenv'), !0;
@@ -1,12 +1,13 @@
1
- /*! For license information please see 506.js.LICENSE.txt */
2
- let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin, hmrClientPath, overlayClientPath;
3
- let __WEBPACK_EXTERNAL_createRequire_require = __WEBPACK_EXTERNAL_createRequire(import.meta.url);
4
- import * as __WEBPACK_EXTERNAL_MODULE_async_hooks__ from "async_hooks";
5
- import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
6
- import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
7
- import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
8
- import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
9
- import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
1
+ /*! For license information please see 131.js.LICENSE.txt */
2
+ "use strict";
3
+ let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
4
+ let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
+ import * as __rspack_external_async_hooks from "async_hooks";
6
+ import * as __rspack_external_fs from "fs";
7
+ import * as __rspack_external_node_path_c5b9b54f from "node:path";
8
+ import * as __rspack_external_os from "os";
9
+ import * as __rspack_external_path from "path";
10
+ import * as __rspack_external_url from "url";
10
11
  import { __webpack_require__ } from "./rslib-runtime.js";
11
12
  import { EventEmitter } from "events";
12
13
  import node_fs, { existsSync } from "node:fs";
@@ -663,9 +664,9 @@ __webpack_require__.add({
663
664
  return path.dirname(p) || path.sep;
664
665
  }
665
666
  let jsonLoader = (_, content)=>JSON.parse(content), defaultLoadersSync = Object.freeze({
666
- '.js': __WEBPACK_EXTERNAL_createRequire_require,
667
- '.json': __WEBPACK_EXTERNAL_createRequire_require,
668
- '.cjs': __WEBPACK_EXTERNAL_createRequire_require,
667
+ '.js': __rspack_createRequire_require,
668
+ '.json': __rspack_createRequire_require,
669
+ '.cjs': __rspack_createRequire_require,
669
670
  noExt: jsonLoader
670
671
  });
671
672
  module.exports.defaultLoadersSync = defaultLoadersSync;
@@ -675,7 +676,7 @@ __webpack_require__.add({
675
676
  return (await import(fileUrl)).default;
676
677
  } catch (e) {
677
678
  try {
678
- return __WEBPACK_EXTERNAL_createRequire_require(id);
679
+ return __rspack_createRequire_require(id);
679
680
  } catch (requireE) {
680
681
  if ('ERR_REQUIRE_ESM' === requireE.code || requireE instanceof SyntaxError && requireE.toString().includes('Cannot use import statement outside a module')) throw e;
681
682
  throw requireE;
@@ -1587,28 +1588,28 @@ __webpack_require__.add({
1587
1588
  };
1588
1589
  },
1589
1590
  async_hooks: function(module) {
1590
- module.exports = __WEBPACK_EXTERNAL_MODULE_async_hooks__;
1591
+ module.exports = __rspack_external_async_hooks;
1591
1592
  },
1592
1593
  fs: function(module) {
1593
- module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
1594
+ module.exports = __rspack_external_fs;
1594
1595
  },
1595
1596
  "node:module": function(module) {
1596
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
1597
+ module.exports = __rspack_external_node_module_ab9f2194;
1597
1598
  },
1598
1599
  "node:path": function(module) {
1599
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
1600
+ module.exports = __rspack_external_node_path_c5b9b54f;
1600
1601
  },
1601
1602
  "node:url": function(module) {
1602
- module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
1603
+ module.exports = __rspack_external_node_url_e96de089;
1603
1604
  },
1604
1605
  os: function(module) {
1605
- module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
1606
+ module.exports = __rspack_external_os;
1606
1607
  },
1607
1608
  path: function(module) {
1608
- module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
1609
+ module.exports = __rspack_external_path;
1609
1610
  },
1610
1611
  url: function(module) {
1611
- module.exports = __WEBPACK_EXTERNAL_MODULE_url__;
1612
+ module.exports = __rspack_external_url;
1612
1613
  }
1613
1614
  });
1614
1615
  var superClass, superClass1, provider_helpers_namespaceObject = {};
@@ -2775,7 +2776,7 @@ function partition(array, predicate) {
2775
2776
  falsy
2776
2777
  ];
2777
2778
  }
2778
- let upperFirst = (str)=>str ? str.charAt(0).toUpperCase() + str.slice(1) : '', createVirtualModule = (content)=>`data:text/javascript,${content}`;
2779
+ let upperFirst = (str)=>str ? str.charAt(0).toUpperCase() + str.slice(1) : '', createVirtualModule = (content)=>`data:text/javascript,${encodeURIComponent(content)}`;
2779
2780
  function isWebTarget(target) {
2780
2781
  let targets = helpers_castArray(target);
2781
2782
  return targets.includes('web') || targets.includes('web-worker');
@@ -4083,7 +4084,7 @@ function createPublicContext(context) {
4083
4084
  async function createContext(options, userConfig) {
4084
4085
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
4085
4086
  return {
4086
- version: "1.6.8",
4087
+ version: "1.6.10",
4087
4088
  rootPath,
4088
4089
  distPath: '',
4089
4090
  cachePath,
@@ -4566,11 +4567,12 @@ async function initConfigs({ context, pluginManager, rsbuildOptions }) {
4566
4567
  let normalizedConfig = await initRsbuildConfig({
4567
4568
  context,
4568
4569
  pluginManager
4569
- }), rspackConfigs = await Promise.all(Object.entries(normalizedConfig.environments).map(([environmentName, config])=>generateRspackConfig({
4570
- target: config.output.target,
4571
- context,
4572
- environmentName
4573
- })));
4570
+ }), rspackConfigs = [];
4571
+ for (let [environmentName, config] of Object.entries(normalizedConfig.environments))rspackConfigs.push(await generateRspackConfig({
4572
+ target: config.output.target,
4573
+ context,
4574
+ environmentName
4575
+ }));
4574
4576
  if (isDebug()) {
4575
4577
  let inspect = async ()=>{
4576
4578
  await inspectConfig_inspectConfig({
@@ -4618,9 +4620,9 @@ function printBuildLog(compiler, context, lazyModules) {
4618
4620
  }
4619
4621
  let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
4620
4622
  if (removedFiles?.length) {
4623
+ if (removedFiles.every((item)=>item.includes('virtual'))) return void logger.start(`building ${color.dim('virtual modules')}`);
4621
4624
  let fileInfo = formatFileList(removedFiles, context.rootPath);
4622
- logger.start(`building ${color.dim(`removed ${fileInfo}`)}`);
4623
- return;
4625
+ return void logger.start(`building ${color.dim(`removed ${fileInfo}`)}`);
4624
4626
  }
4625
4627
  logger.start('build started...');
4626
4628
  }
@@ -6405,30 +6407,29 @@ function setupWriteToDisk(compilers, writeToDisk) {
6405
6407
  }), compiler.__hasRsbuildAssetEmittedCallback = !0);
6406
6408
  });
6407
6409
  }
6408
- let noop = ()=>{}, assets_middleware_require = (0, external_node_module_.createRequire)(import.meta.url);
6409
- function getClientPaths(devConfig) {
6410
- let clientPaths = [];
6411
- return (devConfig.hmr || devConfig.liveReload) && (hmrClientPath || (hmrClientPath = assets_middleware_require.resolve('@rsbuild/core/client/hmr')), clientPaths.push(hmrClientPath), devConfig.client?.overlay && (overlayClientPath || (overlayClientPath = assets_middleware_require.resolve('@rsbuild/core/client/overlay')), clientPaths.push(overlayClientPath))), clientPaths;
6412
- }
6413
- let isTsError = (error)=>'message' in error && error.stack?.includes('ts-checker-rspack-plugin');
6410
+ let noop = ()=>{}, isTsError = (error)=>'message' in error && error.stack?.includes('ts-checker-rspack-plugin');
6414
6411
  function applyHMREntry({ config, compiler, token, resolvedHost, resolvedPort }) {
6415
6412
  if (!((compiler)=>{
6416
6413
  let { target } = compiler.options;
6417
6414
  return !!target && (Array.isArray(target) ? target.includes('web') : 'web' === target);
6418
- })(compiler)) return;
6419
- let clientPaths = getClientPaths(config.dev);
6420
- if (!clientPaths.length) return;
6415
+ })(compiler) || !config.dev.hmr && !config.dev.liveReload) return;
6421
6416
  let clientConfig = {
6422
6417
  ...config.dev.client
6423
6418
  };
6424
- for (let clientPath of ('<port>' === clientConfig.port && (clientConfig.port = resolvedPort), new compiler.webpack.DefinePlugin({
6425
- RSBUILD_WEB_SOCKET_TOKEN: JSON.stringify(token),
6426
- RSBUILD_CLIENT_CONFIG: JSON.stringify(clientConfig),
6427
- RSBUILD_SERVER_HOST: JSON.stringify(resolvedHost),
6428
- RSBUILD_SERVER_PORT: JSON.stringify(resolvedPort),
6429
- RSBUILD_DEV_LIVE_RELOAD: config.dev.liveReload,
6430
- RSBUILD_DEV_BROWSER_LOGS: config.dev.browserLogs
6431
- }).apply(compiler), clientPaths))new compiler.webpack.EntryPlugin(compiler.context, clientPath, {
6419
+ '<port>' === clientConfig.port && (clientConfig.port = resolvedPort);
6420
+ let hmrEntry = `import { init } from '@rsbuild/core/client/hmr';
6421
+ ${config.dev.client.overlay ? "import '@rsbuild/core/client/overlay';" : ''}
6422
+
6423
+ init({
6424
+ token: '${token}',
6425
+ config: ${JSON.stringify(clientConfig)},
6426
+ serverHost: ${JSON.stringify(resolvedHost)},
6427
+ serverPort: ${resolvedPort},
6428
+ liveReload: ${config.dev.liveReload},
6429
+ browserLogs: ${!!config.dev.browserLogs}
6430
+ });
6431
+ `;
6432
+ new compiler.webpack.EntryPlugin(compiler.context, createVirtualModule(hmrEntry), {
6432
6433
  name: void 0
6433
6434
  }).apply(compiler);
6434
6435
  }
@@ -6700,13 +6701,18 @@ function ansiHTML(text) {
6700
6701
  return ansiCodes.length > 0 && (ret += Array(ansiCodes.length + 1).join('</span>')), ret;
6701
6702
  }
6702
6703
  function convertLinksInHtml(text, root) {
6703
- let pathRegex = /(?:\.\.?[/\\]|[a-zA-Z]:\\|\/)[^:]*:\d+:\d+/g, urlRegex = /(https?:\/\/(?:[\w-]+\.)+[a-z0-9](?:[\w-.~:/?#[\]@!$&'*+,;=])*)/gi;
6704
+ let PATH_RE = /(?:\.\.?[/\\]|(file:\/\/\/)?[a-zA-Z]:\\|(file:\/\/)?\/)[^:]*:\d+:\d+/g, URL_RE = /(https?:\/\/(?:[\w-]+\.)+[a-z0-9](?:[\w-.~:/?#[\]@!$&'*+,;=])*)/gi, NODE_INTERNAL_RE = /node:internal[/\\]/, FILE_URI_WINDOWS_RE = /^file:\/\/\/([A-Za-z]:)/, FILE_URI_UNIX_RE = /^file:\/\//;
6704
6705
  return text.split('\n').map((line)=>{
6705
- let replacedLine = line.replace(pathRegex, (file)=>{
6706
- let hasClosingSpan = file.includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = external_node_path_.default.isAbsolute(filePath), absolutePath = root && !isAbsolute ? external_node_path_.default.join(root, filePath) : filePath, relativePath = root && isAbsolute ? toRelativePath(root, filePath) : filePath;
6706
+ if (NODE_INTERNAL_RE.test(line)) return line;
6707
+ let replacedLine = line.replace(PATH_RE, (file)=>{
6708
+ let hasClosingSpan = (file = ((file)=>{
6709
+ if (!file.startsWith('file://')) return file;
6710
+ let windows = file.replace(FILE_URI_WINDOWS_RE, '$1');
6711
+ return windows !== file ? windows : file.replace(FILE_URI_UNIX_RE, '');
6712
+ })(file)).includes('</span>') && !file.includes('<span'), filePath = hasClosingSpan ? file.replace('</span>', '') : file, isAbsolute = external_node_path_.default.isAbsolute(filePath), absolutePath = root && !isAbsolute ? external_node_path_.default.join(root, filePath) : filePath, relativePath = root && isAbsolute ? toRelativePath(root, filePath) : filePath;
6707
6713
  return `<a class="file-link" data-file="${absolutePath}">${relativePath}</a>${hasClosingSpan ? '</span>' : ''}`;
6708
6714
  });
6709
- return replacedLine.replace(urlRegex, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
6715
+ return replacedLine.replace(URL_RE, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
6710
6716
  }).join('\n');
6711
6717
  }
6712
6718
  function genOverlayHTML(errors, root) {
@@ -6755,7 +6761,8 @@ function genOverlayHTML(errors, root) {
6755
6761
  margin: 0;
6756
6762
  font-size: 14px;
6757
6763
  font-family: inherit;
6758
- overflow-x: scroll;
6764
+ white-space: pre-wrap;
6765
+ word-break: break-all;
6759
6766
  scrollbar-width: none;
6760
6767
  }
6761
6768
  .content::-webkit-scrollbar {
@@ -7123,7 +7130,10 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
7123
7130
  }
7124
7131
  };
7125
7132
  res.writeHead = (status, reason, headers)=>{
7126
- if (reason) for (let [key, value] of Object.entries(headers || reason))res.setHeader(key, value);
7133
+ if ('string' == typeof reason) {
7134
+ if (headers) for (let [key, value] of Object.entries(headers))res.setHeader(key, value);
7135
+ res.statusMessage = reason;
7136
+ } else if (reason) for (let [key, value] of Object.entries(reason))void 0 !== value && res.setHeader(key, value);
7127
7137
  return writeHeadStatus = status, res;
7128
7138
  }, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip ? gzip.end(...args) : end.apply(res, args)), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on(type, listener) : listeners.push([
7129
7139
  type,
@@ -7578,7 +7588,7 @@ function prepareWatchOptions(paths, options = {}, type) {
7578
7588
  type
7579
7589
  };
7580
7590
  }
7581
- let GLOB_REGEX = /[*?{}[\]()!@+|]/;
7591
+ let GLOB_REGEX = /[*?{}[\]()!+|]/;
7582
7592
  async function createChokidar(pathOrGlobs, root, options) {
7583
7593
  let chokidar = requireCompiledPackage('chokidar'), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
7584
7594
  if (globPatterns.length) {
@@ -9708,7 +9718,7 @@ let applyServerOptions = (command)=>{
9708
9718
  };
9709
9719
  function setupCommands() {
9710
9720
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9711
- cli.version("1.6.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)', {
9721
+ cli.version("1.6.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)', {
9712
9722
  default: 'auto'
9713
9723
  }).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', {
9714
9724
  type: [
@@ -9777,7 +9787,7 @@ function initNodeEnv() {
9777
9787
  }
9778
9788
  function showGreeting() {
9779
9789
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9780
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.8\n`);
9790
+ logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.10\n`);
9781
9791
  }
9782
9792
  function setupLogLevel() {
9783
9793
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9798,9 +9808,9 @@ function runCLI() {
9798
9808
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9799
9809
  }
9800
9810
  }
9801
- let src_version = "1.6.8";
9802
- import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
9803
- import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "node:module";
9804
- import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
9811
+ let src_version = "1.6.10";
9812
+ import * as __rspack_external_node_module_ab9f2194 from "node:module";
9813
+ import { createRequire as __rspack_createRequire } from "node:module";
9814
+ import * as __rspack_external_node_url_e96de089 from "node:url";
9805
9815
  import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
9806
9816
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, external_node_util_promisify, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, node_fs, node_os, node_process, rspack_rspack as rspack, runCLI, src_version as version };
package/dist/136.mjs ADDED
@@ -0,0 +1,42 @@
1
+ import { createRequire } from "node:module";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ let constants_dirname = dirname(fileURLToPath(import.meta.url));
5
+ process.platform, join(constants_dirname), join(constants_dirname, '../static');
6
+ let COMPILED_PATH = join(constants_dirname, '../compiled'), vendors_require = createRequire(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`);
7
+ requireCompiledPackage('picocolors');
8
+ let transformLoader = async function transform(source, map) {
9
+ let callback = this.async(), bypass = ()=>{
10
+ callback(null, source, map);
11
+ }, { id: transformId, getEnvironment } = this.getOptions();
12
+ if (!transformId) return void bypass();
13
+ let transform = this._compiler?.__rsbuildTransformer?.[transformId];
14
+ if (!transform) return void bypass();
15
+ try {
16
+ var generatedSourceMap;
17
+ let result = await transform({
18
+ code: source,
19
+ context: this.context,
20
+ resource: this.resource,
21
+ resourcePath: this.resourcePath,
22
+ resourceQuery: this.resourceQuery,
23
+ environment: getEnvironment(),
24
+ addDependency: this.addDependency.bind(this),
25
+ addMissingDependency: this.addMissingDependency.bind(this),
26
+ addContextDependency: this.addContextDependency.bind(this),
27
+ emitFile: this.emitFile.bind(this),
28
+ importModule: this.importModule.bind(this),
29
+ resolve: this.resolve.bind(this)
30
+ });
31
+ if (null == result) return void bypass();
32
+ if ('string' == typeof result || Buffer.isBuffer(result)) return void callback(null, result, map);
33
+ let mergedMap = (generatedSourceMap = result.map, map && generatedSourceMap ? requireCompiledPackage('@jridgewell/remapping')([
34
+ generatedSourceMap,
35
+ map
36
+ ], ()=>null) : generatedSourceMap ?? map);
37
+ callback(null, result.code, mergedMap);
38
+ } catch (error) {
39
+ error instanceof Error ? callback(error) : callback(Error(String(error)));
40
+ }
41
+ };
42
+ export default transformLoader;