@rsbuild/core 1.6.5 → 1.6.6

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
- 2502: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 9957: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const loader = __nccwpck_require__(2476);
5
+ const loader = __nccwpck_require__(1519);
6
6
  module.exports = loader.default;
7
7
  module.exports.defaultGetLocalIdent =
8
- __nccwpck_require__(8645).defaultGetLocalIdent;
8
+ __nccwpck_require__(4618).defaultGetLocalIdent;
9
9
  },
10
- 2476: (__unused_webpack_module, exports, __nccwpck_require__) => {
10
+ 1519: (__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__(1259));
15
- var _plugins = __nccwpck_require__(5923);
16
- var _utils = __nccwpck_require__(8645);
15
+ var _plugins = __nccwpck_require__(8884);
16
+ var _utils = __nccwpck_require__(4618);
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
- 5923: (__unused_webpack_module, exports, __nccwpck_require__) => {
239
+ 8884: (__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__(6584),
261
+ __nccwpck_require__(8767),
262
262
  );
263
263
  var _postcssIcssParser = _interopRequireDefault(
264
- __nccwpck_require__(3965),
264
+ __nccwpck_require__(3922),
265
265
  );
266
- var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(9836));
266
+ var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(3669));
267
267
  function _interopRequireDefault(obj) {
268
268
  return obj && obj.__esModule ? obj : { default: obj };
269
269
  }
270
270
  },
271
- 3965: (__unused_webpack_module, exports, __nccwpck_require__) => {
271
+ 3922: (__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__(229);
276
- var _utils = __nccwpck_require__(8645);
276
+ var _utils = __nccwpck_require__(4618);
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
- 6584: (__unused_webpack_module, exports, __nccwpck_require__) => {
375
+ 8767: (__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__(5245),
381
381
  );
382
- var _utils = __nccwpck_require__(8645);
382
+ var _utils = __nccwpck_require__(4618);
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
- 9836: (__unused_webpack_module, exports, __nccwpck_require__) => {
687
+ 3669: (__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__(5245),
693
693
  );
694
- var _utils = __nccwpck_require__(8645);
694
+ var _utils = __nccwpck_require__(4618);
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
- 8645: (__unused_webpack_module, exports, __nccwpck_require__) => {
1037
+ 4618: (__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__(2502);
8101
+ var __webpack_exports__ = __nccwpck_require__(9957);
8102
8102
  module.exports = __webpack_exports__;
8103
8103
  })();
@@ -1,8 +1,8 @@
1
1
  (() => {
2
2
  var __webpack_modules__ = {
3
- 837: (module, __unused_webpack_exports, __nccwpck_require__) => {
3
+ 887: (module, __unused_webpack_exports, __nccwpck_require__) => {
4
4
  "use strict";
5
- const { HtmlWebpackChildCompiler } = __nccwpck_require__(726);
5
+ const { HtmlWebpackChildCompiler } = __nccwpck_require__(892);
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
- 726: (module) => {
314
+ 892: (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
- 926: (module) => {
483
+ 636: (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
- 393: (module) => {
502
+ 411: (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
- 616: (module, __unused_webpack_exports, __nccwpck_require__) => {
523
+ 514: (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
- 813: (module) => {
549
+ 807: (module) => {
550
550
  const voidTags = [
551
551
  "area",
552
552
  "base",
@@ -614,19 +614,19 @@
614
614
  htmlTagObjectToString,
615
615
  };
616
616
  },
617
- 440: (module, __unused_webpack_exports, __nccwpck_require__) => {
617
+ 886: (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__(837);
623
+ const { CachedChildCompilation } = __nccwpck_require__(887);
624
624
  const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
625
- __nccwpck_require__(813);
626
- const prettyError = __nccwpck_require__(393);
627
- const chunkSorter = __nccwpck_require__(926);
625
+ __nccwpck_require__(807);
626
+ const prettyError = __nccwpck_require__(411);
627
+ const chunkSorter = __nccwpck_require__(636);
628
628
  const getHtmlRspackPluginHooks =
629
- __nccwpck_require__(616).getHtmlRspackPluginHooks;
629
+ __nccwpck_require__(514).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__(440);
1600
+ var __webpack_exports__ = __nccwpck_require__(886);
1601
1601
  module.exports = __webpack_exports__;
1602
1602
  })();
@@ -1,15 +1,15 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 450: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
- module.exports = __nccwpck_require__(288)["default"];
4
+ 43: (module, __unused_webpack_exports, __nccwpck_require__) => {
5
+ module.exports = __nccwpck_require__(133)["default"];
6
6
  },
7
- 288: (__unused_webpack_module, exports, __nccwpck_require__) => {
7
+ 133: (__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 _nodePath = _interopRequireDefault(__nccwpck_require__(760));
12
- var _utils = __nccwpck_require__(681);
12
+ var _utils = __nccwpck_require__(712);
13
13
  function _interopRequireDefault(e) {
14
14
  return e && e.__esModule ? e : { default: e };
15
15
  }
@@ -179,7 +179,7 @@
179
179
  callback(null, result.css, map, { ast });
180
180
  }
181
181
  },
182
- 681: (module, exports, __nccwpck_require__) => {
182
+ 712: (module, exports, __nccwpck_require__) => {
183
183
  module = __nccwpck_require__.nmd(module);
184
184
  Object.defineProperty(exports, "__esModule", { value: true });
185
185
  exports.exec = exec;
@@ -715,6 +715,6 @@
715
715
  })();
716
716
  if (typeof __nccwpck_require__ !== "undefined")
717
717
  __nccwpck_require__.ab = __dirname + "/";
718
- var __webpack_exports__ = __nccwpck_require__(450);
718
+ var __webpack_exports__ = __nccwpck_require__(43);
719
719
  module.exports = __webpack_exports__;
720
720
  })();
@@ -1,7 +1,7 @@
1
1
  (() => {
2
2
  "use strict";
3
3
  var __webpack_modules__ = {
4
- 724: (__unused_webpack_module, exports, __nccwpck_require__) => {
4
+ 898: (__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
- 629: (__unused_webpack_module, exports, __nccwpck_require__) => {
123
+ 835: (__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 node_fs_1 = __nccwpck_require__(24);
131
131
  const node_path_1 = __nccwpck_require__(760);
132
132
  const lite_tapable_1 = __nccwpck_require__(408);
133
- const helpers_1 = __nccwpck_require__(724);
133
+ const helpers_1 = __nccwpck_require__(898);
134
134
  const compilerHookMap = new WeakMap();
135
135
  const getCompilerHooks = (compiler) => {
136
136
  let hooks = compilerHookMap.get(compiler);
@@ -313,7 +313,7 @@
313
313
  exports.getCompilerHooks =
314
314
  void 0;
315
315
  const node_path_1 = __nccwpck_require__(760);
316
- const hooks_1 = __nccwpck_require__(629);
316
+ const hooks_1 = __nccwpck_require__(835);
317
317
  Object.defineProperty(exports, "getCompilerHooks", {
318
318
  enumerable: true,
319
319
  get: function () {
package/dist/index.cjs CHANGED
@@ -3039,7 +3039,7 @@ ${section.body}` : section.body).join("\n\n"));
3039
3039
  onAfterEnvironmentCompile: createEnvironmentAsyncHook()
3040
3040
  };
3041
3041
  }
3042
- let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isWatch })=>{
3042
+ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWatch })=>{
3043
3043
  let name = 'rsbuild:beforeCompile';
3044
3044
  if (compiler_isMultiCompiler(compiler)) {
3045
3045
  let waitBeforeCompileDone, { compilers } = compiler;
@@ -3049,11 +3049,11 @@ ${section.body}` : section.body).join("\n\n"));
3049
3049
  for(let index = 0; index < compilers.length; index++){
3050
3050
  let compiler = compilers[index];
3051
3051
  (isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
3052
- waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile?.()), await waitBeforeCompileDone, await beforeEnvironmentCompiler(index);
3052
+ waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile()), await waitBeforeCompileDone, await beforeEnvironmentCompile(index);
3053
3053
  });
3054
3054
  }
3055
3055
  } else (isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
3056
- await beforeCompile?.(), await beforeEnvironmentCompiler(0);
3056
+ await beforeCompile(), await beforeEnvironmentCompile(0);
3057
3057
  });
3058
3058
  }, onCompileDone = ({ compiler, onDone, onEnvironmentDone, MultiStatsCtor })=>{
3059
3059
  if (compiler_isMultiCompiler(compiler)) {
@@ -3073,13 +3073,13 @@ ${section.body}` : section.body).join("\n\n"));
3073
3073
  });
3074
3074
  }, registerBuildHook = ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor })=>{
3075
3075
  let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
3076
- let p = context.hooks.onAfterBuild.callBatch({
3076
+ let promise = context.hooks.onAfterBuild.callBatch({
3077
3077
  isFirstCompile,
3078
3078
  stats,
3079
3079
  environments: context.environments,
3080
3080
  isWatch
3081
3081
  });
3082
- isFirstCompile = !1, await p;
3082
+ isFirstCompile = !1, await promise;
3083
3083
  }, onEnvironmentDone = async (buildIndex, stats)=>{
3084
3084
  await context.hooks.onAfterEnvironmentCompile.callBatch({
3085
3085
  environment: environmentList[buildIndex].name,
@@ -3101,17 +3101,20 @@ ${section.body}` : section.body).join("\n\n"));
3101
3101
  isWatch,
3102
3102
  isFirstCompile
3103
3103
  }),
3104
- beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
3105
- environment: environmentList[buildIndex].name,
3104
+ beforeEnvironmentCompile: async (buildIndex)=>{
3105
+ let environment = environmentList[buildIndex];
3106
+ return context.hooks.onBeforeEnvironmentCompile.callBatch({
3107
+ environment: environment.name,
3106
3108
  args: [
3107
3109
  {
3108
- bundlerConfig: bundlerConfigs?.[buildIndex],
3109
- environment: environmentList[buildIndex],
3110
+ bundlerConfig: bundlerConfigs[buildIndex],
3111
+ environment,
3110
3112
  isWatch,
3111
3113
  isFirstCompile
3112
3114
  }
3113
3115
  ]
3114
- }),
3116
+ });
3117
+ },
3115
3118
  isWatch
3116
3119
  }), onCompileDone({
3117
3120
  compiler,
@@ -3121,12 +3124,12 @@ ${section.body}` : section.body).join("\n\n"));
3121
3124
  });
3122
3125
  }, registerDevHook = ({ context, compiler, bundlerConfigs, MultiStatsCtor })=>{
3123
3126
  let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
3124
- let p = context.hooks.onAfterDevCompile.callBatch({
3127
+ let promise = context.hooks.onAfterDevCompile.callBatch({
3125
3128
  isFirstCompile,
3126
3129
  stats,
3127
3130
  environments: context.environments
3128
3131
  });
3129
- isFirstCompile = !1, await p;
3132
+ isFirstCompile = !1, await promise;
3130
3133
  }, onEnvironmentDone = async (buildIndex, stats)=>{
3131
3134
  await context.hooks.onAfterEnvironmentCompile.callBatch({
3132
3135
  environment: environmentList[buildIndex].name,
@@ -3142,17 +3145,20 @@ ${section.body}` : section.body).join("\n\n"));
3142
3145
  };
3143
3146
  onBeforeCompile({
3144
3147
  compiler,
3145
- beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
3146
- environment: environmentList[buildIndex].name,
3148
+ beforeEnvironmentCompile: async (buildIndex)=>{
3149
+ let environment = environmentList[buildIndex];
3150
+ return context.hooks.onBeforeEnvironmentCompile.callBatch({
3151
+ environment: environment.name,
3147
3152
  args: [
3148
3153
  {
3149
- bundlerConfig: bundlerConfigs?.[buildIndex],
3150
- environment: environmentList[buildIndex],
3154
+ bundlerConfig: bundlerConfigs[buildIndex],
3155
+ environment,
3151
3156
  isWatch: !0,
3152
3157
  isFirstCompile
3153
3158
  }
3154
3159
  ]
3155
- }),
3160
+ });
3161
+ },
3156
3162
  beforeCompile: async ()=>context.hooks.onBeforeDevCompile.callBatch({
3157
3163
  bundlerConfigs,
3158
3164
  environments: context.environments,
@@ -4221,7 +4227,7 @@ ${section.body}` : section.body).join("\n\n"));
4221
4227
  async function createContext(options, userConfig) {
4222
4228
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
4223
4229
  return {
4224
- version: "1.6.5",
4230
+ version: "1.6.6",
4225
4231
  rootPath,
4226
4232
  distPath: '',
4227
4233
  cachePath,
@@ -4813,7 +4819,7 @@ ${section.body}` : section.body).join("\n\n"));
4813
4819
  }
4814
4820
  let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
4815
4821
  let compiler, bundlerConfigs, { context } = initOptions;
4816
- if (customCompiler) compiler = customCompiler;
4822
+ if (customCompiler) compiler = customCompiler, bundlerConfigs = customCompiler.options;
4817
4823
  else {
4818
4824
  let result = await createCompiler_createCompiler(initOptions);
4819
4825
  compiler = result.compiler, bundlerConfigs = result.rspackConfigs;
@@ -5789,37 +5795,6 @@ ${section.body}` : section.body).join("\n\n"));
5789
5795
  ...manifest
5790
5796
  };
5791
5797
  }
5792
- class PatchSplitChunksPlugin {
5793
- name;
5794
- constructor(name){
5795
- this.name = name;
5796
- }
5797
- apply(compiler) {
5798
- let { splitChunks } = compiler.options.optimization;
5799
- if (!splitChunks) return;
5800
- let applyPatch = (config)=>{
5801
- if ('object' != typeof config || (0, types_namespaceObject.isRegExp)(config)) return;
5802
- let { chunks } = config;
5803
- if (chunks && 'async' !== chunks) {
5804
- if ('function' == typeof chunks) {
5805
- config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
5806
- return;
5807
- }
5808
- if ('all' === chunks) {
5809
- config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
5810
- return;
5811
- }
5812
- if ('initial' === chunks) {
5813
- config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
5814
- return;
5815
- }
5816
- }
5817
- };
5818
- applyPatch(splitChunks);
5819
- let { cacheGroups } = splitChunks;
5820
- if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
5821
- }
5822
- }
5823
5798
  function pluginModuleFederation() {
5824
5799
  return {
5825
5800
  name: 'rsbuild:module-federation',
@@ -5844,9 +5819,7 @@ ${section.body}` : section.body).join("\n\n"));
5844
5819
  let { options } = config.moduleFederation;
5845
5820
  chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(rspack_rspack.container.ModuleFederationPlugin, [
5846
5821
  options
5847
- ]), options.name && (options.exposes && chain.plugin('mf-patch-split-chunks').use(PatchSplitChunksPlugin, [
5848
- options.name
5849
- ]), chain.output.get('uniqueName') || chain.output.set('uniqueName', options.name));
5822
+ ]), options.name && !chain.output.get('uniqueName') && chain.output.set('uniqueName', options.name);
5850
5823
  }));
5851
5824
  }
5852
5825
  };
@@ -9135,7 +9108,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9135
9108
  api.modifyBundlerChain((chain, { environment, target })=>{
9136
9109
  let { config } = environment;
9137
9110
  if (config.output.module) {
9138
- if ('web' === target && chain.optimization.runtimeChunk(!0), 'node' === target && chain.output.library({
9111
+ if ('node' === target && chain.output.library({
9139
9112
  ...chain.output.get('library'),
9140
9113
  type: 'module'
9141
9114
  }), 'web-worker' === target) throw Error('[rsbuild:config] `output.module` is not supported for web-worker target.');
@@ -9868,7 +9841,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9868
9841
  };
9869
9842
  function setupCommands() {
9870
9843
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9871
- cli.version("1.6.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)', {
9844
+ cli.version("1.6.6"), 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)', {
9872
9845
  default: 'auto'
9873
9846
  }).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', {
9874
9847
  type: [
@@ -9937,7 +9910,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9937
9910
  }
9938
9911
  function showGreeting() {
9939
9912
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9940
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.5\n`);
9913
+ logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.6\n`);
9941
9914
  }
9942
9915
  function setupLogLevel() {
9943
9916
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9958,7 +9931,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9958
9931
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9959
9932
  }
9960
9933
  }
9961
- let src_version = "1.6.5";
9934
+ let src_version = "1.6.6";
9962
9935
  })(), 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 === [
9963
9936
  "PLUGIN_CSS_NAME",
9964
9937
  "PLUGIN_SWC_NAME",
package/dist/index.js CHANGED
@@ -2997,7 +2997,7 @@ function initHooks() {
2997
2997
  onAfterEnvironmentCompile: createEnvironmentAsyncHook()
2998
2998
  };
2999
2999
  }
3000
- let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isWatch })=>{
3000
+ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompile, isWatch })=>{
3001
3001
  let name = 'rsbuild:beforeCompile';
3002
3002
  if (compiler_isMultiCompiler(compiler)) {
3003
3003
  let waitBeforeCompileDone, { compilers } = compiler;
@@ -3007,11 +3007,11 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
3007
3007
  for(let index = 0; index < compilers.length; index++){
3008
3008
  let compiler = compilers[index];
3009
3009
  (isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
3010
- waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile?.()), await waitBeforeCompileDone, await beforeEnvironmentCompiler(index);
3010
+ waitBeforeCompileDone || (waitBeforeCompileDone = beforeCompile()), await waitBeforeCompileDone, await beforeEnvironmentCompile(index);
3011
3011
  });
3012
3012
  }
3013
3013
  } else (isWatch ? compiler.hooks.watchRun : compiler.hooks.run).tapPromise(name, async ()=>{
3014
- await beforeCompile?.(), await beforeEnvironmentCompiler(0);
3014
+ await beforeCompile(), await beforeEnvironmentCompile(0);
3015
3015
  });
3016
3016
  }, onCompileDone = ({ compiler, onDone, onEnvironmentDone, MultiStatsCtor })=>{
3017
3017
  if (compiler_isMultiCompiler(compiler)) {
@@ -3031,13 +3031,13 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
3031
3031
  });
3032
3032
  }, registerBuildHook = ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor })=>{
3033
3033
  let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
3034
- let p = context.hooks.onAfterBuild.callBatch({
3034
+ let promise = context.hooks.onAfterBuild.callBatch({
3035
3035
  isFirstCompile,
3036
3036
  stats,
3037
3037
  environments: context.environments,
3038
3038
  isWatch
3039
3039
  });
3040
- isFirstCompile = !1, await p;
3040
+ isFirstCompile = !1, await promise;
3041
3041
  }, onEnvironmentDone = async (buildIndex, stats)=>{
3042
3042
  await context.hooks.onAfterEnvironmentCompile.callBatch({
3043
3043
  environment: environmentList[buildIndex].name,
@@ -3059,17 +3059,20 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
3059
3059
  isWatch,
3060
3060
  isFirstCompile
3061
3061
  }),
3062
- beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
3063
- environment: environmentList[buildIndex].name,
3062
+ beforeEnvironmentCompile: async (buildIndex)=>{
3063
+ let environment = environmentList[buildIndex];
3064
+ return context.hooks.onBeforeEnvironmentCompile.callBatch({
3065
+ environment: environment.name,
3064
3066
  args: [
3065
3067
  {
3066
- bundlerConfig: bundlerConfigs?.[buildIndex],
3067
- environment: environmentList[buildIndex],
3068
+ bundlerConfig: bundlerConfigs[buildIndex],
3069
+ environment,
3068
3070
  isWatch,
3069
3071
  isFirstCompile
3070
3072
  }
3071
3073
  ]
3072
- }),
3074
+ });
3075
+ },
3073
3076
  isWatch
3074
3077
  }), onCompileDone({
3075
3078
  compiler,
@@ -3079,12 +3082,12 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
3079
3082
  });
3080
3083
  }, registerDevHook = ({ context, compiler, bundlerConfigs, MultiStatsCtor })=>{
3081
3084
  let isFirstCompile = !0, { environmentList } = context, onDone = async (stats)=>{
3082
- let p = context.hooks.onAfterDevCompile.callBatch({
3085
+ let promise = context.hooks.onAfterDevCompile.callBatch({
3083
3086
  isFirstCompile,
3084
3087
  stats,
3085
3088
  environments: context.environments
3086
3089
  });
3087
- isFirstCompile = !1, await p;
3090
+ isFirstCompile = !1, await promise;
3088
3091
  }, onEnvironmentDone = async (buildIndex, stats)=>{
3089
3092
  await context.hooks.onAfterEnvironmentCompile.callBatch({
3090
3093
  environment: environmentList[buildIndex].name,
@@ -3100,17 +3103,20 @@ let onBeforeCompile = ({ compiler, beforeCompile, beforeEnvironmentCompiler, isW
3100
3103
  };
3101
3104
  onBeforeCompile({
3102
3105
  compiler,
3103
- beforeEnvironmentCompiler: async (buildIndex)=>context.hooks.onBeforeEnvironmentCompile.callBatch({
3104
- environment: environmentList[buildIndex].name,
3106
+ beforeEnvironmentCompile: async (buildIndex)=>{
3107
+ let environment = environmentList[buildIndex];
3108
+ return context.hooks.onBeforeEnvironmentCompile.callBatch({
3109
+ environment: environment.name,
3105
3110
  args: [
3106
3111
  {
3107
- bundlerConfig: bundlerConfigs?.[buildIndex],
3108
- environment: environmentList[buildIndex],
3112
+ bundlerConfig: bundlerConfigs[buildIndex],
3113
+ environment,
3109
3114
  isWatch: !0,
3110
3115
  isFirstCompile
3111
3116
  }
3112
3117
  ]
3113
- }),
3118
+ });
3119
+ },
3114
3120
  beforeCompile: async ()=>context.hooks.onBeforeDevCompile.callBatch({
3115
3121
  bundlerConfigs,
3116
3122
  environments: context.environments,
@@ -4154,7 +4160,7 @@ function createPublicContext(context) {
4154
4160
  async function createContext(options, userConfig) {
4155
4161
  let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
4156
4162
  return {
4157
- version: "1.6.5",
4163
+ version: "1.6.6",
4158
4164
  rootPath,
4159
4165
  distPath: '',
4160
4166
  cachePath,
@@ -4764,7 +4770,7 @@ async function createCompiler_createCompiler(options) {
4764
4770
  }
4765
4771
  let RSPACK_BUILD_ERROR = 'Rspack build failed.', build_build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
4766
4772
  let compiler, bundlerConfigs, { context } = initOptions;
4767
- if (customCompiler) compiler = customCompiler;
4773
+ if (customCompiler) compiler = customCompiler, bundlerConfigs = customCompiler.options;
4768
4774
  else {
4769
4775
  let result = await createCompiler_createCompiler(initOptions);
4770
4776
  compiler = result.compiler, bundlerConfigs = result.rspackConfigs;
@@ -5731,37 +5737,6 @@ function normalizeManifestObjectConfig(manifest) {
5731
5737
  ...manifest
5732
5738
  };
5733
5739
  }
5734
- class PatchSplitChunksPlugin {
5735
- name;
5736
- constructor(name){
5737
- this.name = name;
5738
- }
5739
- apply(compiler) {
5740
- let { splitChunks } = compiler.options.optimization;
5741
- if (!splitChunks) return;
5742
- let applyPatch = (config)=>{
5743
- if ('object' != typeof config || isRegExp(config)) return;
5744
- let { chunks } = config;
5745
- if (chunks && 'async' !== chunks) {
5746
- if ('function' == typeof chunks) {
5747
- config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunks(chunk);
5748
- return;
5749
- }
5750
- if ('all' === chunks) {
5751
- config.chunks = (chunk)=>!chunk.name || chunk.name !== this.name;
5752
- return;
5753
- }
5754
- if ('initial' === chunks) {
5755
- config.chunks = (chunk)=>(!chunk.name || chunk.name !== this.name) && chunk.isOnlyInitial();
5756
- return;
5757
- }
5758
- }
5759
- };
5760
- applyPatch(splitChunks);
5761
- let { cacheGroups } = splitChunks;
5762
- if (cacheGroups) for (let cacheGroupKey of Object.keys(cacheGroups))cacheGroups[cacheGroupKey] && applyPatch(cacheGroups[cacheGroupKey]);
5763
- }
5764
- }
5765
5740
  function pluginModuleFederation() {
5766
5741
  return {
5767
5742
  name: 'rsbuild:module-federation',
@@ -5786,9 +5761,7 @@ function pluginModuleFederation() {
5786
5761
  let { options } = config.moduleFederation;
5787
5762
  chain.plugin(CHAIN_ID.PLUGIN.MODULE_FEDERATION).use(rspack_rspack.container.ModuleFederationPlugin, [
5788
5763
  options
5789
- ]), options.name && (options.exposes && chain.plugin('mf-patch-split-chunks').use(PatchSplitChunksPlugin, [
5790
- options.name
5791
- ]), chain.output.get('uniqueName') || chain.output.set('uniqueName', options.name));
5764
+ ]), options.name && !chain.output.get('uniqueName') && chain.output.set('uniqueName', options.name);
5792
5765
  }));
5793
5766
  }
5794
5767
  };
@@ -9068,7 +9041,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
9068
9041
  api.modifyBundlerChain((chain, { environment, target })=>{
9069
9042
  let { config } = environment;
9070
9043
  if (config.output.module) {
9071
- if ('web' === target && chain.optimization.runtimeChunk(!0), 'node' === target && chain.output.library({
9044
+ if ('node' === target && chain.output.library({
9072
9045
  ...chain.output.get('library'),
9073
9046
  type: 'module'
9074
9047
  }), 'web-worker' === target) throw Error('[rsbuild:config] `output.module` is not supported for web-worker target.');
@@ -9801,7 +9774,7 @@ let applyServerOptions = (command)=>{
9801
9774
  };
9802
9775
  function setupCommands() {
9803
9776
  let cli = ((name = "")=>new CAC(name))('rsbuild');
9804
- cli.version("1.6.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)', {
9777
+ cli.version("1.6.6"), 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)', {
9805
9778
  default: 'auto'
9806
9779
  }).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', {
9807
9780
  type: [
@@ -9870,7 +9843,7 @@ function initNodeEnv() {
9870
9843
  }
9871
9844
  function showGreeting() {
9872
9845
  let { npm_execpath, npm_lifecycle_event, NODE_RUN_SCRIPT_NAME } = process.env, isBun = npm_execpath?.includes('.bun');
9873
- logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.5\n`);
9846
+ logger.greet(`${'npx' === npm_lifecycle_event || isBun || NODE_RUN_SCRIPT_NAME ? '\n' : ''}Rsbuild v1.6.6\n`);
9874
9847
  }
9875
9848
  function setupLogLevel() {
9876
9849
  let logLevelIndex = process.argv.findIndex((item)=>'--log-level' === item || '--logLevel' === item);
@@ -9891,7 +9864,7 @@ function runCLI() {
9891
9864
  logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
9892
9865
  }
9893
9866
  }
9894
- let src_version = "1.6.5";
9867
+ let src_version = "1.6.6";
9895
9868
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
9896
9869
  import { fileURLToPath as __webpack_fileURLToPath__ } from "node:url";
9897
9870
  import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
@@ -30,14 +30,14 @@ export declare function initHooks(): {
30
30
  };
31
31
  export type Hooks = ReturnType<typeof initHooks>;
32
32
  export declare const registerBuildHook: ({ context, isWatch, compiler, bundlerConfigs, MultiStatsCtor, }: {
33
- bundlerConfigs?: Rspack.Configuration[];
33
+ bundlerConfigs: Rspack.Configuration[];
34
34
  context: InternalContext;
35
35
  compiler: Rspack.Compiler | Rspack.MultiCompiler;
36
36
  isWatch: boolean;
37
37
  MultiStatsCtor: new (stats: Rspack.Stats[]) => Rspack.MultiStats;
38
38
  }) => void;
39
39
  export declare const registerDevHook: ({ context, compiler, bundlerConfigs, MultiStatsCtor, }: {
40
- bundlerConfigs?: Rspack.Configuration[];
40
+ bundlerConfigs: Rspack.Configuration[];
41
41
  context: InternalContext;
42
42
  compiler: Rspack.Compiler | Rspack.MultiCompiler;
43
43
  MultiStatsCtor: new (stats: Rspack.Stats[]) => Rspack.MultiStats;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -46,8 +46,8 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.6.1",
50
- "@rspack/lite-tapable": "~1.0.1",
49
+ "@rspack/core": "1.6.3",
50
+ "@rspack/lite-tapable": "~1.1.0",
51
51
  "@swc/helpers": "^0.5.17",
52
52
  "core-js": "~3.46.0",
53
53
  "jiti": "^2.6.1"