@rsbuild/core 2.2.13 → 2.2.14

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/m.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /*! LICENSE: m.js.LICENSE.txt */
2
- let runtimeProcessArgs, runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
2
+ let runtimeInfo, swcHelpersPath, pluginHelper_htmlPlugin;
3
3
  import { rspackRequire, moduleFactories, compatGetDefaultExport, createFakeNamespaceObject } from "./rslib-runtime.js";
4
4
  import { rspack as core_rspack } from "@rspack/core";
5
5
  import node_util, { format as external_node_util_format, promisify, stripVTControlCharacters } from "node:util";
6
6
  import node_path, { dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, resolve as external_node_path_resolve, sep } from "node:path";
7
7
  import { builtinModules, createRequire, createRequire as __rspack_createRequire } from "node:module";
8
- import node_fs, { existsSync } from "node:fs";
8
+ import node_fs, { existsSync, readFileSync } from "node:fs";
9
9
  import node_os, { constants } from "node:os";
10
10
  import node_process from "node:process";
11
11
  import { URL as external_node_url_URL, pathToFileURL, fileURLToPath as __rspack_fileURLToPath } from "node:url";
@@ -390,8 +390,8 @@ moduleFactories.add({
390
390
  return (asyncHooks.AsyncResource && (res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')), res && res.runInAsyncScope) ? res.runInAsyncScope.bind(res, fn, null) : fn;
391
391
  }
392
392
  },
393
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/index.js" (module) {
394
- let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/req.js");
393
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/index.js" (module) {
394
+ let yaml, { resolve } = __rspack_createRequire_require("node:path"), config = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/lilconfig/3.1.3/8e9a79516bf61f8427342cef50cdad2cdc2572f42288ba8053b88eadfdc0ebef/node_modules/lilconfig/src/index.js"), loadOptions = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/options.js"), loadPlugins = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/plugins.js"), req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
395
395
  async function processResult(ctx, result) {
396
396
  let obj, file = result.filepath || '', projectConfig = ((obj = result.config) && obj.__esModule ? obj : {
397
397
  default: obj
@@ -464,8 +464,8 @@ moduleFactories.add({
464
464
  });
465
465
  };
466
466
  },
467
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/options.js" (module) {
468
- let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/req.js");
467
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/options.js" (module) {
468
+ let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
469
469
  module.exports = async function options(config, file) {
470
470
  if (config.parser && 'string' == typeof config.parser) try {
471
471
  config.parser = await req(config.parser, file);
@@ -485,8 +485,8 @@ moduleFactories.add({
485
485
  return config;
486
486
  };
487
487
  },
488
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/plugins.js" (module) {
489
- let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/req.js");
488
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/plugins.js" (module) {
489
+ let req = rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js");
490
490
  async function load(plugin, options, file) {
491
491
  try {
492
492
  if (null == options || 0 === Object.keys(options).length) return await req(plugin, file);
@@ -502,7 +502,7 @@ moduleFactories.add({
502
502
  }), list;
503
503
  };
504
504
  },
505
- "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/req.js" (module) {
505
+ "../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/req.js" (module) {
506
506
  let tsx, jiti, { createRequire } = __rspack_createRequire_require("node:module"), { pathToFileURL } = __rspack_createRequire_require("node:url"), TS_EXT_RE = /\.[mc]?ts$/, importError = [];
507
507
  module.exports = async function req(name, rootFile = __rspack_import_meta_filename__) {
508
508
  let url = createRequire(rootFile).resolve(name);
@@ -758,7 +758,7 @@ function setDotProp(obj, keys, val) {
758
758
  }
759
759
  }
760
760
  function setByType(obj, transforms) {
761
- for (let [key, transform] of Object.entries(transforms))transform.shouldTransform && (obj[key] = [
761
+ for (let [key, transform] of Object.entries(transforms))transform.shouldTransform && key in obj && (obj[key] = [
762
762
  obj[key]
763
763
  ].flat(), "function" == typeof transform.transformFunction && (obj[key] = obj[key].map(transform.transformFunction)));
764
764
  }
@@ -791,8 +791,11 @@ var CACError = class extends Error {
791
791
  };
792
792
  if ("u" > typeof process) {
793
793
  let runtimeName;
794
- runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node", runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`, runtimeProcessArgs = process.argv;
794
+ runtimeName = "u" > typeof Deno && "string" == typeof Deno.version?.deno ? "deno" : "u" > typeof Bun && "string" == typeof Bun.version ? "bun" : "node", runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
795
795
  } else runtimeInfo = "u" < typeof navigator ? "unknown" : `${navigator.platform} ${navigator.userAgent}`;
796
+ function getRuntimeProcessArgs() {
797
+ return "u" < typeof process ? void 0 : process.argv;
798
+ }
796
799
  var Command = class {
797
800
  rawName;
798
801
  description;
@@ -965,6 +968,7 @@ var Command = class {
965
968
  }
966
969
  parse(argv, { run = !0 } = {}) {
967
970
  if (!argv) {
971
+ let runtimeProcessArgs = getRuntimeProcessArgs();
968
972
  if (!runtimeProcessArgs) throw Error("No argv provided and runtime process argv is not available.");
969
973
  argv = runtimeProcessArgs;
970
974
  }
@@ -2495,8 +2499,14 @@ class BrowserslistError extends Error {
2495
2499
  let isFileCache = {};
2496
2500
  function isFile(file) {
2497
2501
  if (file in isFileCache) return isFileCache[file];
2498
- let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
2499
- return isFileCache[file] = result, result;
2502
+ try {
2503
+ let result = node_fs.existsSync(file) && node_fs.statSync(file).isFile();
2504
+ return isFileCache[file] = result, result;
2505
+ } catch (error) {
2506
+ let { code } = error;
2507
+ if ('ENOENT' === code || 'EACCES' === code || 'ERR_ACCESS_DENIED' === code) return !1;
2508
+ throw error;
2509
+ }
2500
2510
  }
2501
2511
  function dist_check(section) {
2502
2512
  let FORMAT = 'Browserslist config should be a string or an array of strings with browser queries';
@@ -2510,7 +2520,7 @@ function parsePackage(file) {
2510
2520
  let list = config.browserslist;
2511
2521
  for(let i in Array.isArray(list) && (list = {
2512
2522
  defaults: list
2513
- }), 'string' == typeof list && (list = parseConfig(list)), list)dist_check(list[i]);
2523
+ }), 'string' == typeof list && (list = parseConfig(list)), list)dist_check(list[i]), 'string' == typeof list[i] && (list[i] = parseConfig(list[i]).defaults);
2514
2524
  return list;
2515
2525
  }
2516
2526
  let IS_SECTION = /^\s*\[(.+)]\s*$/;
@@ -3303,7 +3313,7 @@ function createPublicContext(context) {
3303
3313
  async function createContext(options, userConfig, logger, loadConfigResult) {
3304
3314
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, hooks = initHooks();
3305
3315
  return {
3306
- version: "2.2.13",
3316
+ version: "2.2.14",
3307
3317
  rootPath,
3308
3318
  configFile: loadConfigResult?.filePath ?? userConfig._privateMeta?.configFilePath,
3309
3319
  configFileDependencies: loadConfigResult?.dependencies ?? userConfig._privateMeta?.configFileDependencies ?? [],
@@ -4114,9 +4124,9 @@ let getChokidar = cachedImport_cachedImport(()=>import("./chokidar.js").then((m)
4114
4124
  'unlink'
4115
4125
  ];
4116
4126
  async function setupWatchFiles(options) {
4117
- let { config, root, buildManager } = options, { hmr, liveReload } = config.dev;
4127
+ let { config, root, logger, buildManager } = options, { hmr, liveReload } = config.dev;
4118
4128
  if (!hmr && !liveReload || !buildManager) return;
4119
- let closeDevFilesWatcher = await watchDevFiles(config.dev, buildManager, root), serverFilesWatcher = await watchServerFiles(config.server, buildManager, root);
4129
+ let closeDevFilesWatcher = await watchDevFiles(config.dev, buildManager, root, logger), serverFilesWatcher = await watchServerFiles(config.server, buildManager, root, logger);
4120
4130
  return {
4121
4131
  async close () {
4122
4132
  await Promise.all([
@@ -4126,22 +4136,22 @@ async function setupWatchFiles(options) {
4126
4136
  }
4127
4137
  };
4128
4138
  }
4129
- async function watchDevFiles(devConfig, buildManager, root) {
4139
+ async function watchDevFiles(devConfig, buildManager, root, logger) {
4130
4140
  let { watchFiles } = devConfig;
4131
4141
  if (!watchFiles) return;
4132
4142
  let watchers = [];
4133
4143
  for (let { paths, events, options, type } of helpers_castArray(watchFiles)){
4134
- let watchOptions = prepareWatchOptions(paths, options, type, events), watcher = await startWatchFiles(watchOptions, buildManager, root);
4144
+ let watchOptions = prepareWatchOptions(paths, options, type, events), watcher = await startWatchFiles(watchOptions, buildManager, root, logger);
4135
4145
  watcher && watchers.push(watcher);
4136
4146
  }
4137
4147
  return async ()=>{
4138
4148
  for (let watcher of watchers)await watcher.close();
4139
4149
  };
4140
4150
  }
4141
- function watchServerFiles({ publicDir }, buildManager, root) {
4151
+ function watchServerFiles({ publicDir }, buildManager, root, logger) {
4142
4152
  if (!publicDir.length) return;
4143
4153
  let watchPaths = publicDir.filter((item)=>item.watch).map((item)=>item.name);
4144
- if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), buildManager, root);
4154
+ if (watchPaths.length) return startWatchFiles(prepareWatchOptions(watchPaths), buildManager, root, logger);
4145
4155
  }
4146
4156
  function prepareWatchOptions(paths, options = {}, type, events) {
4147
4157
  return {
@@ -4154,7 +4164,7 @@ function prepareWatchOptions(paths, options = {}, type, events) {
4154
4164
  };
4155
4165
  }
4156
4166
  let GLOB_REGEX = /[*?{}[\]()!+|]/;
4157
- async function createChokidar(pathOrGlobs, root, options) {
4167
+ async function createChokidar(pathOrGlobs, root, options, logger) {
4158
4168
  let { default: chokidar } = await getChokidar(), watchFiles = new Set(), globPatterns = pathOrGlobs.filter((pathOrGlob)=>!!GLOB_REGEX.test(pathOrGlob) || (watchFiles.add(pathOrGlob), !1));
4159
4169
  if (globPatterns.length) {
4160
4170
  let { glob } = await getTinyglobby();
@@ -4163,14 +4173,17 @@ async function createChokidar(pathOrGlobs, root, options) {
4163
4173
  absolute: !0
4164
4174
  })))watchFiles.add(file);
4165
4175
  }
4166
- return chokidar.watch(Array.from(watchFiles), options);
4176
+ let watcher = chokidar.watch(Array.from(watchFiles), options);
4177
+ return watcher.on('error', (error)=>{
4178
+ logger.error('File watcher error:', error);
4179
+ }), watcher;
4167
4180
  }
4168
- async function startWatchFiles({ paths, events, options, type = 'reload-page' }, buildManager, root) {
4181
+ async function startWatchFiles({ paths, events, options, type = 'reload-page' }, buildManager, root, logger) {
4169
4182
  if ('reload-page' !== type || events?.length === 0) return;
4170
4183
  let watcher = await createChokidar(paths, root, {
4171
4184
  ignoreInitial: !0,
4172
4185
  ...options
4173
- }), reloadPage = ()=>{
4186
+ }, logger), reloadPage = ()=>{
4174
4187
  buildManager.socketServer.sendMessage({
4175
4188
  type: 'full-reload'
4176
4189
  });
@@ -4234,7 +4247,7 @@ function watchFilesForRestart({ watchFiles, context, restartContext }) {
4234
4247
  ignoreInitial: !0,
4235
4248
  ignorePermissionErrors: !0,
4236
4249
  ...options
4237
- }), cwd = options?.cwd ?? root;
4250
+ }, logger), cwd = options?.cwd ?? root;
4238
4251
  for (let event of events ? new Set(events) : DEFAULT_WATCH_FILE_EVENTS)watcher.on(event, (filePath)=>onWatchEvent(event, filePath, cwd));
4239
4252
  return watcher;
4240
4253
  } catch (error) {
@@ -4890,7 +4903,25 @@ let normalizeCleanDistPath = (userOptions)=>{
4890
4903
  ...defaultOptions,
4891
4904
  ...userOptions
4892
4905
  };
4893
- }, getConsolePureFuncs = (methods)=>methods.map((method)=>`console.${method}`), ALL_CONSOLE_PURE_FUNCS = getConsolePureFuncs([
4906
+ };
4907
+ function findWorkspaceRoot(root) {
4908
+ let packageRoot, current = root;
4909
+ for(;;){
4910
+ if (isFileSync(join(current, 'pnpm-workspace.yaml')) || isFileSync(join(current, 'lerna.json'))) return current;
4911
+ let packageJson = join(current, 'package.json');
4912
+ if (isFileSync(packageJson)) {
4913
+ packageRoot ??= current;
4914
+ try {
4915
+ let pkg = JSON.parse(readFileSync(packageJson, 'utf8'));
4916
+ if (pkg?.workspaces) return current;
4917
+ } catch {}
4918
+ }
4919
+ let parent = dirname(current);
4920
+ if (parent === current) return packageRoot ?? root;
4921
+ current = parent;
4922
+ }
4923
+ }
4924
+ let getConsolePureFuncs = (methods)=>methods.map((method)=>`console.${method}`), ALL_CONSOLE_PURE_FUNCS = getConsolePureFuncs([
4894
4925
  'assert',
4895
4926
  'clear',
4896
4927
  'count',
@@ -4950,7 +4981,7 @@ function parseMinifyOptions(config) {
4950
4981
  cssOptions: minify.cssOptions
4951
4982
  };
4952
4983
  }
4953
- var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/baf07bf9099810ce2e0c00768f056c90b47d57b154f4b8912460449b9922899a/node_modules/postcss-load-config/src/index.js"));
4984
+ var postcss_load_config_src_default = compatGetDefaultExport(rspackRequire("../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/postcss-load-config/6.0.1/cbcc4ffbb08c543cea9a1ac750ccfc742d666712f0530b683d312c61ffd50060/node_modules/postcss-load-config/src/index.js"));
4954
4985
  async function getLightningCSSLoaderOptions(config, targets, minify) {
4955
4986
  let userOptions = 'object' == typeof config.tools.lightningcssLoader ? config.tools.lightningcssLoader : {}, initialOptions = {
4956
4987
  targets,
@@ -4973,7 +5004,9 @@ let clonePostCSSConfig = (config)=>({
4973
5004
  async function loadUserPostcssrc(root, postcssrcCache) {
4974
5005
  let cached = postcssrcCache.get(root);
4975
5006
  if (cached) return clonePostCSSConfig(await cached);
4976
- let promise = postcss_load_config_src_default()({}, root).catch((err)=>{
5007
+ let promise = postcss_load_config_src_default()({}, root, {
5008
+ stopDir: findWorkspaceRoot(root)
5009
+ }).catch((err)=>{
4977
5010
  if (err.message?.includes('No PostCSS Config found')) return {};
4978
5011
  throw err;
4979
5012
  });
@@ -5691,7 +5724,7 @@ async function getMetaTags(entryName, config, templateContent) {
5691
5724
  entryName
5692
5725
  }
5693
5726
  });
5694
- return templateContent && metaTags.charset && /<meta[^>]+charset=["'][^>]*>/i.test(templateContent) && delete metaTags.charset, metaTags;
5727
+ return templateContent && metaTags.charset && /<meta\b(?:[^>"']|"[^"]*"|'[^']*')*?\scharset\s*=/i.test(templateContent) && delete metaTags.charset, metaTags;
5695
5728
  }
5696
5729
  function getTemplateParameters(entryName, config, assetPrefix) {
5697
5730
  return async (compilation, assets, assetTags, pluginOptions)=>{
@@ -7897,7 +7930,7 @@ let applyDefaultMiddlewares = async ({ config, buildManager, context, devServer,
7897
7930
  dev: !0
7898
7931
  });
7899
7932
  middlewares.use(function publicDirMiddleware(req, res, next) {
7900
- sirvMiddleware(req, res, next);
7933
+ req.method && 'GET' !== req.method && 'HEAD' !== req.method ? next() : sirvMiddleware(req, res, next);
7901
7934
  });
7902
7935
  }
7903
7936
  }
@@ -8513,6 +8546,7 @@ async function devServer_createDevServer(options, createCompiler, config, devSer
8513
8546
  ];
8514
8547
  return runCompile ? context.hooks.onBeforeCreateCompiler.tapOnce(beforeCreateCompiler) : await beforeCreateCompiler(), state.buildManager = runCompile ? await startCompile() : void 0, state.fileWatcher = await setupWatchFiles({
8515
8548
  config,
8549
+ logger,
8516
8550
  buildManager: state.buildManager,
8517
8551
  root: context.rootPath
8518
8552
  }), state.devMiddlewares = await getDevMiddlewares({
@@ -9245,7 +9279,13 @@ try {
9245
9279
  name: 'rsbuild:define',
9246
9280
  setup (api) {
9247
9281
  api.modifyBundlerChain((chain, { CHAIN_ID, rspack, environment })=>{
9248
- let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)), mergedDefine = {
9282
+ let { config } = environment, baseUrl = JSON.stringify(config.server.base), assetPrefix = JSON.stringify(getPublicPathFromChain(chain, !1)), envPrefix = 'import.meta.env.', userEnv = Object.create(null);
9283
+ for (let [key, value] of Object.entries(config.source.define)){
9284
+ if (!key.startsWith(envPrefix)) continue;
9285
+ let name = key.slice(envPrefix.length);
9286
+ '' === name || name.includes('.') || (userEnv[name] = value);
9287
+ }
9288
+ let mergedDefine = {
9249
9289
  ...{
9250
9290
  'import.meta.env': {
9251
9291
  MODE: JSON.stringify(config.mode),
@@ -9253,7 +9293,8 @@ try {
9253
9293
  PROD: 'production' === config.mode,
9254
9294
  SSR: 'node' === config.output.target,
9255
9295
  BASE_URL: baseUrl,
9256
- ASSET_PREFIX: assetPrefix
9296
+ ASSET_PREFIX: assetPrefix,
9297
+ ...userEnv
9257
9298
  },
9258
9299
  'process.env.BASE_URL': baseUrl,
9259
9300
  'process.env.ASSET_PREFIX': assetPrefix
@@ -9674,7 +9715,7 @@ try {
9674
9715
  return;
9675
9716
  }
9676
9717
  }
9677
- api.logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow('@rsdoctor/rspack-plugin'))} package.`);
9718
+ api.logger.warn(`\`process.env.RSDOCTOR\` enabled, please install ${color.bold(color.yellow('@rsdoctor/core@latest'))} package.`);
9678
9719
  });
9679
9720
  }
9680
9721
  },
@@ -10350,7 +10391,7 @@ let applyServerOptions = (command)=>{
10350
10391
  };
10351
10392
  function setupCommands(argv) {
10352
10393
  let cli = ((name = "")=>new CAC(name))('rsbuild');
10353
- cli.version("2.2.13"), 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)', {
10394
+ cli.version("2.2.14"), 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)', {
10354
10395
  default: 'auto'
10355
10396
  }).option('--dist-path <dir>', 'Set the root directory of output files').option('--source-map', 'Enable source map').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', {
10356
10397
  type: [
@@ -10415,7 +10456,7 @@ function setupCommands(argv) {
10415
10456
  }
10416
10457
  function showGreeting() {
10417
10458
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
10418
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.13\n`);
10459
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.2.14\n`);
10419
10460
  }
10420
10461
  function setupLogLevel(argv) {
10421
10462
  if (argv.length <= 3) return;
@@ -10437,5 +10478,5 @@ function runCLI({ argv = process.argv } = {}) {
10437
10478
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
10438
10479
  }
10439
10480
  }
10440
- let src_version = "2.2.13";
10481
+ let src_version = "2.2.14";
10441
10482
  export { core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, mrmime_lookup, runCLI, src_logger as logger, src_version as version };
@@ -1,9 +1,11 @@
1
1
  import type { FSWatcher } from '../../compiled/chokidar/index.js';
2
+ import type { Logger } from '../logger.js';
2
3
  import type { ChokidarOptions, NormalizedConfig, WatchFileEvent } from '../types/index.js';
3
4
  import type { BuildManager } from './buildManager.js';
4
5
  export declare const DEFAULT_WATCH_FILE_EVENTS: readonly WatchFileEvent[];
5
6
  type WatchFilesOptions = {
6
7
  root: string;
8
+ logger: Logger;
7
9
  config: NormalizedConfig;
8
10
  buildManager?: BuildManager;
9
11
  };
@@ -11,5 +13,5 @@ export type WatchFilesResult = {
11
13
  close(): Promise<void>;
12
14
  };
13
15
  export declare function setupWatchFiles(options: WatchFilesOptions): Promise<WatchFilesResult | undefined>;
14
- export declare function createChokidar(pathOrGlobs: string[], root: string, options: ChokidarOptions): Promise<FSWatcher>;
16
+ export declare function createChokidar(pathOrGlobs: string[], root: string, options: ChokidarOptions, logger: Logger): Promise<FSWatcher>;
15
17
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.2.13",
3
+ "version": "2.2.14",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,14 +46,14 @@
46
46
  "@jridgewell/remapping": "^2.3.5",
47
47
  "@jridgewell/trace-mapping": "^0.3.31",
48
48
  "@jsonjoy.com/fs-core": "4.80.0",
49
- "@rstackjs/load-config": "^1.0.1",
49
+ "@rstackjs/load-config": "^1.0.2",
50
50
  "@types/cors": "^2.8.19",
51
51
  "@types/node": "^24.19.2",
52
52
  "@types/on-finished": "2.3.5",
53
53
  "@types/range-parser": "^1.2.7",
54
54
  "@types/ws": "^8.18.2",
55
- "browserslist-load-config": "^1.0.3",
56
- "cac": "^7.0.1",
55
+ "browserslist-load-config": "^1.0.4",
56
+ "cac": "^7.1.0",
57
57
  "chokidar": "^5.0.0",
58
58
  "connect-next": "5.0.0",
59
59
  "core-js": "^3.50.0",
@@ -70,7 +70,7 @@
70
70
  "mrmime": "^2.0.1",
71
71
  "on-finished": "2.4.1",
72
72
  "open": "^11.0.4",
73
- "postcss": "^8.5.29",
73
+ "postcss": "^8.5.30",
74
74
  "postcss-load-config": "6.0.1",
75
75
  "postcss-loader": "8.2.1",
76
76
  "prebundle": "1.6.5",