@rsbuild/core 1.7.0-beta.0 → 1.7.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/131.js CHANGED
@@ -1,19 +1,24 @@
1
1
  /*! For license information please see 131.js.LICENSE.txt */
2
2
  "use strict";
3
- let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
3
+ let flagForceColor, swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
4
+ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
5
+ import { createRequire as __rspack_createRequire } from "node:module";
4
6
  let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
5
7
  import * as __rspack_external_async_hooks from "async_hooks";
6
8
  import * as __rspack_external_fs from "fs";
9
+ import * as __rspack_external_node_module_ab9f2194 from "node:module";
7
10
  import * as __rspack_external_node_path_c5b9b54f from "node:path";
11
+ import * as __rspack_external_node_url_e96de089 from "node:url";
8
12
  import * as __rspack_external_os from "os";
9
13
  import * as __rspack_external_path from "path";
10
14
  import * as __rspack_external_url from "url";
11
15
  import { __webpack_require__ } from "./rslib-runtime.js";
16
+ import node_process from "node:process";
17
+ import node_os, { constants as external_node_os_constants } from "node:os";
18
+ import node_tty from "node:tty";
12
19
  import { EventEmitter } from "events";
13
20
  import { promisify as external_node_util_promisify, stripVTControlCharacters } from "node:util";
14
21
  import node_fs, { existsSync } from "node:fs";
15
- import node_os, { constants as external_node_os_constants } from "node:os";
16
- import node_process from "node:process";
17
22
  import { isPromise, isRegExp } from "node:util/types";
18
23
  import node_zlib from "node:zlib";
19
24
  __webpack_require__.add({
@@ -951,7 +956,179 @@ __webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(p
951
956
  setCssExtractPlugin: ()=>setCssExtractPlugin,
952
957
  setHTMLPlugin: ()=>setHTMLPlugin
953
958
  });
954
- let external_node_module_ = __webpack_require__("node:module"), rspack_rspack = (0, external_node_module_.createRequire)(import.meta.url)('@rspack/core'), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), constants_filename = (0, external_node_url_.fileURLToPath)(import.meta.url), constants_dirname = (0, external_node_path_.dirname)(constants_filename), isDeno = 'undefined' != typeof Deno, isWindows = 'win32' === process.platform, ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(constants_dirname), STATIC_PATH = (0, external_node_path_.join)(constants_dirname, '../static'), CLIENT_PATH = (0, external_node_path_.join)(constants_dirname, 'client'), COMPILED_PATH = (0, external_node_path_.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
959
+ let external_node_module_ = __webpack_require__("node:module"), rspack_rspack = (0, external_node_module_.createRequire)(import.meta.url)('@rspack/core');
960
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
961
+ let prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--', position = argv.indexOf(prefix + flag), terminatorPosition = argv.indexOf('--');
962
+ return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
963
+ }
964
+ let { env: dist_env } = node_process;
965
+ function envForceColor() {
966
+ if (!('FORCE_COLOR' in dist_env)) return;
967
+ if ('true' === dist_env.FORCE_COLOR) return 1;
968
+ if ('false' === dist_env.FORCE_COLOR) return 0;
969
+ if (0 === dist_env.FORCE_COLOR.length) return 1;
970
+ let level = Math.min(Number.parseInt(dist_env.FORCE_COLOR, 10), 3);
971
+ if ([
972
+ 0,
973
+ 1,
974
+ 2,
975
+ 3
976
+ ].includes(level)) return level;
977
+ }
978
+ function translateLevel(level) {
979
+ return 0 !== level && {
980
+ level,
981
+ hasBasic: !0,
982
+ has256: level >= 2,
983
+ has16m: level >= 3
984
+ };
985
+ }
986
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = !0 } = {}) {
987
+ let noFlagForceColor = envForceColor();
988
+ void 0 !== noFlagForceColor && (flagForceColor = noFlagForceColor);
989
+ let forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
990
+ if (0 === forceColor) return 0;
991
+ if (sniffFlags) {
992
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
993
+ if (hasFlag('color=256')) return 2;
994
+ }
995
+ if ('TF_BUILD' in dist_env && 'AGENT_NAME' in dist_env) return 1;
996
+ if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
997
+ let min = forceColor || 0;
998
+ if ('dumb' === dist_env.TERM) return min;
999
+ if ('win32' === node_process.platform) {
1000
+ let osRelease = node_os.release().split('.');
1001
+ return Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ? Number(osRelease[2]) >= 14931 ? 3 : 2 : 1;
1002
+ }
1003
+ if ('CI' in dist_env) return [
1004
+ 'GITHUB_ACTIONS',
1005
+ 'GITEA_ACTIONS',
1006
+ 'CIRCLECI'
1007
+ ].some((key)=>key in dist_env) ? 3 : [
1008
+ 'TRAVIS',
1009
+ 'APPVEYOR',
1010
+ 'GITLAB_CI',
1011
+ 'BUILDKITE',
1012
+ 'DRONE'
1013
+ ].some((sign)=>sign in dist_env) || 'codeship' === dist_env.CI_NAME ? 1 : min;
1014
+ if ('TEAMCITY_VERSION' in dist_env) return +!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(dist_env.TEAMCITY_VERSION);
1015
+ if ('truecolor' === dist_env.COLORTERM || 'xterm-kitty' === dist_env.TERM || 'xterm-ghostty' === dist_env.TERM || 'wezterm' === dist_env.TERM) return 3;
1016
+ if ('TERM_PROGRAM' in dist_env) {
1017
+ let version = Number.parseInt((dist_env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
1018
+ switch(dist_env.TERM_PROGRAM){
1019
+ case 'iTerm.app':
1020
+ return version >= 3 ? 3 : 2;
1021
+ case 'Apple_Terminal':
1022
+ return 2;
1023
+ }
1024
+ }
1025
+ return /-256(color)?$/i.test(dist_env.TERM) ? 2 : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(dist_env.TERM) || 'COLORTERM' in dist_env ? 1 : min;
1026
+ }
1027
+ function createSupportsColor(stream, options = {}) {
1028
+ return translateLevel(_supportsColor(stream, {
1029
+ streamIsTTY: stream && stream.isTTY,
1030
+ ...options
1031
+ }));
1032
+ }
1033
+ hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never') ? flagForceColor = 0 : (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) && (flagForceColor = 1);
1034
+ let supportsColor = {
1035
+ stdout: createSupportsColor({
1036
+ isTTY: node_tty.isatty(1)
1037
+ }),
1038
+ stderr: createSupportsColor({
1039
+ isTTY: node_tty.isatty(2)
1040
+ })
1041
+ }, colorLevel = supportsColor.stdout ? supportsColor.stdout.level : 0, errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/, indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/, formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
1042
+ let string = '' + input, index = string.indexOf(close, open.length);
1043
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
1044
+ } : String, replaceClose = (string, close, replace, index)=>{
1045
+ let start = string.substring(0, index) + replace, end = string.substring(index + close.length), nextIndex = end.indexOf(close);
1046
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
1047
+ }, bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m'), red = formatter('\x1b[31m', '\x1b[39m'), green = formatter('\x1b[32m', '\x1b[39m'), yellow = formatter('\x1b[33m', '\x1b[39m'), magenta = formatter('\x1b[35m', '\x1b[39m'), cyan = formatter('\x1b[36m', '\x1b[39m'), gray = formatter('\x1b[90m', '\x1b[39m'), isWord = (char)=>!/[\s\n]/.test(char), LOG_LEVEL = {
1048
+ silent: -1,
1049
+ error: 0,
1050
+ warn: 1,
1051
+ info: 2,
1052
+ log: 2,
1053
+ verbose: 3
1054
+ }, LOG_TYPES = {
1055
+ error: {
1056
+ label: 'error',
1057
+ level: 'error',
1058
+ color: red
1059
+ },
1060
+ warn: {
1061
+ label: 'warn',
1062
+ level: 'warn',
1063
+ color: yellow
1064
+ },
1065
+ info: {
1066
+ label: 'info',
1067
+ level: 'info',
1068
+ color: cyan
1069
+ },
1070
+ start: {
1071
+ label: 'start',
1072
+ level: 'info',
1073
+ color: cyan
1074
+ },
1075
+ ready: {
1076
+ label: 'ready',
1077
+ level: 'info',
1078
+ color: green
1079
+ },
1080
+ success: {
1081
+ label: 'success',
1082
+ level: 'info',
1083
+ color: green
1084
+ },
1085
+ log: {
1086
+ level: 'info'
1087
+ },
1088
+ debug: {
1089
+ label: 'debug',
1090
+ level: 'verbose',
1091
+ color: magenta
1092
+ }
1093
+ }, normalizeErrorMessage = (err)=>{
1094
+ if (err.stack) {
1095
+ let [name, ...rest] = err.stack.split('\n');
1096
+ return name.startsWith('Error: ') && (name = name.slice(7)), `${name}\n${gray(rest.join('\n'))}`;
1097
+ }
1098
+ return err.message;
1099
+ }, src_logger = ((options = {})=>{
1100
+ let maxLevel = options.level || 'info', log = (type, message, ...args)=>{
1101
+ let logType = LOG_TYPES[type], { level } = logType;
1102
+ if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
1103
+ if (null == message) return console.log();
1104
+ let label = '', text = '';
1105
+ if ('label' in logType && (label = (logType.label || '').padEnd(7), label = bold(logType.color ? logType.color(label) : label)), message instanceof Error) {
1106
+ text += normalizeErrorMessage(message);
1107
+ let { cause } = message;
1108
+ cause && (text += yellow('\n [cause]: '), text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause));
1109
+ } else text = 'error' === level && 'string' == typeof message ? message.split('\n').map((line)=>errorStackRegExp.test(line) || anonymousErrorStackRegExp.test(line) || indexErrorStackRegExp.test(line) ? gray(line) : line).join('\n') : `${message}`;
1110
+ console['error' === level || 'warn' === level ? level : 'log'](label.length ? `${label} ${text}` : text, ...args);
1111
+ }, logger = {
1112
+ greet: (message)=>log('log', ((message)=>{
1113
+ if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
1114
+ let chars = [
1115
+ ...message
1116
+ ], steps = chars.filter(isWord).length, r = 189, g = 255, b = 243, rStep = -115 / steps, gStep = -61 / steps, bStep = -89 / steps, output = '';
1117
+ for (let char of chars)isWord(char) && (r += rStep, g += gStep, b += bStep), output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
1118
+ return bold(output);
1119
+ })(message))
1120
+ };
1121
+ return Object.keys(LOG_TYPES).forEach((key)=>{
1122
+ logger[key] = (...args)=>log(key, ...args);
1123
+ }), Object.defineProperty(logger, 'level', {
1124
+ get: ()=>maxLevel,
1125
+ set (val) {
1126
+ maxLevel = val;
1127
+ }
1128
+ }), logger.override = (customLogger)=>{
1129
+ Object.assign(logger, customLogger);
1130
+ }, logger;
1131
+ })(), external_node_path_ = __webpack_require__("node:path"), external_node_url_ = __webpack_require__("node:url"), constants_filename = (0, external_node_url_.fileURLToPath)(import.meta.url), constants_dirname = (0, external_node_path_.dirname)(constants_filename), isDeno = "u" > typeof Deno, isWindows = 'win32' === process.platform, ROOT_DIST_DIR = 'dist', LOADER_PATH = (0, external_node_path_.join)(constants_dirname), STATIC_PATH = (0, external_node_path_.join)(constants_dirname, '../static'), CLIENT_PATH = (0, external_node_path_.join)(constants_dirname, 'client'), COMPILED_PATH = (0, external_node_path_.join)(constants_dirname, '../compiled'), RSBUILD_OUTPUTS_PATH = '.rsbuild', DEFAULT_DEV_HOST = '0.0.0.0', DEFAULT_ASSET_PREFIX = '/', DEFAULT_STACK_TRACE = 'summary', DEFAULT_WEB_BROWSERSLIST = [
955
1132
  'chrome >= 87',
956
1133
  'edge >= 88',
957
1134
  'firefox >= 78',
@@ -997,7 +1174,7 @@ let external_node_module_ = __webpack_require__("node:module"), rspack_rspack =
997
1174
  'aac',
998
1175
  'm4a',
999
1176
  'opus'
1000
- ], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy', vendors_require = (0, external_node_module_.createRequire)(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), color = requireCompiledPackage('picocolors'), logger = requireCompiledPackage('rslog').logger, isDebug = ()=>{
1177
+ ], LAZY_COMPILATION_IDENTIFIER = 'lazy-compilation-proxy', vendors_require = (0, external_node_module_.createRequire)(import.meta.url), requireCompiledPackage = (name)=>vendors_require(`${COMPILED_PATH}/${name}/index.js`), color = requireCompiledPackage('picocolors'), isDebug = ()=>{
1001
1178
  if (!process.env.DEBUG) return !1;
1002
1179
  let values = process.env.DEBUG.toLocaleLowerCase().split(',');
1003
1180
  return [
@@ -1059,9 +1236,9 @@ function mri2(args, opts) {
1059
1236
  if (alibi) for(k in out)for(arr = opts.alias[k] || []; arr.length > 0;)out[arr.shift()] = out[k];
1060
1237
  return out;
1061
1238
  }
1062
- isDebug() && (logger.level = 'verbose'), logger.override({
1239
+ isDebug() && (src_logger.level = 'verbose'), src_logger.override({
1063
1240
  debug: (message, ...args)=>{
1064
- if ('verbose' !== logger.level) return;
1241
+ if ('verbose' !== src_logger.level) return;
1065
1242
  let time = color.gray(getTime());
1066
1243
  console.log(` ${color.magenta('rsbuild')} ${time} ${message}`, ...args);
1067
1244
  }
@@ -2403,7 +2580,7 @@ function formatModuleTrace(stats, errorFile, level) {
2403
2580
  moduleNames[0] !== formatted && moduleNames.unshift(formatted);
2404
2581
  }
2405
2582
  let trace = moduleNames.slice().reverse();
2406
- return trace.length > 4 && 'verbose' !== logger.level && (trace = [
2583
+ return trace.length > 4 && 'verbose' !== src_logger.level && (trace = [
2407
2584
  ...trace.slice(0, 2),
2408
2585
  `… (${trace.length - 2 - 2} hidden)`,
2409
2586
  ...trace.slice(trace.length - 2)
@@ -2459,8 +2636,8 @@ function formatStatsError(stats, root, level = 'error') {
2459
2636
  }
2460
2637
  let prefix = root + external_node_path_.sep;
2461
2638
  return (fileName.startsWith(prefix) && (fileName = fileName.replace(prefix, `.${external_node_path_.sep}`)), /:\d+:\d+/.test(fileName)) ? `File: ${color.cyan(fileName)}\n` : stats.loc ? `File: ${color.cyan(`${fileName}:${stats.loc}`)}\n` : `File: ${color.cyan(`${fileName}:1:1`)}\n`;
2462
- })(fileName, stats, root)}${stats.message}`, verbose = 'verbose' === logger.level;
2463
- if (verbose && (stats.details && (message += `\nDetails: ${stats.details}\n`), stats.stack && (message += `\n${stats.stack}`)), 'error' === level || 'verbose' === logger.level) {
2639
+ })(fileName, stats, root)}${stats.message}`, verbose = 'verbose' === src_logger.level;
2640
+ if (verbose && (stats.details && (message += `\nDetails: ${stats.details}\n`), stats.stack && (message += `\n${stats.stack}`)), 'error' === level || 'verbose' === src_logger.level) {
2464
2641
  let moduleTrace = formatModuleTrace(stats, fileName, level);
2465
2642
  moduleTrace && (message += moduleTrace);
2466
2643
  }
@@ -2549,7 +2726,7 @@ function getStatsOptions(compiler, action) {
2549
2726
  errors: !0,
2550
2727
  warnings: !0,
2551
2728
  moduleTrace: !0,
2552
- errorStack: 'verbose' === logger.level
2729
+ errorStack: 'verbose' === src_logger.level
2553
2730
  };
2554
2731
  if ('dev' === action && (defaultOptions = {
2555
2732
  ...defaultOptions,
@@ -2587,7 +2764,7 @@ function formatStats(stats, hasErrors, root) {
2587
2764
  }
2588
2765
  return {};
2589
2766
  }
2590
- let removeLoaderChainDelimiter = (moduleId)=>'verbose' === logger.level ? moduleId : moduleId.split('!=!')[0];
2767
+ let removeLoaderChainDelimiter = (moduleId)=>'verbose' === src_logger.level ? moduleId : moduleId.split('!=!')[0];
2591
2768
  function _define_property(obj, key, value) {
2592
2769
  return key in obj ? Object.defineProperty(obj, key, {
2593
2770
  value: value,
@@ -2753,7 +2930,7 @@ async function emptyDir(dir, keep = [], checkExists = !0) {
2753
2930
  !keep.some((reg)=>reg.test(toPosixPath(fullPath))) && (entry.isDirectory() ? (await emptyDir(fullPath, keep, !1), keep.length || await node_fs.promises.rmdir(fullPath)) : await node_fs.promises.unlink(fullPath));
2754
2931
  }));
2755
2932
  } catch (err) {
2756
- logger.debug(`failed to empty dir: ${dir}`), logger.debug(err);
2933
+ src_logger.debug(`failed to empty dir: ${dir}`), src_logger.debug(err);
2757
2934
  }
2758
2935
  }
2759
2936
  let OVERRIDE_PATHS = new Set([
@@ -3056,7 +3233,7 @@ function createPluginManager() {
3056
3233
  let { before, environment } = options || {};
3057
3234
  for (let newPlugin of newPlugins)if (newPlugin) if (validatePlugin(newPlugin), before) {
3058
3235
  let index = plugins.findIndex((item)=>item.instance.name === before);
3059
- -1 === index ? (logger.warn(`Plugin "${before}" does not exist.`), plugins.push({
3236
+ -1 === index ? (src_logger.warn(`Plugin "${before}" does not exist.`), plugins.push({
3060
3237
  environment,
3061
3238
  instance: newPlugin
3062
3239
  })) : plugins.splice(index, 0, {
@@ -3075,7 +3252,7 @@ function createPluginManager() {
3075
3252
  };
3076
3253
  }
3077
3254
  async function initPlugins({ context, pluginManager }) {
3078
- logger.debug('initializing plugins');
3255
+ src_logger.debug('initializing plugins');
3079
3256
  let plugins = pluginManager.getAllPluginsWithMeta();
3080
3257
  plugins = ((plugins)=>{
3081
3258
  let allLines = [];
@@ -3138,11 +3315,11 @@ async function initPlugins({ context, pluginManager }) {
3138
3315
  await setup(context.getPluginAPI(environment));
3139
3316
  }
3140
3317
  }
3141
- logger.debug('plugins initialized');
3318
+ src_logger.debug('plugins initialized');
3142
3319
  }
3143
3320
  function getHTMLPathByEntry(entryName, config) {
3144
3321
  let filename = getFilename(config, 'html').replace('[name]', entryName), prefix = config.output.distPath.html;
3145
- return prefix.startsWith('/') && logger.warn(`${color.dim('[rsbuild:config]')} Absolute path is not recommended at ${color.yellow(`output.distPath.html: "${prefix}"`)}, use relative path instead.`), external_node_path_.posix.join(prefix, filename).replace(/^\/+/, '');
3322
+ return prefix.startsWith('/') && src_logger.warn(`${color.dim('[rsbuild:config]')} Absolute path is not recommended at ${color.yellow(`output.distPath.html: "${prefix}"`)}, use relative path instead.`), external_node_path_.posix.join(prefix, filename).replace(/^\/+/, '');
3146
3323
  }
3147
3324
  let mapProcessAssetsStage = (compiler, stage)=>{
3148
3325
  let { Compilation } = compiler.webpack;
@@ -3257,7 +3434,7 @@ function initPluginAPI({ context, pluginManager }) {
3257
3434
  return (environment)=>({
3258
3435
  context: publicContext,
3259
3436
  expose,
3260
- logger: logger,
3437
+ logger: src_logger,
3261
3438
  transform: (descriptor, handler)=>{
3262
3439
  let id = `rsbuild-transform-${transformId++}`;
3263
3440
  transformer[id] = handler, hooks.modifyBundlerChain.tapEnvironment({
@@ -3402,7 +3579,7 @@ async function updateEnvironmentContext(context, configs) {
3402
3579
  webSocketToken
3403
3580
  }, readonlyEnvironmentContext = new Proxy(environmentContext, {
3404
3581
  get: (target, prop)=>target[prop],
3405
- set: (target, prop, newValue)=>('manifest' === prop ? target[prop] = newValue : logger.error(`EnvironmentContext is readonly, you can not assign to the "environment.${prop}" prop.`), !0)
3582
+ set: (target, prop, newValue)=>('manifest' === prop ? target[prop] = newValue : src_logger.error(`EnvironmentContext is readonly, you can not assign to the "environment.${prop}" prop.`), !0)
3406
3583
  });
3407
3584
  context.environmentList[index] = readonlyEnvironmentContext, context.environments[name] = readonlyEnvironmentContext;
3408
3585
  }
@@ -3426,13 +3603,13 @@ function createPublicContext(context) {
3426
3603
  get (target, prop) {
3427
3604
  if (exposedKeys.includes(prop)) return target[prop];
3428
3605
  },
3429
- set: (_, prop)=>(logger.error(`Context is readonly, you can not assign to the "context.${prop}" prop.`), !0)
3606
+ set: (_, prop)=>(src_logger.error(`Context is readonly, you can not assign to the "context.${prop}" prop.`), !0)
3430
3607
  });
3431
3608
  }
3432
3609
  async function createContext(options, userConfig) {
3433
3610
  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';
3434
3611
  return {
3435
- version: "1.7.0-beta.0",
3612
+ version: "1.7.0-beta.1",
3436
3613
  rootPath,
3437
3614
  distPath: '',
3438
3615
  cachePath,
@@ -3495,7 +3672,7 @@ async function outputInspectConfigFiles({ rawBundlerConfigs, rawEnvironmentConfi
3495
3672
  recursive: !0
3496
3673
  }), await Promise.all(files.map(async (item)=>node_fs.promises.writeFile(item.path, `export default ${item.content}`)));
3497
3674
  let fileInfos = files.map((item)=>` - ${color.bold(color.yellow(item.label))}: ${color.underline(item.path)}`).join('\n');
3498
- logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
3675
+ src_logger.success(`config inspection completed, generated files: \n\n${fileInfos}\n`);
3499
3676
  }
3500
3677
  function stringifyConfig(config, verbose) {
3501
3678
  return src_class.toString(config, {
@@ -3595,7 +3772,7 @@ function reduceConfigsMergeContext({ initial, config, ctx, mergeFn = Object.assi
3595
3772
  }), initial) : config ?? initial;
3596
3773
  }
3597
3774
  async function modifyBundlerChain(context, utils) {
3598
- logger.debug('applying modifyBundlerChain hook');
3775
+ src_logger.debug('applying modifyBundlerChain hook');
3599
3776
  let bundlerChain = new src_class(), [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.callChain({
3600
3777
  environment: utils.environment.name,
3601
3778
  args: [
@@ -3604,7 +3781,7 @@ async function modifyBundlerChain(context, utils) {
3604
3781
  ]
3605
3782
  });
3606
3783
  if (utils.environment.config.tools?.bundlerChain) for (let item of helpers_castArray(utils.environment.config.tools.bundlerChain))await item(modifiedBundlerChain, utils);
3607
- return logger.debug('applied modifyBundlerChain hook'), modifiedBundlerChain;
3784
+ return src_logger.debug('applied modifyBundlerChain hook'), modifiedBundlerChain;
3608
3785
  }
3609
3786
  let configChain_CHAIN_ID = {
3610
3787
  RULE: {
@@ -3693,7 +3870,7 @@ let configChain_CHAIN_ID = {
3693
3870
  cssExtractPlugin = plugin;
3694
3871
  };
3695
3872
  async function modifyRspackConfig(context, rspackConfig, chainUtils) {
3696
- logger.debug('applying modifyRspackConfig hook');
3873
+ src_logger.debug('applying modifyRspackConfig hook');
3697
3874
  let currentConfig = rspackConfig, utils = getConfigUtils(()=>currentConfig, chainUtils);
3698
3875
  if ([currentConfig] = await context.hooks.modifyRspackConfig.callChain({
3699
3876
  environment: utils.environment.name,
@@ -3713,7 +3890,7 @@ async function modifyRspackConfig(context, rspackConfig, chainUtils) {
3713
3890
  mergeFn: (...args)=>currentConfig = utils.mergeConfig.call(utils, args)
3714
3891
  });
3715
3892
  }
3716
- return logger.debug('applied modifyRspackConfig hook'), currentConfig;
3893
+ return src_logger.debug('applied modifyRspackConfig hook'), currentConfig;
3717
3894
  }
3718
3895
  function getConfigUtils(getCurrentConfig, chainUtils) {
3719
3896
  return {
@@ -3766,7 +3943,7 @@ function validateRspackConfig(config) {
3766
3943
  throw Error(`${color.dim('[rsbuild:plugin]')} "${color.yellow(name)}" appears to be an Rsbuild plugin. It cannot be used as an Rspack plugin.`);
3767
3944
  }
3768
3945
  }
3769
- config.devServer && logger.warn(`${color.dim('[rsbuild:config]')} Find invalid Rspack config: "${color.yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`);
3946
+ config.devServer && src_logger.warn(`${color.dim('[rsbuild:config]')} Find invalid Rspack config: "${color.yellow('devServer')}". Note that Rspack's "devServer" config is not supported by Rsbuild. You can use Rsbuild's "dev" config to configure the Rsbuild dev server.`);
3770
3947
  }
3771
3948
  async function generateRspackConfig({ target, context, environmentName }) {
3772
3949
  let chainUtils = getChainUtils(target, context.environments[environmentName], context.environments), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, SourceMapDevToolPlugin, HotModuleReplacementPlugin } = rspack_rspack, rspackConfig = (await modifyBundlerChain(context, {
@@ -3793,14 +3970,14 @@ let allowedEnvironmentDevKeys = [
3793
3970
  'lazyCompilation'
3794
3971
  ];
3795
3972
  async function modifyRsbuildConfig(context) {
3796
- logger.debug('applying modifyRsbuildConfig hook');
3973
+ src_logger.debug('applying modifyRsbuildConfig hook');
3797
3974
  let pluginsCount = context.config.plugins?.length ?? 0, [modified] = await context.hooks.modifyRsbuildConfig.callChain(context.config, {
3798
3975
  mergeRsbuildConfig: mergeRsbuildConfig
3799
3976
  });
3800
- context.config = modified, (modified.plugins?.length ?? 0) !== pluginsCount && logger.warn(`${color.dim('[rsbuild]')} Cannot change plugins via ${color.yellow('modifyRsbuildConfig')} as plugins are already initialized when it executes.`), logger.debug('applied modifyRsbuildConfig hook');
3977
+ context.config = modified, (modified.plugins?.length ?? 0) !== pluginsCount && src_logger.warn(`${color.dim('[rsbuild]')} Cannot change plugins via ${color.yellow('modifyRsbuildConfig')} as plugins are already initialized when it executes.`), src_logger.debug('applied modifyRsbuildConfig hook');
3801
3978
  }
3802
3979
  async function modifyEnvironmentConfig(context, config, name) {
3803
- logger.debug(`applying modifyEnvironmentConfig hook (${name})`);
3980
+ src_logger.debug(`applying modifyEnvironmentConfig hook (${name})`);
3804
3981
  let [modified] = await context.hooks.modifyEnvironmentConfig.callChain({
3805
3982
  environment: name,
3806
3983
  args: [
@@ -3811,7 +3988,7 @@ async function modifyEnvironmentConfig(context, config, name) {
3811
3988
  }
3812
3989
  ]
3813
3990
  });
3814
- return logger.debug(`applied modifyEnvironmentConfig hook (${name})`), modified;
3991
+ return src_logger.debug(`applied modifyEnvironmentConfig hook (${name})`), modified;
3815
3992
  }
3816
3993
  let createEnvironmentNotFoundError = (environments = [])=>{
3817
3994
  let envList = color.yellow(environments.join(','));
@@ -3908,7 +4085,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
3908
4085
  'web-worker'
3909
4086
  ];
3910
4087
  for (let name of environmentNames){
3911
- environmentNameRegexp.test(name) || logger.warn(`${color.dim('[rsbuild:config]')} Environment name "${color.yellow(name)}" contains invalid characters. Only letters, numbers, "-", "_", and "$" are allowed.`);
4088
+ environmentNameRegexp.test(name) || src_logger.warn(`${color.dim('[rsbuild:config]')} Environment name "${color.yellow(name)}" contains invalid characters. Only letters, numbers, "-", "_", and "$" are allowed.`);
3912
4089
  let outputConfig = config.environments[name].output;
3913
4090
  if (outputConfig.target && !validTargets.includes(outputConfig.target)) throw Error(`${color.dim('[rsbuild:config]')} Invalid value of ${color.yellow('output.target')}: ${color.yellow(`"${outputConfig.target}"`)}, valid values are: ${color.yellow(validTargets.join(', '))}`);
3914
4091
  }
@@ -3966,20 +4143,20 @@ function printBuildLog(compiler, context, lazyModules) {
3966
4143
  let { modifiedFiles } = compiler, changedFiles = modifiedFiles?.size ? Array.from(modifiedFiles) : lazyModules.size ? Array.from(lazyModules) : null;
3967
4144
  if (changedFiles?.length) {
3968
4145
  let fileInfo = formatFileList(changedFiles, context.rootPath);
3969
- logger.start(`building ${color.dim(fileInfo)}`);
4146
+ src_logger.start(`building ${color.dim(fileInfo)}`);
3970
4147
  return;
3971
4148
  }
3972
4149
  let removedFiles = compiler.removedFiles ? Array.from(compiler.removedFiles) : null;
3973
4150
  if (removedFiles?.length) {
3974
- if (removedFiles.every((item)=>item.includes('virtual'))) return void logger.start(`building ${color.dim('virtual modules')}`);
4151
+ if (removedFiles.every((item)=>item.includes('virtual'))) return void src_logger.start(`building ${color.dim('virtual modules')}`);
3975
4152
  let fileInfo = formatFileList(removedFiles, context.rootPath);
3976
- return void logger.start(`building ${color.dim(`removed ${fileInfo}`)}`);
4153
+ return void src_logger.start(`building ${color.dim(`removed ${fileInfo}`)}`);
3977
4154
  }
3978
- logger.start('build started...');
4155
+ src_logger.start('build started...');
3979
4156
  }
3980
4157
  async function createCompiler_createCompiler(options) {
3981
4158
  let version;
3982
- logger.debug('creating compiler');
4159
+ src_logger.debug('creating compiler');
3983
4160
  let HOOK_NAME = 'rsbuild:compiler', { context } = options, { rspackConfigs } = await initConfigs(options);
3984
4161
  if (await context.hooks.onBeforeCreateCompiler.callBatch({
3985
4162
  bundlerConfigs: rspackConfigs,
@@ -3996,7 +4173,7 @@ async function createCompiler_createCompiler(options) {
3996
4173
  let isMultiCompiler = rspackConfigs.length > 1, compiler = isMultiCompiler ? rspack_rspack(rspackConfigs) : rspack_rspack(rspackConfigs[0]);
3997
4174
  'true' === process.env.RSPACK_UNSAFE_FAST_DROP && (compiler.unsafeFastDrop = !0);
3998
4175
  let isVersionLogged = !1, isCompiling = !1, logRspackVersion = ()=>{
3999
- isVersionLogged || (logger.debug(`using Rspack v${rspack_rspack.rspackVersion}`), isVersionLogged = !0);
4176
+ isVersionLogged || (src_logger.debug(`using Rspack v${rspack_rspack.rspackVersion}`), isVersionLogged = !0);
4000
4177
  }, lazyModules = new Set();
4001
4178
  compiler.hooks.infrastructureLog.tap(HOOK_NAME, (name, _, args)=>{
4002
4179
  let log = args[0];
@@ -4018,14 +4195,14 @@ async function createCompiler_createCompiler(options) {
4018
4195
  }), compiler.hooks.invalid.tap(HOOK_NAME, ()=>{
4019
4196
  context.buildState.stats = null, context.buildState.status = 'idle', context.buildState.hasErrors = !1;
4020
4197
  }), 'build' === context.action && (isMultiCompiler ? compiler.compilers[0] : compiler).hooks.run.tap(HOOK_NAME, ()=>{
4021
- logger.info('build started...'), logRspackVersion();
4198
+ src_logger.info('build started...'), logRspackVersion();
4022
4199
  });
4023
4200
  let printTime = (index, hasErrors)=>{
4024
4201
  if (null === startTime) return;
4025
4202
  let { name } = context.environmentList[index], time = Date.now() - startTime;
4026
4203
  context.buildState.time[name] = time;
4027
4204
  let suffix = isMultiCompiler ? color.dim(` (${name})`) : '', timeStr = `${prettyTime(time / 1000)}${suffix}`;
4028
- hasErrors ? logger.error(`build failed in ${timeStr}`) : logger.ready(`built in ${timeStr}`);
4205
+ hasErrors ? src_logger.error(`build failed in ${timeStr}`) : src_logger.ready(`built in ${timeStr}`);
4029
4206
  };
4030
4207
  return isMultiCompiler && compiler.compilers.forEach((item, index)=>{
4031
4208
  item.hooks.done.tap(HOOK_NAME, (stats)=>{
@@ -4035,7 +4212,7 @@ async function createCompiler_createCompiler(options) {
4035
4212
  let stats = getRsbuildStats(statsInstance, compiler, context.action), hasErrors = statsInstance.hasErrors();
4036
4213
  context.buildState.stats = stats, context.buildState.status = 'done', context.buildState.hasErrors = hasErrors, context.socketServer?.onBuildDone();
4037
4214
  let { message, level } = formatStats(stats, hasErrors, options.context.rootPath);
4038
- 'error' === level && logger.error(message), 'warning' === level && logger.warn(message), isMultiCompiler || printTime(0, hasErrors), isCompiling = !1;
4215
+ 'error' === level && src_logger.error(message), 'warning' === level && src_logger.warn(message), isMultiCompiler || printTime(0, hasErrors), isCompiling = !1;
4039
4216
  }), 'dev' === context.action && registerDevHook({
4040
4217
  context,
4041
4218
  compiler,
@@ -4044,7 +4221,7 @@ async function createCompiler_createCompiler(options) {
4044
4221
  }), await context.hooks.onAfterCreateCompiler.callBatch({
4045
4222
  compiler,
4046
4223
  environments: context.environments
4047
- }), logger.debug('compiler created'), {
4224
+ }), src_logger.debug('compiler created'), {
4048
4225
  compiler,
4049
4226
  rspackConfigs
4050
4227
  };
@@ -4065,7 +4242,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
4065
4242
  }), watch) {
4066
4243
  let watchOptions = bundlerConfigs ? bundlerConfigs.map((options)=>options.watchOptions || {}) : [];
4067
4244
  return compiler.watch(watchOptions.length > 1 ? watchOptions : watchOptions[0] || {}, (err)=>{
4068
- err && logger.error(err);
4245
+ err && src_logger.error(err);
4069
4246
  }), {
4070
4247
  close: ()=>new Promise((resolve)=>{
4071
4248
  compiler.close(()=>{
@@ -4077,7 +4254,7 @@ let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOption
4077
4254
  let { stats } = await new Promise((resolve, reject)=>{
4078
4255
  compiler.run((err, stats)=>{
4079
4256
  compiler.close((closeErr)=>{
4080
- closeErr && logger.error('Failed to close compiler: ', closeErr), err ? reject(err) : context.buildState.hasErrors ? reject(Error(RSPACK_BUILD_ERROR)) : resolve({
4257
+ closeErr && src_logger.error('Failed to close compiler: ', closeErr), err ? reject(err) : context.buildState.hasErrors ? reject(Error(RSPACK_BUILD_ERROR)) : resolve({
4081
4258
  stats
4082
4259
  });
4083
4260
  });
@@ -4106,7 +4283,7 @@ function loadEnv({ cwd = process.cwd(), mode = process.env.NODE_ENV || '', prefi
4106
4283
  `.env.${mode}`,
4107
4284
  `.env.${mode}.local`
4108
4285
  ].map((filename)=>(0, external_node_path_.join)(cwd, filename)).filter(isFileSync), parsed = {};
4109
- for (let envPath of filePaths)Object.assign(parsed, loadEnv_parse(node_fs.readFileSync(envPath))), logger.debug('loaded env file:', envPath);
4286
+ for (let envPath of filePaths)Object.assign(parsed, loadEnv_parse(node_fs.readFileSync(envPath))), src_logger.debug('loaded env file:', envPath);
4110
4287
  parsed.NODE_ENV && (processEnv.NODE_ENV = parsed.NODE_ENV), (0, main.expand)({
4111
4288
  parsed,
4112
4289
  processEnv
@@ -4182,7 +4359,7 @@ async function validateWebpackCache(cacheDirectory, buildDependencies) {
4182
4359
  try {
4183
4360
  prevBuildDependencies = JSON.parse(rawConfigFile);
4184
4361
  } catch (e) {
4185
- logger.debug('failed to parse the previous buildDependencies.json', e);
4362
+ src_logger.debug('failed to parse the previous buildDependencies.json', e);
4186
4363
  }
4187
4364
  if (JSON.stringify(prevBuildDependencies) === JSON.stringify(buildDependencies)) return;
4188
4365
  await node_fs.promises.rm(cacheDirectory, {
@@ -4195,7 +4372,7 @@ async function validateWebpackCache(cacheDirectory, buildDependencies) {
4195
4372
  recursive: !0
4196
4373
  }), await node_fs.promises.writeFile(configFile, JSON.stringify(buildDependencies));
4197
4374
  } catch (e) {
4198
- logger.debug('failed to write the buildDependencies.json', e);
4375
+ src_logger.debug('failed to write the buildDependencies.json', e);
4199
4376
  }
4200
4377
  }
4201
4378
  function getCacheDirectory({ cacheDirectory }, context) {
@@ -4326,7 +4503,7 @@ function checkProcessEnvSecurity(define) {
4326
4503
  if (!value) return;
4327
4504
  let check = (value)=>{
4328
4505
  let pathKey = Object.keys(value).find((key)=>'path' === key.toLowerCase() && value[key] === process.env[key]);
4329
- pathKey && logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.define"')} option includes an object with the key ${color.yellow(JSON.stringify(pathKey))} under ${color.yellow('"process.env"')}, indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`);
4506
+ pathKey && src_logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.define"')} option includes an object with the key ${color.yellow(JSON.stringify(pathKey))} under ${color.yellow('"process.env"')}, indicating potential exposure of all environment variables. This can lead to security risks and should be avoided.`);
4330
4507
  };
4331
4508
  if ('object' == typeof value) return void check(value);
4332
4509
  if ('string' == typeof value) try {
@@ -4371,7 +4548,7 @@ async function saveSnapshots(snapshotPath, snapshots) {
4371
4548
  recursive: !0
4372
4549
  }), await node_fs.promises.writeFile(snapshotPath, JSON.stringify(snapshots, null, 2));
4373
4550
  } catch (err) {
4374
- logger.debug('Failed to save file size snapshots:', err);
4551
+ src_logger.debug('Failed to save file size snapshots:', err);
4375
4552
  }
4376
4553
  }
4377
4554
  let EXCLUDE_ASSET_REGEX = /\.(?:map|LICENSE\.txt|d\.ts)$/, excludeAsset = (asset)=>EXCLUDE_ASSET_REGEX.test(asset.name), isSignificantDiff = (diff)=>Math.abs(diff) >= 10, formatDiff = (diff)=>{
@@ -4603,7 +4780,7 @@ class RsbuildHtmlPlugin {
4603
4780
  try {
4604
4781
  if (!(buffer = await external_node_util_promisify(compilation.inputFileSystem.readFile)(inputFilename))) throw Error('Buffer is undefined');
4605
4782
  } catch (error) {
4606
- return logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
4783
+ return src_logger.debug(`read favicon error: ${error}`), addCompilationError(compilation, `${color.dim('[rsbuild:html]')} Failed to read the favicon file at ${color.yellow(inputFilename)}.`), null;
4607
4784
  }
4608
4785
  let source = new compiler.webpack.sources.RawSource(buffer, !1), outputFilename = external_node_path_.default.posix.join(faviconDistPath, name);
4609
4786
  return compilation.emitAsset(outputFilename, source), outputFilename;
@@ -4911,7 +5088,7 @@ function printServerURLs({ urls: originalUrls, port, routes, protocol, printUrls
4911
5088
  }
4912
5089
  if (0 === urls.length || 0 === routes.length && !useCustomUrl) return null;
4913
5090
  let message = getURLMessages(urls, routes);
4914
- return !trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), logger.log(message), message;
5091
+ return !trailingLineBreak && message.endsWith('\n') && (message = message.slice(0, -1)), src_logger.log(message), message;
4915
5092
  }
4916
5093
  let getPort = async ({ host, port, strictPort, tryLimits = 20 })=>{
4917
5094
  'string' == typeof port && (port = Number.parseInt(port, 10)), strictPort && (tryLimits = 1);
@@ -5043,9 +5220,9 @@ async function openBrowser(url) {
5043
5220
  if (chromiumBrowser) return await execAsync(`osascript openChrome.applescript "${encodeURI(url)}" "${chromiumBrowser}"`, {
5044
5221
  cwd: STATIC_PATH
5045
5222
  }), !0;
5046
- logger.debug('failed to find the target browser.');
5223
+ src_logger.debug('failed to find the target browser.');
5047
5224
  } catch (err) {
5048
- logger.debug("failed to open start URL with apple script."), logger.debug(err);
5225
+ src_logger.debug("failed to open start URL with apple script."), src_logger.debug(err);
5049
5226
  }
5050
5227
  }
5051
5228
  let { apps, default: baseOpen } = await import("./0~open.js").then((mod)=>({
@@ -5060,10 +5237,10 @@ async function openBrowser(url) {
5060
5237
  }
5061
5238
  } : {};
5062
5239
  return (await baseOpen(url, options)).on('error', (err)=>{
5063
- logger.error('Failed to launch browser in child process', err);
5240
+ src_logger.error('Failed to launch browser in child process', err);
5064
5241
  }), !0;
5065
5242
  } catch (err) {
5066
- return logger.error('Failed to launch browser.'), logger.error(err), !1;
5243
+ return src_logger.error('Failed to launch browser.'), src_logger.error(err), !1;
5067
5244
  }
5068
5245
  }
5069
5246
  let openedURLs = [], replacePortPlaceholder = (url, port)=>url.replace(/<port>/g, String(port));
@@ -5178,13 +5355,13 @@ function applyAlias({ chain, config, rootPath }) {
5178
5355
  initial: {},
5179
5356
  config: config.resolve.alias
5180
5357
  });
5181
- if (config.source.alias && (logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.alias"')} config is deprecated, use ${color.yellow('"resolve.alias"')} instead.`), mergedAlias = reduceConfigs({
5358
+ if (config.source.alias && (src_logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.alias"')} config is deprecated, use ${color.yellow('"resolve.alias"')} instead.`), mergedAlias = reduceConfigs({
5182
5359
  initial: mergedAlias,
5183
5360
  config: config.source.alias
5184
5361
  })), config.resolve.dedupe) for (let pkgName of config.resolve.dedupe){
5185
5362
  let pkgPath;
5186
5363
  if (mergedAlias[pkgName]) {
5187
- logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is already in the alias config, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
5364
+ src_logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is already in the alias config, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
5188
5365
  continue;
5189
5366
  }
5190
5367
  try {
@@ -5206,7 +5383,7 @@ function applyAlias({ chain, config, rootPath }) {
5206
5383
  ].join(external_node_path_.sep);
5207
5384
  for(; !pkgPath.endsWith(trailing) && pkgPath.includes('node_modules');)pkgPath = (0, external_node_path_.dirname)(pkgPath);
5208
5385
  } catch {
5209
- logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is not resolved in the project, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
5386
+ src_logger.debug(`${color.dim('[rsbuild:resolve]')} The package ${color.yellow(pkgName)} is not resolved in the project, dedupe option for ${color.yellow(pkgName)} will be ignored.`);
5210
5387
  continue;
5211
5388
  }
5212
5389
  mergedAlias[pkgName] = pkgPath;
@@ -5775,7 +5952,7 @@ function createMiddleware(context, ready, outputFileSystem) {
5775
5952
  let resolved = await getFileFromUrl(req.url, outputFileSystem, context);
5776
5953
  if (!resolved) return void await goNext();
5777
5954
  if ('errorCode' in resolved) {
5778
- 403 === resolved.errorCode ? logger.error(`[rsbuild:middleware] Malicious path "${req.url}".`) : 400 === resolved.errorCode && logger.error(`[rsbuild:middleware] Invalid pathname "${req.url}".`), sendError(res, resolved.errorCode);
5955
+ 403 === resolved.errorCode ? src_logger.error(`[rsbuild:middleware] Malicious path "${req.url}".`) : 400 === resolved.errorCode && src_logger.error(`[rsbuild:middleware] Invalid pathname "${req.url}".`), sendError(res, resolved.errorCode);
5779
5956
  return;
5780
5957
  }
5781
5958
  let { fsStats, filename } = resolved, { size } = fsStats, len = size, offset = 0;
@@ -5802,10 +5979,10 @@ function createMiddleware(context, ready, outputFileSystem) {
5802
5979
  if (rangeHeader) {
5803
5980
  let parsedRanges = await parseRangeHeaders(`${size}|${rangeHeader}`);
5804
5981
  if (isRangeFresh() || (parsedRanges = []), -1 === parsedRanges) {
5805
- logger.error("[rsbuild:middleware] Unsatisfiable range for 'Range' header."), res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size)), sendError(res, 416);
5982
+ src_logger.error("[rsbuild:middleware] Unsatisfiable range for 'Range' header."), res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size)), sendError(res, 416);
5806
5983
  return;
5807
5984
  }
5808
- -2 === parsedRanges ? logger.error("[rsbuild:middleware] A malformed 'Range' header was provided. A regular response will be sent for this request.") : parsedRanges.length > 1 && logger.error("[rsbuild:middleware] A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request."), -2 !== parsedRanges && 1 === parsedRanges.length && (res.statusCode = 206, res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size, parsedRanges[0])), [offset, len] = getOffsetAndLenFromRange(parsedRanges[0]));
5985
+ -2 === parsedRanges ? src_logger.error("[rsbuild:middleware] A malformed 'Range' header was provided. A regular response will be sent for this request.") : parsedRanges.length > 1 && src_logger.error("[rsbuild:middleware] A 'Range' header with multiple ranges was provided. Multiple ranges are not supported, so a regular response will be sent for this request."), -2 !== parsedRanges && 1 === parsedRanges.length && (res.statusCode = 206, res.setHeader('Content-Range', getValueContentRangeHeader('bytes', size, parsedRanges[0])), [offset, len] = getOffsetAndLenFromRange(parsedRanges[0]));
5809
5986
  }
5810
5987
  let [start, end] = calcStartAndEnd(offset, len);
5811
5988
  try {
@@ -5854,12 +6031,12 @@ function setupWriteToDisk(compilers, writeToDisk) {
5854
6031
  recursive: !0
5855
6032
  }, (mkdirError)=>{
5856
6033
  if (mkdirError) {
5857
- logger.error(`[rsbuild:middleware] ${name}Unable to write "${dir}" directory to disk:\n${mkdirError.message}`), callback(mkdirError);
6034
+ src_logger.error(`[rsbuild:middleware] ${name}Unable to write "${dir}" directory to disk:\n${mkdirError.message}`), callback(mkdirError);
5858
6035
  return;
5859
6036
  }
5860
6037
  node_fs.writeFile(targetPath, content, (writeFileError)=>{
5861
6038
  if (writeFileError) {
5862
- logger.error(`[rsbuild:middleware] ${name}Unable to write "${targetPath}" asset to disk:\n${writeFileError.message}`), callback(writeFileError);
6039
+ src_logger.error(`[rsbuild:middleware] ${name}Unable to write "${targetPath}" asset to disk:\n${writeFileError.message}`), callback(writeFileError);
5863
6040
  return;
5864
6041
  }
5865
6042
  callback();
@@ -5973,7 +6150,7 @@ let assets_middleware_assetsMiddleware = async ({ config, compiler, context, soc
5973
6150
  else {
5974
6151
  let watchOptions = compilers.length > 1 ? compilers.map(({ options })=>options.watchOptions || {}) : compilers[0].options.watchOptions || {};
5975
6152
  watching = compiler.watch(watchOptions, (error)=>{
5976
- error && (error.message?.includes('× Error:') && (error.message = error.message.replace('× Error:', '').trim()), logger.error(error));
6153
+ error && (error.message?.includes('× Error:') && (error.message = error.message.replace('× Error:', '').trim()), src_logger.error(error));
5977
6154
  });
5978
6155
  }
5979
6156
  }, instance.close = (callback = noop)=>{
@@ -6067,7 +6244,7 @@ let parseFrame = async (frame, fs, context)=>{
6067
6244
  originalPosition: getOriginalPosition(sourceMap.toString(), lineNumber ?? 0, column ?? 0)
6068
6245
  };
6069
6246
  } catch (error) {
6070
- error instanceof Error && logger.debug(`failed to map source map position: ${error.message}`);
6247
+ error instanceof Error && src_logger.debug(`failed to map source map position: ${error.message}`);
6071
6248
  }
6072
6249
  }, resolveOriginalLocation = async (stack, fs, context)=>{
6073
6250
  let parsed = stack_trace_parser_esm_parse(stack);
@@ -6184,141 +6361,6 @@ function convertLinksInHtml(text, root) {
6184
6361
  return replacedLine.replace(URL_RE, (url)=>`<a class="url-link" href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
6185
6362
  }).join('\n');
6186
6363
  }
6187
- function genOverlayHTML(errors, root) {
6188
- let htmlItems = errors.map((item)=>convertLinksInHtml(ansiHTML(escapeHtml(item)), root));
6189
- return `
6190
- <style>
6191
- .root {
6192
- position: fixed;
6193
- z-index: 9999;
6194
- top: 0;
6195
- left: 0;
6196
- width: 100%;
6197
- height: 100%;
6198
- overflow-y: scroll;
6199
- margin: 0;
6200
- background: rgba(0, 0, 0, 0.66);
6201
- cursor: pointer;
6202
- }
6203
- .container {
6204
- font-family: Menlo, Consolas, monospace;
6205
- line-height: 1.6;
6206
- width: 960px;
6207
- max-width: 85%;
6208
- color: #d8d8d8;
6209
- margin: 32px auto;
6210
- padding: 32px 40px;
6211
- position: relative;
6212
- background: #181818;
6213
- border-radius: 24px;
6214
- box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
6215
- overflow: hidden;
6216
- direction: ltr;
6217
- text-align: left;
6218
- box-sizing: border-box;
6219
- cursor: default;
6220
- }
6221
- .title {
6222
- margin: 0 0 20px;
6223
- padding-bottom: 12px;
6224
- font-size: 17px;
6225
- font-weight: 600;
6226
- color: #fb6a6a;
6227
- border-bottom: 2px solid rgba(252,94,94,.66);
6228
- }
6229
- .content {
6230
- margin: 0;
6231
- font-size: 14px;
6232
- font-family: inherit;
6233
- white-space: pre-wrap;
6234
- word-break: break-all;
6235
- scrollbar-width: none;
6236
- }
6237
- .content::-webkit-scrollbar {
6238
- display: none;
6239
- }
6240
- .file-link,
6241
- .url-link,
6242
- .config-link {
6243
- cursor: pointer;
6244
- text-decoration: underline;
6245
- text-underline-offset: 3px;
6246
- &:hover {
6247
- opacity: 0.8;
6248
- }
6249
- &:active {
6250
- opacity: 0.6;
6251
- }
6252
- }
6253
- .file-link {
6254
- color: #6eecf7;
6255
- }
6256
- .url-link {
6257
- color: #eff986;
6258
- }
6259
- .config-link {
6260
- color: inherit;
6261
- text-decoration: none;
6262
- }
6263
- .close {
6264
- position: absolute;
6265
- top: 27px;
6266
- right: 32px;
6267
- width: 32px;
6268
- height: 32px;
6269
- cursor: pointer;
6270
- }
6271
- .close:hover {
6272
- opacity: 0.8;
6273
- }
6274
- .close:active {
6275
- opacity: 0.6;
6276
- }
6277
- .close:before,
6278
- .close:after {
6279
- position: absolute;
6280
- left: 16px;
6281
- top: 8px;
6282
- content: ' ';
6283
- height: 18px;
6284
- width: 2px;
6285
- border-radius: 4px;
6286
- background-color: #b8b8b8;
6287
- }
6288
- .close:before {
6289
- transform: rotate(45deg);
6290
- }
6291
- .close:after {
6292
- transform: rotate(-45deg);
6293
- }
6294
- .footer {
6295
- font-size: 12px;
6296
- color: #7e6a92;
6297
- margin-top: 20px;
6298
- padding-top: 12px;
6299
- border-top: 2px solid rgba(126,106,146,.6);
6300
- }
6301
- .footer p {
6302
- margin: 4px 0 0;
6303
- }
6304
- .footer span {
6305
- color: #a88dc3;
6306
- }
6307
- </style>
6308
-
6309
- <div class="root">
6310
- <div class="container">
6311
- <div class="close"></div>
6312
- <p class="title">Build failed</p>
6313
- <pre class="content">${htmlItems.join('\n\n').trim()}</pre>
6314
- <footer class="footer">
6315
- <p><span>Fix error</span>, click outside, or press Esc to close the overlay.</p>
6316
- <p>Disable overlay by setting Rsbuild's <span><a class="config-link" target="_blank" rel="noopener noreferrer" href="https://rsbuild.rs/config/dev/client">dev.client.overlay</a></span> config to false.<p>
6317
- </footer>
6318
- </div>
6319
- </div>
6320
- `;
6321
- }
6322
6364
  function isEqualSet(a, b) {
6323
6365
  return a.size === b.size && [
6324
6366
  ...a
@@ -6362,7 +6404,7 @@ class SocketServer {
6362
6404
  noServer: !0,
6363
6405
  path: this.options.client?.path
6364
6406
  }), this.wsServer.on('error', (err)=>{
6365
- logger.error(err);
6407
+ src_logger.error(err);
6366
6408
  }), this.heartbeatTimer = setTimeout(this.checkSockets, 30000).unref(), this.wsServer.on('connection', (socket, req)=>{
6367
6409
  let query = parseQueryString(req);
6368
6410
  this.onConnect(socket, query.token);
@@ -6374,12 +6416,12 @@ class SocketServer {
6374
6416
  });
6375
6417
  }
6376
6418
  sendError(errors, token) {
6377
- let formattedErrors = errors.map((item)=>formatStatsError(item, this.context.rootPath));
6419
+ let { rootPath } = this.context, formattedErrors = errors.map((item)=>formatStatsError(item, rootPath)), html = formattedErrors.map((error)=>convertLinksInHtml(ansiHTML(escapeHtml(error)), rootPath)).join('\n\n').trim();
6378
6420
  this.sockWrite({
6379
6421
  type: 'errors',
6380
6422
  data: {
6381
6423
  text: formattedErrors,
6382
- html: genOverlayHTML(formattedErrors, this.context.rootPath)
6424
+ html
6383
6425
  }
6384
6426
  }, token);
6385
6427
  }
@@ -6417,12 +6459,18 @@ class SocketServer {
6417
6459
  socket.isAlive = !0;
6418
6460
  }), socket.on('message', async (data)=>{
6419
6461
  try {
6420
- let message = JSON.parse('string' == typeof data ? data : data.toString()), config = this.context.normalizedConfig;
6462
+ let message = JSON.parse('string' == typeof data ? data : data.toString()), { context } = this, config = context.normalizedConfig;
6421
6463
  if (!config) return;
6422
- let { browserLogs } = config.dev;
6423
- if ('client-error' === message.type && 'rspack' === this.context.bundlerType && !this.context.buildState.hasErrors && browserLogs) {
6424
- let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, log = await formatBrowserErrorLog(message, this.context, this.getOutputFileSystem(), stackTrace);
6425
- this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), logger.error(log));
6464
+ let { browserLogs, client } = config.dev;
6465
+ if ('client-error' === message.type && 'rspack' === context.bundlerType && !context.buildState.hasErrors && browserLogs) {
6466
+ let stackTrace = isObject(browserLogs) && browserLogs.stackTrace || DEFAULT_STACK_TRACE, log = await formatBrowserErrorLog(message, context, this.getOutputFileSystem(), stackTrace);
6467
+ this.reportedBrowserLogs.has(log) || (this.reportedBrowserLogs.add(log), src_logger.error(log)), 'object' == typeof client.overlay && client.overlay.runtime && this.sockWrite({
6468
+ type: 'resolved-client-error',
6469
+ data: {
6470
+ id: message.id,
6471
+ message: convertLinksInHtml(ansiHTML(escapeHtml(log)), void 0)
6472
+ }
6473
+ }, token);
6426
6474
  }
6427
6475
  } catch {}
6428
6476
  });
@@ -6559,7 +6607,7 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
6559
6607
  }
6560
6608
  ].filter(Boolean);
6561
6609
  if (customShortcuts && !Array.isArray(shortcuts = customShortcuts(shortcuts))) throw Error(`${color.dim('[rsbuild:config]')} ${color.yellow('dev.cliShortcuts')} option must return an array of shortcuts.`);
6562
- help && logger.log(!0 === help ? ` ➜ ${color.dim('press')} ${color.bold('h + enter')} ${color.dim('to show shortcuts')}\n` : ` ➜ ${help}\n`);
6610
+ help && src_logger.log(!0 === help ? ` ➜ ${color.dim('press')} ${color.bold('h + enter')} ${color.dim('to show shortcuts')}\n` : ` ➜ ${help}\n`);
6563
6611
  let { createInterface } = await import("node:readline"), rl = createInterface({
6564
6612
  input: process.stdin
6565
6613
  });
@@ -6567,7 +6615,7 @@ async function setupCliShortcuts({ help = !0, openPage, closeServer, printUrls,
6567
6615
  if ('h' === input) {
6568
6616
  let message = `\n ${color.bold(color.blue('Shortcuts:'))}\n`;
6569
6617
  for (let shortcut of shortcuts)message += ` ${shortcut.description}\n`;
6570
- logger.log(message);
6618
+ src_logger.log(message);
6571
6619
  }
6572
6620
  for (let shortcut of shortcuts)if (input === shortcut.key) return void shortcut.action();
6573
6621
  }), ()=>{
@@ -6613,15 +6661,15 @@ function historyApiFallback_historyApiFallbackMiddleware(options = {}) {
6613
6661
  let rewriteTarget, { headers } = req;
6614
6662
  if (!req.url) return void next();
6615
6663
  if ('GET' !== req.method && 'HEAD' !== req.method) {
6616
- logger.debug('Not rewriting', req.method, req.url, 'because the method is not GET or HEAD.'), next();
6664
+ src_logger.debug('Not rewriting', req.method, req.url, 'because the method is not GET or HEAD.'), next();
6617
6665
  return;
6618
6666
  }
6619
6667
  if (!headers || 'string' != typeof headers.accept) {
6620
- logger.debug('Not rewriting', req.method, req.url, 'because the client did not send an HTTP accept header.'), next();
6668
+ src_logger.debug('Not rewriting', req.method, req.url, 'because the client did not send an HTTP accept header.'), next();
6621
6669
  return;
6622
6670
  }
6623
6671
  if (0 === headers.accept.indexOf('application/json')) {
6624
- logger.debug('Not rewriting', req.method, req.url, 'because the client prefers JSON.'), next();
6672
+ src_logger.debug('Not rewriting', req.method, req.url, 'because the client prefers JSON.'), next();
6625
6673
  return;
6626
6674
  }
6627
6675
  let rewrites = options.rewrites || [], htmlAcceptHeaders = options.htmlAcceptHeaders || [
@@ -6629,7 +6677,7 @@ function historyApiFallback_historyApiFallbackMiddleware(options = {}) {
6629
6677
  '*/*'
6630
6678
  ], { accept } = headers;
6631
6679
  if (!htmlAcceptHeaders.some((item)=>accept.includes(item))) {
6632
- logger.debug('Not rewriting', req.method, req.url, 'because the client does not accept HTML.'), next();
6680
+ src_logger.debug('Not rewriting', req.method, req.url, 'because the client does not accept HTML.'), next();
6633
6681
  return;
6634
6682
  }
6635
6683
  let parsedUrl = parseReqUrl(req);
@@ -6642,16 +6690,16 @@ function historyApiFallback_historyApiFallbackMiddleware(options = {}) {
6642
6690
  parsedUrl,
6643
6691
  match,
6644
6692
  request: req
6645
- })).charAt(0) && logger.debug('We recommend using an absolute path for the rewrite target.', 'Received a non-absolute rewrite target', rewriteTarget, 'for URL', req.url), logger.debug('Rewriting', req.method, req.url, 'to', rewriteTarget), req.url = rewriteTarget, next();
6693
+ })).charAt(0) && src_logger.debug('We recommend using an absolute path for the rewrite target.', 'Received a non-absolute rewrite target', rewriteTarget, 'for URL', req.url), src_logger.debug('Rewriting', req.method, req.url, 'to', rewriteTarget), req.url = rewriteTarget, next();
6646
6694
  return;
6647
6695
  }
6648
6696
  let { pathname } = parsedUrl;
6649
6697
  if (pathname && pathname.lastIndexOf('.') > pathname.lastIndexOf('/') && !0 !== options.disableDotRule) {
6650
- logger.debug('Not rewriting', req.method, req.url, 'because the path includes a dot (.) character.'), next();
6698
+ src_logger.debug('Not rewriting', req.method, req.url, 'because the path includes a dot (.) character.'), next();
6651
6699
  return;
6652
6700
  }
6653
6701
  let index = options.index || '/index.html';
6654
- logger.debug('Rewriting', req.method, req.url, 'to', index), req.url = index, next();
6702
+ src_logger.debug('Rewriting', req.method, req.url, 'to', index), req.url = index, next();
6655
6703
  };
6656
6704
  }
6657
6705
  function parseReqUrl(req) {
@@ -6669,7 +6717,7 @@ let faviconFallbackMiddleware = (req, res, next)=>{
6669
6717
  let _startAt = process.hrtime();
6670
6718
  on_finished_default()(res, ()=>{
6671
6719
  let method = req.method, url = req.originalUrl || req.url, status = Number(res.statusCode), statusColor = status >= 500 ? color.red : status >= 400 ? color.yellow : status >= 300 ? color.cyan : status >= 200 ? color.green : (res)=>res, endAt = process.hrtime(), totalTime = (endAt[0] - _startAt[0]) * 1e3 + (endAt[1] - _startAt[1]) * 1e-6;
6672
- logger.debug(`${statusColor(status)} ${method} ${url} ${color.dim(`${totalTime.toFixed(3)} ms`)}`);
6720
+ src_logger.debug(`${statusColor(status)} ${method} ${url} ${color.dim(`${totalTime.toFixed(3)} ms`)}`);
6673
6721
  }), next();
6674
6722
  };
6675
6723
  }, notFoundMiddleware = (_req, res, _next)=>{
@@ -6720,7 +6768,7 @@ function formatProxyOptions(proxyOptions) {
6720
6768
  context,
6721
6769
  changeOrigin: !0,
6722
6770
  logLevel: 'warn',
6723
- logProvider: ()=>logger
6771
+ logProvider: ()=>src_logger
6724
6772
  };
6725
6773
  'string' == typeof options ? opts.target = options : Object.assign(opts, options), ret.push(opts);
6726
6774
  }
@@ -7079,7 +7127,7 @@ async function startWatchFiles({ paths, options, type = 'reload-page' }, buildMa
7079
7127
  }
7080
7128
  async function devServer_createDevServer(options, createCompiler, config, { compiler: customCompiler, getPortSilently, runCompile = !0 } = {}) {
7081
7129
  let lastStats, fileWatcher, devMiddlewares;
7082
- logger.debug('create dev server');
7130
+ src_logger.debug('create dev server');
7083
7131
  let { port, host, https, portTip } = await getServerConfig({
7084
7132
  config
7085
7133
  }), { middlewareMode } = config.server, { context } = options, routes = getRoutes(context), root = context.rootPath;
@@ -7152,7 +7200,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7152
7200
  });
7153
7201
  context.hooks.onCloseDevServer.tap(cleanup);
7154
7202
  }
7155
- !getPortSilently && portTip && logger.info(portTip);
7203
+ !getPortSilently && portTip && src_logger.info(portTip);
7156
7204
  }, cacheableLoadBundle = createCacheableFunction(loadBundle), cacheableTransformedHtml = createCacheableFunction((_stats, entryName, utils)=>((entryName, utils)=>{
7157
7205
  let { htmlPaths, distPath } = utils.environment, htmlPath = htmlPaths[entryName];
7158
7206
  if (!htmlPath) throw Error(`${color.dim('[rsbuild:getTransformedHtml]')} Failed to get HTML file by entryName: ${color.yellow(entryName)}`);
@@ -7197,13 +7245,13 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7197
7245
  listen: async ()=>{
7198
7246
  if (!httpServer) throw Error(`${color.dim('[rsbuild:server]')} Can not listen dev server as ${color.yellow('server.middlewareMode')} is enabled.`);
7199
7247
  let serverTerminator = getServerTerminator(httpServer);
7200
- return logger.debug('listen dev server'), context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
7248
+ return src_logger.debug('listen dev server'), context.hooks.onCloseDevServer.tap(serverTerminator), new Promise((resolve)=>{
7201
7249
  httpServer.listen({
7202
7250
  host,
7203
7251
  port
7204
7252
  }, async (err)=>{
7205
7253
  if (err) throw err;
7206
- middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
7254
+ middlewares.use(optionsFallbackMiddleware), middlewares.use(notFoundMiddleware), devMiddlewares && httpServer.on('upgrade', devMiddlewares.onUpgrade), src_logger.debug('listen dev server done'), await devServerAPI.afterListen(), onBeforeRestartServer(devServerAPI.close), resolve({
7207
7255
  port,
7208
7256
  urls: urls.map((item)=>item.url),
7209
7257
  server: {
@@ -7238,7 +7286,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7238
7286
  root
7239
7287
  }), (devMiddlewares = ((options)=>{
7240
7288
  let middlewares = [], { buildManager } = options;
7241
- 'verbose' === logger.level && middlewares.push(getRequestLoggerMiddleware());
7289
+ 'verbose' === src_logger.level && middlewares.push(getRequestLoggerMiddleware());
7242
7290
  let { before, after } = ((config, devServerAPI)=>{
7243
7291
  let setupMiddlewares = config.dev.setupMiddlewares || [], serverOptions = pick(devServerAPI, [
7244
7292
  'sockWrite',
@@ -7336,7 +7384,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7336
7384
  }
7337
7385
  res.end('</body></html>');
7338
7386
  } catch (err) {
7339
- logger.error(err), res.writeHead(500), res.end('Failed to list the files');
7387
+ src_logger.error(err), res.writeHead(500), res.end('Failed to list the files');
7340
7388
  }
7341
7389
  })({
7342
7390
  environments: devServerAPI.environments
@@ -7375,7 +7423,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7375
7423
  let filePath = external_node_path_.default.join(distPath, 'index.html');
7376
7424
  if (await middlewares_isFileExists(filePath, buildManager.outputFileSystem)) {
7377
7425
  let newUrl = '/index.html';
7378
- 'verbose' === logger.level && logger.debug(` ${req.method} ${req.url} ${color.yellow('fallback to')} ${newUrl}`), req.url = newUrl, buildManager.assetsMiddleware(req, res, (...args)=>{
7426
+ 'verbose' === src_logger.level && src_logger.debug(` ${req.method} ${req.url} ${color.yellow('fallback to')} ${newUrl}`), req.url = newUrl, buildManager.assetsMiddleware(req, res, (...args)=>{
7379
7427
  next(...args);
7380
7428
  });
7381
7429
  return;
@@ -7408,7 +7456,7 @@ async function devServer_createDevServer(options, createCompiler, config, { comp
7408
7456
  context,
7409
7457
  postCallbacks
7410
7458
  })).middlewares))Array.isArray(item) ? middlewares.use(...item) : middlewares.use(item);
7411
- return buildManager?.watch(), logger.debug('create dev server done'), devServerAPI;
7459
+ return buildManager?.watch(), src_logger.debug('create dev server done'), devServerAPI;
7412
7460
  }
7413
7461
  let rspackProvider = ({ context, pluginManager, rsbuildOptions })=>{
7414
7462
  let createCompiler = async ()=>(await createCompiler_createCompiler({
@@ -7487,7 +7535,7 @@ class RsbuildProdServer {
7487
7535
  }
7488
7536
  async applyDefaultMiddlewares() {
7489
7537
  let { headers, proxy, historyApiFallback, compress, base, cors } = this.options.serverConfig;
7490
- if ('verbose' === logger.level && this.middlewares.use(getRequestLoggerMiddleware()), cors) {
7538
+ if ('verbose' === src_logger.level && this.middlewares.use(getRequestLoggerMiddleware()), cors) {
7491
7539
  let corsMiddleware = requireCompiledPackage('cors');
7492
7540
  this.middlewares.use(corsMiddleware('boolean' == typeof cors ? {} : cors));
7493
7541
  }
@@ -7590,7 +7638,7 @@ async function startProdServer(context, config, { getPortSilently } = {}) {
7590
7638
  customShortcuts: shortcutsOptions.custom
7591
7639
  });
7592
7640
  }
7593
- !getPortSilently && portTip && logger.info(portTip), resolve({
7641
+ !getPortSilently && portTip && src_logger.info(portTip), resolve({
7594
7642
  port,
7595
7643
  urls: urls.map((item)=>item.url),
7596
7644
  server: {
@@ -7605,7 +7653,7 @@ function applyDefaultPlugins(pluginManager, context) {
7605
7653
  {
7606
7654
  name: 'rsbuild:basic',
7607
7655
  setup (api) {
7608
- api.modifyBundlerChain((chain, { isDev, isProd, target, bundler, environment, CHAIN_ID })=>{
7656
+ api.modifyBundlerChain((chain, { isDev, target, bundler, environment, CHAIN_ID })=>{
7609
7657
  let { config } = environment;
7610
7658
  chain.name(environment.name), chain.context(api.context.rootPath), chain.mode(environment.config.mode), chain.infrastructureLogging({
7611
7659
  level: 'error'
@@ -7619,7 +7667,7 @@ function applyDefaultPlugins(pluginManager, context) {
7619
7667
  javascript: {
7620
7668
  typeReexportsPresence: 'tolerant'
7621
7669
  }
7622
- }), chain.optimization.inlineExports(isProd), chain.experiments({
7670
+ }), chain.experiments({
7623
7671
  ...chain.get('experiments'),
7624
7672
  rspackFuture: {
7625
7673
  bundlerInfo: {
@@ -7660,39 +7708,20 @@ function applyDefaultPlugins(pluginManager, context) {
7660
7708
  {
7661
7709
  name: 'rsbuild:source-map',
7662
7710
  setup (api) {
7663
- let DEFAULT_SOURCE_MAP_TEMPLATE = '[absolute-resource-path]', enableCssSourceMap = (config)=>{
7664
- let { sourceMap } = config.output;
7665
- return 'object' == typeof sourceMap && sourceMap.css;
7666
- };
7667
7711
  api.modifyBundlerChain((chain, { bundler, environment, isDev, target })=>{
7668
7712
  let { config } = environment, devtool = ((config)=>{
7669
7713
  let { sourceMap } = config.output, isProd = 'production' === config.mode;
7670
7714
  return !1 !== sourceMap && (!0 === sourceMap ? isProd ? 'source-map' : 'cheap-module-source-map' : void 0 === sourceMap.js ? !isProd && 'cheap-module-source-map' : sourceMap.js);
7671
7715
  })(config);
7672
- chain.devtool(devtool), isDev && 'web' === target ? chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)) : chain.output.devtoolModuleFilenameTemplate(DEFAULT_SOURCE_MAP_TEMPLATE), !devtool && enableCssSourceMap(config) && chain.plugin('source-map-css').use(bundler.SourceMapDevToolPlugin, [
7716
+ chain.devtool(devtool), isDev && 'web' === target || 'webpack' === api.context.bundlerType ? chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)) : chain.output.devtoolModuleFilenameTemplate('[relative-resource-path]'), !devtool && ((config)=>{
7717
+ let { sourceMap } = config.output;
7718
+ return 'object' == typeof sourceMap && sourceMap.css;
7719
+ })(config) && chain.plugin('source-map-css').use(bundler.SourceMapDevToolPlugin, [
7673
7720
  {
7674
7721
  test: /\.css$/,
7675
7722
  filename: '[file].map[query]'
7676
7723
  }
7677
7724
  ]);
7678
- }), api.processAssets({
7679
- stage: 'optimize-transfer'
7680
- }, ({ assets, compilation, sources, environment })=>{
7681
- if (!compilation.options.devtool && !enableCssSourceMap(environment.config) || compilation.outputOptions.devtoolModuleFilenameTemplate !== DEFAULT_SOURCE_MAP_TEMPLATE) return;
7682
- let { distPath } = environment;
7683
- for (let [filename, asset] of Object.entries(assets)){
7684
- let map;
7685
- if (!filename.endsWith('.map')) continue;
7686
- let rawSource = asset.source();
7687
- try {
7688
- map = JSON.parse(Buffer.isBuffer(rawSource) ? rawSource.toString() : rawSource);
7689
- } catch {
7690
- continue;
7691
- }
7692
- if (!Array.isArray(map.sources)) continue;
7693
- let mapDir = external_node_path_.default.dirname(external_node_path_.default.join(distPath, filename)), isSourcesUpdated = !1;
7694
- map.sources = map.sources.map((source)=>external_node_path_.default.isAbsolute(source) ? (isSourcesUpdated = !0, toPosixPath(external_node_path_.default.relative(mapDir, source))) : source), isSourcesUpdated && compilation.updateAsset(filename, new sources.RawSource(JSON.stringify(map)));
7695
- }
7696
7725
  });
7697
7726
  }
7698
7727
  },
@@ -7725,7 +7754,7 @@ function applyDefaultPlugins(pluginManager, context) {
7725
7754
  buildDependencies
7726
7755
  });
7727
7756
  }), api.onAfterCreateCompiler(()=>{
7728
- cacheEnabled && 'rspack' === api.context.bundlerType && logger.debug('Rspack persistent cache enabled');
7757
+ cacheEnabled && 'rspack' === api.context.bundlerType && src_logger.debug('Rspack persistent cache enabled');
7729
7758
  });
7730
7759
  }
7731
7760
  },
@@ -7807,7 +7836,7 @@ function applyDefaultPlugins(pluginManager, context) {
7807
7836
  chain,
7808
7837
  config,
7809
7838
  rootPath: api.context.rootPath
7810
- }), chain.module.rule(CHAIN_ID.RULE.MJS).test(/\.m?js/).resolve.set('fullySpecified', !1), config.source.aliasStrategy && logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.aliasStrategy"')} config is deprecated, use ${color.yellow('"resolve.aliasStrategy"')} instead.`);
7839
+ }), chain.module.rule(CHAIN_ID.RULE.MJS).test(/\.m?js/).resolve.set('fullySpecified', !1), config.source.aliasStrategy && src_logger.warn(`${color.dim('[rsbuild:config]')} The ${color.yellow('"source.aliasStrategy"')} config is deprecated, use ${color.yellow('"resolve.aliasStrategy"')} instead.`);
7811
7840
  let aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
7812
7841
  tsconfigPath && 'rspack' === api.context.bundlerType && 'prefer-tsconfig' === aliasStrategy && chain.resolve.tsConfig({
7813
7842
  configFile: tsconfigPath,
@@ -7843,9 +7872,9 @@ function applyDefaultPlugins(pluginManager, context) {
7843
7872
  })(config), statsItem, api.context.rootPath, distPath, name, prevSnapshots);
7844
7873
  return snapshot && (nextSnapshots[name] = snapshot), sizeLogs.join('\n');
7845
7874
  })).catch((err)=>{
7846
- logger.warn('Failed to print file size.'), logger.warn(err);
7875
+ src_logger.warn('Failed to print file size.'), src_logger.warn(err);
7847
7876
  });
7848
- logs && logger.log(logs.join('\n')), showDiff && await saveSnapshots(snapshotPath, nextSnapshots);
7877
+ logs && src_logger.log(logs.join('\n')), showDiff && await saveSnapshots(snapshotPath, nextSnapshots);
7849
7878
  });
7850
7879
  }
7851
7880
  },
@@ -7859,7 +7888,7 @@ function applyDefaultPlugins(pluginManager, context) {
7859
7888
  return 'auto' === enable ? isDev && !config.dev.writeToDisk ? void 0 : isStrictSubdir(rootPath, distPath) ? {
7860
7889
  path: distPath,
7861
7890
  keep
7862
- } : (logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), logger.warn(`Please set ${color.yellow('`output.cleanDistPath`')} config manually.`), logger.warn(`Current root path: ${color.dim(rootPath)}`), void logger.warn(`Current dist path: ${color.dim(distPath)}`)) : !0 === enable ? {
7891
+ } : (src_logger.warn('The dist path is not a subdir of root path, Rsbuild will not empty it.'), src_logger.warn(`Please set ${color.yellow('`output.cleanDistPath`')} config manually.`), src_logger.warn(`Current root path: ${color.dim(rootPath)}`), void src_logger.warn(`Current dist path: ${color.dim(distPath)}`)) : !0 === enable ? {
7863
7892
  path: distPath,
7864
7893
  keep
7865
7894
  } : void 0;
@@ -8459,7 +8488,7 @@ try {
8459
8488
  ...chain.output.get('library'),
8460
8489
  type: 'module'
8461
8490
  }), 'web-worker' === target) throw Error('[rsbuild:config] `output.module` is not supported for web-worker target.');
8462
- chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import'), chain.experiments({
8491
+ chain.node.set('__dirname', !1).set('__filename', !1), chain.output.module(!0).chunkFormat('module').chunkLoading('import').workerChunkLoading('import'), chain.experiments({
8463
8492
  ...chain.get('experiments'),
8464
8493
  outputModule: !0
8465
8494
  });
@@ -8587,19 +8616,19 @@ try {
8587
8616
  ]
8588
8617
  });
8589
8618
  } catch {
8590
- logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow(packageName))} package.`);
8619
+ src_logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow(packageName))} package.`);
8591
8620
  return;
8592
8621
  }
8593
8622
  try {
8594
8623
  let moduleURL = isWindows ? (0, external_node_url_.pathToFileURL)(packagePath).href : packagePath;
8595
8624
  module = await import(moduleURL);
8596
8625
  } catch {
8597
- logger.error(`\`process.env.RSDOCTOR\` enabled, but failed to load ${color.bold(color.yellow(packageName))} module.`);
8626
+ src_logger.error(`\`process.env.RSDOCTOR\` enabled, but failed to load ${color.bold(color.yellow(packageName))} module.`);
8598
8627
  return;
8599
8628
  }
8600
8629
  if (module && module[pluginName]) {
8601
8630
  for (let config of bundlerConfigs)config.plugins ||= [], config.plugins.push(new module[pluginName]());
8602
- logger.info(`${color.bold(color.yellow(packageName))} enabled.`);
8631
+ src_logger.info(`${color.bold(color.yellow(packageName))} enabled.`);
8603
8632
  }
8604
8633
  });
8605
8634
  }
@@ -8798,7 +8827,7 @@ try {
8798
8827
  }), api.onAfterCreateCompiler(()=>{
8799
8828
  if (manifestFilenames.size <= 1) return void manifestFilenames.clear();
8800
8829
  let environmentNames = Array.from(manifestFilenames.keys()), filenames = Array.from(manifestFilenames.values());
8801
- new Set(filenames).size !== filenames.length && logger.warn(`${color.dim('[rsbuild:manifest]')} The ${color.yellow('"manifest.filename"')} option must be unique when there are multiple environments (${environmentNames.join(', ')}), otherwise the manifest file will be overwritten.`), manifestFilenames.clear();
8830
+ new Set(filenames).size !== filenames.length && src_logger.warn(`${color.dim('[rsbuild:manifest]')} The ${color.yellow('"manifest.filename"')} option must be unique when there are multiple environments (${environmentNames.join(', ')}), otherwise the manifest file will be overwritten.`), manifestFilenames.clear();
8802
8831
  });
8803
8832
  }
8804
8833
  },
@@ -8816,7 +8845,7 @@ try {
8816
8845
  api.onBeforeBuild(async ({ isFirstCompile })=>{
8817
8846
  isFirstCompile && await onStart();
8818
8847
  }), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
8819
- traceOutput && (rspack_rspack.experiments.globalTrace.cleanup(), logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
8848
+ traceOutput && (rspack_rspack.experiments.globalTrace.cleanup(), src_logger.info(`profile file saved to ${color.cyan(traceOutput)}`));
8820
8849
  });
8821
8850
  }
8822
8851
  },
@@ -8853,7 +8882,7 @@ try {
8853
8882
  let crossorigin = chain.output.get('crossOriginLoading');
8854
8883
  (!1 === crossorigin || void 0 === crossorigin) && chain.output.crossOriginLoading('anonymous');
8855
8884
  let { algorithm = 'sha384' } = sri;
8856
- chain.plugin(CHAIN_ID.PLUGIN.SUBRESOURCE_INTEGRITY).use(rspack.experiments.SubresourceIntegrityPlugin, [
8885
+ chain.plugin(CHAIN_ID.PLUGIN.SUBRESOURCE_INTEGRITY).use(rspack.SubresourceIntegrityPlugin, [
8857
8886
  {
8858
8887
  enabled: !0,
8859
8888
  hashFuncNames: helpers_castArray(algorithm),
@@ -8916,7 +8945,7 @@ async function createRsbuild(options = {}) {
8916
8945
  cwd: options.cwd,
8917
8946
  ...'boolean' == typeof options.loadEnv ? {} : options.loadEnv
8918
8947
  }) : null, configOrFactory = options.config ?? options.rsbuildConfig, config = isFunction(configOrFactory) ? await configOrFactory() : configOrFactory || {};
8919
- config.logLevel && !isDebug() && (logger.level = config.logLevel), applyEnvsToConfig(config, envs);
8948
+ config.logLevel && !isDebug() && (src_logger.level = config.logLevel), applyEnvsToConfig(config, envs);
8920
8949
  let resolvedOptions = {
8921
8950
  cwd: process.cwd(),
8922
8951
  callerName: 'rsbuild',
@@ -8928,7 +8957,7 @@ async function createRsbuild(options = {}) {
8928
8957
  });
8929
8958
  context.getPluginAPI = getPluginAPI;
8930
8959
  let globalPluginAPI = getPluginAPI();
8931
- logger.debug('registering default plugins'), applyDefaultPlugins(pluginManager, context), logger.debug('default plugins registered');
8960
+ src_logger.debug('registering default plugins'), applyDefaultPlugins(pluginManager, context), src_logger.debug('default plugins registered');
8932
8961
  let provider = config.provider || rspackProvider, providerInstance = await provider({
8933
8962
  context,
8934
8963
  pluginManager,
@@ -9024,7 +9053,7 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9024
9053
  if (customConfig) {
9025
9054
  let customConfigPath = (0, external_node_path_.isAbsolute)(customConfig) ? customConfig : (0, external_node_path_.join)(root, customConfig);
9026
9055
  if (node_fs.existsSync(customConfigPath)) return customConfigPath;
9027
- logger.warn(`Cannot find config file: ${color.dim(customConfigPath)}\n`);
9056
+ src_logger.warn(`Cannot find config file: ${color.dim(customConfigPath)}\n`);
9028
9057
  }
9029
9058
  for (let file of [
9030
9059
  'rsbuild.config.mjs',
@@ -9039,7 +9068,7 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9039
9068
  }
9040
9069
  return null;
9041
9070
  })(cwd, path);
9042
- if (!configFilePath) return logger.debug('no config file found.'), {
9071
+ if (!configFilePath) return src_logger.debug('no config file found.'), {
9043
9072
  content: {},
9044
9073
  filePath: configFilePath
9045
9074
  };
@@ -9051,8 +9080,8 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9051
9080
  configExport = exportModule.default ? exportModule.default : exportModule;
9052
9081
  } catch (err) {
9053
9082
  let errorMessage = `Failed to load file with native loader: ${color.dim(configFilePath)}`;
9054
- if ('native' === loader) throw logger.error(errorMessage), err;
9055
- logger.debug(`${errorMessage}, fallback to jiti.`), logger.debug(err);
9083
+ if ('native' === loader) throw src_logger.error(errorMessage), err;
9084
+ src_logger.debug(`${errorMessage}, fallback to jiti.`), src_logger.debug(err);
9056
9085
  }
9057
9086
  if (void 0 === configExport) try {
9058
9087
  let { createJiti } = await import("jiti"), jiti = createJiti(constants_filename, {
@@ -9067,7 +9096,7 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9067
9096
  default: !0
9068
9097
  });
9069
9098
  } catch (err) {
9070
- throw logger.error(`Failed to load file with jiti: ${color.dim(configFilePath)}`), err;
9099
+ throw src_logger.error(`Failed to load file with jiti: ${color.dim(configFilePath)}`), err;
9071
9100
  }
9072
9101
  if ('function' == typeof configExport) {
9073
9102
  let command = process.argv[2], nodeEnv = process.env.NODE_ENV || '', result = await configExport({
@@ -9083,7 +9112,7 @@ async function loadConfig_loadConfig({ cwd = process.cwd(), path, envMode, meta,
9083
9112
  };
9084
9113
  }
9085
9114
  if (!isObject(configExport)) throw Error(`${color.dim('[rsbuild:loadConfig]')} The config must be an object or a function that returns an object, get ${color.yellow(configExport)}`);
9086
- return logger.debug('configuration loaded from:', configFilePath), {
9115
+ return src_logger.debug('configuration loaded from:', configFilePath), {
9087
9116
  content: applyMetaInfo(configExport),
9088
9117
  filePath: configFilePath
9089
9118
  };
@@ -9136,7 +9165,7 @@ async function init_init({ cliOptions, isRestart, isBuildWatch = !1 }) {
9136
9165
  });
9137
9166
  }), rsbuild;
9138
9167
  } catch (err) {
9139
- if (isRestart) logger.error(err);
9168
+ if (isRestart) src_logger.error(err);
9140
9169
  else throw err;
9141
9170
  }
9142
9171
  }
@@ -9145,8 +9174,8 @@ let cleaners = [], onBeforeRestartServer = (cleaner)=>{
9145
9174
  }, beforeRestart = async ({ filePath, clear = !0, id })=>{
9146
9175
  if (clear && isTTY() && !process.env.DEBUG && process.stdout.write('\x1B[H\x1B[2J'), filePath) {
9147
9176
  let filename = external_node_path_.default.basename(filePath);
9148
- logger.info(`restarting ${id} as ${color.yellow(filename)} changed\n`);
9149
- } else logger.info(`restarting ${id}...\n`);
9177
+ src_logger.info(`restarting ${id} as ${color.yellow(filename)} changed\n`);
9178
+ } else src_logger.info(`restarting ${id}...\n`);
9150
9179
  for (let cleaner of cleaners)await cleaner();
9151
9180
  cleaners = [];
9152
9181
  }, restartDevServer = async ({ filePath, clear = !0 } = {})=>{
@@ -9184,7 +9213,7 @@ async function watchFilesForRestart({ files, rsbuild, isBuildWatch, watchOptions
9184
9213
  filePath
9185
9214
  }) : await restartDevServer({
9186
9215
  filePath
9187
- })) ? await watcher.close() : logger.error(isBuildWatch ? 'Restart build failed.' : 'Restart server failed.'), restarting = !1);
9216
+ })) ? await watcher.close() : src_logger.error(isBuildWatch ? 'Restart build failed.' : 'Restart server failed.'), restarting = !1);
9188
9217
  };
9189
9218
  watcher.on('add', onChange), watcher.on('change', onChange), watcher.on('unlink', onChange);
9190
9219
  }
@@ -9193,7 +9222,7 @@ let applyServerOptions = (command)=>{
9193
9222
  };
9194
9223
  function setupCommands() {
9195
9224
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9196
- cli.version("1.7.0-beta.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)', {
9225
+ cli.version("1.7.0-beta.1"), 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)', {
9197
9226
  default: 'auto'
9198
9227
  }).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', {
9199
9228
  type: [
@@ -9209,7 +9238,7 @@ function setupCommands() {
9209
9238
  });
9210
9239
  await rsbuild?.startDevServer();
9211
9240
  } catch (err) {
9212
- logger.error('Failed to start dev server.'), logger.error(err), process.exit(1);
9241
+ src_logger.error('Failed to start dev server.'), src_logger.error(err), process.exit(1);
9213
9242
  }
9214
9243
  }), buildCommand.option('-w, --watch', 'Enable watch mode to automatically rebuild on file changes').action(async (options)=>{
9215
9244
  try {
@@ -9222,7 +9251,7 @@ function setupCommands() {
9222
9251
  });
9223
9252
  buildInstance && (options.watch ? onBeforeRestartServer(buildInstance.close) : await buildInstance.close());
9224
9253
  } catch (err) {
9225
- err instanceof Error && err.message === RSPACK_BUILD_ERROR || logger.error('Failed to build.'), logger.error(err), process.exit(1);
9254
+ err instanceof Error && err.message === RSPACK_BUILD_ERROR || src_logger.error('Failed to build.'), src_logger.error(err), process.exit(1);
9226
9255
  }
9227
9256
  }), previewCommand.action(async (options)=>{
9228
9257
  try {
@@ -9231,7 +9260,7 @@ function setupCommands() {
9231
9260
  });
9232
9261
  await rsbuild?.preview();
9233
9262
  } catch (err) {
9234
- logger.error('Failed to start preview server.'), logger.error(err), process.exit(1);
9263
+ src_logger.error('Failed to start preview server.'), src_logger.error(err), process.exit(1);
9235
9264
  }
9236
9265
  }), inspectCommand.option('--output <output>', 'Set the output path for inspection results').option('--verbose', 'Show complete function definitions in output').action(async (options)=>{
9237
9266
  try {
@@ -9244,7 +9273,7 @@ function setupCommands() {
9244
9273
  writeToDisk: !0
9245
9274
  });
9246
9275
  } catch (err) {
9247
- logger.error('Failed to inspect config.'), logger.error(err), process.exit(1);
9276
+ src_logger.error('Failed to inspect config.'), src_logger.error(err), process.exit(1);
9248
9277
  }
9249
9278
  }), cli.help((sections)=>{
9250
9279
  for (let section of (sections.shift(), sections))'Usage' === section.title && (section.body = section.body.replace('$ rsbuild', color.yellow("$ rsbuild [command] [options]"))), 'Commands' === section.title && (section.body = section.body.replace(` ${devDescription}`, `dev ${devDescription}`)), section.title?.startsWith('For more info') ? (section.title = color.dim(' For details on a sub-command, run'), section.body = color.dim(' $ rsbuild <command> -h')) : section.title = color.cyan(section.title);
@@ -9262,7 +9291,7 @@ function initNodeEnv() {
9262
9291
  }
9263
9292
  function showGreeting() {
9264
9293
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9265
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.7.0-beta.0\n`);
9294
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.7.0-beta.1\n`);
9266
9295
  }
9267
9296
  function setupLogLevel() {
9268
9297
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9272,7 +9301,7 @@ function setupLogLevel() {
9272
9301
  'warn',
9273
9302
  'error',
9274
9303
  'silent'
9275
- ].includes(level) && !isDebug() && (logger.level = level);
9304
+ ].includes(level) && !isDebug() && (src_logger.level = level);
9276
9305
  }
9277
9306
  }
9278
9307
  function runCLI() {
@@ -9280,12 +9309,8 @@ function runCLI() {
9280
9309
  try {
9281
9310
  setupCommands();
9282
9311
  } catch (err) {
9283
- logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9312
+ src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err);
9284
9313
  }
9285
9314
  }
9286
- let src_version = "1.7.0-beta.0";
9287
- import * as __rspack_external_node_module_ab9f2194 from "node:module";
9288
- import { createRequire as __rspack_createRequire } from "node:module";
9289
- import * as __rspack_external_node_url_e96de089 from "node:url";
9290
- import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
9291
- 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 };
9315
+ let src_version = "1.7.0-beta.1";
9316
+ export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, external_node_util_promisify, loadConfig_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, node_fs, node_os, node_process, rspack_rspack as rspack, runCLI, src_logger as logger, src_version as version };