@rspack-canary/browser 1.7.2-canary-cad7e7a3-20260113065652 → 1.7.3-canary-26c87d78-20260113175831

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.mjs CHANGED
@@ -50923,6 +50923,7 @@ class RuntimeModule {
50923
50923
  this.chunk = chunk;
50924
50924
  this.chunkGraph = chunkGraph;
50925
50925
  }
50926
+ get source() {}
50926
50927
  get name() {
50927
50928
  return this._name;
50928
50929
  }
@@ -58215,7 +58216,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58215
58216
  if ('object' == typeof rspackFuture) {
58216
58217
  D(rspackFuture, 'bundlerInfo', {});
58217
58218
  if ('object' == typeof rspackFuture.bundlerInfo) {
58218
- D(rspackFuture.bundlerInfo, 'version', "1.7.2-canary-cad7e7a3-20260113065652");
58219
+ D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-26c87d78-20260113175831");
58219
58220
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58220
58221
  D(rspackFuture.bundlerInfo, 'force', !library);
58221
58222
  }
@@ -60485,7 +60486,7 @@ class MultiStats {
60485
60486
  return obj;
60486
60487
  });
60487
60488
  if (childOptions.version) {
60488
- obj.rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
60489
+ obj.rspackVersion = "1.7.3-canary-26c87d78-20260113175831";
60489
60490
  obj.version = "5.75.0";
60490
60491
  }
60491
60492
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62317,7 +62318,7 @@ const SIMPLE_EXTRACTORS = {
62317
62318
  },
62318
62319
  version: (object)=>{
62319
62320
  object.version = "5.75.0";
62320
- object.rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
62321
+ object.rspackVersion = "1.7.3-canary-26c87d78-20260113175831";
62321
62322
  },
62322
62323
  env: (object, _compilation, _context, { _env })=>{
62323
62324
  object.env = _env;
@@ -64112,7 +64113,7 @@ function createCompiler(userOptions) {
64112
64113
  function isMultiRspackOptions(o) {
64113
64114
  return Array.isArray(o);
64114
64115
  }
64115
- function rspack_rspack(options, callback) {
64116
+ function rspack(options, callback) {
64116
64117
  try {
64117
64118
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
64118
64119
  else validateRspackConfig(options);
@@ -65777,7 +65778,7 @@ class Compiler {
65777
65778
  };
65778
65779
  const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
65779
65780
  const compilerFn = function(...params) {
65780
- return rspack_rspack(...params);
65781
+ return rspack(...params);
65781
65782
  };
65782
65783
  const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
65783
65784
  RuntimeGlobals: compilerRuntimeGlobals
@@ -66279,266 +66280,10 @@ class NodeTemplatePlugin {
66279
66280
  this._options = _options;
66280
66281
  }
66281
66282
  }
66282
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66283
- const array = (items)=>{
66284
- for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66285
- else if (item && 'object' == typeof item) object(item);
66286
- else throw new Error('Unexpected options format');
66287
- };
66288
- const object = (obj)=>{
66289
- for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66290
- };
66291
- if (!options) return;
66292
- if (Array.isArray(options)) array(options);
66293
- else if ('object' == typeof options) object(options);
66294
- else throw new Error('Unexpected options format');
66295
- };
66296
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66297
- const items = [];
66298
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66299
- items.push([
66300
- key,
66301
- value
66302
- ]);
66303
- });
66304
- return items;
66305
- };
66306
- function ShareRuntimePlugin_define_property(obj, key, value) {
66307
- if (key in obj) Object.defineProperty(obj, key, {
66308
- value: value,
66309
- enumerable: true,
66310
- configurable: true,
66311
- writable: true
66312
- });
66313
- else obj[key] = value;
66314
- return obj;
66315
- }
66316
- const compilerSet = new WeakSet();
66317
- function isSingleton(compiler) {
66318
- return compilerSet.has(compiler);
66319
- }
66320
- function setSingleton(compiler) {
66321
- compilerSet.add(compiler);
66322
- }
66323
- class ShareRuntimePlugin extends RspackBuiltinPlugin {
66324
- raw(compiler) {
66325
- if (isSingleton(compiler)) return;
66326
- setSingleton(compiler);
66327
- return createBuiltinPlugin(this.name, this.enhanced);
66328
- }
66329
- constructor(enhanced = false){
66330
- super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
66331
- }
66332
- }
66333
66283
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66334
66284
  function isRequiredVersion(str) {
66335
66285
  return VERSION_PATTERN_REGEXP.test(str);
66336
66286
  }
66337
- const encodeName = function(name, prefix = '', withExt = false) {
66338
- const ext = withExt ? '.js' : '';
66339
- return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
66340
- };
66341
- function ConsumeSharedPlugin_define_property(obj, key, value) {
66342
- if (key in obj) Object.defineProperty(obj, key, {
66343
- value: value,
66344
- enumerable: true,
66345
- configurable: true,
66346
- writable: true
66347
- });
66348
- else obj[key] = value;
66349
- return obj;
66350
- }
66351
- function normalizeConsumeShareOptions(consumes, shareScope) {
66352
- return parseOptions(consumes, (item, key)=>{
66353
- if (Array.isArray(item)) throw new Error('Unexpected array in options');
66354
- const result = item !== key && isRequiredVersion(item) ? {
66355
- import: key,
66356
- shareScope: shareScope || 'default',
66357
- shareKey: key,
66358
- requiredVersion: item,
66359
- strictVersion: true,
66360
- packageName: void 0,
66361
- singleton: false,
66362
- eager: false,
66363
- treeShakingMode: void 0
66364
- } : {
66365
- import: key,
66366
- shareScope: shareScope || 'default',
66367
- shareKey: key,
66368
- requiredVersion: void 0,
66369
- packageName: void 0,
66370
- strictVersion: false,
66371
- singleton: false,
66372
- eager: false,
66373
- treeShakingMode: void 0
66374
- };
66375
- return result;
66376
- }, (item, key)=>({
66377
- import: false === item.import ? void 0 : item.import || key,
66378
- shareScope: item.shareScope || shareScope || 'default',
66379
- shareKey: item.shareKey || key,
66380
- requiredVersion: item.requiredVersion,
66381
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66382
- packageName: item.packageName,
66383
- singleton: !!item.singleton,
66384
- eager: !!item.eager,
66385
- treeShakingMode: item.treeShakingMode
66386
- }));
66387
- }
66388
- class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66389
- raw(compiler) {
66390
- new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66391
- const rawOptions = {
66392
- consumes: this._options.consumes.map(([key, v])=>({
66393
- key,
66394
- ...v
66395
- })),
66396
- enhanced: this._options.enhanced
66397
- };
66398
- return createBuiltinPlugin(this.name, rawOptions);
66399
- }
66400
- constructor(options){
66401
- super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66402
- this._options = {
66403
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66404
- enhanced: options.enhanced ?? false
66405
- };
66406
- }
66407
- }
66408
- function ProvideSharedPlugin_define_property(obj, key, value) {
66409
- if (key in obj) Object.defineProperty(obj, key, {
66410
- value: value,
66411
- enumerable: true,
66412
- configurable: true,
66413
- writable: true
66414
- });
66415
- else obj[key] = value;
66416
- return obj;
66417
- }
66418
- function normalizeProvideShareOptions(options, shareScope, enhanced) {
66419
- return parseOptions(options, (item)=>{
66420
- if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66421
- return {
66422
- shareKey: item,
66423
- version: void 0,
66424
- shareScope: shareScope || 'default',
66425
- eager: false
66426
- };
66427
- }, (item)=>{
66428
- const raw = {
66429
- shareKey: item.shareKey,
66430
- version: item.version,
66431
- shareScope: item.shareScope || shareScope || 'default',
66432
- eager: !!item.eager
66433
- };
66434
- if (enhanced) {
66435
- const enhancedItem = item;
66436
- return {
66437
- ...raw,
66438
- singleton: enhancedItem.singleton,
66439
- requiredVersion: enhancedItem.requiredVersion,
66440
- strictVersion: enhancedItem.strictVersion,
66441
- treeShakingMode: enhancedItem.treeShakingMode
66442
- };
66443
- }
66444
- return raw;
66445
- });
66446
- }
66447
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66448
- raw(compiler) {
66449
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66450
- const rawOptions = this._provides.map(([key, v])=>({
66451
- key,
66452
- ...v
66453
- }));
66454
- return createBuiltinPlugin(this.name, rawOptions);
66455
- }
66456
- constructor(options){
66457
- super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
66458
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66459
- this._enhanced = options.enhanced;
66460
- }
66461
- }
66462
- function SharePlugin_define_property(obj, key, value) {
66463
- if (key in obj) Object.defineProperty(obj, key, {
66464
- value: value,
66465
- enumerable: true,
66466
- configurable: true,
66467
- writable: true
66468
- });
66469
- else obj[key] = value;
66470
- return obj;
66471
- }
66472
- function normalizeSharedOptions(shared) {
66473
- return parseOptions(shared, (item, key)=>{
66474
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66475
- const config = item !== key && isRequiredVersion(item) ? {
66476
- import: key,
66477
- requiredVersion: item
66478
- } : {
66479
- import: item
66480
- };
66481
- return config;
66482
- }, (item)=>item);
66483
- }
66484
- function createProvideShareOptions(normalizedSharedOptions) {
66485
- return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66486
- [options.import || key]: {
66487
- shareKey: options.shareKey || key,
66488
- shareScope: options.shareScope,
66489
- version: options.version,
66490
- eager: options.eager,
66491
- singleton: options.singleton,
66492
- requiredVersion: options.requiredVersion,
66493
- strictVersion: options.strictVersion,
66494
- treeShakingMode: options.treeShaking?.mode
66495
- }
66496
- }));
66497
- }
66498
- function createConsumeShareOptions(normalizedSharedOptions) {
66499
- return normalizedSharedOptions.map(([key, options])=>({
66500
- [key]: {
66501
- import: options.import,
66502
- shareKey: options.shareKey || key,
66503
- shareScope: options.shareScope,
66504
- requiredVersion: options.requiredVersion,
66505
- strictVersion: options.strictVersion,
66506
- singleton: options.singleton,
66507
- packageName: options.packageName,
66508
- eager: options.eager,
66509
- treeShakingMode: options.treeShaking?.mode
66510
- }
66511
- }));
66512
- }
66513
- class SharePlugin {
66514
- apply(compiler) {
66515
- new ConsumeSharedPlugin({
66516
- shareScope: this._shareScope,
66517
- consumes: this._consumes,
66518
- enhanced: this._enhanced
66519
- }).apply(compiler);
66520
- new ProvideSharedPlugin({
66521
- shareScope: this._shareScope,
66522
- provides: this._provides,
66523
- enhanced: this._enhanced
66524
- }).apply(compiler);
66525
- }
66526
- constructor(options){
66527
- SharePlugin_define_property(this, "_shareScope", void 0);
66528
- SharePlugin_define_property(this, "_consumes", void 0);
66529
- SharePlugin_define_property(this, "_provides", void 0);
66530
- SharePlugin_define_property(this, "_enhanced", void 0);
66531
- SharePlugin_define_property(this, "_sharedOptions", void 0);
66532
- const sharedOptions = normalizeSharedOptions(options.shared);
66533
- const consumes = createConsumeShareOptions(sharedOptions);
66534
- const provides = createProvideShareOptions(sharedOptions);
66535
- this._shareScope = options.shareScope;
66536
- this._consumes = consumes;
66537
- this._provides = provides;
66538
- this._enhanced = options.enhanced ?? false;
66539
- this._sharedOptions = sharedOptions;
66540
- }
66541
- }
66542
66287
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66543
66288
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66544
66289
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66577,29 +66322,17 @@ function readPKGJson(root) {
66577
66322
  } catch {}
66578
66323
  return {};
66579
66324
  }
66580
- function getBuildInfo(isDev, compiler, mfConfig) {
66581
- const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
66325
+ function getBuildInfo(isDev, root) {
66326
+ const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
66582
66327
  const pkg = readPKGJson(rootPath);
66583
66328
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
66584
- const statsBuildInfo = {
66329
+ return {
66585
66330
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
66586
66331
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
66587
66332
  };
66588
- const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
66589
- const enableTreeShaking = Object.values(normalizedShared).some((config)=>config[1].treeShaking);
66590
- if (enableTreeShaking) {
66591
- statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
66592
- statsBuildInfo.plugins = mfConfig.treeShakingSharedPlugins || [];
66593
- statsBuildInfo.excludePlugins = mfConfig.treeShakingSharedExcludePlugins || [];
66594
- }
66595
- return statsBuildInfo;
66596
66333
  }
66597
66334
  function getFileName(manifestOptions) {
66598
66335
  if (!manifestOptions) return {
66599
- statsFileName: '',
66600
- manifestFileName: ''
66601
- };
66602
- if ('boolean' == typeof manifestOptions) return {
66603
66336
  statsFileName: STATS_FILE_NAME,
66604
66337
  manifestFileName: MANIFEST_FILE_NAME
66605
66338
  };
@@ -66612,591 +66345,60 @@ function getFileName(manifestOptions) {
66612
66345
  const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
66613
66346
  const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
66614
66347
  const statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : STATS_FILE_NAME;
66615
- return {
66616
- statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66617
- manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66618
- };
66619
- }
66620
- function resolveLibraryGlobalName(library) {
66621
- if (!library) return;
66622
- const libName = library.name;
66623
- if (!libName) return;
66624
- if ('string' == typeof libName) return libName;
66625
- if (Array.isArray(libName)) return libName[0];
66626
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66627
- }
66628
- function collectManifestExposes(exposes) {
66629
- if (!exposes) return;
66630
- const parsed = parseOptions(exposes, (value)=>({
66631
- import: Array.isArray(value) ? value : [
66632
- value
66633
- ],
66634
- name: void 0
66635
- }), (value)=>({
66636
- import: Array.isArray(value.import) ? value.import : [
66637
- value.import
66638
- ],
66639
- name: value.name ?? void 0
66640
- }));
66641
- const result = parsed.map(([exposeKey, info])=>{
66642
- const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66643
- return {
66644
- path: exposeKey,
66645
- name: exposeName
66646
- };
66647
- });
66648
- return result.length > 0 ? result : void 0;
66649
- }
66650
- function collectManifestShared(shared) {
66651
- if (!shared) return;
66652
- const parsed = parseOptions(shared, (item, key)=>{
66653
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66654
- return item !== key && isRequiredVersion(item) ? {
66655
- import: key,
66656
- requiredVersion: item
66657
- } : {
66658
- import: item
66659
- };
66660
- }, (item)=>item);
66661
- const result = parsed.map(([key, config])=>{
66662
- const name = config.shareKey || key;
66663
- const version = 'string' == typeof config.version ? config.version : void 0;
66664
- const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66665
- return {
66666
- name,
66667
- version,
66668
- requiredVersion,
66669
- singleton: config.singleton
66670
- };
66671
- });
66672
- return result.length > 0 ? result : void 0;
66673
- }
66674
- function normalizeManifestOptions(mfConfig) {
66675
- const manifestOptions = true === mfConfig.manifest ? {} : {
66676
- ...mfConfig.manifest
66677
- };
66678
- const containerName = mfConfig.name;
66679
- const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
66680
- const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
66681
- if (cur[1].length > 1) return sum;
66682
- const remoteInfo = cur[1][0];
66683
- const { entry, alias, name } = remoteInfo;
66684
- if (entry && name) sum[alias] = {
66685
- name,
66686
- entry
66687
- };
66688
- return sum;
66689
- }, {});
66690
- const manifestExposes = collectManifestExposes(mfConfig.exposes);
66691
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66692
- const manifestShared = collectManifestShared(mfConfig.shared);
66693
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66694
- return {
66695
- ...manifestOptions,
66696
- remoteAliasMap,
66697
- globalName,
66698
- name: containerName
66699
- };
66700
- }
66701
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66702
- raw(compiler) {
66703
- const opts = normalizeManifestOptions(this.rawOpts);
66704
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
66705
- const { statsFileName, manifestFileName } = getFileName(opts);
66706
- const rawOptions = {
66707
- name: opts.name,
66708
- globalName: opts.globalName,
66709
- fileName,
66710
- filePath,
66711
- manifestFileName,
66712
- statsFileName,
66713
- disableAssetsAnalyze,
66714
- remoteAliasMap,
66715
- exposes,
66716
- shared,
66717
- buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
66718
- };
66719
- return createBuiltinPlugin(this.name, rawOptions);
66720
- }
66721
- constructor(opts){
66722
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "rawOpts", void 0);
66723
- this.rawOpts = opts;
66724
- }
66725
- }
66726
- function CollectSharedEntryPlugin_define_property(obj, key, value) {
66727
- if (key in obj) Object.defineProperty(obj, key, {
66728
- value: value,
66729
- enumerable: true,
66730
- configurable: true,
66731
- writable: true
66732
- });
66733
- else obj[key] = value;
66734
- return obj;
66735
- }
66736
- const SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
66737
- class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66738
- getData() {
66739
- return this._collectedEntries;
66740
- }
66741
- getFilename() {
66742
- return SHARE_ENTRY_ASSET;
66743
- }
66744
- apply(compiler) {
66745
- super.apply(compiler);
66746
- compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
66747
- compilation.hooks.processAssets.tap({
66748
- name: 'CollectSharedEntry',
66749
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66750
- }, ()=>{
66751
- compilation.getAssets().forEach((asset)=>{
66752
- if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
66753
- compilation.deleteAsset(asset.name);
66754
- });
66755
- });
66756
- });
66757
- }
66758
- raw() {
66759
- const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66760
- const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66761
- const rawOptions = {
66762
- consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66763
- key,
66764
- ...v
66765
- })),
66766
- filename: this.getFilename()
66767
- };
66768
- return createBuiltinPlugin(this.name, rawOptions);
66769
- }
66770
- constructor(options){
66771
- super(), CollectSharedEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectSharedEntryPlugin), CollectSharedEntryPlugin_define_property(this, "sharedOptions", void 0), CollectSharedEntryPlugin_define_property(this, "_collectedEntries", void 0);
66772
- const { sharedOptions } = options;
66773
- this.sharedOptions = sharedOptions;
66774
- this._collectedEntries = {};
66775
- }
66776
- }
66777
- function SharedContainerPlugin_define_property(obj, key, value) {
66778
- if (key in obj) Object.defineProperty(obj, key, {
66779
- value: value,
66780
- enumerable: true,
66781
- configurable: true,
66782
- writable: true
66783
- });
66784
- else obj[key] = value;
66785
- return obj;
66786
- }
66787
- function assert(condition, msg) {
66788
- if (!condition) throw new Error(msg);
66789
- }
66790
- const HOT_UPDATE_SUFFIX = '.hot-update';
66791
- class SharedContainerPlugin extends RspackBuiltinPlugin {
66792
- getData() {
66793
- return [
66794
- this._options.fileName,
66795
- this._globalName,
66796
- this._options.version
66797
- ];
66798
- }
66799
- raw(compiler) {
66800
- const { library } = this._options;
66801
- if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66802
- return createBuiltinPlugin(this.name, this._options);
66803
- }
66804
- apply(compiler) {
66805
- super.apply(compiler);
66806
- const shareName = this._shareName;
66807
- compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66808
- compilation.hooks.processAssets.tap({
66809
- name: 'getShareContainerFile'
66810
- }, ()=>{
66811
- const remoteEntryPoint = compilation.entrypoints.get(shareName);
66812
- assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66813
- const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66814
- assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66815
- const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
66816
- assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66817
- assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
66818
- this.filename = files[0];
66819
- });
66820
- });
66821
- }
66822
- constructor(options){
66823
- super(), SharedContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedContainerPlugin), SharedContainerPlugin_define_property(this, "filename", ''), SharedContainerPlugin_define_property(this, "_options", void 0), SharedContainerPlugin_define_property(this, "_shareName", void 0), SharedContainerPlugin_define_property(this, "_globalName", void 0);
66824
- const { shareName, library, request, independentShareFileName, mfName } = options;
66825
- const version = options.version || '0.0.0';
66826
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
66827
- const fileName = independentShareFileName || `${version}/share-entry.js`;
66828
- this._shareName = shareName;
66829
- this._options = {
66830
- name: shareName,
66831
- request: request,
66832
- library: (library ? {
66833
- ...library,
66834
- name: this._globalName
66835
- } : void 0) || {
66836
- type: 'global',
66837
- name: this._globalName
66838
- },
66839
- version,
66840
- fileName
66841
- };
66842
- }
66843
- }
66844
- function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66845
- if (key in obj) Object.defineProperty(obj, key, {
66846
- value: value,
66847
- enumerable: true,
66848
- configurable: true,
66849
- writable: true
66850
- });
66851
- else obj[key] = value;
66852
- return obj;
66853
- }
66854
- class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66855
- buildOptions() {
66856
- const shared = this.sharedOptions.map(([shareKey, config])=>({
66857
- shareKey,
66858
- treeShaking: !!config.treeShaking,
66859
- usedExports: config.treeShaking?.usedExports
66860
- }));
66861
- const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66862
- return {
66863
- shared,
66864
- injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
66865
- manifestFileName,
66866
- statsFileName
66867
- };
66868
- }
66869
- raw() {
66870
- if (!this.sharedOptions.length) return;
66871
- return createBuiltinPlugin(this.name, this.buildOptions());
66872
- }
66873
- constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
66874
- super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectTreeShakingUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
66875
- this.sharedOptions = sharedOptions;
66876
- this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
66877
- this.manifestOptions = manifestOptions ?? {};
66878
- }
66879
- }
66880
- function IndependentSharedPlugin_define_property(obj, key, value) {
66881
- if (key in obj) Object.defineProperty(obj, key, {
66882
- value: value,
66883
- enumerable: true,
66884
- configurable: true,
66885
- writable: true
66886
- });
66887
- else obj[key] = value;
66888
- return obj;
66889
- }
66890
- const VIRTUAL_ENTRY = './virtual-entry.js';
66891
- const VIRTUAL_ENTRY_NAME = 'virtual-entry';
66892
- const filterPlugin = (plugin, excludedPlugins = [])=>{
66893
- if (!plugin) return true;
66894
- const pluginName = plugin.name || plugin.constructor?.name;
66895
- if (!pluginName) return true;
66896
- return ![
66897
- 'TreeShakingSharedPlugin',
66898
- 'IndependentSharedPlugin',
66899
- 'ModuleFederationPlugin',
66900
- 'SharedUsedExportsOptimizerPlugin',
66901
- 'HtmlWebpackPlugin',
66902
- 'HtmlRspackPlugin',
66903
- 'RsbuildHtmlPlugin',
66904
- ...excludedPlugins
66905
- ].includes(pluginName);
66906
- };
66907
- class VirtualEntryPlugin {
66908
- createEntry() {
66909
- const { sharedOptions, collectShared } = this;
66910
- const entryContent = sharedOptions.reduce((acc, cur, index)=>{
66911
- const importLine = `import shared_${index} from '${cur[0]}';\n`;
66912
- const logLine = collectShared ? `console.log(shared_${index});\n` : '';
66913
- return acc + importLine + logLine;
66914
- }, '');
66915
- return entryContent;
66916
- }
66917
- static entry() {
66918
- return {
66919
- [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66920
- };
66921
- }
66922
- apply(compiler) {
66923
- new compiler.rspack.experiments.VirtualModulesPlugin({
66924
- [VIRTUAL_ENTRY]: this.createEntry()
66925
- }).apply(compiler);
66926
- compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
66927
- compilation.hooks.processAssets.tap({
66928
- name: 'RemoveVirtualEntryAsset',
66929
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66930
- }, ()=>{
66931
- try {
66932
- const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66933
- chunk?.files.forEach((f)=>{
66934
- compilation.deleteAsset(f);
66935
- });
66936
- } catch (_e) {
66937
- console.error('Failed to remove virtual entry file!');
66938
- }
66939
- });
66940
- });
66941
- }
66942
- constructor(sharedOptions, collectShared){
66943
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66944
- IndependentSharedPlugin_define_property(this, "collectShared", false);
66945
- this.sharedOptions = sharedOptions;
66946
- this.collectShared = collectShared;
66947
- }
66948
- }
66949
- const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
66950
- class IndependentSharedPlugin {
66951
- apply(compiler) {
66952
- const { manifest } = this;
66953
- let runCount = 0;
66954
- compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
66955
- if (runCount) return;
66956
- await this.createIndependentCompilers(compiler);
66957
- runCount++;
66958
- });
66959
- compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
66960
- if (runCount) return;
66961
- await this.createIndependentCompilers(compiler);
66962
- runCount++;
66963
- });
66964
- compiler.hooks.shutdown.tapAsync('IndependentSharedPlugin', (callback)=>{
66965
- callback();
66966
- });
66967
- if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
66968
- compilation.hooks.processAssets.tap({
66969
- name: 'injectBuildAssets',
66970
- stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66971
- }, ()=>{
66972
- const { statsFileName, manifestFileName } = getFileName(manifest);
66973
- const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66974
- const stats = compilation.getAsset(filename);
66975
- if (!stats) return;
66976
- const statsContent = JSON.parse(stats.source.source().toString());
66977
- const { shared } = statsContent;
66978
- Object.entries(this.buildAssets).forEach(([key, item])=>{
66979
- const targetShared = shared.find((s)=>s.name === key);
66980
- if (!targetShared) return;
66981
- item.forEach(([entry, version, globalName])=>{
66982
- if (version === targetShared.version) {
66983
- targetShared.fallback = entry;
66984
- targetShared.fallbackName = globalName;
66985
- }
66986
- });
66987
- });
66988
- compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66989
- };
66990
- injectBuildAssetsIntoStatsOrManifest(statsFileName);
66991
- injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66992
- });
66993
- });
66994
- }
66995
- async createIndependentCompilers(parentCompiler) {
66996
- const { sharedOptions, buildAssets, outputDir } = this;
66997
- console.log('Start building shared fallback resources ...');
66998
- const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
66999
- await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
67000
- if (!shareConfig.treeShaking || false === shareConfig.import) return;
67001
- const shareRequests = shareRequestsMap[shareName].requests;
67002
- await Promise.all(shareRequests.map(async ([request, version])=>{
67003
- const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
67004
- const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
67005
- shareRequestsMap,
67006
- currentShare: {
67007
- shareName,
67008
- version,
67009
- request,
67010
- independentShareFileName: sharedConfig?.treeShaking?.filename
67011
- }
67012
- });
67013
- if ('string' == typeof shareFileName) {
67014
- buildAssets[shareName] ||= [];
67015
- buildAssets[shareName].push([
67016
- (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
67017
- sharedVersion,
67018
- globalName
67019
- ]);
67020
- }
67021
- }));
67022
- }));
67023
- console.log('All shared fallback have been compiled successfully!');
67024
- }
67025
- async createIndependentCompiler(parentCompiler, extraOptions) {
67026
- const { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this;
67027
- const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
67028
- const parentConfig = parentCompiler.options;
67029
- const finalPlugins = [];
67030
- const rspack = parentCompiler.rspack;
67031
- let extraPlugin;
67032
- extraPlugin = extraOptions ? new SharedContainerPlugin({
67033
- mfName,
67034
- library,
67035
- ...extraOptions.currentShare
67036
- }) : new CollectSharedEntryPlugin({
67037
- sharedOptions,
67038
- shareScope: 'default'
67039
- });
67040
- (parentConfig.plugins || []).forEach((plugin)=>{
67041
- if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeShakingSharedExcludePlugins)) finalPlugins.push(plugin);
67042
- });
67043
- plugins.forEach((plugin)=>{
67044
- finalPlugins.push(plugin);
67045
- });
67046
- finalPlugins.push(extraPlugin);
67047
- finalPlugins.push(new ConsumeSharedPlugin({
67048
- consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
67049
- [key]: {
67050
- import: extraOptions ? false : options.import,
67051
- shareKey: options.shareKey || key,
67052
- shareScope: options.shareScope,
67053
- requiredVersion: options.requiredVersion,
67054
- strictVersion: options.strictVersion,
67055
- singleton: options.singleton,
67056
- packageName: options.packageName,
67057
- eager: options.eager
67058
- }
67059
- })),
67060
- enhanced: true
67061
- }));
67062
- if (treeShaking) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports));
67063
- finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
67064
- const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
67065
- const compilerConfig = {
67066
- ...parentConfig,
67067
- module: {
67068
- ...parentConfig.module,
67069
- rules: [
67070
- {
67071
- test: /virtual-entry\.js$/,
67072
- type: "javascript/auto",
67073
- resolve: {
67074
- fullySpecified: false
67075
- },
67076
- use: {
67077
- loader: 'builtin:swc-loader'
67078
- }
67079
- },
67080
- ...parentConfig.module?.rules || []
67081
- ]
67082
- },
67083
- mode: parentConfig.mode || 'development',
67084
- entry: VirtualEntryPlugin.entry,
67085
- output: {
67086
- path: fullOutputDir,
67087
- clean: true,
67088
- publicPath: parentConfig.output?.publicPath || 'auto'
67089
- },
67090
- plugins: finalPlugins,
67091
- optimization: {
67092
- ...parentConfig.optimization,
67093
- splitChunks: false
67094
- }
67095
- };
67096
- const compiler = rspack.rspack(compilerConfig);
67097
- compiler.inputFileSystem = parentCompiler.inputFileSystem;
67098
- compiler.outputFileSystem = parentCompiler.outputFileSystem;
67099
- compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
67100
- const { currentShare } = extraOptions || {};
67101
- return new Promise((resolve, reject)=>{
67102
- compiler.run((err, stats)=>{
67103
- if (err || stats?.hasErrors()) {
67104
- const target = currentShare ? currentShare.shareName : 'Collect deps';
67105
- console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
67106
- reject(err || new Error(`${target} Compile failed`));
67107
- return;
67108
- }
67109
- currentShare && console.log(`${currentShare.shareName} Compile success`);
67110
- resolve(extraPlugin.getData());
67111
- });
67112
- });
67113
- }
67114
- constructor(options){
67115
- IndependentSharedPlugin_define_property(this, "mfName", void 0);
67116
- IndependentSharedPlugin_define_property(this, "shared", void 0);
67117
- IndependentSharedPlugin_define_property(this, "library", void 0);
67118
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
67119
- IndependentSharedPlugin_define_property(this, "outputDir", void 0);
67120
- IndependentSharedPlugin_define_property(this, "plugins", void 0);
67121
- IndependentSharedPlugin_define_property(this, "treeShaking", void 0);
67122
- IndependentSharedPlugin_define_property(this, "manifest", void 0);
67123
- IndependentSharedPlugin_define_property(this, "buildAssets", {});
67124
- IndependentSharedPlugin_define_property(this, "injectTreeShakingUsedExports", void 0);
67125
- IndependentSharedPlugin_define_property(this, "treeShakingSharedExcludePlugins", void 0);
67126
- IndependentSharedPlugin_define_property(this, "name", 'IndependentSharedPlugin');
67127
- const { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
67128
- this.shared = shared;
67129
- this.mfName = name;
67130
- this.outputDir = outputDir || 'independent-packages';
67131
- this.plugins = plugins || [];
67132
- this.treeShaking = treeShaking;
67133
- this.manifest = manifest;
67134
- this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
67135
- this.library = library;
67136
- this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [];
67137
- this.sharedOptions = parseOptions(shared, (item, key)=>{
67138
- if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
67139
- const config = item !== key && isRequiredVersion(item) ? {
67140
- import: key,
67141
- requiredVersion: item
67142
- } : {
67143
- import: item
67144
- };
67145
- return config;
67146
- }, (item)=>item);
67147
- }
67148
- }
67149
- function TreeShakingSharedPlugin_define_property(obj, key, value) {
67150
- if (key in obj) Object.defineProperty(obj, key, {
67151
- value: value,
67152
- enumerable: true,
67153
- configurable: true,
67154
- writable: true
67155
- });
67156
- else obj[key] = value;
67157
- return obj;
67158
- }
67159
- class TreeShakingSharedPlugin {
67160
- apply(compiler) {
67161
- const { mfConfig, outputDir, reShake } = this;
67162
- const { name, shared, library, treeShakingSharedPlugins } = mfConfig;
67163
- if (!shared) return;
67164
- const sharedOptions = normalizeSharedOptions(shared);
67165
- if (!sharedOptions.length) return;
67166
- if (sharedOptions.some(([_, config])=>config.treeShaking && false !== config.import)) {
67167
- if (!reShake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler);
67168
- this._independentSharePlugin = new IndependentSharedPlugin({
67169
- name: name,
67170
- shared: shared,
67171
- outputDir,
67172
- plugins: treeShakingSharedPlugins?.map((p)=>{
67173
- const _constructor = require(p);
67174
- return new _constructor();
67175
- }) || [],
67176
- treeShaking: reShake,
67177
- library,
67178
- manifest: mfConfig.manifest,
67179
- treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
67180
- });
67181
- this._independentSharePlugin.apply(compiler);
67182
- }
67183
- }
67184
- get buildAssets() {
67185
- return this._independentSharePlugin?.buildAssets || {};
66348
+ return {
66349
+ statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66350
+ manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66351
+ };
66352
+ }
66353
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66354
+ raw(compiler) {
66355
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66356
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66357
+ const rawOptions = {
66358
+ name: this.opts.name,
66359
+ globalName: this.opts.globalName,
66360
+ fileName,
66361
+ filePath,
66362
+ manifestFileName,
66363
+ statsFileName,
66364
+ disableAssetsAnalyze,
66365
+ remoteAliasMap,
66366
+ exposes,
66367
+ shared,
66368
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
66369
+ };
66370
+ return createBuiltinPlugin(this.name, rawOptions);
67186
66371
  }
67187
- constructor(options){
67188
- TreeShakingSharedPlugin_define_property(this, "mfConfig", void 0);
67189
- TreeShakingSharedPlugin_define_property(this, "outputDir", void 0);
67190
- TreeShakingSharedPlugin_define_property(this, "reShake", void 0);
67191
- TreeShakingSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
67192
- TreeShakingSharedPlugin_define_property(this, "name", 'TreeShakingSharedPlugin');
67193
- const { mfConfig, reShake } = options;
67194
- this.mfConfig = mfConfig;
67195
- this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages';
67196
- this.reShake = Boolean(reShake);
66372
+ constructor(opts){
66373
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66374
+ this.opts = opts;
67197
66375
  }
67198
66376
  }
67199
66377
  const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66378
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66379
+ const array = (items)=>{
66380
+ for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66381
+ else if (item && 'object' == typeof item) object(item);
66382
+ else throw new Error('Unexpected options format');
66383
+ };
66384
+ const object = (obj)=>{
66385
+ for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66386
+ };
66387
+ if (!options) return;
66388
+ if (Array.isArray(options)) array(options);
66389
+ else if ('object' == typeof options) object(options);
66390
+ else throw new Error('Unexpected options format');
66391
+ };
66392
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66393
+ const items = [];
66394
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66395
+ items.push([
66396
+ key,
66397
+ value
66398
+ ]);
66399
+ });
66400
+ return items;
66401
+ };
67200
66402
  function ModuleFederationPlugin_define_property(obj, key, value) {
67201
66403
  if (key in obj) Object.defineProperty(obj, key, {
67202
66404
  value: value,
@@ -67216,50 +66418,101 @@ class ModuleFederationPlugin {
67216
66418
  '@module-federation/runtime': paths.runtime,
67217
66419
  ...compiler.options.resolve.alias
67218
66420
  };
67219
- const sharedOptions = getSharedOptions(this._options);
67220
- const treeShakingEntries = sharedOptions.filter(([, config])=>config.treeShaking);
67221
- if (treeShakingEntries.length > 0) {
67222
- this._treeShakingSharedPlugin = new TreeShakingSharedPlugin({
67223
- mfConfig: this._options,
67224
- reShake: false
67225
- });
67226
- this._treeShakingSharedPlugin.apply(compiler);
67227
- }
67228
- let runtimePluginApplied = false;
67229
- compiler.hooks.beforeRun.tap({
67230
- name: 'ModuleFederationPlugin',
67231
- stage: 100
67232
- }, ()=>{
67233
- if (runtimePluginApplied) return;
67234
- runtimePluginApplied = true;
67235
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets);
67236
- new ModuleFederationRuntimePlugin({
67237
- entryRuntime
67238
- }).apply(compiler);
67239
- });
67240
- compiler.hooks.watchRun.tap({
67241
- name: 'ModuleFederationPlugin',
67242
- stage: 100
67243
- }, ()=>{
67244
- if (runtimePluginApplied) return;
67245
- runtimePluginApplied = true;
67246
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {});
67247
- new ModuleFederationRuntimePlugin({
67248
- entryRuntime
67249
- }).apply(compiler);
67250
- });
66421
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66422
+ new ModuleFederationRuntimePlugin({
66423
+ entryRuntime
66424
+ }).apply(compiler);
67251
66425
  new webpack.container.ModuleFederationPluginV1({
67252
66426
  ...this._options,
67253
66427
  enhanced: true
67254
66428
  }).apply(compiler);
67255
- if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66429
+ if (this._options.manifest) {
66430
+ const manifestOptions = true === this._options.manifest ? {} : {
66431
+ ...this._options.manifest
66432
+ };
66433
+ const containerName = manifestOptions.name ?? this._options.name;
66434
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66435
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66436
+ if (cur[1].length > 1) return sum;
66437
+ const remoteInfo = cur[1][0];
66438
+ const { entry, alias, name } = remoteInfo;
66439
+ if (entry && name) sum[alias] = {
66440
+ name,
66441
+ entry
66442
+ };
66443
+ return sum;
66444
+ }, {});
66445
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66446
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66447
+ const manifestShared = collectManifestShared(this._options.shared);
66448
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66449
+ new ModuleFederationManifestPlugin({
66450
+ ...manifestOptions,
66451
+ name: containerName,
66452
+ globalName,
66453
+ remoteAliasMap
66454
+ }).apply(compiler);
66455
+ }
67256
66456
  }
67257
66457
  constructor(_options){
67258
66458
  ModuleFederationPlugin_define_property(this, "_options", void 0);
67259
- ModuleFederationPlugin_define_property(this, "_treeShakingSharedPlugin", void 0);
67260
66459
  this._options = _options;
67261
66460
  }
67262
66461
  }
66462
+ function collectManifestExposes(exposes) {
66463
+ if (!exposes) return;
66464
+ const parsed = parseOptions(exposes, (value)=>({
66465
+ import: Array.isArray(value) ? value : [
66466
+ value
66467
+ ],
66468
+ name: void 0
66469
+ }), (value)=>({
66470
+ import: Array.isArray(value.import) ? value.import : [
66471
+ value.import
66472
+ ],
66473
+ name: value.name ?? void 0
66474
+ }));
66475
+ const result = parsed.map(([exposeKey, info])=>{
66476
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66477
+ return {
66478
+ path: exposeKey,
66479
+ name: exposeName
66480
+ };
66481
+ });
66482
+ return result.length > 0 ? result : void 0;
66483
+ }
66484
+ function collectManifestShared(shared) {
66485
+ if (!shared) return;
66486
+ const parsed = parseOptions(shared, (item, key)=>{
66487
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66488
+ return item !== key && isRequiredVersion(item) ? {
66489
+ import: key,
66490
+ requiredVersion: item
66491
+ } : {
66492
+ import: item
66493
+ };
66494
+ }, (item)=>item);
66495
+ const result = parsed.map(([key, config])=>{
66496
+ const name = config.shareKey || key;
66497
+ const version = 'string' == typeof config.version ? config.version : void 0;
66498
+ const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66499
+ return {
66500
+ name,
66501
+ version,
66502
+ requiredVersion,
66503
+ singleton: config.singleton
66504
+ };
66505
+ });
66506
+ return result.length > 0 ? result : void 0;
66507
+ }
66508
+ function resolveLibraryGlobalName(library) {
66509
+ if (!library) return;
66510
+ const libName = library.name;
66511
+ if (!libName) return;
66512
+ if ('string' == typeof libName) return libName;
66513
+ if (Array.isArray(libName)) return libName[0];
66514
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66515
+ }
67263
66516
  function getRemoteInfos(options) {
67264
66517
  if (!options.remotes) return {};
67265
66518
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -67326,18 +66579,6 @@ function getRemoteInfos(options) {
67326
66579
  function getRuntimePlugins(options) {
67327
66580
  return options.runtimePlugins ?? [];
67328
66581
  }
67329
- function getSharedOptions(options) {
67330
- if (!options.shared) return [];
67331
- return parseOptions(options.shared, (item, key)=>{
67332
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
67333
- return item !== key && isRequiredVersion(item) ? {
67334
- import: key,
67335
- requiredVersion: item
67336
- } : {
67337
- import: item
67338
- };
67339
- }, (item)=>item);
67340
- }
67341
66582
  function getPaths(options) {
67342
66583
  return {
67343
66584
  runtimeTools: '@module-federation/runtime-tools',
@@ -67345,12 +66586,11 @@ function getPaths(options) {
67345
66586
  runtime: '@module-federation/runtime'
67346
66587
  };
67347
66588
  }
67348
- function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
66589
+ function getDefaultEntryRuntime(paths, options, compiler) {
67349
66590
  const runtimePlugins = getRuntimePlugins(options);
67350
66591
  const remoteInfos = getRemoteInfos(options);
67351
66592
  const runtimePluginImports = [];
67352
66593
  const runtimePluginVars = [];
67353
- const libraryType = options.library?.type || 'var';
67354
66594
  for(let i = 0; i < runtimePlugins.length; i++){
67355
66595
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67356
66596
  const pluginSpec = runtimePlugins[i];
@@ -67367,12 +66607,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
67367
66607
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67368
66608
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67369
66609
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
67370
- `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
67371
- `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
67372
- 'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var _ref,_ref1,_ref2,_ref3,_ref4;var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1,_1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"libraryType",()=>__module_federation_library_type__);early(__webpack_require__.federation,"sharedFallback",()=>__module_federation_share_fallbacks__);const sharedFallback=__webpack_require__.federation.sharedFallback;early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){var __webpack_require___federation_bundlerRuntime;consumesLoadingModuleToHandlerMapping[moduleId]={getter:sharedFallback?(__webpack_require___federation_bundlerRuntime=__webpack_require__.federation.bundlerRuntime)===null||__webpack_require___federation_bundlerRuntime===void 0?void 0:__webpack_require___federation_bundlerRuntime.getSharedFallbackGetter({shareKey:data.shareKey,factory:data.fallback,webpackRequire:__webpack_require__,libraryType:__webpack_require__.federation.libraryType}):data.fallback,treeShakingGetter:sharedFallback?data.fallback:undefined,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey,treeShaking:__webpack_require__.federation.sharedFallback?{get:data.fallback,mode:data.treeShakingMode}:undefined}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion,treeShakingMode}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory,treeShaking:treeShakingMode?{mode:treeShakingMode}:undefined};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.bundlerRuntime.init({webpackRequire:__webpack_require__});if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
66610
+ 'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){var _ref,_ref1,_ref2,_ref3,_ref4;var __webpack_require___remotesLoadingData,__webpack_require___remotesLoadingData1,__webpack_require___initializeSharingData,__webpack_require___consumesLoadingData,__webpack_require___consumesLoadingData1,__webpack_require___initializeExposesData,__webpack_require___consumesLoadingData2;const override=(obj,key,value)=>{if(!obj)return;if(obj[key])obj[key]=value};const merge=(obj,key,fn)=>{const value=fn();if(Array.isArray(value)){var _obj,_key,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1,_1;(_1=(_obj1=obj)[_key1=key])!==null&&_1!==void 0?_1:_obj1[_key1]={};Object.assign(obj[key],value)}};const early=(obj,key,initial)=>{var _obj,_key,_;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};const remotesLoadingChunkMapping=(_ref=(__webpack_require___remotesLoadingData=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData===void 0?void 0:__webpack_require___remotesLoadingData.chunkMapping)!==null&&_ref!==void 0?_ref:{};const remotesLoadingModuleIdToRemoteDataMapping=(_ref1=(__webpack_require___remotesLoadingData1=__webpack_require__.remotesLoadingData)===null||__webpack_require___remotesLoadingData1===void 0?void 0:__webpack_require___remotesLoadingData1.moduleIdToRemoteDataMapping)!==null&&_ref1!==void 0?_ref1:{};const initializeSharingScopeToInitDataMapping=(_ref2=(__webpack_require___initializeSharingData=__webpack_require__.initializeSharingData)===null||__webpack_require___initializeSharingData===void 0?void 0:__webpack_require___initializeSharingData.scopeToSharingDataMapping)!==null&&_ref2!==void 0?_ref2:{};const consumesLoadingChunkMapping=(_ref3=(__webpack_require___consumesLoadingData=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData===void 0?void 0:__webpack_require___consumesLoadingData.chunkMapping)!==null&&_ref3!==void 0?_ref3:{};const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){consumesLoadingModuleToHandlerMapping[moduleId]={getter:data.fallback,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
67373
66611
  ].join(';');
67374
66612
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67375
66613
  }
66614
+ function ShareRuntimePlugin_define_property(obj, key, value) {
66615
+ if (key in obj) Object.defineProperty(obj, key, {
66616
+ value: value,
66617
+ enumerable: true,
66618
+ configurable: true,
66619
+ writable: true
66620
+ });
66621
+ else obj[key] = value;
66622
+ return obj;
66623
+ }
66624
+ const compilerSet = new WeakSet();
66625
+ function isSingleton(compiler) {
66626
+ return compilerSet.has(compiler);
66627
+ }
66628
+ function setSingleton(compiler) {
66629
+ compilerSet.add(compiler);
66630
+ }
66631
+ class ShareRuntimePlugin extends RspackBuiltinPlugin {
66632
+ raw(compiler) {
66633
+ if (isSingleton(compiler)) return;
66634
+ setSingleton(compiler);
66635
+ return createBuiltinPlugin(this.name, this.enhanced);
66636
+ }
66637
+ constructor(enhanced = false){
66638
+ super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
66639
+ }
66640
+ }
66641
+ function ConsumeSharedPlugin_define_property(obj, key, value) {
66642
+ if (key in obj) Object.defineProperty(obj, key, {
66643
+ value: value,
66644
+ enumerable: true,
66645
+ configurable: true,
66646
+ writable: true
66647
+ });
66648
+ else obj[key] = value;
66649
+ return obj;
66650
+ }
66651
+ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66652
+ raw(compiler) {
66653
+ new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66654
+ const rawOptions = {
66655
+ consumes: this._options.consumes.map(([key, v])=>({
66656
+ key,
66657
+ ...v
66658
+ })),
66659
+ enhanced: this._options.enhanced
66660
+ };
66661
+ return createBuiltinPlugin(this.name, rawOptions);
66662
+ }
66663
+ constructor(options){
66664
+ super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66665
+ this._options = {
66666
+ consumes: parseOptions(options.consumes, (item, key)=>{
66667
+ if (Array.isArray(item)) throw new Error('Unexpected array in options');
66668
+ const result = item !== key && isRequiredVersion(item) ? {
66669
+ import: key,
66670
+ shareScope: options.shareScope || 'default',
66671
+ shareKey: key,
66672
+ requiredVersion: item,
66673
+ strictVersion: true,
66674
+ packageName: void 0,
66675
+ singleton: false,
66676
+ eager: false
66677
+ } : {
66678
+ import: key,
66679
+ shareScope: options.shareScope || 'default',
66680
+ shareKey: key,
66681
+ requiredVersion: void 0,
66682
+ packageName: void 0,
66683
+ strictVersion: false,
66684
+ singleton: false,
66685
+ eager: false
66686
+ };
66687
+ return result;
66688
+ }, (item, key)=>({
66689
+ import: false === item.import ? void 0 : item.import || key,
66690
+ shareScope: item.shareScope || options.shareScope || 'default',
66691
+ shareKey: item.shareKey || key,
66692
+ requiredVersion: item.requiredVersion,
66693
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66694
+ packageName: item.packageName,
66695
+ singleton: !!item.singleton,
66696
+ eager: !!item.eager
66697
+ })),
66698
+ enhanced: options.enhanced ?? false
66699
+ };
66700
+ }
66701
+ }
66702
+ function ProvideSharedPlugin_define_property(obj, key, value) {
66703
+ if (key in obj) Object.defineProperty(obj, key, {
66704
+ value: value,
66705
+ enumerable: true,
66706
+ configurable: true,
66707
+ writable: true
66708
+ });
66709
+ else obj[key] = value;
66710
+ return obj;
66711
+ }
66712
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66713
+ raw(compiler) {
66714
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66715
+ const rawOptions = this._provides.map(([key, v])=>({
66716
+ key,
66717
+ ...v
66718
+ }));
66719
+ return createBuiltinPlugin(this.name, rawOptions);
66720
+ }
66721
+ constructor(options){
66722
+ super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
66723
+ this._provides = parseOptions(options.provides, (item)=>{
66724
+ if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66725
+ return {
66726
+ shareKey: item,
66727
+ version: void 0,
66728
+ shareScope: options.shareScope || 'default',
66729
+ eager: false
66730
+ };
66731
+ }, (item)=>{
66732
+ const raw = {
66733
+ shareKey: item.shareKey,
66734
+ version: item.version,
66735
+ shareScope: item.shareScope || options.shareScope || 'default',
66736
+ eager: !!item.eager
66737
+ };
66738
+ if (options.enhanced) {
66739
+ const enhancedItem = item;
66740
+ return {
66741
+ ...raw,
66742
+ singleton: enhancedItem.singleton,
66743
+ requiredVersion: enhancedItem.requiredVersion,
66744
+ strictVersion: enhancedItem.strictVersion
66745
+ };
66746
+ }
66747
+ return raw;
66748
+ });
66749
+ this._enhanced = options.enhanced;
66750
+ }
66751
+ }
66752
+ function SharePlugin_define_property(obj, key, value) {
66753
+ if (key in obj) Object.defineProperty(obj, key, {
66754
+ value: value,
66755
+ enumerable: true,
66756
+ configurable: true,
66757
+ writable: true
66758
+ });
66759
+ else obj[key] = value;
66760
+ return obj;
66761
+ }
66762
+ class SharePlugin {
66763
+ apply(compiler) {
66764
+ new ConsumeSharedPlugin({
66765
+ shareScope: this._shareScope,
66766
+ consumes: this._consumes,
66767
+ enhanced: this._enhanced
66768
+ }).apply(compiler);
66769
+ new ProvideSharedPlugin({
66770
+ shareScope: this._shareScope,
66771
+ provides: this._provides,
66772
+ enhanced: this._enhanced
66773
+ }).apply(compiler);
66774
+ }
66775
+ constructor(options){
66776
+ SharePlugin_define_property(this, "_shareScope", void 0);
66777
+ SharePlugin_define_property(this, "_consumes", void 0);
66778
+ SharePlugin_define_property(this, "_provides", void 0);
66779
+ SharePlugin_define_property(this, "_enhanced", void 0);
66780
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66781
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66782
+ const config = item !== key && isRequiredVersion(item) ? {
66783
+ import: key,
66784
+ requiredVersion: item
66785
+ } : {
66786
+ import: item
66787
+ };
66788
+ return config;
66789
+ }, (item)=>item);
66790
+ const consumes = sharedOptions.map(([key, options])=>({
66791
+ [key]: {
66792
+ import: options.import,
66793
+ shareKey: options.shareKey || key,
66794
+ shareScope: options.shareScope,
66795
+ requiredVersion: options.requiredVersion,
66796
+ strictVersion: options.strictVersion,
66797
+ singleton: options.singleton,
66798
+ packageName: options.packageName,
66799
+ eager: options.eager
66800
+ }
66801
+ }));
66802
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66803
+ [options.import || key]: {
66804
+ shareKey: options.shareKey || key,
66805
+ shareScope: options.shareScope,
66806
+ version: options.version,
66807
+ eager: options.eager,
66808
+ singleton: options.singleton,
66809
+ requiredVersion: options.requiredVersion,
66810
+ strictVersion: options.strictVersion
66811
+ }
66812
+ }));
66813
+ this._shareScope = options.shareScope;
66814
+ this._consumes = consumes;
66815
+ this._provides = provides;
66816
+ this._enhanced = options.enhanced ?? false;
66817
+ }
66818
+ }
67376
66819
  function ContainerPlugin_define_property(obj, key, value) {
67377
66820
  if (key in obj) Object.defineProperty(obj, key, {
67378
66821
  value: value,
@@ -67408,7 +66851,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67408
66851
  name: options.name,
67409
66852
  shareScope: options.shareScope || 'default',
67410
66853
  library: options.library || {
67411
- type: 'global',
66854
+ type: 'var',
67412
66855
  name: options.name
67413
66856
  },
67414
66857
  runtime: options.runtime,
@@ -67545,7 +66988,7 @@ function transformSync(source, options) {
67545
66988
  const _options = JSON.stringify(options || {});
67546
66989
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67547
66990
  }
67548
- const exports_rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
66991
+ const exports_rspackVersion = "1.7.3-canary-26c87d78-20260113175831";
67549
66992
  const exports_version = "5.75.0";
67550
66993
  const exports_WebpackError = Error;
67551
66994
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67596,7 +67039,6 @@ const container = {
67596
67039
  };
67597
67040
  const sharing = {
67598
67041
  ProvideSharedPlugin: ProvideSharedPlugin,
67599
- TreeShakingSharedPlugin: TreeShakingSharedPlugin,
67600
67042
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67601
67043
  SharePlugin: SharePlugin
67602
67044
  };
@@ -67636,7 +67078,7 @@ const exports_experiments = {
67636
67078
  createNativePlugin: createNativePlugin,
67637
67079
  VirtualModulesPlugin: VirtualModulesPlugin
67638
67080
  };
67639
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67081
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67640
67082
  src_fn.rspack = src_fn;
67641
67083
  src_fn.webpack = src_fn;
67642
67084
  const src_rspack_0 = src_fn;