@rsbuild/core 1.4.4 → 1.4.6

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
- 6768: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 5067: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(3806);
5
+ const loader = __nccwpck_require__(7733);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(7455).defaultGetLocalIdent;
8
+ __nccwpck_require__(8320).defaultGetLocalIdent;
9
9
  },
10
- 3806: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 7733: (__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__(9409));
15
- var _plugins = __nccwpck_require__(469);
16
- var _utils = __nccwpck_require__(7455);
15
+ var _plugins = __nccwpck_require__(6154);
16
+ var _utils = __nccwpck_require__(8320);
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
- 469: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 6154: (__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,20 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(7494),
261
+ __nccwpck_require__(3353),
262
262
  );
263
- var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(1159),
265
- );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(834));
263
+ var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(400));
264
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(343));
267
265
  function _interopRequireDefault(obj) {
268
266
  return obj && obj.__esModule ? obj : { default: obj };
269
267
  }
270
268
  },
271
- 1159: (__unused_webpack_module, exports, __nccwpck_require__) => {
269
+ 400: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
270
  "use strict";
273
271
  Object.defineProperty(exports, "__esModule", { value: true });
274
272
  exports["default"] = void 0;
275
273
  var _icssUtils = __nccwpck_require__(9028);
276
- var _utils = __nccwpck_require__(7455);
274
+ var _utils = __nccwpck_require__(8320);
277
275
  const plugin = (options = {}) => ({
278
276
  postcssPlugin: "postcss-icss-parser",
279
277
  async OnceExit(root) {
@@ -372,14 +370,14 @@
372
370
  plugin.postcss = true;
373
371
  var _default = (exports["default"] = plugin);
374
372
  },
375
- 7494: (__unused_webpack_module, exports, __nccwpck_require__) => {
373
+ 3353: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
374
  "use strict";
377
375
  Object.defineProperty(exports, "__esModule", { value: true });
378
376
  exports["default"] = void 0;
379
377
  var _postcssValueParser = _interopRequireDefault(
380
378
  __nccwpck_require__(2948),
381
379
  );
382
- var _utils = __nccwpck_require__(7455);
380
+ var _utils = __nccwpck_require__(8320);
383
381
  function _interopRequireDefault(obj) {
384
382
  return obj && obj.__esModule ? obj : { default: obj };
385
383
  }
@@ -684,14 +682,14 @@
684
682
  plugin.postcss = true;
685
683
  var _default = (exports["default"] = plugin);
686
684
  },
687
- 834: (__unused_webpack_module, exports, __nccwpck_require__) => {
685
+ 343: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
686
  "use strict";
689
687
  Object.defineProperty(exports, "__esModule", { value: true });
690
688
  exports["default"] = void 0;
691
689
  var _postcssValueParser = _interopRequireDefault(
692
690
  __nccwpck_require__(2948),
693
691
  );
694
- var _utils = __nccwpck_require__(7455);
692
+ var _utils = __nccwpck_require__(8320);
695
693
  function _interopRequireDefault(obj) {
696
694
  return obj && obj.__esModule ? obj : { default: obj };
697
695
  }
@@ -1034,7 +1032,7 @@
1034
1032
  plugin.postcss = true;
1035
1033
  var _default = (exports["default"] = plugin);
1036
1034
  },
1037
- 7455: (__unused_webpack_module, exports, __nccwpck_require__) => {
1035
+ 8320: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1036
  "use strict";
1039
1037
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1038
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -8098,6 +8096,6 @@
8098
8096
  }
8099
8097
  if (typeof __nccwpck_require__ !== "undefined")
8100
8098
  __nccwpck_require__.ab = __dirname + "/";
8101
- var __webpack_exports__ = __nccwpck_require__(6768);
8099
+ var __webpack_exports__ = __nccwpck_require__(5067);
8102
8100
  module.exports = __webpack_exports__;
8103
8101
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 26: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 822: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(955);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(431);
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
- 955: (module) => {
314
+ 431: (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
- 281: (module) => {
483
+ 293: (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
- 24: (module) => {
502
+ 124: (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
- 87: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 827: (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
- 334: (module) => {
549
+ 218: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 647: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 43: (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__(26);
623
+ const { CachedChildCompilation } = __nccwpck_require__(822);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(334);
626
- const prettyError = __nccwpck_require__(24);
627
- const chunkSorter = __nccwpck_require__(281);
625
+ __nccwpck_require__(218);
626
+ const prettyError = __nccwpck_require__(124);
627
+ const chunkSorter = __nccwpck_require__(293);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(87).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(827).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__(647);
1600
+ var __webpack_exports__ = __nccwpck_require__(43);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 435: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(421)["default"];
4
+ 64: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(638)["default"];
6
6
  },
7
- 421: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 638: (__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 _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(768);
12
+ var _utils = __nccwpck_require__(887);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 768: (module, exports, __nccwpck_require__) => {
182
+ 887: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(435);
719
+ var __webpack_exports__ = __nccwpck_require__(64);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 438: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 642: (__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
- 823: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 531: (__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 fs_1 = __nccwpck_require__(896);
131
131
  const path_1 = __nccwpck_require__(928);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(438);
133
+ const helpers_1 = __nccwpck_require__(642);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(928);
315
- const hooks_1 = __nccwpck_require__(823);
315
+ const hooks_1 = __nccwpck_require__(531);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -1274,8 +1274,10 @@ for(var __webpack_i__ in (()=>{
1274
1274
  return `${format(seconds.toFixed(digits))} s`;
1275
1275
  }
1276
1276
  if (seconds < 60) return `${format(seconds.toFixed(1))} s`;
1277
- let minutes = seconds / 60;
1278
- return `${format(minutes.toFixed(2))} m`;
1277
+ let minutes = Math.floor(seconds / 60), minutesLabel = `${format(minutes.toFixed(0))} m`, remainingSeconds = seconds % 60;
1278
+ if (0 === remainingSeconds) return minutesLabel;
1279
+ let secondsLabel = `${format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)))} s`;
1280
+ return `${minutesLabel} ${secondsLabel}`;
1279
1281
  }, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI, addCompilationError = (compilation, message)=>{
1280
1282
  compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
1281
1283
  };
@@ -2248,7 +2250,7 @@ ${section.body}` : section.body).join("\n\n"));
2248
2250
  async function createContext(options, userConfig) {
2249
2251
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2250
2252
  return {
2251
- version: "1.4.4",
2253
+ version: "1.4.6",
2252
2254
  rootPath,
2253
2255
  distPath: '',
2254
2256
  cachePath,
@@ -2824,7 +2826,7 @@ ${section.body}` : section.body).join("\n\n"));
2824
2826
  }
2825
2827
  index_js_namespaceObject.logger.start('build started...');
2826
2828
  }(compiler, context), isCompiling = !0;
2827
- }), 'build' === context.action && compiler.hooks.run.tap('rsbuild:run', ()=>{
2829
+ }), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap('rsbuild:run', ()=>{
2828
2830
  index_js_namespaceObject.logger.info('build started...'), logRspackVersion();
2829
2831
  }), compiler.hooks.done.tap('rsbuild:done', (stats)=>{
2830
2832
  ((stats)=>{
@@ -3581,7 +3583,7 @@ ${section.body}` : section.body).join("\n\n"));
3581
3583
  if (mountPoint) return mountPoint;
3582
3584
  let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
3583
3585
  try {
3584
- await promises_namespaceObject.access(configFilePath, promises_namespaceObject.constants.F_OK), isConfigFileExists = !0;
3586
+ await promises_namespaceObject.access(configFilePath, external_node_fs_namespaceObject.constants.F_OK), isConfigFileExists = !0;
3585
3587
  } catch {}
3586
3588
  if (!isConfigFileExists) return defaultMountPoint;
3587
3589
  let configContent = await promises_namespaceObject.readFile(configFilePath, {
@@ -3676,7 +3678,7 @@ ${section.body}` : section.body).join("\n\n"));
3676
3678
  else {
3677
3679
  let isBundled = !open_dirname || '/' === open_dirname, exeLocalXdgOpen = !1;
3678
3680
  try {
3679
- await promises_namespaceObject.access(localXdgOpenPath, promises_namespaceObject.constants.X_OK), exeLocalXdgOpen = !0;
3681
+ await promises_namespaceObject.access(localXdgOpenPath, external_node_fs_namespaceObject.constants.X_OK), exeLocalXdgOpen = !0;
3680
3682
  } catch {}
3681
3683
  command = external_node_process_namespaceObject.versions.electron ?? ('android' === platform || isBundled || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
3682
3684
  }
@@ -3835,8 +3837,8 @@ ${section.body}` : section.body).join("\n\n"));
3835
3837
  return isIPv6(host) ? '::' === host ? '[::1]' : `[${host}]` : host;
3836
3838
  }, concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getUrlLabel = (url)=>{
3837
3839
  try {
3838
- let { host } = new URL(url);
3839
- return isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL;
3840
+ let { hostname } = new URL(url);
3841
+ return isLoopbackHost(hostname) ? LOCAL_LABEL : NETWORK_LABEL;
3840
3842
  } catch {
3841
3843
  return NETWORK_LABEL;
3842
3844
  }
@@ -7862,11 +7864,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7862
7864
  ].includes(level) && (index_js_namespaceObject.logger.level = level);
7863
7865
  }
7864
7866
  let { npm_execpath } = process.env;
7865
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.4\n`);
7867
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.6\n`);
7866
7868
  try {
7867
7869
  !function() {
7868
7870
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7869
- cli.help(), cli.version("1.4.4"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7871
+ cli.help(), cli.version("1.4.6"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7870
7872
  default: 'jiti'
7871
7873
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7872
7874
  type: [
@@ -7924,7 +7926,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7924
7926
  index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
7925
7927
  }
7926
7928
  }
7927
- let src_version = "1.4.4";
7929
+ let src_version = "1.4.6";
7928
7930
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7929
7931
  "PLUGIN_CSS_NAME",
7930
7932
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { logger } from "../compiled/rslog/index.js";
5
5
  import node_path, { dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, sep } from "node:path";
6
6
  import { URL as external_node_url_URL, fileURLToPath, pathToFileURL } from "node:url";
7
7
  import picocolors from "../compiled/picocolors/index.js";
8
- import node_fs, { existsSync } from "node:fs";
8
+ import node_fs, { constants as external_node_fs_constants, existsSync } from "node:fs";
9
9
  import { EventEmitter } from "events";
10
10
  import { createRequire } from "node:module";
11
11
  import node_os, { constants as external_node_os_constants } from "node:os";
@@ -17,7 +17,7 @@ import { lookup } from "../compiled/mrmime/index.js";
17
17
  import node_zlib from "node:zlib";
18
18
  import { Buffer as external_node_buffer_Buffer } from "node:buffer";
19
19
  import node_child_process, { execFile } from "node:child_process";
20
- import promises, { constants as promises_constants } from "node:fs/promises";
20
+ import promises from "node:fs/promises";
21
21
  var EsmMode, __webpack_modules__ = {
22
22
  "../../node_modules/.pnpm/clone-deep@4.0.1/node_modules/clone-deep/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
23
23
  let clone = __webpack_require__("../../node_modules/.pnpm/shallow-clone@3.0.1/node_modules/shallow-clone/index.js"), typeOf = __webpack_require__("../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"), isPlainObject = __webpack_require__("../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js");
@@ -1096,8 +1096,10 @@ let prettyTime = (seconds)=>{
1096
1096
  return `${format(seconds.toFixed(digits))} s`;
1097
1097
  }
1098
1098
  if (seconds < 60) return `${format(seconds.toFixed(1))} s`;
1099
- let minutes = seconds / 60;
1100
- return `${format(minutes.toFixed(2))} m`;
1099
+ let minutes = Math.floor(seconds / 60), minutesLabel = `${format(minutes.toFixed(0))} m`, remainingSeconds = seconds % 60;
1100
+ if (0 === remainingSeconds) return minutesLabel;
1101
+ let secondsLabel = `${format(remainingSeconds.toFixed(+(remainingSeconds % 1 != 0)))} s`;
1102
+ return `${minutesLabel} ${secondsLabel}`;
1101
1103
  }, isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI, addCompilationError = (compilation, message)=>{
1102
1104
  compilation.errors.push(new compilation.compiler.webpack.WebpackError(message));
1103
1105
  };
@@ -2063,7 +2065,7 @@ async function updateEnvironmentContext(context, configs) {
2063
2065
  async function createContext(options, userConfig) {
2064
2066
  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, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2065
2067
  return {
2066
- version: "1.4.4",
2068
+ version: "1.4.6",
2067
2069
  rootPath,
2068
2070
  distPath: '',
2069
2071
  cachePath,
@@ -2631,7 +2633,7 @@ async function createCompiler_createCompiler(options) {
2631
2633
  }
2632
2634
  logger.start('build started...');
2633
2635
  }(compiler, context), isCompiling = !0;
2634
- }), 'build' === context.action && compiler.hooks.run.tap('rsbuild:run', ()=>{
2636
+ }), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap('rsbuild:run', ()=>{
2635
2637
  logger.info('build started...'), logRspackVersion();
2636
2638
  }), compiler.hooks.done.tap('rsbuild:done', (stats)=>{
2637
2639
  ((stats)=>{
@@ -3386,7 +3388,7 @@ let open_execFile = node_util.promisify(node_child_process.execFile), open_dirna
3386
3388
  if (mountPoint) return mountPoint;
3387
3389
  let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
3388
3390
  try {
3389
- await promises.access(configFilePath, promises_constants.F_OK), isConfigFileExists = !0;
3391
+ await promises.access(configFilePath, external_node_fs_constants.F_OK), isConfigFileExists = !0;
3390
3392
  } catch {}
3391
3393
  if (!isConfigFileExists) return defaultMountPoint;
3392
3394
  let configContent = await promises.readFile(configFilePath, {
@@ -3481,7 +3483,7 @@ let pTryEach = async (array, mapper)=>{
3481
3483
  else {
3482
3484
  let exeLocalXdgOpen = !1;
3483
3485
  try {
3484
- await promises.access(localXdgOpenPath, promises_constants.X_OK), exeLocalXdgOpen = !0;
3486
+ await promises.access(localXdgOpenPath, external_node_fs_constants.X_OK), exeLocalXdgOpen = !0;
3485
3487
  } catch {}
3486
3488
  command = node_process.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
3487
3489
  }
@@ -3640,8 +3642,8 @@ let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
3640
3642
  return isIPv6(host) ? '::' === host ? '[::1]' : `[${host}]` : host;
3641
3643
  }, concatUrl = ({ host, port, protocol })=>`${protocol}://${host}:${port}`, LOCAL_LABEL = 'Local: ', NETWORK_LABEL = 'Network: ', getUrlLabel = (url)=>{
3642
3644
  try {
3643
- let { host } = new URL(url);
3644
- return isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL;
3645
+ let { hostname } = new URL(url);
3646
+ return isLoopbackHost(hostname) ? LOCAL_LABEL : NETWORK_LABEL;
3645
3647
  } catch {
3646
3648
  return NETWORK_LABEL;
3647
3649
  }
@@ -7645,11 +7647,11 @@ async function runCLI() {
7645
7647
  ].includes(level) && (logger.level = level);
7646
7648
  }
7647
7649
  let { npm_execpath } = process.env;
7648
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.4\n`);
7650
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.6\n`);
7649
7651
  try {
7650
7652
  !function() {
7651
7653
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7652
- cli.help(), cli.version("1.4.4"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7654
+ cli.help(), cli.version("1.4.6"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7653
7655
  default: 'jiti'
7654
7656
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7655
7657
  type: [
@@ -7707,5 +7709,5 @@ async function runCLI() {
7707
7709
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
7708
7710
  }
7709
7711
  }
7710
- let src_version = "1.4.4";
7712
+ let src_version = "1.4.6";
7711
7713
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
@@ -1110,25 +1110,76 @@ export type MetaOptions = {
1110
1110
  [name: string]: string | false | MetaAttrs;
1111
1111
  };
1112
1112
  export type HtmlBasicTag = {
1113
+ /**
1114
+ * The HTML tag name to be generated. Should be a valid HTML element name.
1115
+ * @example
1116
+ * - `'script'` for JavaScript files
1117
+ * - `'link'` for stylesheets or external resources
1118
+ * - `'meta'` for metadata
1119
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element
1120
+ */
1113
1121
  tag: string;
1122
+ /**
1123
+ * HTML attributes to be applied to the tag.
1124
+ * - `string` values will be rendered as `attribute="value"`
1125
+ * - `true` renders as boolean attribute (e.g., `<input disabled>`)
1126
+ * - `false` or `null` or `undefined` values will omit the attribute
1127
+ *
1128
+ * @example
1129
+ * // String attributes
1130
+ * attrs: {
1131
+ * src: 'https://example.com/script.js',
1132
+ * type: 'text/javascript',
1133
+ * }
1134
+ * // Result: <script src="https://example.com/script.js" type="text/javascript">
1135
+
1136
+ * // Boolean attributes
1137
+ * attrs: {
1138
+ * async: true, // <script async>
1139
+ * defer: false, // attribute omitted
1140
+ * }
1141
+ * // Result: <script async>
1142
+ */
1114
1143
  attrs?: Record<string, string | boolean | null | undefined>;
1144
+ /**
1145
+ * The innerHTML content of the tag. The content is inserted as-is without
1146
+ * HTML escaping, so ensure it's safe to prevent XSS vulnerabilities.
1147
+ */
1115
1148
  children?: string;
1116
1149
  };
1117
1150
  export type HtmlTag = HtmlBasicTag & {
1118
- /** @default false */
1151
+ /**
1152
+ * Controls whether to add a hash query parameter to asset URLs for cache invalidation.
1153
+ * Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
1154
+ * - `false`: No hash query
1155
+ * - `true`: Generate hash based on HTML content
1156
+ * - `string`: Uses a custom hash string
1157
+ * - `function`: Custom hash generation via a function
1158
+ * @default false
1159
+ */
1119
1160
  hash?: boolean | string | ((url: string, hash: string) => string);
1120
- /** @default true */
1161
+ /**
1162
+ * Controls whether to prepend the asset prefix to resource URLs.
1163
+ * Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
1164
+ * - `true`: Prepends asset prefix to the URL
1165
+ * - `false`: Uses the URL as-is
1166
+ * - `string`: Uses a custom prefix
1167
+ * - `function`: Custom path transformation via a function
1168
+ * @default true
1169
+ */
1121
1170
  publicPath?: boolean | string | ((url: string, publicPath: string) => string);
1122
1171
  /**
1123
- * Defines the injection position of the current tag relative to existing tags
1124
- * - When set to `true`, the tag will be inserted after existing tags
1125
- * - When set to `false`, the tag will be inserted before existing tags
1172
+ * Defines the injection position relative to existing tags.
1173
+ * - `true`: Insert after existing tags
1174
+ * - `false`: Insert before existing tags
1126
1175
  * @default true
1127
1176
  */
1128
1177
  append?: boolean;
1129
1178
  /**
1130
- * Specifies whether to add the current tag to the HTML `<head>` element
1131
- * @default defaults to `true` for element types allowed in the `<head>`, otherwise `false`
1179
+ * Specifies whether to inject the tag into the HTML `<head>` element.
1180
+ * - `true`: Inject into `<head>`
1181
+ * - `false`: Inject into `<body>`
1182
+ * @default Auto-detect: `true` for head-allowed elements, `false` otherwise
1132
1183
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#see_also
1133
1184
  */
1134
1185
  head?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,10 +46,10 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.4.2",
49
+ "@rspack/core": "1.4.6",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
- "core-js": "~3.43.0",
52
+ "core-js": "~3.44.0",
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {