@rsbuild/core 1.4.0-rc.0 → 1.4.0

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.
@@ -1,19 +1,19 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 6430: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 2562: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(7188);
5
+ const loader = __nccwpck_require__(7856);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(1693).defaultGetLocalIdent;
8
+ __nccwpck_require__(5241).defaultGetLocalIdent;
9
9
  },
10
- 7188: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 7856: (__unused_webpack_module, exports, __nccwpck_require__) => {
11
11
  "use strict";
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports["default"] = loader;
14
14
  var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
15
- var _plugins = __nccwpck_require__(9675);
16
- var _utils = __nccwpck_require__(1693);
15
+ var _plugins = __nccwpck_require__(4655);
16
+ var _utils = __nccwpck_require__(5241);
17
17
  function _interopRequireDefault(obj) {
18
18
  return obj && obj.__esModule ? obj : { default: obj };
19
19
  }
@@ -236,7 +236,7 @@
236
236
  callback(null, `${importCode}${moduleCode}${exportCode}`);
237
237
  }
238
238
  },
239
- 9675: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 4655: (__unused_webpack_module, exports, __nccwpck_require__) => {
240
240
  "use strict";
241
241
  Object.defineProperty(exports, "__esModule", { value: true });
242
242
  Object.defineProperty(exports, "icssParser", {
@@ -258,22 +258,22 @@
258
258
  },
259
259
  });
260
260
  var _postcssImportParser = _interopRequireDefault(
261
- __nccwpck_require__(8816),
261
+ __nccwpck_require__(3612),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(8533),
264
+ __nccwpck_require__(3321),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(8164));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9008));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 8533: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 3321: (__unused_webpack_module, exports, __nccwpck_require__) => {
272
272
  "use strict";
273
273
  Object.defineProperty(exports, "__esModule", { value: true });
274
274
  exports["default"] = void 0;
275
275
  var _icssUtils = __nccwpck_require__(9028);
276
- var _utils = __nccwpck_require__(1693);
276
+ var _utils = __nccwpck_require__(5241);
277
277
  const plugin = (options = {}) => ({
278
278
  postcssPlugin: "postcss-icss-parser",
279
279
  async OnceExit(root) {
@@ -372,14 +372,14 @@
372
372
  plugin.postcss = true;
373
373
  var _default = (exports["default"] = plugin);
374
374
  },
375
- 8816: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 3612: (__unused_webpack_module, exports, __nccwpck_require__) => {
376
376
  "use strict";
377
377
  Object.defineProperty(exports, "__esModule", { value: true });
378
378
  exports["default"] = void 0;
379
379
  var _postcssValueParser = _interopRequireDefault(
380
380
  __nccwpck_require__(2948),
381
381
  );
382
- var _utils = __nccwpck_require__(1693);
382
+ var _utils = __nccwpck_require__(5241);
383
383
  function _interopRequireDefault(obj) {
384
384
  return obj && obj.__esModule ? obj : { default: obj };
385
385
  }
@@ -684,14 +684,14 @@
684
684
  plugin.postcss = true;
685
685
  var _default = (exports["default"] = plugin);
686
686
  },
687
- 8164: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 9008: (__unused_webpack_module, exports, __nccwpck_require__) => {
688
688
  "use strict";
689
689
  Object.defineProperty(exports, "__esModule", { value: true });
690
690
  exports["default"] = void 0;
691
691
  var _postcssValueParser = _interopRequireDefault(
692
692
  __nccwpck_require__(2948),
693
693
  );
694
- var _utils = __nccwpck_require__(1693);
694
+ var _utils = __nccwpck_require__(5241);
695
695
  function _interopRequireDefault(obj) {
696
696
  return obj && obj.__esModule ? obj : { default: obj };
697
697
  }
@@ -1034,7 +1034,7 @@
1034
1034
  plugin.postcss = true;
1035
1035
  var _default = (exports["default"] = plugin);
1036
1036
  },
1037
- 1693: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 5241: (__unused_webpack_module, exports, __nccwpck_require__) => {
1038
1038
  "use strict";
1039
1039
  Object.defineProperty(exports, "__esModule", { value: true });
1040
1040
  exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
@@ -8098,6 +8098,6 @@
8098
8098
  }
8099
8099
  if (typeof __nccwpck_require__ !== "undefined")
8100
8100
  __nccwpck_require__.ab = __dirname + "/";
8101
- var __webpack_exports__ = __nccwpck_require__(6430);
8101
+ var __webpack_exports__ = __nccwpck_require__(2562);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 108: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 528: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(529);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(773);
6
6
  const compilerMap = new WeakMap();
7
7
  class CachedChildCompilation {
8
8
  constructor(compiler) {
@@ -311,7 +311,7 @@
311
311
  }
312
312
  module.exports = { CachedChildCompilation };
313
313
  },
314
- 529: (module) => {
314
+ 773: (module) => {
315
315
  "use strict";
316
316
  class HtmlWebpackChildCompiler {
317
317
  constructor(templates) {
@@ -480,7 +480,7 @@
480
480
  }
481
481
  module.exports = { HtmlWebpackChildCompiler };
482
482
  },
483
- 327: (module) => {
483
+ 979: (module) => {
484
484
  "use strict";
485
485
  module.exports = {};
486
486
  module.exports.none = (chunks) => chunks;
@@ -499,7 +499,7 @@
499
499
  };
500
500
  module.exports.auto = module.exports.none;
501
501
  },
502
- 426: (module) => {
502
+ 406: (module) => {
503
503
  "use strict";
504
504
  module.exports = function (err) {
505
505
  return {
@@ -520,7 +520,7 @@
520
520
  };
521
521
  };
522
522
  },
523
- 985: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 613: (module, __unused_webpack_exports, __nccwpck_require__) => {
524
524
  "use strict";
525
525
  const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
526
526
  const htmlWebpackPluginHooksMap = new WeakMap();
@@ -546,7 +546,7 @@
546
546
  }
547
547
  module.exports = { getHtmlRspackPluginHooks };
548
548
  },
549
- 640: (module) => {
549
+ 476: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 989: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 177: (module, __unused_webpack_exports, __nccwpck_require__) => {
618
618
  "use strict";
619
619
  const promisify = __nccwpck_require__(23).promisify;
620
620
  const vm = __nccwpck_require__(154);
621
621
  const fs = __nccwpck_require__(896);
622
622
  const path = __nccwpck_require__(928);
623
- const { CachedChildCompilation } = __nccwpck_require__(108);
623
+ const { CachedChildCompilation } = __nccwpck_require__(528);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(640);
626
- const prettyError = __nccwpck_require__(426);
627
- const chunkSorter = __nccwpck_require__(327);
625
+ __nccwpck_require__(476);
626
+ const prettyError = __nccwpck_require__(406);
627
+ const chunkSorter = __nccwpck_require__(979);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(985).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(613).getHtmlRspackPluginHooks;
630
630
  const WITH_PLACEHOLDER = "function __with_placeholder__";
631
631
  class HtmlRspackPlugin {
632
632
  constructor(userOptions = {}) {
@@ -1597,6 +1597,6 @@
1597
1597
  }
1598
1598
  if (typeof __nccwpck_require__ !== "undefined")
1599
1599
  __nccwpck_require__.ab = __dirname + "/";
1600
- var __webpack_exports__ = __nccwpck_require__(989);
1600
+ var __webpack_exports__ = __nccwpck_require__(177);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 521: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(739)["default"];
4
+ 414: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(148)["default"];
6
6
  },
7
- 739: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 148: (__unused_webpack_module, exports, __nccwpck_require__) => {
8
8
  var __webpack_unused_export__;
9
9
  __webpack_unused_export__ = { value: true };
10
10
  exports["default"] = loader;
11
11
  var _path = _interopRequireDefault(__nccwpck_require__(928));
12
- var _utils = __nccwpck_require__(478);
12
+ var _utils = __nccwpck_require__(237);
13
13
  function _interopRequireDefault(obj) {
14
14
  return obj && obj.__esModule ? obj : { default: obj };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 478: (module, exports, __nccwpck_require__) => {
182
+ 237: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -716,6 +716,6 @@
716
716
  })();
717
717
  if (typeof __nccwpck_require__ !== "undefined")
718
718
  __nccwpck_require__.ab = __dirname + "/";
719
- var __webpack_exports__ = __nccwpck_require__(521);
719
+ var __webpack_exports__ = __nccwpck_require__(414);
720
720
  module.exports = __webpack_exports__;
721
721
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 622: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 776: (__unused_webpack_module, exports, __nccwpck_require__) => {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.transformFiles =
7
7
  exports.reduceChunk =
@@ -120,7 +120,7 @@
120
120
  .map(standardizeFilePaths);
121
121
  exports.transformFiles = transformFiles;
122
122
  },
123
- 127: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 121: (__unused_webpack_module, exports, __nccwpck_require__) => {
124
124
  Object.defineProperty(exports, "__esModule", { value: true });
125
125
  exports.normalModuleLoaderHook =
126
126
  exports.getCompilerHooks =
@@ -130,7 +130,7 @@
130
130
  const fs_1 = __nccwpck_require__(896);
131
131
  const path_1 = __nccwpck_require__(928);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(622);
133
+ const helpers_1 = __nccwpck_require__(776);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -312,7 +312,7 @@
312
312
  exports.getCompilerHooks =
313
313
  void 0;
314
314
  const path_1 = __nccwpck_require__(928);
315
- const hooks_1 = __nccwpck_require__(127);
315
+ const hooks_1 = __nccwpck_require__(121);
316
316
  Object.defineProperty(exports, "getCompilerHooks", {
317
317
  enumerable: true,
318
318
  get: function () {
package/dist/index.cjs CHANGED
@@ -2247,7 +2247,7 @@ ${section.body}` : section.body).join("\n\n"));
2247
2247
  async function createContext(options, userConfig) {
2248
2248
  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';
2249
2249
  return {
2250
- version: "1.4.0-rc.0",
2250
+ version: "1.4.0",
2251
2251
  rootPath,
2252
2252
  distPath: '',
2253
2253
  cachePath,
@@ -4592,7 +4592,7 @@ ${section.body}` : section.body).join("\n\n"));
4592
4592
  for (let middleware of proxyMiddlewares)'function' == typeof middleware.upgrade && middleware.upgrade(req, socket, head);
4593
4593
  }
4594
4594
  };
4595
- }, applyDefaultMiddlewares = async ({ dev, devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
4595
+ }, applyDefaultMiddlewares = async ({ devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
4596
4596
  let upgradeEvents = [];
4597
4597
  if (server.cors) {
4598
4598
  let { default: corsMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/cors/index.js"));
@@ -4606,7 +4606,17 @@ ${section.body}` : section.body).join("\n\n"));
4606
4606
  let { middlewares: proxyMiddlewares, upgrade } = await createProxyMiddleware(server.proxy);
4607
4607
  for (let middleware of (upgradeEvents.push(upgrade), proxyMiddlewares))middlewares.push(middleware);
4608
4608
  }
4609
- server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager && middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(compilationManager.compiler)), server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
4609
+ if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && compilationManager) {
4610
+ let { compiler } = compilationManager;
4611
+ (()=>{
4612
+ var _compiler_options_experiments;
4613
+ return helpers_isMultiCompiler(compiler) ? compiler.compilers.some((childCompiler)=>{
4614
+ var _childCompiler_options_experiments;
4615
+ return null == (_childCompiler_options_experiments = childCompiler.options.experiments) ? void 0 : _childCompiler_options_experiments.lazyCompilation;
4616
+ }) : null == (_compiler_options_experiments = compiler.options.experiments) ? void 0 : _compiler_options_experiments.lazyCompilation;
4617
+ })() && middlewares.push(core_namespaceObject.rspack.experiments.lazyCompilationMiddleware(compiler));
4618
+ }
4619
+ server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
4610
4620
  base: server.base
4611
4621
  }));
4612
4622
  let { default: launchEditorMiddleware } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "../../compiled/launch-editor-middleware/index.js"));
@@ -5465,7 +5475,7 @@ ${section.body}` : section.body).join("\n\n"));
5465
5475
  {
5466
5476
  name: 'rsbuild:basic',
5467
5477
  setup (api) {
5468
- api.modifyBundlerChain((chain, { env, isDev, target, bundler, environment, CHAIN_ID })=>{
5478
+ api.modifyBundlerChain((chain, { isDev, target, bundler, environment, CHAIN_ID })=>{
5469
5479
  let { config } = environment;
5470
5480
  chain.name(environment.name);
5471
5481
  let devtool = ((config)=>{
@@ -5487,7 +5497,14 @@ ${section.body}` : section.body).join("\n\n"));
5487
5497
  javascript: {
5488
5498
  exportsPresence: 'error'
5489
5499
  }
5490
- }), 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';
5500
+ }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), isDev && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), 'rspack' === api.context.bundlerType && chain.experiments({
5501
+ ...chain.get('experiments'),
5502
+ rspackFuture: {
5503
+ bundlerInfo: {
5504
+ force: !!config.security.sri.enable
5505
+ }
5506
+ }
5507
+ }), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
5491
5508
  });
5492
5509
  }
5493
5510
  },
@@ -7502,11 +7519,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7502
7519
  ].includes(level) && (index_js_namespaceObject.logger.level = level);
7503
7520
  }
7504
7521
  let { npm_execpath } = process.env;
7505
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0-rc.0\n`);
7522
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.0\n`);
7506
7523
  try {
7507
7524
  !function() {
7508
7525
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7509
- cli.help(), cli.version("1.4.0-rc.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7526
+ cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7510
7527
  default: 'jiti'
7511
7528
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7512
7529
  type: [
@@ -7564,7 +7581,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
7564
7581
  index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
7565
7582
  }
7566
7583
  }
7567
- let src_version = "1.4.0-rc.0";
7584
+ let src_version = "1.4.0";
7568
7585
  })(), 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 === [
7569
7586
  "PLUGIN_CSS_NAME",
7570
7587
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -2059,7 +2059,7 @@ async function updateEnvironmentContext(context, configs) {
2059
2059
  async function createContext(options, userConfig) {
2060
2060
  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';
2061
2061
  return {
2062
- version: "1.4.0-rc.0",
2062
+ version: "1.4.0",
2063
2063
  rootPath,
2064
2064
  distPath: '',
2065
2065
  cachePath,
@@ -4388,7 +4388,7 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
4388
4388
  for (let middleware of proxyMiddlewares)'function' == typeof middleware.upgrade && middleware.upgrade(req, socket, head);
4389
4389
  }
4390
4390
  };
4391
- }, applyDefaultMiddlewares = async ({ dev, devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
4391
+ }, applyDefaultMiddlewares = async ({ devServerAPI, middlewares, server, compilationManager, context, pwd, postCallbacks })=>{
4392
4392
  let upgradeEvents = [];
4393
4393
  if (server.cors) {
4394
4394
  let { default: corsMiddleware } = await import("../compiled/cors/index.js");
@@ -4402,7 +4402,15 @@ let ENCODING_REGEX = /\bgzip\b/, CONTENT_TYPE_REGEX = /text|javascript|\/json|xm
4402
4402
  let { middlewares: proxyMiddlewares, upgrade } = await createProxyMiddleware(server.proxy);
4403
4403
  for (let middleware of (upgradeEvents.push(upgrade), proxyMiddlewares))middlewares.push(middleware);
4404
4404
  }
4405
- server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && dev.lazyCompilation && compilationManager && middlewares.push(rspack.experiments.lazyCompilationMiddleware(compilationManager.compiler)), server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
4405
+ if (server.compress && middlewares.push(gzipMiddleware()), 'dev' === context.action && 'rspack' === context.bundlerType && compilationManager) {
4406
+ var _compiler_options_experiments;
4407
+ let { compiler } = compilationManager;
4408
+ (helpers_isMultiCompiler(compiler) ? compiler.compilers.some((childCompiler)=>{
4409
+ var _childCompiler_options_experiments;
4410
+ return null == (_childCompiler_options_experiments = childCompiler.options.experiments) ? void 0 : _childCompiler_options_experiments.lazyCompilation;
4411
+ }) : null == (_compiler_options_experiments = compiler.options.experiments) ? void 0 : _compiler_options_experiments.lazyCompilation) && middlewares.push(rspack.experiments.lazyCompilationMiddleware(compiler));
4412
+ }
4413
+ server.base && '/' !== server.base && middlewares.push(getBaseMiddleware({
4406
4414
  base: server.base
4407
4415
  }));
4408
4416
  let { default: launchEditorMiddleware } = await import("../compiled/launch-editor-middleware/index.js");
@@ -5253,7 +5261,7 @@ async function applyDefaultPlugins(pluginManager, context) {
5253
5261
  {
5254
5262
  name: 'rsbuild:basic',
5255
5263
  setup (api) {
5256
- api.modifyBundlerChain((chain, { env, isDev, target, bundler, environment, CHAIN_ID })=>{
5264
+ api.modifyBundlerChain((chain, { isDev, target, bundler, environment, CHAIN_ID })=>{
5257
5265
  let { config } = environment;
5258
5266
  chain.name(environment.name);
5259
5267
  let devtool = ((config)=>{
@@ -5275,7 +5283,14 @@ async function applyDefaultPlugins(pluginManager, context) {
5275
5283
  javascript: {
5276
5284
  exportsPresence: 'error'
5277
5285
  }
5278
- }), 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';
5286
+ }), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), isDev && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), 'rspack' === api.context.bundlerType && chain.experiments({
5287
+ ...chain.get('experiments'),
5288
+ rspackFuture: {
5289
+ bundlerInfo: {
5290
+ force: !!config.security.sri.enable
5291
+ }
5292
+ }
5293
+ }), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-silent';
5279
5294
  });
5280
5295
  }
5281
5296
  },
@@ -7284,11 +7299,11 @@ async function runCLI() {
7284
7299
  ].includes(level) && (logger.level = level);
7285
7300
  }
7286
7301
  let { npm_execpath } = process.env;
7287
- (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0-rc.0\n`);
7302
+ (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.0\n`);
7288
7303
  try {
7289
7304
  !function() {
7290
7305
  let cli = ((name = "")=>new CAC(name))('rsbuild');
7291
- cli.help(), cli.version("1.4.0-rc.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7306
+ cli.help(), cli.version("1.4.0"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
7292
7307
  default: 'jiti'
7293
7308
  }).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
7294
7309
  type: [
@@ -7346,5 +7361,5 @@ async function runCLI() {
7346
7361
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
7347
7362
  }
7348
7363
  }
7349
- let src_version = "1.4.0-rc.0";
7364
+ let src_version = "1.4.0";
7350
7365
  export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
@@ -163,14 +163,45 @@ export type ModifyChainUtils = {
163
163
  * The value of `process.env.NODE_ENV`
164
164
  */
165
165
  env: string;
166
+ /**
167
+ * A boolean value indicating whether this is a development build.
168
+ * Set to `true` when the `mode` is `development`.
169
+ */
166
170
  isDev: boolean;
171
+ /**
172
+ * A boolean value indicating whether this is a production build.
173
+ * Set to `true` when the `mode` is `production`.
174
+ */
167
175
  isProd: boolean;
176
+ /**
177
+ * The current build target.
178
+ */
168
179
  target: RsbuildTarget;
180
+ /**
181
+ * A boolean value indicating whether the build target is `node`.
182
+ * Equivalent to `target === 'node'`.
183
+ */
169
184
  isServer: boolean;
185
+ /**
186
+ * A boolean value indicating whether the build target is `web-worker`.
187
+ * Equivalent to `target === 'web-worker'`.
188
+ */
170
189
  isWebWorker: boolean;
190
+ /**
191
+ * Predefined chain IDs.
192
+ */
171
193
  CHAIN_ID: ChainIdentifier;
194
+ /**
195
+ * The environment context for current build.
196
+ */
172
197
  environment: EnvironmentContext;
198
+ /**
199
+ * The Rspack instance, same as `import { rspack } from '@rsbuild/core'`.
200
+ */
173
201
  rspack: typeof rspack;
202
+ /**
203
+ * The default export of `html-rspack-plugin`.
204
+ */
174
205
  HtmlPlugin: typeof HtmlRspackPlugin;
175
206
  };
176
207
  interface PluginInstance {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.4.0-rc.0",
3
+ "version": "1.4.0",
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-rc.0",
49
+ "@rspack/core": "1.4.0",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.43.0",