@rsbuild/core 1.4.0-beta.3 → 1.4.0-beta.4

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/index.cjs CHANGED
@@ -2001,7 +2001,7 @@ for(var __webpack_i__ in (()=>{
2001
2001
  async function createContext(options, userConfig) {
2002
2002
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
2003
2003
  return {
2004
- version: "1.4.0-beta.3",
2004
+ version: "1.4.0-beta.4",
2005
2005
  rootPath,
2006
2006
  distPath: '',
2007
2007
  cachePath,
@@ -2317,10 +2317,7 @@ for(var __webpack_i__ in (()=>{
2317
2317
  javascript: {
2318
2318
  exportsPresence: 'error'
2319
2319
  }
2320
- }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', 'rspack' === api.context.bundlerType && chain.experiments({
2321
- ...chain.get('experiments'),
2322
- incremental: !0
2323
- });
2320
+ }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys';
2324
2321
  });
2325
2322
  }
2326
2323
  }), isUseAnalyzer = (config)=>{
@@ -3354,6 +3351,19 @@ for(var __webpack_i__ in (()=>{
3354
3351
  };
3355
3352
  });
3356
3353
  }
3354
+ }), pluginLazyCompilation = ()=>({
3355
+ name: 'rsbuild:lazy-compilation',
3356
+ setup (api) {
3357
+ api.modifyBundlerChain((chain, { environment, isProd, target })=>{
3358
+ var _config_dev;
3359
+ if (isProd || 'web' !== target) return;
3360
+ let { config } = environment, options = null == (_config_dev = config.dev) ? void 0 : _config_dev.lazyCompilation;
3361
+ options && chain.experiments({
3362
+ ...chain.get('experiments'),
3363
+ lazyCompilation: options
3364
+ });
3365
+ });
3366
+ }
3357
3367
  });
3358
3368
  function recursiveChunkEntryNames(chunk) {
3359
3369
  let [...chunkGroups] = chunk.groupsIterable;
@@ -5862,7 +5872,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
5862
5872
  }
5863
5873
  if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager) {
5864
5874
  let { compiler } = compilationManager;
5865
- 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
5875
+ 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler));
5866
5876
  }
5867
5877
  server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
5868
5878
  base: server.base
@@ -6771,6 +6781,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6771
6781
  }
6772
6782
  },
6773
6783
  pluginRspackProfile(),
6784
+ pluginLazyCompilation(),
6774
6785
  pluginSri(),
6775
6786
  pluginNonce()
6776
6787
  ]);
@@ -6780,22 +6791,24 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
6780
6791
  cwd: options.cwd,
6781
6792
  ...'boolean' == typeof options.loadEnv ? {} : options.loadEnv
6782
6793
  }) : null, config = isFunction(options.rsbuildConfig) ? await options.rsbuildConfig() : options.rsbuildConfig || {};
6783
- var _config_performance, config1 = config, envs1 = envs;
6784
- if (null !== envs1 && (config1.source ||= {}, config1.source.define = {
6785
- ...envs1.publicVars,
6786
- ...config1.source.define
6787
- }, 0 !== envs1.filePaths.length && (config1.dev ||= {}, config1.dev.watchFiles = [
6788
- ...config1.dev.watchFiles ? castArray(config1.dev.watchFiles) : [],
6789
- {
6790
- paths: envs1.filePaths,
6791
- type: 'reload-server'
6794
+ config.logLevel && (rslog_index_js_namespaceObject.logger.level = config.logLevel), function(config, envs) {
6795
+ var _config_performance;
6796
+ if (null !== envs && (config.source ||= {}, config.source.define = {
6797
+ ...envs.publicVars,
6798
+ ...config.source.define
6799
+ }, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
6800
+ ...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
6801
+ {
6802
+ paths: envs.filePaths,
6803
+ type: 'reload-server'
6804
+ }
6805
+ ], null == (_config_performance = config.performance) ? void 0 : _config_performance.buildCache))) {
6806
+ let { buildCache } = config.performance;
6807
+ !0 === buildCache ? config.performance.buildCache = {
6808
+ buildDependencies: envs.filePaths
6809
+ } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
6792
6810
  }
6793
- ], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
6794
- let { buildCache } = config1.performance;
6795
- !0 === buildCache ? config1.performance.buildCache = {
6796
- buildDependencies: envs1.filePaths
6797
- } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs1.filePaths));
6798
- }
6811
+ }(config, envs);
6799
6812
  let resolvedOptions = {
6800
6813
  cwd: process.cwd(),
6801
6814
  callerName: 'rsbuild',
@@ -7457,11 +7470,11 @@ ${section.body}` : section.body).join("\n\n"));
7457
7470
  }
7458
7471
  process.title = 'rsbuild-node';
7459
7472
  let { npm_execpath } = process.env;
7460
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-beta.3\n`);
7473
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && rslog_index_js_namespaceObject.logger.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-beta.4\n`);
7461
7474
  try {
7462
7475
  !function() {
7463
7476
  let cli = cac_dist('rsbuild');
7464
- cli.help(), cli.version("1.4.0-beta.3"), applyCommonOptions(cli);
7477
+ cli.help(), cli.version("1.4.0-beta.4"), applyCommonOptions(cli);
7465
7478
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7466
7479
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7467
7480
  try {
@@ -7512,7 +7525,7 @@ ${section.body}` : section.body).join("\n\n"));
7512
7525
  rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
7513
7526
  }
7514
7527
  }
7515
- let src_version = "1.4.0-beta.3";
7528
+ let src_version = "1.4.0-beta.4";
7516
7529
  })(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
7517
7530
  "PLUGIN_CSS_NAME",
7518
7531
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -1813,7 +1813,7 @@ async function updateEnvironmentContext(context, configs) {
1813
1813
  async function createContext(options, userConfig) {
1814
1814
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
1815
1815
  return {
1816
- version: "1.4.0-beta.3",
1816
+ version: "1.4.0-beta.4",
1817
1817
  rootPath,
1818
1818
  distPath: '',
1819
1819
  cachePath,
@@ -2128,10 +2128,7 @@ let configChain_CHAIN_ID = {
2128
2128
  javascript: {
2129
2129
  exportsPresence: 'error'
2130
2130
  }
2131
- }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', 'rspack' === api.context.bundlerType && chain.experiments({
2132
- ...chain.get('experiments'),
2133
- incremental: !0
2134
- });
2131
+ }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys';
2135
2132
  });
2136
2133
  }
2137
2134
  }), isUseAnalyzer = (config)=>{
@@ -3162,6 +3159,19 @@ let getInlineTests = (config)=>{
3162
3159
  };
3163
3160
  });
3164
3161
  }
3162
+ }), pluginLazyCompilation = ()=>({
3163
+ name: 'rsbuild:lazy-compilation',
3164
+ setup (api) {
3165
+ api.modifyBundlerChain((chain, { environment, isProd, target })=>{
3166
+ var _config_dev;
3167
+ if (isProd || 'web' !== target) return;
3168
+ let { config } = environment, options = null == (_config_dev = config.dev) ? void 0 : _config_dev.lazyCompilation;
3169
+ options && chain.experiments({
3170
+ ...chain.get('experiments'),
3171
+ lazyCompilation: options
3172
+ });
3173
+ });
3174
+ }
3165
3175
  });
3166
3176
  function recursiveChunkEntryNames(chunk) {
3167
3177
  let [...chunkGroups] = chunk.groupsIterable;
@@ -5659,7 +5669,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
5659
5669
  }
5660
5670
  if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager) {
5661
5671
  let { compiler } = compilationManager;
5662
- 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(rspack.experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler, dev.lazyCompilation));
5672
+ 'object' == typeof dev.lazyCompilation && 'string' == typeof dev.lazyCompilation.serverUrl && context.devServer && (dev.lazyCompilation.serverUrl = replacePortPlaceholder(dev.lazyCompilation.serverUrl, context.devServer.port)), middlewares.push(rspack.experiments.lazyCompilationMiddleware(helpers_isMultiCompiler(compiler) ? compiler.compilers[0] : compiler));
5663
5673
  }
5664
5674
  server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
5665
5675
  base: server.base
@@ -6565,6 +6575,7 @@ async function applyDefaultPlugins(pluginManager, context) {
6565
6575
  }
6566
6576
  },
6567
6577
  pluginRspackProfile(),
6578
+ pluginLazyCompilation(),
6568
6579
  pluginSri(),
6569
6580
  pluginNonce()
6570
6581
  ]);
@@ -6574,22 +6585,24 @@ async function createRsbuild(options = {}) {
6574
6585
  cwd: options.cwd,
6575
6586
  ...'boolean' == typeof options.loadEnv ? {} : options.loadEnv
6576
6587
  }) : null, config = isFunction(options.rsbuildConfig) ? await options.rsbuildConfig() : options.rsbuildConfig || {};
6577
- var _config_performance, config1 = config, envs1 = envs;
6578
- if (null !== envs1 && (config1.source ||= {}, config1.source.define = {
6579
- ...envs1.publicVars,
6580
- ...config1.source.define
6581
- }, 0 !== envs1.filePaths.length && (config1.dev ||= {}, config1.dev.watchFiles = [
6582
- ...config1.dev.watchFiles ? castArray(config1.dev.watchFiles) : [],
6583
- {
6584
- paths: envs1.filePaths,
6585
- type: 'reload-server'
6588
+ config.logLevel && (logger.level = config.logLevel), function(config, envs) {
6589
+ var _config_performance;
6590
+ if (null !== envs && (config.source ||= {}, config.source.define = {
6591
+ ...envs.publicVars,
6592
+ ...config.source.define
6593
+ }, 0 !== envs.filePaths.length && (config.dev ||= {}, config.dev.watchFiles = [
6594
+ ...config.dev.watchFiles ? castArray(config.dev.watchFiles) : [],
6595
+ {
6596
+ paths: envs.filePaths,
6597
+ type: 'reload-server'
6598
+ }
6599
+ ], null == (_config_performance = config.performance) ? void 0 : _config_performance.buildCache))) {
6600
+ let { buildCache } = config.performance;
6601
+ !0 === buildCache ? config.performance.buildCache = {
6602
+ buildDependencies: envs.filePaths
6603
+ } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs.filePaths));
6586
6604
  }
6587
- ], null == (_config_performance = config1.performance) ? void 0 : _config_performance.buildCache))) {
6588
- let { buildCache } = config1.performance;
6589
- !0 === buildCache ? config1.performance.buildCache = {
6590
- buildDependencies: envs1.filePaths
6591
- } : (buildCache.buildDependencies ||= [], buildCache.buildDependencies.push(...envs1.filePaths));
6592
- }
6605
+ }(config, envs);
6593
6606
  let resolvedOptions = {
6594
6607
  cwd: process.cwd(),
6595
6608
  callerName: 'rsbuild',
@@ -7249,11 +7262,11 @@ async function runCLI() {
7249
7262
  }
7250
7263
  process.title = 'rsbuild-node';
7251
7264
  let { npm_execpath } = process.env;
7252
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), logger.greet(` Rsbuild v1.4.0-beta.3\n`);
7265
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0-beta.4\n`);
7253
7266
  try {
7254
7267
  !function() {
7255
7268
  let cli = cac_dist('rsbuild');
7256
- cli.help(), cli.version("1.4.0-beta.3"), applyCommonOptions(cli);
7269
+ cli.help(), cli.version("1.4.0-beta.4"), applyCommonOptions(cli);
7257
7270
  let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
7258
7271
  applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
7259
7272
  try {
@@ -7304,5 +7317,5 @@ async function runCLI() {
7304
7317
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
7305
7318
  }
7306
7319
  }
7307
- let src_version = "1.4.0-beta.3";
7320
+ let src_version = "1.4.0-beta.4";
7308
7321
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
@@ -0,0 +1,2 @@
1
+ import type { RsbuildPlugin } from '../types';
2
+ export declare const pluginLazyCompilation: () => RsbuildPlugin;
@@ -1496,6 +1496,15 @@ export interface RsbuildConfig extends EnvironmentConfig {
1496
1496
  * @default `process.cwd()`
1497
1497
  */
1498
1498
  root?: string;
1499
+ /**
1500
+ * Specify the log level.
1501
+ * - 'info': show 'info', 'start', 'success', 'ready', 'warn' and 'error' logs.
1502
+ * - 'warn': show 'warn' and 'error' logs.
1503
+ * - 'error': only show 'error' logs.
1504
+ * - 'silent': disable all logs.
1505
+ * @default 'info'
1506
+ */
1507
+ logLevel?: 'info' | 'warn' | 'error' | 'silent';
1499
1508
  /**
1500
1509
  * Options for local development.
1501
1510
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.0-beta.3",
3
+ "version": "1.4.0-beta.4",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,7 +46,7 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.4.0-beta.0",
49
+ "@rspack/core": "1.4.0-beta.1",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.43.0",
@@ -56,7 +56,7 @@
56
56
  "@rslib/core": "0.9.2",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.19",
59
- "@types/node": "^22.15.30",
59
+ "@types/node": "^22.15.31",
60
60
  "@types/on-finished": "2.3.5",
61
61
  "@types/webpack-bundle-analyzer": "4.7.0",
62
62
  "@types/ws": "^8.18.1",
@@ -76,13 +76,13 @@
76
76
  "on-finished": "2.4.1",
77
77
  "open": "^8.4.0",
78
78
  "picocolors": "^1.1.1",
79
- "postcss": "^8.5.4",
79
+ "postcss": "^8.5.5",
80
80
  "postcss-load-config": "6.0.1",
81
81
  "postcss-loader": "8.1.1",
82
82
  "prebundle": "1.3.3",
83
83
  "reduce-configs": "^1.1.0",
84
84
  "rsbuild-dev-middleware": "0.2.0",
85
- "rslog": "^1.2.3",
85
+ "rslog": "^1.2.6",
86
86
  "rspack-chain": "^1.2.5",
87
87
  "rspack-manifest-plugin": "5.0.3",
88
88
  "sirv": "^3.0.1",