@rsbuild/core 2.0.4 → 2.0.5

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.
Files changed (2) hide show
  1. package/dist/753.js +26 -11
  2. package/package.json +1 -1
package/dist/753.js CHANGED
@@ -3481,7 +3481,7 @@ function createPublicContext(context) {
3481
3481
  async function createContext(options, userConfig, logger) {
3482
3482
  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;
3483
3483
  return {
3484
- version: "2.0.4",
3484
+ version: "2.0.5",
3485
3485
  rootPath,
3486
3486
  distPath: '',
3487
3487
  cachePath,
@@ -6783,11 +6783,26 @@ function gzipMiddleware_gzipMiddleware({ filter, level = node_zlib.constants.Z_B
6783
6783
  void 0 !== writeHeadMessage ? writeHead(statusCode, writeHeadMessage) : writeHead(statusCode);
6784
6784
  };
6785
6785
  res.writeHead = (status, reason, headers)=>{
6786
- writeHeadStatus = status, 'string' == typeof reason && (writeHeadMessage = reason);
6786
+ writeHeadStatus = status, writeHeadMessage = 'string' == typeof reason ? reason : void 0;
6787
6787
  let resolvedHeaders = 'string' == typeof reason ? headers : reason;
6788
- if (resolvedHeaders) for (let [key, value] of Object.entries(resolvedHeaders))res.setHeader(key, value);
6789
- return res;
6790
- }, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip ? gzip.end(...args) : end.apply(res, args)), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on(type, listener) : listeners.push([
6788
+ return resolvedHeaders && ((res, headers)=>{
6789
+ if (Array.isArray(headers)) {
6790
+ let seen = new Set();
6791
+ for(let index = 0; index < headers.length; index += 2){
6792
+ let key = String(headers[index]), value = headers[index + 1];
6793
+ if (void 0 !== value) {
6794
+ let lowerKey = key.toLowerCase();
6795
+ seen.has(lowerKey) || (seen.add(lowerKey), res.removeHeader(key)), res.appendHeader(key, Array.isArray(value) ? value : String(value));
6796
+ }
6797
+ }
6798
+ return;
6799
+ }
6800
+ for (let key of Object.keys(headers)){
6801
+ let value = headers[key];
6802
+ void 0 !== value && res.setHeader(key, value);
6803
+ }
6804
+ })(res, resolvedHeaders), res;
6805
+ }, res.write = (...args)=>(start(), gzip ? gzip.write(...args) : write.apply(res, args)), res.end = (...args)=>(start(), gzip) ? (gzip.end(...args), res) : end.apply(res, args), res.on = (type, listener)=>(started ? gzip && 'drain' === type ? gzip.on(type, listener) : on(type, listener) : listeners.push([
6791
6806
  type,
6792
6807
  listener
6793
6808
  ]), res), next();
@@ -9087,17 +9102,17 @@ async function createRsbuild(options = {}) {
9087
9102
  context.action || (context.action = 'development' === config.mode ? 'dev' : 'build');
9088
9103
  }, inspectConfig = async (inspectOptions)=>{
9089
9104
  initAction();
9090
- let bundlerConfigs = (await initConfigs_initConfigs({
9105
+ let { rspackConfigs } = await initConfigs_initConfigs({
9091
9106
  context,
9092
9107
  pluginManager,
9093
9108
  rsbuildOptions: resolvedOptions
9094
- })).rspackConfigs;
9109
+ });
9095
9110
  return inspectConfig_inspectConfig({
9096
9111
  context,
9097
9112
  pluginManager,
9098
9113
  rsbuildOptions: resolvedOptions,
9099
9114
  inspectOptions,
9100
- bundlerConfigs
9115
+ bundlerConfigs: rspackConfigs
9101
9116
  });
9102
9117
  }, initConfigs = async (options)=>{
9103
9118
  if (context.action && options?.action && context.action !== options.action) throw Error(`\
@@ -9351,7 +9366,7 @@ let applyServerOptions = (command)=>{
9351
9366
  };
9352
9367
  function setupCommands() {
9353
9368
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9354
- cli.version("2.0.4"), 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)', {
9369
+ cli.version("2.0.5"), 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)', {
9355
9370
  default: 'auto'
9356
9371
  }).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', {
9357
9372
  type: [
@@ -9428,7 +9443,7 @@ function initNodeEnv() {
9428
9443
  }
9429
9444
  function showGreeting() {
9430
9445
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9431
- src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.4\n`);
9446
+ src_logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v2.0.5\n`);
9432
9447
  }
9433
9448
  function setupLogLevel() {
9434
9449
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9449,5 +9464,5 @@ function runCLI() {
9449
9464
  src_logger.error('Failed to start Rsbuild CLI.'), src_logger.error(err), process.exit(1);
9450
9465
  }
9451
9466
  }
9452
- let src_version = "2.0.4";
9467
+ let src_version = "2.0.5";
9453
9468
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, core_rspack as rspack, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger_createLogger as createLogger, mergeRsbuildConfig, runCLI, src_logger as logger, src_version as version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {