"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/index.ts
var src_exports = {};
__export(src_exports, {
  AUDIO_EXTENSIONS: () => AUDIO_EXTENSIONS,
  CHAIN_ID: () => CHAIN_ID,
  CSS_DIST_DIR: () => CSS_DIST_DIR,
  CSS_MODULES_REGEX: () => CSS_MODULES_REGEX,
  CSS_REGEX: () => CSS_REGEX,
  DEFAULT_ASSET_PREFIX: () => DEFAULT_ASSET_PREFIX,
  DEFAULT_BROWSERSLIST: () => DEFAULT_BROWSERSLIST,
  DEFAULT_DATA_URL_SIZE: () => DEFAULT_DATA_URL_SIZE,
  DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
  DEFAULT_MOUNT_ID: () => DEFAULT_MOUNT_ID,
  DEFAULT_PORT: () => DEFAULT_PORT,
  FONT_DIST_DIR: () => FONT_DIST_DIR,
  FONT_EXTENSIONS: () => FONT_EXTENSIONS,
  HTML_DIST_DIR: () => HTML_DIST_DIR,
  HTML_REGEX: () => HTML_REGEX,
  IMAGE_DIST_DIR: () => IMAGE_DIST_DIR,
  IMAGE_EXTENSIONS: () => IMAGE_EXTENSIONS,
  JS_DIST_DIR: () => JS_DIST_DIR,
  JS_REGEX: () => JS_REGEX,
  LESS_REGEX: () => LESS_REGEX,
  MEDIA_DIST_DIR: () => MEDIA_DIST_DIR,
  NODE_MODULES_REGEX: () => NODE_MODULES_REGEX,
  ROOT_DIST_DIR: () => ROOT_DIST_DIR,
  SASS_REGEX: () => SASS_REGEX,
  SCRIPT_REGEX: () => SCRIPT_REGEX,
  SERVER_DIST_DIR: () => SERVER_DIST_DIR,
  SERVICE_WORKER_DIST_DIR: () => SERVICE_WORKER_DIST_DIR,
  SVG_DIST_DIR: () => SVG_DIST_DIR,
  SVG_REGEX: () => SVG_REGEX,
  TARGET_ID_MAP: () => TARGET_ID_MAP,
  TS_AND_JSX_REGEX: () => TS_AND_JSX_REGEX,
  TS_CONFIG_FILE: () => TS_CONFIG_FILE,
  TS_REGEX: () => TS_REGEX,
  VIDEO_EXTENSIONS: () => VIDEO_EXTENSIONS,
  WASM_DIST_DIR: () => WASM_DIST_DIR,
  addTrailingSlash: () => addTrailingSlash,
  applyOutputPlugin: () => applyOutputPlugin,
  applyResolvePlugin: () => applyResolvePlugin,
  applyScriptCondition: () => applyScriptCondition,
  applyToCompiler: () => applyToCompiler,
  awaitableGetter: () => awaitableGetter,
  browserslistToESVersion: () => browserslistToESVersion,
  camelCase: () => camelCase,
  castArray: () => castArray,
  chainToConfig: () => chainToConfig,
  cloneDeep: () => cloneDeep,
  color: () => import_picocolors.default,
  createCacheGroups: () => createCacheGroups,
  createDependenciesRegExp: () => createDependenciesRegExp,
  createVirtualModule: () => createVirtualModule,
  debounce: () => debounce,
  debug: () => debug,
  deepmerge: () => import_deepmerge.default,
  ensureAbsolutePath: () => ensureAbsolutePath,
  findExists: () => findExists,
  findUp: () => findUp,
  formatPublicPath: () => formatPublicPath,
  fse: () => import_fs_extra2.default,
  generateScriptTag: () => generateScriptTag,
  getAddressUrls: () => getAddressUrls,
  getBrowserslist: () => getBrowserslist,
  getBrowserslistWithDefault: () => getBrowserslistWithDefault,
  getBundlerChain: () => getBundlerChain,
  getCoreJsVersion: () => getCoreJsVersion,
  getDefaultStyledComponentsConfig: () => getDefaultStyledComponentsConfig,
  getDistPath: () => getDistPath,
  getFilename: () => getFilename,
  getHtmlMinifyOptions: () => getHtmlMinifyOptions,
  getJsSourceMap: () => getJsSourceMap,
  getNodeEnv: () => getNodeEnv,
  getProgressColor: () => getProgressColor,
  getPublicPathFromChain: () => getPublicPathFromChain,
  getPublicPathFromCompiler: () => getPublicPathFromCompiler,
  getSharedPkgCompiledPath: () => getSharedPkgCompiledPath,
  getSwcMinimizerOptions: () => getSwcMinimizerOptions,
  getUrlLabel: () => getUrlLabel,
  isClientCompiler: () => isClientCompiler,
  isCssModules: () => isCssModules,
  isDebug: () => isDebug,
  isDev: () => isDev,
  isFileExists: () => isFileExists,
  isFileSync: () => isFileSync,
  isFunction: () => isFunction,
  isHtmlDisabled: () => isHtmlDisabled,
  isInNodeModules: () => isInNodeModules,
  isMultiCompiler: () => isMultiCompiler,
  isNil: () => isNil,
  isObject: () => isObject,
  isPlainObject: () => isPlainObject,
  isProd: () => isProd,
  isRegExp: () => isRegExp,
  isServerTarget: () => isServerTarget,
  isString: () => isString,
  isTest: () => isTest,
  isURL: () => isURL,
  isUndefined: () => isUndefined,
  isUsingHMR: () => isUsingHMR,
  isWebTarget: () => isWebTarget,
  kebabCase: () => kebabCase,
  logger: () => logger,
  mergeChainedOptions: () => mergeChainedOptions,
  modifyBundlerChain: () => modifyBundlerChain,
  modifySwcLoaderOptions: () => modifySwcLoaderOptions,
  normalizeUrl: () => normalizeUrl,
  onCompileDone: () => onCompileDone,
  outputInspectConfigFiles: () => outputInspectConfigFiles,
  parseMinifyOptions: () => parseMinifyOptions,
  partition: () => partition,
  pick: () => pick,
  pickRsbuildConfig: () => pickRsbuildConfig,
  prettyTime: () => prettyTime,
  removeLeadingSlash: () => removeLeadingSlash,
  removeTailingSlash: () => removeTailingSlash,
  resolvePackage: () => resolvePackage,
  setNodeEnv: () => setNodeEnv,
  setupServerHooks: () => setupServerHooks,
  stringifyConfig: () => stringifyConfig,
  upperFirst: () => upperFirst,
  withPublicPath: () => withPublicPath
});
module.exports = __toCommonJS(src_exports);

// src/constants.ts
var DEFAULT_PORT = 3e3;
var DEFAULT_DATA_URL_SIZE = 4096;
var DEFAULT_MOUNT_ID = "root";
var DEFAULT_DEV_HOST = "0.0.0.0";
var DEFAULT_WEB_BROWSERSLIST = [
  "chrome >= 87",
  "edge >= 88",
  "firefox >= 78",
  "safari >= 14"
];
var DEFAULT_BROWSERSLIST = {
  web: DEFAULT_WEB_BROWSERSLIST,
  "web-worker": DEFAULT_WEB_BROWSERSLIST,
  "service-worker": DEFAULT_WEB_BROWSERSLIST,
  node: ["node >= 16"]
};
var ROOT_DIST_DIR = "dist";
var HTML_DIST_DIR = "/";
var SERVER_DIST_DIR = "server";
var SERVICE_WORKER_DIST_DIR = "worker";
var JS_DIST_DIR = "static/js";
var CSS_DIST_DIR = "static/css";
var SVG_DIST_DIR = "static/svg";
var FONT_DIST_DIR = "static/font";
var WASM_DIST_DIR = "static/wasm";
var IMAGE_DIST_DIR = "static/image";
var MEDIA_DIST_DIR = "static/media";
var FONT_EXTENSIONS = ["woff", "woff2", "eot", "ttf", "otf", "ttc"];
var IMAGE_EXTENSIONS = [
  "png",
  "jpg",
  "jpeg",
  "pjpeg",
  "pjp",
  "gif",
  "bmp",
  "webp",
  "ico",
  "apng",
  "avif",
  "tif",
  "tiff",
  "jfif"
];
var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "mov"];
var AUDIO_EXTENSIONS = ["mp3", "wav", "flac", "aac", "m4a", "opus"];
var DEFAULT_ASSET_PREFIX = "/";
var HTML_REGEX = /\.html$/;
var JS_REGEX = /\.(?:js|mjs|cjs|jsx)$/;
var TS_REGEX = /\.(?:ts|mts|cts|tsx)$/;
var SCRIPT_REGEX = /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/;
var TS_AND_JSX_REGEX = /\.(?:ts|tsx|jsx|mts|cts)$/;
var SVG_REGEX = /\.svg$/;
var CSS_REGEX = /\.css$/;
var LESS_REGEX = /\.less$/;
var SASS_REGEX = /\.s(?:a|c)ss$/;
var CSS_MODULES_REGEX = /\.module\.\w+$/i;
var NODE_MODULES_REGEX = /[\\/]node_modules[\\/]/;
var TS_CONFIG_FILE = "tsconfig.json";
var TARGET_ID_MAP = {
  web: "Client",
  node: "Server",
  "web-worker": "Web Worker",
  "service-worker": "Service Worker"
};

// src/utils.ts
var import_node_path = __toESM(require("path"));
var import_deepmerge = __toESM(require("../compiled/deepmerge/index.js"));
var import_fs_extra = __toESM(require("../compiled/fs-extra/index.js"));
var import_picocolors = __toESM(require("../compiled/picocolors/index.js"));
var getNodeEnv = () => process.env.NODE_ENV;
var setNodeEnv = (env) => {
  process.env.NODE_ENV = env;
};
var isDev = () => getNodeEnv() === "development";
var isProd = () => getNodeEnv() === "production";
var isTest = () => getNodeEnv() === "test";
var isString = (str) => typeof str === "string";
var isUndefined = (obj) => typeof obj === "undefined";
var isFunction = (func) => typeof func === "function";
var isObject = (obj) => obj !== null && typeof obj === "object";
var isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]";
var isRegExp = (obj) => Object.prototype.toString.call(obj) === "[object RegExp]";
var isNil = (o) => o === void 0 || o === null;
var createVirtualModule = (content) => `data:text/javascript,${content}`;
var removeLeadingSlash = (s) => s.replace(/^\/+/, "");
var removeTailingSlash = (s) => s.replace(/\/+$/, "");
var addTrailingSlash = (s) => s.endsWith("/") ? s : `${s}/`;
var awaitableGetter = (promises2) => {
  const then = (...args) => Promise.all(promises2).then(...args);
  return { then, promises: promises2 };
};
var getJsSourceMap = (config) => {
  const { sourceMap } = config.output;
  if (sourceMap.js === void 0) {
    return isProd() ? false : "cheap-module-source-map";
  }
  return sourceMap.js;
};
var getSharedPkgCompiledPath = (packageName) => import_node_path.default.join(__dirname, "../compiled", packageName);
var isURL = (str) => str.startsWith("http") || str.startsWith("//:");
function isWebTarget(target) {
  return ["web", "web-worker"].some(
    (t) => (Array.isArray(target) ? target : [target]).includes(t)
  );
}
function isServerTarget(target) {
  return (Array.isArray(target) ? target : [target]).some(
    (item) => ["node", "service-worker"].includes(item)
  );
}
function resolvePackage(loader, dirname) {
  return process.env.VITEST ? loader : require.resolve(loader, { paths: [dirname] });
}
var getCoreJsVersion = (corejsPkgPath) => {
  try {
    const { version } = import_fs_extra.default.readJSONSync(corejsPkgPath);
    const [major, minor] = version.split(".");
    return `${major}.${minor}`;
  } catch (err) {
    return "3";
  }
};
var ensureAbsolutePath = (base, filePath) => import_node_path.default.isAbsolute(filePath) ? filePath : import_node_path.default.resolve(base, filePath);
var castArray = (arr) => {
  if (arr === void 0) {
    return [];
  }
  return Array.isArray(arr) ? arr : [arr];
};
var camelCase = (input) => input.replace(/[-_](\w)/g, (_, c) => c.toUpperCase());
var kebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase().replace(/^-/, "");
var cloneDeep = (value) => (0, import_deepmerge.default)({}, value);
var DEP_MATCH_TEMPLATE = /[\\/]node_modules[\\/](<SOURCES>)[\\/]/.source;
var createDependenciesRegExp = (...dependencies) => {
  const sources = dependencies.map(
    (d) => typeof d === "string" ? d : d.source
  );
  const expr = DEP_MATCH_TEMPLATE.replace("<SOURCES>", sources.join("|"));
  return new RegExp(expr);
};
function createCacheGroups(group) {
  const experienceCacheGroup = {};
  for (const [name, pkgs] of Object.entries(group)) {
    const key = `lib-${name}`;
    experienceCacheGroup[key] = {
      test: createDependenciesRegExp(...pkgs),
      priority: 0,
      name: key,
      reuseExistingChunk: true
    };
  }
  return experienceCacheGroup;
}
function debounce(func, wait) {
  let timeoutId = null;
  return (...args) => {
    if (timeoutId !== null) {
      clearTimeout(timeoutId);
    }
    timeoutId = setTimeout(() => {
      func(...args);
    }, wait);
  };
}
var upperFirst = (str) => str ? str.charAt(0).toUpperCase() + str.slice(1) : "";
var generateScriptTag = () => ({
  tagName: "script",
  attributes: {
    type: "text/javascript"
  },
  voidTag: false,
  meta: {}
});
var getPublicPathFromCompiler = (compiler) => {
  const { publicPath } = compiler.options.output;
  if (typeof publicPath === "string") {
    if (publicPath === "auto") {
      return "";
    }
    return addTrailingSlash(publicPath);
  }
  return DEFAULT_ASSET_PREFIX;
};
function partition(array, predicate) {
  const truthy = [];
  const falsy = [];
  for (const value of array) {
    if (predicate(value)) {
      truthy.push(value);
    } else {
      falsy.push(value);
    }
  }
  return [truthy, falsy];
}
function pick(obj, keys) {
  return keys.reduce(
    (ret, key) => {
      if (obj[key] !== void 0) {
        ret[key] = obj[key];
      }
      return ret;
    },
    {}
  );
}
var prettyTime = (seconds) => {
  const format = (time) => import_picocolors.default.bold(time);
  if (seconds < 10) {
    const digits = seconds >= 0.01 ? 2 : 3;
    return `${format(seconds.toFixed(digits))} s`;
  }
  if (seconds < 60) {
    return `${format(seconds.toFixed(1))} s`;
  }
  const minutes = seconds / 60;
  return `${format(minutes.toFixed(2))} m`;
};
var colorList = ["green", "cyan", "yellow", "blue", "magenta"];
var getProgressColor = (index) => colorList[index % colorList.length];
var isHtmlDisabled = (config, target) => {
  const { htmlPlugin } = config.tools;
  return htmlPlugin === false || Array.isArray(htmlPlugin) && htmlPlugin.includes(false) || target !== "web";
};
function isUsingHMR(config, { isProd: isProd2, target }) {
  return !isProd2 && config.dev.hmr && target === "web";
}
var isClientCompiler = (compiler) => {
  const { target } = compiler.options;
  if (target) {
    return Array.isArray(target) ? target.includes("web") : target === "web";
  }
  return false;
};
var isNodeCompiler = (compiler) => {
  const { target } = compiler.options;
  if (target) {
    return Array.isArray(target) ? target.includes("node") : target === "node";
  }
  return false;
};
var setupServerHooks = (compiler, hookCallbacks) => {
  if (isNodeCompiler(compiler)) {
    return;
  }
  const { compile, invalid, done } = compiler.hooks;
  compile.tap("rsbuild-dev-server", hookCallbacks.onInvalid);
  invalid.tap("rsbuild-dev-server", hookCallbacks.onInvalid);
  done.tap("rsbuild-dev-server", hookCallbacks.onDone);
};
var isMultiCompiler = (compiler) => {
  return compiler.constructor.name === "MultiCompiler";
};
var applyToCompiler = (compiler, apply) => {
  if (isMultiCompiler(compiler)) {
    compiler.compilers.forEach(apply);
  } else {
    apply(compiler);
  }
};
var onCompileDone = (compiler, onDone, MultiStatsCtor) => {
  if (isMultiCompiler(compiler)) {
    const { compilers } = compiler;
    const compilerStats = [];
    let doneCompilers = 0;
    for (let index = 0; index < compilers.length; index++) {
      const compiler2 = compilers[index];
      const compilerIndex = index;
      let compilerDone = false;
      compiler2.hooks.done.tapPromise("rsbuild:done", async (stats) => {
        if (!compilerDone) {
          compilerDone = true;
          doneCompilers++;
        }
        compilerStats[compilerIndex] = stats;
        if (doneCompilers === compilers.length) {
          await onDone(new MultiStatsCtor(compilerStats));
        }
      });
      compiler2.hooks.invalid.tap("rsbuild:done", () => {
        if (compilerDone) {
          compilerDone = false;
          doneCompilers--;
        }
      });
    }
  } else {
    compiler.hooks.done.tapPromise("rsbuild:done", onDone);
  }
};

// src/fs.ts
var import_node_fs = require("fs");
var import_node_path2 = __toESM(require("path"));
var import_fs_extra2 = __toESM(require("../compiled/fs-extra/index.js"));
var getDistPath = (config, type) => {
  const { distPath } = config.output || {};
  const ret = distPath?.[type];
  if (typeof ret !== "string") {
    if (type === "jsAsync") {
      const jsPath = getDistPath(config, "js");
      return jsPath ? `${jsPath}/async` : "async";
    }
    if (type === "cssAsync") {
      const cssPath = getDistPath(config, "css");
      return cssPath ? `${cssPath}/async` : "async";
    }
    throw new Error(`unknown key ${type} in "output.distPath"`);
  }
  return ret;
};
async function isFileExists(file) {
  return import_node_fs.promises.access(file, import_node_fs.constants.F_OK).then(() => true).catch(() => false);
}
var isFileSync = (filePath) => {
  try {
    return (0, import_node_fs.statSync)(filePath, { throwIfNoEntry: false })?.isFile();
  } catch (_) {
    return false;
  }
};
var findExists = (files) => {
  for (const file of files) {
    if (isFileSync(file)) {
      return file;
    }
  }
  return false;
};
var getFilename = (config, type, isProd2) => {
  const { filename, filenameHash } = config.output;
  const getHash = () => {
    if (typeof filenameHash === "string") {
      return filenameHash ? `.[${filenameHash}]` : "";
    }
    return filenameHash ? ".[contenthash:8]" : "";
  };
  const hash = getHash();
  switch (type) {
    case "js":
      return filename.js ?? `[name]${isProd2 ? hash : ""}.js`;
    case "css":
      return filename.css ?? `[name]${isProd2 ? hash : ""}.css`;
    case "svg":
      return filename.svg ?? `[name]${hash}.svg`;
    case "font":
      return filename.font ?? `[name]${hash}[ext]`;
    case "image":
      return filename.image ?? `[name]${hash}[ext]`;
    case "media":
      return filename.media ?? `[name]${hash}[ext]`;
    default:
      throw new Error(`unknown key ${type} in "output.filename"`);
  }
};
async function findUp({
  filename,
  cwd = process.cwd()
}) {
  const { root } = import_node_path2.default.parse(cwd);
  let dir = cwd;
  while (dir && dir !== root) {
    const filePath = import_node_path2.default.join(dir, filename);
    try {
      const stats = await import_node_fs.promises.stat(filePath);
      if (stats?.isFile()) {
        return filePath;
      }
    } catch {
    }
    dir = import_node_path2.default.dirname(dir);
  }
}

// src/getBrowserslist.ts
var import_browserslist = __toESM(require("../compiled/browserslist/index.js"));
var browsersListCache = /* @__PURE__ */ new Map();
async function getBrowserslist(path3) {
  const env = getNodeEnv();
  const cacheKey = path3 + env;
  if (browsersListCache.has(cacheKey)) {
    return browsersListCache.get(cacheKey);
  }
  const result = import_browserslist.default.loadConfig({ path: path3, env });
  if (result) {
    browsersListCache.set(cacheKey, result);
    return result;
  }
  return null;
}
async function getBrowserslistWithDefault(path3, config, target) {
  const { overrideBrowserslist: overrides = {} } = config?.output || {};
  if (target === "web" || target === "web-worker") {
    if (Array.isArray(overrides)) {
      return overrides;
    }
    if (overrides[target]) {
      return overrides[target];
    }
    const browserslistrc = await getBrowserslist(path3);
    if (browserslistrc) {
      return browserslistrc;
    }
  }
  if (!Array.isArray(overrides) && overrides[target]) {
    return overrides[target];
  }
  return DEFAULT_BROWSERSLIST[target];
}
var ES_VERSIONS_MAP = {
  chrome: [51, 52, 57, 64],
  edge: [15, 15, 15, 79],
  safari: [10, 10.3, 11, 16.4],
  firefox: [54, 54, 54, 78],
  opera: [38, 39, 44, 51],
  samsung: [5, 6.2, 6.2, 8.2]
};
var renameBrowser = (name) => {
  return name === "ios_saf" ? "safari" : name;
};
function browserslistToESVersion(browsers) {
  const projectBrowsers = (0, import_browserslist.default)(browsers, {
    ignoreUnknownVersions: true
  });
  let esVersion = 2018 /* es2018 */;
  for (const item of projectBrowsers) {
    const pairs = item.split(" ");
    if (pairs.length < 2) {
      continue;
    }
    const browser = renameBrowser(pairs[0]);
    const version = Number(pairs[1].split("-")[0]);
    if (Number.isNaN(version)) {
      continue;
    }
    if (browser === "ie" || browser === "android" && version < 6) {
      esVersion = 5 /* es5 */;
      break;
    }
    const versions = ES_VERSIONS_MAP[browser];
    if (!versions) {
      continue;
    }
    if (version < versions[0]) {
      esVersion = Math.min(5 /* es5 */, esVersion);
    } else if (version < versions[1]) {
      esVersion = Math.min(2015 /* es2015 */, esVersion);
    } else if (version < versions[2]) {
      esVersion = Math.min(2016 /* es2016 */, esVersion);
    } else if (version < versions[3]) {
      esVersion = Math.min(2017 /* es2017 */, esVersion);
    }
  }
  return esVersion;
}

// src/logger.ts
var rslog = __toESM(require("../compiled/rslog/index.js"));
var { logger } = rslog;
if (process.env.DEBUG) {
  logger.level = "verbose";
}
var isDebug = () => {
  if (!process.env.DEBUG) {
    return false;
  }
  logger.level = "verbose";
  const values = process.env.DEBUG.toLocaleLowerCase().split(",");
  return ["rsbuild", "builder", "*"].some((key) => values.includes(key));
};
function getTime() {
  const now = /* @__PURE__ */ new Date();
  const hours = String(now.getHours()).padStart(2, "0");
  const minutes = String(now.getMinutes()).padStart(2, "0");
  const seconds = String(now.getSeconds()).padStart(2, "0");
  return `${hours}:${minutes}:${seconds}`;
}
var debug = (message) => {
  if (isDebug()) {
    const result = typeof message === "string" ? message : message();
    const time = import_picocolors.default.gray(`${getTime()}`);
    logger.debug(`${time} ${result}`);
  }
};

// src/mergeChainedOptions.ts
function mergeChainedOptions({
  defaults,
  options,
  utils,
  mergeFn = Object.assign,
  useObjectParam,
  isFalsy = (v) => !v
}) {
  if (isFalsy(options)) {
    return defaults;
  }
  if (isPlainObject(options)) {
    return mergeFn(
      defaults,
      options
    );
  }
  if (isFunction(options)) {
    const ret = useObjectParam ? options({
      value: defaults,
      ...utils
    }) : options(defaults, utils);
    return isFalsy(ret) ? defaults : ret;
  }
  if (Array.isArray(options)) {
    return options.reduce(
      (defaults2, options2) => mergeChainedOptions({
        defaults: defaults2,
        options: options2,
        utils,
        mergeFn,
        useObjectParam,
        isFalsy
      }),
      defaults
    );
  }
  return options ?? defaults;
}

// src/config.ts
var import_node_path3 = require("path");
var import_fs_extra3 = __toESM(require("../compiled/fs-extra/index.js"));
async function outputInspectConfigFiles({
  rsbuildConfig,
  rawRsbuildConfig,
  bundlerConfigs,
  inspectOptions,
  configType
}) {
  const { outputPath } = inspectOptions;
  const files = [
    {
      path: (0, import_node_path3.join)(outputPath, "rsbuild.config.mjs"),
      label: "Rsbuild Config",
      content: rawRsbuildConfig
    },
    ...bundlerConfigs.map((content, index) => {
      const suffix = rsbuildConfig.output.targets[index];
      const outputFile = `${configType}.config.${suffix}.mjs`;
      let outputFilePath = (0, import_node_path3.join)(outputPath, outputFile);
      if (import_fs_extra3.default.existsSync(outputFilePath)) {
        outputFilePath = outputFilePath.replace(/\.mjs$/, `.${Date.now()}.mjs`);
      }
      return {
        path: outputFilePath,
        label: `${upperFirst(configType)} Config (${suffix})`,
        content
      };
    })
  ];
  await Promise.all(
    files.map(
      (item) => import_fs_extra3.default.outputFile(item.path, `export default ${item.content}`)
    )
  );
  const fileInfos = files.map(
    (item) => `  - ${import_picocolors.default.bold(import_picocolors.default.yellow(item.label))}: ${import_picocolors.default.underline(
      item.path
    )}`
  ).join("\n");
  logger.success(
    `Inspect config succeed, open following files to view the content: 

${fileInfos}
`
  );
}
async function stringifyConfig(config, verbose) {
  const { default: WebpackChain } = await import("../compiled/webpack-chain/index.js");
  const stringify = WebpackChain.toString;
  return stringify(config, { verbose });
}
var getDefaultStyledComponentsConfig = (isProd2, ssr) => {
  return {
    ssr,
    // "pure" is used to improve dead code elimination in production.
    // we don't need to enable it in development because it will slow down the build process.
    pure: isProd2,
    displayName: true,
    transpileTemplateLiterals: true
  };
};
var pickRsbuildConfig = (rsbuildConfig) => {
  const keys = [
    "dev",
    "html",
    "tools",
    "output",
    "source",
    "server",
    "security",
    "performance",
    "moduleFederation",
    "_privateMeta"
  ];
  return pick(rsbuildConfig, keys);
};

// src/chain.ts
var import_node_path4 = require("path");
async function getBundlerChain() {
  const { default: WebpackChain } = await import("../compiled/webpack-chain/index.js");
  const bundlerChain = new WebpackChain();
  return bundlerChain;
}
async function modifyBundlerChain(context, utils) {
  debug("modify bundler chain");
  const bundlerChain = await getBundlerChain();
  const [modifiedBundlerChain] = await context.hooks.modifyBundlerChain.call(
    bundlerChain,
    utils
  );
  if (context.config.tools?.bundlerChain) {
    for (const item of castArray(context.config.tools.bundlerChain)) {
      item(modifiedBundlerChain, utils);
    }
  }
  debug("modify bundler chain done");
  return modifiedBundlerChain;
}
var CHAIN_ID = {
  /** Predefined rules */
  RULE: {
    /** Rule for .mjs */
    MJS: "mjs",
    /** Rule for fonts */
    FONT: "font",
    /** Rule for images */
    IMAGE: "image",
    /** Rule for media */
    MEDIA: "media",
    /** Rule for js */
    JS: "js",
    /** Rule for data uri encoded javascript */
    JS_DATA_URI: "js-data-uri",
    /** Rule for ts */
    TS: "ts",
    /** Rule for css */
    CSS: "css",
    /** Rule for less */
    LESS: "less",
    /** Rule for sass */
    SASS: "sass",
    /** Rule for stylus */
    STYLUS: "stylus",
    /** Rule for svg */
    SVG: "svg",
    /** Rule for pug */
    PUG: "pug",
    /** Rule for Vue */
    VUE: "vue",
    /** Rule for yaml */
    YAML: "yaml",
    /** Rule for wasm */
    WASM: "wasm",
    /** Rule for svelte */
    SVELTE: "svelte"
  },
  /** Predefined rule groups */
  ONE_OF: {
    SVG: "svg",
    SVG_URL: "svg-asset-url",
    SVG_ASSET: "svg-asset",
    SVG_REACT: "svg-react",
    SVG_INLINE: "svg-asset-inline"
  },
  /** Predefined loaders */
  USE: {
    /** ts-loader */
    TS: "ts",
    /** css-loader */
    CSS: "css",
    /** sass-loader */
    SASS: "sass",
    /** less-loader */
    LESS: "less",
    /** stylus-loader */
    STYLUS: "stylus",
    /** url-loader */
    URL: "url",
    /** pug-loader */
    PUG: "pug",
    /** vue-loader */
    VUE: "vue",
    /** swc-loader */
    SWC: "swc",
    /** svgr */
    SVGR: "svgr",
    /** plugin-image-compress svgo-loader */
    SVGO: "svgo",
    /** yaml-loader */
    YAML: "yaml",
    /** babel-loader */
    BABEL: "babel",
    /** style-loader */
    STYLE: "style-loader",
    /** svelte-loader */
    SVELTE: "svelte",
    /** esbuild-loader */
    ESBUILD: "esbuild",
    /** postcss-loader */
    POSTCSS: "postcss",
    /** lightningcss-loader */
    LIGHTNINGCSS: "lightningcss",
    /** ignore-css-loader */
    IGNORE_CSS: "ignore-css",
    /** css-modules-typescript-loader */
    CSS_MODULES_TS: "css-modules-typescript",
    /** mini-css-extract-plugin.loader */
    MINI_CSS_EXTRACT: "mini-css-extract",
    /** resolve-url-loader */
    RESOLVE_URL: "resolve-url-loader",
    /** plugin-image-compress.loader */
    IMAGE_COMPRESS: "image-compress"
  },
  /** Predefined plugins */
  PLUGIN: {
    /** HotModuleReplacementPlugin */
    HMR: "hmr",
    /** CopyWebpackPlugin */
    COPY: "copy",
    /** HtmlWebpackPlugin */
    HTML: "html",
    /** ESLintWebpackPlugin */
    ESLINT: "eslint",
    /** DefinePlugin */
    DEFINE: "define",
    /** ProgressPlugin */
    PROGRESS: "progress",
    /** AppIconPlugin */
    APP_ICON: "app-icon",
    /** WebpackManifestPlugin */
    MANIFEST: "webpack-manifest",
    /** ForkTsCheckerWebpackPlugin */
    TS_CHECKER: "ts-checker",
    /** InlineChunkHtmlPlugin */
    INLINE_HTML: "inline-html",
    /** WebpackBundleAnalyzer */
    BUNDLE_ANALYZER: "bundle-analyze",
    /** ModuleFederationPlugin */
    MODULE_FEDERATION: "module-federation",
    /** HtmlBasicPlugin */
    HTML_BASIC: "html-basic-plugin",
    /** htmlPreconnectPlugin */
    HTML_PRECONNECT: "html-preconnect-plugin",
    /** htmlDnsPrefetchPlugin */
    HTML_DNS_PREFETCH: "html-dns-prefetch-plugin",
    /** htmlPrefetchPlugin */
    HTML_PREFETCH: "html-prefetch-plugin",
    /** htmlPreloadPlugin */
    HTML_PRELOAD: "html-preload-plugin",
    /** MiniCssExtractPlugin */
    MINI_CSS_EXTRACT: "mini-css-extract",
    /** VueLoaderPlugin */
    VUE_LOADER_PLUGIN: "vue-loader-plugin",
    /** ReactFastRefreshPlugin */
    REACT_FAST_REFRESH: "react-fast-refresh",
    /** ProvidePlugin for node polyfill */
    NODE_POLYFILL_PROVIDE: "node-polyfill-provide",
    /** WebpackSRIPlugin */
    SUBRESOURCE_INTEGRITY: "subresource-integrity",
    /** AssetsRetryPlugin */
    ASSETS_RETRY: "assets-retry",
    /** AsyncChunkRetryPlugin */
    ASYNC_CHUNK_RETRY: "async-chunk-retry",
    /** AutoSetRootFontSizePlugin */
    AUTO_SET_ROOT_SIZE: "auto-set-root-size",
    /** VueLoader15PitchFixPlugin */
    VUE_LOADER_15_PITCH_FIX_PLUGIN: "vue-loader-15-pitch-fix"
  },
  /** Predefined minimizers */
  MINIMIZER: {
    /** SwcJsMinimizerRspackPlugin */
    JS: "js",
    /** SwcCssMinimizerRspackPlugin */
    CSS: "css",
    /** ESBuildPlugin */
    ESBUILD: "js-css",
    /** SWCPlugin */
    SWC: "swc"
  },
  /** Predefined resolve plugins */
  RESOLVE_PLUGIN: {
    /** ModuleScopePlugin */
    MODULE_SCOPE: "module-scope",
    /** TsConfigPathsPlugin */
    TS_CONFIG_PATHS: "ts-config-paths"
  }
};
function applyScriptCondition({
  rule,
  chain,
  config,
  context,
  includes,
  excludes
}) {
  rule.include.add({
    and: [context.rootPath, { not: NODE_MODULES_REGEX }]
  });
  rule.include.add(TS_AND_JSX_REGEX);
  const target = castArray(chain.get("target"));
  const legacyTarget = ["es5", "es6", "es2015", "es2016"];
  if (legacyTarget.some((item) => target.includes(item))) {
    rule.include.add(/[\\/]@rsbuild[\\/]core[\\/]dist[\\/]/);
  }
  for (const condition of [...includes, ...config.source.include || []]) {
    rule.include.add(condition);
  }
  for (const condition of [...excludes, ...config.source.exclude || []]) {
    rule.exclude.add(condition);
  }
}
var formatPublicPath = (publicPath, withSlash = true) => {
  if (publicPath === "auto") {
    return publicPath;
  }
  return withSlash ? addTrailingSlash(publicPath) : removeTailingSlash(publicPath);
};
var getPublicPathFromChain = (chain, withSlash = true) => {
  const publicPath = chain.output.get("publicPath");
  if (typeof publicPath === "string") {
    return formatPublicPath(publicPath, withSlash);
  }
  return formatPublicPath(DEFAULT_ASSET_PREFIX, withSlash);
};
function getPublicPath({
  config,
  isProd: isProd2,
  context
}) {
  const { dev, output } = config;
  let publicPath = DEFAULT_ASSET_PREFIX;
  if (isProd2) {
    if (typeof output.assetPrefix === "string") {
      publicPath = output.assetPrefix;
    }
  } else if (typeof dev.assetPrefix === "string") {
    publicPath = dev.assetPrefix;
  } else if (dev.assetPrefix === true) {
    const protocol = context.devServer?.https ? "https" : "http";
    const hostname = context.devServer?.hostname || DEFAULT_DEV_HOST;
    const port = context.devServer?.port || DEFAULT_PORT;
    if (hostname === DEFAULT_DEV_HOST) {
      const localHostname = "localhost";
      publicPath = `${protocol}://${localHostname}:${port}/`;
    } else {
      publicPath = `${protocol}://${hostname}:${port}/`;
    }
  }
  return formatPublicPath(publicPath);
}
function applyOutputPlugin(api) {
  api.modifyBundlerChain(
    async (chain, { isProd: isProd2, isServer, isServiceWorker }) => {
      const config = api.getNormalizedConfig();
      const publicPath = getPublicPath({
        config,
        isProd: isProd2,
        context: api.context
      });
      const jsPath = getDistPath(config, "js");
      const jsAsyncPath = getDistPath(config, "jsAsync");
      const jsFilename = getFilename(config, "js", isProd2);
      chain.output.path(api.context.distPath).filename(import_node_path4.posix.join(jsPath, jsFilename)).chunkFilename(import_node_path4.posix.join(jsAsyncPath, jsFilename)).publicPath(publicPath).pathinfo(false).hashFunction("xxhash64");
      if (isServer) {
        const serverPath = getDistPath(config, "server");
        chain.output.path(import_node_path4.posix.join(api.context.distPath, serverPath)).filename("[name].js").chunkFilename("[name].js").libraryTarget("commonjs2");
      }
      if (isServiceWorker) {
        const workerPath = getDistPath(config, "worker");
        const filename = import_node_path4.posix.join(workerPath, "[name].js");
        chain.output.filename(filename).chunkFilename(filename);
      }
    }
  );
}
function applyResolvePlugin(api) {
  api.modifyBundlerChain({
    order: "pre",
    handler: (chain, { target, CHAIN_ID: CHAIN_ID2 }) => {
      const config = api.getNormalizedConfig();
      applyExtensions({ chain });
      applyAlias({
        chain,
        target,
        config,
        rootPath: api.context.rootPath
      });
      applyFullySpecified({ chain, config, CHAIN_ID: CHAIN_ID2 });
    }
  });
}
function applyFullySpecified({
  chain,
  CHAIN_ID: CHAIN_ID2
}) {
  chain.module.rule(CHAIN_ID2.RULE.MJS).test(/\.m?js/).resolve.set("fullySpecified", false);
}
function applyExtensions({ chain }) {
  const extensions = [
    // most projects are using TypeScript, resolve .ts(x) files first to reduce resolve time.
    ".ts",
    ".tsx",
    ".js",
    ".jsx",
    ".mjs",
    ".json"
  ];
  chain.resolve.extensions.merge(extensions);
}
function applyAlias({
  chain,
  target,
  config,
  rootPath
}) {
  const { alias } = config.source;
  if (!alias) {
    return;
  }
  const mergedAlias = mergeChainedOptions({
    defaults: {},
    options: alias,
    utils: { target }
  });
  for (const name of Object.keys(mergedAlias)) {
    const values = castArray(mergedAlias[name]);
    const formattedValues = values.map((value) => {
      if (typeof value === "string" && value.startsWith(".")) {
        return ensureAbsolutePath(rootPath, value);
      }
      return value;
    });
    chain.resolve.alias.set(
      name,
      formattedValues.length === 1 ? formattedValues[0] : formattedValues
    );
  }
}
function chainToConfig(chain) {
  const config = chain.toConfig();
  const { entry } = config;
  if (!isPlainObject(entry)) {
    return config;
  }
  const formattedEntry = {};
  for (const [entryName, entryValue] of Object.entries(entry)) {
    const entryImport = [];
    let entryDescription = null;
    for (const item of castArray(entryValue)) {
      if (typeof item === "string") {
        entryImport.push(item);
        continue;
      }
      if (item.import) {
        entryImport.push(...castArray(item.import));
      }
      if (entryDescription) {
        Object.assign(entryDescription, item);
      } else {
        entryDescription = item;
      }
    }
    formattedEntry[entryName] = entryDescription ? {
      ...entryDescription,
      import: entryImport
    } : entryImport;
  }
  config.entry = formattedEntry;
  return config;
}
var modifySwcLoaderOptions = ({
  chain,
  modifier
}) => {
  const ruleIds = [CHAIN_ID.RULE.JS, CHAIN_ID.RULE.JS_DATA_URI];
  for (const ruleId of ruleIds) {
    if (chain.module.rules.has(ruleId)) {
      const rule = chain.module.rule(ruleId);
      if (rule.uses.has(CHAIN_ID.USE.SWC)) {
        rule.use(CHAIN_ID.USE.SWC).tap(modifier);
      }
    }
  }
};

// src/css.ts
var isInNodeModules = (path3) => NODE_MODULES_REGEX.test(path3);
var isCssModules = (filename, modules) => {
  if (typeof modules === "boolean") {
    return modules;
  }
  if (typeof modules === "string") {
    return modules !== "global";
  }
  const { auto } = modules;
  if (typeof auto === "boolean") {
    return auto && CSS_MODULES_REGEX.test(filename);
  }
  if (auto instanceof RegExp) {
    return auto.test(filename);
  }
  if (typeof auto === "function") {
    return auto(filename);
  }
  return true;
};

// src/minimize.ts
var import_deepmerge2 = __toESM(require("../compiled/deepmerge/index.js"));
function applyRemoveConsole(options, config) {
  const { removeConsole } = config.performance;
  const compressOptions = typeof options.compress === "boolean" ? {} : options.compress || {};
  if (removeConsole === true) {
    options.compress = {
      ...compressOptions,
      drop_console: true
    };
  } else if (Array.isArray(removeConsole)) {
    const pureFuncs = removeConsole.map((method) => `console.${method}`);
    options.compress = {
      ...compressOptions,
      pure_funcs: pureFuncs
    };
  }
  return options;
}
function getTerserMinifyOptions(config) {
  const options = {
    mangle: {
      safari10: true
    },
    format: {
      ascii_only: config.output.charset === "ascii"
    }
  };
  if (config.output.legalComments === "none") {
    options.format.comments = false;
  }
  const finalOptions = applyRemoveConsole(options, config);
  return finalOptions;
}
async function getHtmlMinifyOptions(isProd2, config) {
  if (!isProd2 || !config.output.minify || !parseMinifyOptions(config).minifyHtml) {
    return false;
  }
  const minifyJS = getTerserMinifyOptions(config);
  const htmlMinifyDefaultOptions = {
    removeComments: false,
    useShortDoctype: true,
    keepClosingSlash: true,
    collapseWhitespace: true,
    removeRedundantAttributes: true,
    removeScriptTypeAttributes: true,
    removeStyleLinkTypeAttributes: true,
    removeEmptyAttributes: true,
    minifyJS,
    minifyCSS: true,
    minifyURLs: true
  };
  const htmlMinifyOptions = parseMinifyOptions(config).htmlOptions;
  return typeof htmlMinifyOptions === "object" ? (0, import_deepmerge2.default)(htmlMinifyDefaultOptions, htmlMinifyOptions) : htmlMinifyDefaultOptions;
}
var getSwcMinimizerOptions = (config) => {
  const options = {};
  const { removeConsole } = config.performance;
  if (removeConsole === true) {
    options.compress = {
      ...isObject(options.compress) ? options.compress : {},
      drop_console: true
    };
  } else if (Array.isArray(removeConsole)) {
    const pureFuncs = removeConsole.map((method) => `console.${method}`);
    options.compress = {
      ...isObject(options.compress) ? options.compress : {},
      pure_funcs: pureFuncs
    };
  }
  options.format || (options.format = {});
  switch (config.output.legalComments) {
    case "inline":
      options.format.comments = "some";
      options.extractComments = false;
      break;
    case "linked":
      options.extractComments = true;
      break;
    case "none":
      options.format.comments = false;
      options.extractComments = false;
      break;
    default:
      break;
  }
  options.format.asciiOnly = config.output.charset === "ascii";
  const jsOptions = parseMinifyOptions(config).jsOptions;
  if (jsOptions) {
    return (0, import_deepmerge2.default)(options, jsOptions);
  }
  return options;
};
var parseMinifyOptions = (config, isProd2 = true) => {
  const minify = config.output.minify;
  if (minify === false || !isProd2) {
    return {
      minifyJs: false,
      minifyCss: false,
      minifyHtml: false,
      jsOptions: void 0,
      htmlOptions: void 0
    };
  }
  if (minify === true) {
    return {
      minifyJs: true,
      minifyCss: true,
      minifyHtml: true,
      jsOptions: void 0,
      htmlOptions: void 0
    };
  }
  return {
    minifyJs: minify.js !== false,
    minifyCss: minify.css !== false,
    minifyHtml: minify.html !== false,
    jsOptions: minify.jsOptions,
    htmlOptions: minify.htmlOptions
  };
};

// src/url.ts
var import_node_net = require("net");
var import_node_os = __toESM(require("os"));
var import_node_path5 = require("path");
var import_node_url = require("url");
var normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
var urlJoin = (base, path3) => {
  const fullUrl = new import_node_url.URL(base);
  fullUrl.pathname = import_node_path5.posix.join(fullUrl.pathname, path3);
  return fullUrl.toString();
};
var withPublicPath = (str, base) => {
  if (str.startsWith("//")) {
    return str;
  }
  try {
    new import_node_url.URL(str).toString();
    return str;
  } catch {
  }
  if (base.startsWith("http")) {
    return urlJoin(base, str);
  }
  if (base.startsWith("//")) {
    return urlJoin(`https:${base}`, str).replace("https:", "");
  }
  return import_node_path5.posix.join(base, str);
};
var getIpv4Interfaces = () => {
  const interfaces = import_node_os.default.networkInterfaces();
  const ipv4Interfaces = /* @__PURE__ */ new Map();
  for (const key of Object.keys(interfaces)) {
    for (const detail of interfaces[key]) {
      const familyV4Value = typeof detail.family === "string" ? "IPv4" : 4;
      if (detail.family === familyV4Value && !ipv4Interfaces.has(detail.address)) {
        ipv4Interfaces.set(detail.address, detail);
      }
    }
  }
  return Array.from(ipv4Interfaces.values());
};
var isLoopbackHost = (host) => {
  const loopbackHosts = [
    "localhost",
    "127.0.0.1",
    "::1",
    "0000:0000:0000:0000:0000:0000:0000:0001"
  ];
  return loopbackHosts.includes(host);
};
var getHostInUrl = (host) => {
  if ((0, import_node_net.isIPv6)(host)) {
    return host === "::" ? "[::1]" : `[${host}]`;
  }
  return host;
};
var concatUrl = ({
  host,
  port,
  protocol
}) => `${protocol}://${host}:${port}`;
var LOCAL_LABEL = "Local:  ";
var NETWORK_LABEL = "Network:  ";
var getUrlLabel = (url) => {
  try {
    const { host } = new import_node_url.URL(url);
    return isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL;
  } catch (err) {
    return NETWORK_LABEL;
  }
};
var getAddressUrls = ({
  protocol = "http",
  port,
  host
}) => {
  if (host && host !== DEFAULT_DEV_HOST) {
    return [
      {
        label: isLoopbackHost(host) ? LOCAL_LABEL : NETWORK_LABEL,
        url: concatUrl({
          port,
          host: getHostInUrl(host),
          protocol
        })
      }
    ];
  }
  const ipv4Interfaces = getIpv4Interfaces();
  const addressUrls = [];
  let hasLocalUrl = false;
  for (const detail of ipv4Interfaces) {
    if (isLoopbackHost(detail.address) || detail.internal) {
      if (hasLocalUrl) {
        continue;
      }
      addressUrls.push({
        label: LOCAL_LABEL,
        url: concatUrl({ host: "localhost", port, protocol })
      });
      hasLocalUrl = true;
    } else {
      addressUrls.push({
        label: NETWORK_LABEL,
        url: concatUrl({ host: detail.address, port, protocol })
      });
    }
  }
  return addressUrls;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  AUDIO_EXTENSIONS,
  CHAIN_ID,
  CSS_DIST_DIR,
  CSS_MODULES_REGEX,
  CSS_REGEX,
  DEFAULT_ASSET_PREFIX,
  DEFAULT_BROWSERSLIST,
  DEFAULT_DATA_URL_SIZE,
  DEFAULT_DEV_HOST,
  DEFAULT_MOUNT_ID,
  DEFAULT_PORT,
  FONT_DIST_DIR,
  FONT_EXTENSIONS,
  HTML_DIST_DIR,
  HTML_REGEX,
  IMAGE_DIST_DIR,
  IMAGE_EXTENSIONS,
  JS_DIST_DIR,
  JS_REGEX,
  LESS_REGEX,
  MEDIA_DIST_DIR,
  NODE_MODULES_REGEX,
  ROOT_DIST_DIR,
  SASS_REGEX,
  SCRIPT_REGEX,
  SERVER_DIST_DIR,
  SERVICE_WORKER_DIST_DIR,
  SVG_DIST_DIR,
  SVG_REGEX,
  TARGET_ID_MAP,
  TS_AND_JSX_REGEX,
  TS_CONFIG_FILE,
  TS_REGEX,
  VIDEO_EXTENSIONS,
  WASM_DIST_DIR,
  addTrailingSlash,
  applyOutputPlugin,
  applyResolvePlugin,
  applyScriptCondition,
  applyToCompiler,
  awaitableGetter,
  browserslistToESVersion,
  camelCase,
  castArray,
  chainToConfig,
  cloneDeep,
  color,
  createCacheGroups,
  createDependenciesRegExp,
  createVirtualModule,
  debounce,
  debug,
  deepmerge,
  ensureAbsolutePath,
  findExists,
  findUp,
  formatPublicPath,
  fse,
  generateScriptTag,
  getAddressUrls,
  getBrowserslist,
  getBrowserslistWithDefault,
  getBundlerChain,
  getCoreJsVersion,
  getDefaultStyledComponentsConfig,
  getDistPath,
  getFilename,
  getHtmlMinifyOptions,
  getJsSourceMap,
  getNodeEnv,
  getProgressColor,
  getPublicPathFromChain,
  getPublicPathFromCompiler,
  getSharedPkgCompiledPath,
  getSwcMinimizerOptions,
  getUrlLabel,
  isClientCompiler,
  isCssModules,
  isDebug,
  isDev,
  isFileExists,
  isFileSync,
  isFunction,
  isHtmlDisabled,
  isInNodeModules,
  isMultiCompiler,
  isNil,
  isObject,
  isPlainObject,
  isProd,
  isRegExp,
  isServerTarget,
  isString,
  isTest,
  isURL,
  isUndefined,
  isUsingHMR,
  isWebTarget,
  kebabCase,
  logger,
  mergeChainedOptions,
  modifyBundlerChain,
  modifySwcLoaderOptions,
  normalizeUrl,
  onCompileDone,
  outputInspectConfigFiles,
  parseMinifyOptions,
  partition,
  pick,
  pickRsbuildConfig,
  prettyTime,
  removeLeadingSlash,
  removeTailingSlash,
  resolvePackage,
  setNodeEnv,
  setupServerHooks,
  stringifyConfig,
  upperFirst,
  withPublicPath
});
