@rspack-canary/browser 1.7.3-canary-1138ed18-20260115124957 → 1.7.3-canary-ef467b46-20260115180501

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
@@ -58267,7 +58267,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58267
58267
  if ('object' == typeof rspackFuture) {
58268
58268
  D(rspackFuture, 'bundlerInfo', {});
58269
58269
  if ('object' == typeof rspackFuture.bundlerInfo) {
58270
- D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-1138ed18-20260115124957");
58270
+ D(rspackFuture.bundlerInfo, 'version', "1.7.3-canary-ef467b46-20260115180501");
58271
58271
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58272
58272
  D(rspackFuture.bundlerInfo, 'force', !library);
58273
58273
  }
@@ -60537,7 +60537,7 @@ class MultiStats {
60537
60537
  return obj;
60538
60538
  });
60539
60539
  if (childOptions.version) {
60540
- obj.rspackVersion = "1.7.3-canary-1138ed18-20260115124957";
60540
+ obj.rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
60541
60541
  obj.version = "5.75.0";
60542
60542
  }
60543
60543
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62369,7 +62369,7 @@ const SIMPLE_EXTRACTORS = {
62369
62369
  },
62370
62370
  version: (object)=>{
62371
62371
  object.version = "5.75.0";
62372
- object.rspackVersion = "1.7.3-canary-1138ed18-20260115124957";
62372
+ object.rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
62373
62373
  },
62374
62374
  env: (object, _compilation, _context, { _env })=>{
62375
62375
  object.env = _env;
@@ -64164,7 +64164,7 @@ function createCompiler(userOptions) {
64164
64164
  function isMultiRspackOptions(o) {
64165
64165
  return Array.isArray(o);
64166
64166
  }
64167
- function rspack_rspack(options, callback) {
64167
+ function rspack(options, callback) {
64168
64168
  try {
64169
64169
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
64170
64170
  else validateRspackConfig(options);
@@ -65829,7 +65829,7 @@ class Compiler {
65829
65829
  };
65830
65830
  const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
65831
65831
  const compilerFn = function(...params) {
65832
- return rspack_rspack(...params);
65832
+ return rspack(...params);
65833
65833
  };
65834
65834
  const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
65835
65835
  RuntimeGlobals: compilerRuntimeGlobals
@@ -66331,266 +66331,10 @@ class NodeTemplatePlugin {
66331
66331
  this._options = _options;
66332
66332
  }
66333
66333
  }
66334
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66335
- const array = (items)=>{
66336
- for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66337
- else if (item && 'object' == typeof item) object(item);
66338
- else throw new Error('Unexpected options format');
66339
- };
66340
- const object = (obj)=>{
66341
- for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66342
- };
66343
- if (!options) return;
66344
- if (Array.isArray(options)) array(options);
66345
- else if ('object' == typeof options) object(options);
66346
- else throw new Error('Unexpected options format');
66347
- };
66348
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66349
- const items = [];
66350
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66351
- items.push([
66352
- key,
66353
- value
66354
- ]);
66355
- });
66356
- return items;
66357
- };
66358
- function ShareRuntimePlugin_define_property(obj, key, value) {
66359
- if (key in obj) Object.defineProperty(obj, key, {
66360
- value: value,
66361
- enumerable: true,
66362
- configurable: true,
66363
- writable: true
66364
- });
66365
- else obj[key] = value;
66366
- return obj;
66367
- }
66368
- const compilerSet = new WeakSet();
66369
- function isSingleton(compiler) {
66370
- return compilerSet.has(compiler);
66371
- }
66372
- function setSingleton(compiler) {
66373
- compilerSet.add(compiler);
66374
- }
66375
- class ShareRuntimePlugin extends RspackBuiltinPlugin {
66376
- raw(compiler) {
66377
- if (isSingleton(compiler)) return;
66378
- setSingleton(compiler);
66379
- return createBuiltinPlugin(this.name, this.enhanced);
66380
- }
66381
- constructor(enhanced = false){
66382
- 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;
66383
- }
66384
- }
66385
66334
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66386
66335
  function isRequiredVersion(str) {
66387
66336
  return VERSION_PATTERN_REGEXP.test(str);
66388
66337
  }
66389
- const encodeName = function(name, prefix = '', withExt = false) {
66390
- const ext = withExt ? '.js' : '';
66391
- return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
66392
- };
66393
- function ConsumeSharedPlugin_define_property(obj, key, value) {
66394
- if (key in obj) Object.defineProperty(obj, key, {
66395
- value: value,
66396
- enumerable: true,
66397
- configurable: true,
66398
- writable: true
66399
- });
66400
- else obj[key] = value;
66401
- return obj;
66402
- }
66403
- function normalizeConsumeShareOptions(consumes, shareScope) {
66404
- return parseOptions(consumes, (item, key)=>{
66405
- if (Array.isArray(item)) throw new Error('Unexpected array in options');
66406
- const result = item !== key && isRequiredVersion(item) ? {
66407
- import: key,
66408
- shareScope: shareScope || 'default',
66409
- shareKey: key,
66410
- requiredVersion: item,
66411
- strictVersion: true,
66412
- packageName: void 0,
66413
- singleton: false,
66414
- eager: false,
66415
- treeShakingMode: void 0
66416
- } : {
66417
- import: key,
66418
- shareScope: shareScope || 'default',
66419
- shareKey: key,
66420
- requiredVersion: void 0,
66421
- packageName: void 0,
66422
- strictVersion: false,
66423
- singleton: false,
66424
- eager: false,
66425
- treeShakingMode: void 0
66426
- };
66427
- return result;
66428
- }, (item, key)=>({
66429
- import: false === item.import ? void 0 : item.import || key,
66430
- shareScope: item.shareScope || shareScope || 'default',
66431
- shareKey: item.shareKey || key,
66432
- requiredVersion: item.requiredVersion,
66433
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66434
- packageName: item.packageName,
66435
- singleton: !!item.singleton,
66436
- eager: !!item.eager,
66437
- treeShakingMode: item.treeShakingMode
66438
- }));
66439
- }
66440
- class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66441
- raw(compiler) {
66442
- new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66443
- const rawOptions = {
66444
- consumes: this._options.consumes.map(([key, v])=>({
66445
- key,
66446
- ...v
66447
- })),
66448
- enhanced: this._options.enhanced
66449
- };
66450
- return createBuiltinPlugin(this.name, rawOptions);
66451
- }
66452
- constructor(options){
66453
- super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66454
- this._options = {
66455
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66456
- enhanced: options.enhanced ?? false
66457
- };
66458
- }
66459
- }
66460
- function ProvideSharedPlugin_define_property(obj, key, value) {
66461
- if (key in obj) Object.defineProperty(obj, key, {
66462
- value: value,
66463
- enumerable: true,
66464
- configurable: true,
66465
- writable: true
66466
- });
66467
- else obj[key] = value;
66468
- return obj;
66469
- }
66470
- function normalizeProvideShareOptions(options, shareScope, enhanced) {
66471
- return parseOptions(options, (item)=>{
66472
- if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66473
- return {
66474
- shareKey: item,
66475
- version: void 0,
66476
- shareScope: shareScope || 'default',
66477
- eager: false
66478
- };
66479
- }, (item)=>{
66480
- const raw = {
66481
- shareKey: item.shareKey,
66482
- version: item.version,
66483
- shareScope: item.shareScope || shareScope || 'default',
66484
- eager: !!item.eager
66485
- };
66486
- if (enhanced) {
66487
- const enhancedItem = item;
66488
- return {
66489
- ...raw,
66490
- singleton: enhancedItem.singleton,
66491
- requiredVersion: enhancedItem.requiredVersion,
66492
- strictVersion: enhancedItem.strictVersion,
66493
- treeShakingMode: enhancedItem.treeShakingMode
66494
- };
66495
- }
66496
- return raw;
66497
- });
66498
- }
66499
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66500
- raw(compiler) {
66501
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66502
- const rawOptions = this._provides.map(([key, v])=>({
66503
- key,
66504
- ...v
66505
- }));
66506
- return createBuiltinPlugin(this.name, rawOptions);
66507
- }
66508
- constructor(options){
66509
- 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);
66510
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66511
- this._enhanced = options.enhanced;
66512
- }
66513
- }
66514
- function SharePlugin_define_property(obj, key, value) {
66515
- if (key in obj) Object.defineProperty(obj, key, {
66516
- value: value,
66517
- enumerable: true,
66518
- configurable: true,
66519
- writable: true
66520
- });
66521
- else obj[key] = value;
66522
- return obj;
66523
- }
66524
- function normalizeSharedOptions(shared) {
66525
- return parseOptions(shared, (item, key)=>{
66526
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66527
- const config = item !== key && isRequiredVersion(item) ? {
66528
- import: key,
66529
- requiredVersion: item
66530
- } : {
66531
- import: item
66532
- };
66533
- return config;
66534
- }, (item)=>item);
66535
- }
66536
- function createProvideShareOptions(normalizedSharedOptions) {
66537
- return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66538
- [options.import || key]: {
66539
- shareKey: options.shareKey || key,
66540
- shareScope: options.shareScope,
66541
- version: options.version,
66542
- eager: options.eager,
66543
- singleton: options.singleton,
66544
- requiredVersion: options.requiredVersion,
66545
- strictVersion: options.strictVersion,
66546
- treeShakingMode: options.treeShaking?.mode
66547
- }
66548
- }));
66549
- }
66550
- function createConsumeShareOptions(normalizedSharedOptions) {
66551
- return normalizedSharedOptions.map(([key, options])=>({
66552
- [key]: {
66553
- import: options.import,
66554
- shareKey: options.shareKey || key,
66555
- shareScope: options.shareScope,
66556
- requiredVersion: options.requiredVersion,
66557
- strictVersion: options.strictVersion,
66558
- singleton: options.singleton,
66559
- packageName: options.packageName,
66560
- eager: options.eager,
66561
- treeShakingMode: options.treeShaking?.mode
66562
- }
66563
- }));
66564
- }
66565
- class SharePlugin {
66566
- apply(compiler) {
66567
- new ConsumeSharedPlugin({
66568
- shareScope: this._shareScope,
66569
- consumes: this._consumes,
66570
- enhanced: this._enhanced
66571
- }).apply(compiler);
66572
- new ProvideSharedPlugin({
66573
- shareScope: this._shareScope,
66574
- provides: this._provides,
66575
- enhanced: this._enhanced
66576
- }).apply(compiler);
66577
- }
66578
- constructor(options){
66579
- SharePlugin_define_property(this, "_shareScope", void 0);
66580
- SharePlugin_define_property(this, "_consumes", void 0);
66581
- SharePlugin_define_property(this, "_provides", void 0);
66582
- SharePlugin_define_property(this, "_enhanced", void 0);
66583
- SharePlugin_define_property(this, "_sharedOptions", void 0);
66584
- const sharedOptions = normalizeSharedOptions(options.shared);
66585
- const consumes = createConsumeShareOptions(sharedOptions);
66586
- const provides = createProvideShareOptions(sharedOptions);
66587
- this._shareScope = options.shareScope;
66588
- this._consumes = consumes;
66589
- this._provides = provides;
66590
- this._enhanced = options.enhanced ?? false;
66591
- this._sharedOptions = sharedOptions;
66592
- }
66593
- }
66594
66338
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66595
66339
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66596
66340
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66629,29 +66373,17 @@ function readPKGJson(root) {
66629
66373
  } catch {}
66630
66374
  return {};
66631
66375
  }
66632
- function getBuildInfo(isDev, compiler, mfConfig) {
66633
- const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
66376
+ function getBuildInfo(isDev, root) {
66377
+ const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
66634
66378
  const pkg = readPKGJson(rootPath);
66635
66379
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
66636
- const statsBuildInfo = {
66380
+ return {
66637
66381
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
66638
66382
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
66639
66383
  };
66640
- const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
66641
- const enableTreeShaking = Object.values(normalizedShared).some((config)=>config[1].treeShaking);
66642
- if (enableTreeShaking) {
66643
- statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
66644
- statsBuildInfo.plugins = mfConfig.treeShakingSharedPlugins || [];
66645
- statsBuildInfo.excludePlugins = mfConfig.treeShakingSharedExcludePlugins || [];
66646
- }
66647
- return statsBuildInfo;
66648
66384
  }
66649
66385
  function getFileName(manifestOptions) {
66650
66386
  if (!manifestOptions) return {
66651
- statsFileName: '',
66652
- manifestFileName: ''
66653
- };
66654
- if ('boolean' == typeof manifestOptions) return {
66655
66387
  statsFileName: STATS_FILE_NAME,
66656
66388
  manifestFileName: MANIFEST_FILE_NAME
66657
66389
  };
@@ -66664,591 +66396,60 @@ function getFileName(manifestOptions) {
66664
66396
  const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
66665
66397
  const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
66666
66398
  const statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : STATS_FILE_NAME;
66667
- return {
66668
- statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66669
- manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66670
- };
66671
- }
66672
- function resolveLibraryGlobalName(library) {
66673
- if (!library) return;
66674
- const libName = library.name;
66675
- if (!libName) return;
66676
- if ('string' == typeof libName) return libName;
66677
- if (Array.isArray(libName)) return libName[0];
66678
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66679
- }
66680
- function collectManifestExposes(exposes) {
66681
- if (!exposes) return;
66682
- const parsed = parseOptions(exposes, (value)=>({
66683
- import: Array.isArray(value) ? value : [
66684
- value
66685
- ],
66686
- name: void 0
66687
- }), (value)=>({
66688
- import: Array.isArray(value.import) ? value.import : [
66689
- value.import
66690
- ],
66691
- name: value.name ?? void 0
66692
- }));
66693
- const result = parsed.map(([exposeKey, info])=>{
66694
- const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66695
- return {
66696
- path: exposeKey,
66697
- name: exposeName
66698
- };
66699
- });
66700
- return result.length > 0 ? result : void 0;
66701
- }
66702
- function collectManifestShared(shared) {
66703
- if (!shared) return;
66704
- const parsed = parseOptions(shared, (item, key)=>{
66705
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66706
- return item !== key && isRequiredVersion(item) ? {
66707
- import: key,
66708
- requiredVersion: item
66709
- } : {
66710
- import: item
66711
- };
66712
- }, (item)=>item);
66713
- const result = parsed.map(([key, config])=>{
66714
- const name = config.shareKey || key;
66715
- const version = 'string' == typeof config.version ? config.version : void 0;
66716
- const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66717
- return {
66718
- name,
66719
- version,
66720
- requiredVersion,
66721
- singleton: config.singleton
66722
- };
66723
- });
66724
- return result.length > 0 ? result : void 0;
66725
- }
66726
- function normalizeManifestOptions(mfConfig) {
66727
- const manifestOptions = true === mfConfig.manifest ? {} : {
66728
- ...mfConfig.manifest
66729
- };
66730
- const containerName = mfConfig.name;
66731
- const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
66732
- const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
66733
- if (cur[1].length > 1) return sum;
66734
- const remoteInfo = cur[1][0];
66735
- const { entry, alias, name } = remoteInfo;
66736
- if (entry && name) sum[alias] = {
66737
- name,
66738
- entry
66739
- };
66740
- return sum;
66741
- }, {});
66742
- const manifestExposes = collectManifestExposes(mfConfig.exposes);
66743
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66744
- const manifestShared = collectManifestShared(mfConfig.shared);
66745
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66746
- return {
66747
- ...manifestOptions,
66748
- remoteAliasMap,
66749
- globalName,
66750
- name: containerName
66751
- };
66752
- }
66753
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66754
- raw(compiler) {
66755
- const opts = normalizeManifestOptions(this.rawOpts);
66756
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
66757
- const { statsFileName, manifestFileName } = getFileName(opts);
66758
- const rawOptions = {
66759
- name: opts.name,
66760
- globalName: opts.globalName,
66761
- fileName,
66762
- filePath,
66763
- manifestFileName,
66764
- statsFileName,
66765
- disableAssetsAnalyze,
66766
- remoteAliasMap,
66767
- exposes,
66768
- shared,
66769
- buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
66770
- };
66771
- return createBuiltinPlugin(this.name, rawOptions);
66772
- }
66773
- constructor(opts){
66774
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "rawOpts", void 0);
66775
- this.rawOpts = opts;
66776
- }
66777
- }
66778
- function CollectSharedEntryPlugin_define_property(obj, key, value) {
66779
- if (key in obj) Object.defineProperty(obj, key, {
66780
- value: value,
66781
- enumerable: true,
66782
- configurable: true,
66783
- writable: true
66784
- });
66785
- else obj[key] = value;
66786
- return obj;
66787
- }
66788
- const SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
66789
- class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66790
- getData() {
66791
- return this._collectedEntries;
66792
- }
66793
- getFilename() {
66794
- return SHARE_ENTRY_ASSET;
66795
- }
66796
- apply(compiler) {
66797
- super.apply(compiler);
66798
- compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
66799
- compilation.hooks.processAssets.tap({
66800
- name: 'CollectSharedEntry',
66801
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66802
- }, ()=>{
66803
- compilation.getAssets().forEach((asset)=>{
66804
- if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
66805
- compilation.deleteAsset(asset.name);
66806
- });
66807
- });
66808
- });
66809
- }
66810
- raw() {
66811
- const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66812
- const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66813
- const rawOptions = {
66814
- consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66815
- key,
66816
- ...v
66817
- })),
66818
- filename: this.getFilename()
66819
- };
66820
- return createBuiltinPlugin(this.name, rawOptions);
66821
- }
66822
- constructor(options){
66823
- 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);
66824
- const { sharedOptions } = options;
66825
- this.sharedOptions = sharedOptions;
66826
- this._collectedEntries = {};
66827
- }
66828
- }
66829
- function SharedContainerPlugin_define_property(obj, key, value) {
66830
- if (key in obj) Object.defineProperty(obj, key, {
66831
- value: value,
66832
- enumerable: true,
66833
- configurable: true,
66834
- writable: true
66835
- });
66836
- else obj[key] = value;
66837
- return obj;
66838
- }
66839
- function assert(condition, msg) {
66840
- if (!condition) throw new Error(msg);
66841
- }
66842
- const HOT_UPDATE_SUFFIX = '.hot-update';
66843
- class SharedContainerPlugin extends RspackBuiltinPlugin {
66844
- getData() {
66845
- return [
66846
- this._options.fileName,
66847
- this._globalName,
66848
- this._options.version
66849
- ];
66850
- }
66851
- raw(compiler) {
66852
- const { library } = this._options;
66853
- if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66854
- return createBuiltinPlugin(this.name, this._options);
66855
- }
66856
- apply(compiler) {
66857
- super.apply(compiler);
66858
- const shareName = this._shareName;
66859
- compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66860
- compilation.hooks.processAssets.tap({
66861
- name: 'getShareContainerFile'
66862
- }, ()=>{
66863
- const remoteEntryPoint = compilation.entrypoints.get(shareName);
66864
- assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66865
- const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66866
- assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66867
- const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
66868
- assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66869
- assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
66870
- this.filename = files[0];
66871
- });
66872
- });
66873
- }
66874
- constructor(options){
66875
- 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);
66876
- const { shareName, library, request, independentShareFileName, mfName } = options;
66877
- const version = options.version || '0.0.0';
66878
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
66879
- const fileName = independentShareFileName || `${version}/share-entry.js`;
66880
- this._shareName = shareName;
66881
- this._options = {
66882
- name: shareName,
66883
- request: request,
66884
- library: (library ? {
66885
- ...library,
66886
- name: this._globalName
66887
- } : void 0) || {
66888
- type: 'global',
66889
- name: this._globalName
66890
- },
66891
- version,
66892
- fileName
66893
- };
66894
- }
66895
- }
66896
- function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66897
- if (key in obj) Object.defineProperty(obj, key, {
66898
- value: value,
66899
- enumerable: true,
66900
- configurable: true,
66901
- writable: true
66902
- });
66903
- else obj[key] = value;
66904
- return obj;
66905
- }
66906
- class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66907
- buildOptions() {
66908
- const shared = this.sharedOptions.map(([shareKey, config])=>({
66909
- shareKey,
66910
- treeShaking: !!config.treeShaking,
66911
- usedExports: config.treeShaking?.usedExports
66912
- }));
66913
- const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66914
- return {
66915
- shared,
66916
- injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
66917
- manifestFileName,
66918
- statsFileName
66919
- };
66920
- }
66921
- raw() {
66922
- if (!this.sharedOptions.length) return;
66923
- return createBuiltinPlugin(this.name, this.buildOptions());
66924
- }
66925
- constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
66926
- 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);
66927
- this.sharedOptions = sharedOptions;
66928
- this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
66929
- this.manifestOptions = manifestOptions ?? {};
66930
- }
66931
- }
66932
- function IndependentSharedPlugin_define_property(obj, key, value) {
66933
- if (key in obj) Object.defineProperty(obj, key, {
66934
- value: value,
66935
- enumerable: true,
66936
- configurable: true,
66937
- writable: true
66938
- });
66939
- else obj[key] = value;
66940
- return obj;
66941
- }
66942
- const VIRTUAL_ENTRY = './virtual-entry.js';
66943
- const VIRTUAL_ENTRY_NAME = 'virtual-entry';
66944
- const filterPlugin = (plugin, excludedPlugins = [])=>{
66945
- if (!plugin) return true;
66946
- const pluginName = plugin.name || plugin.constructor?.name;
66947
- if (!pluginName) return true;
66948
- return ![
66949
- 'TreeShakingSharedPlugin',
66950
- 'IndependentSharedPlugin',
66951
- 'ModuleFederationPlugin',
66952
- 'SharedUsedExportsOptimizerPlugin',
66953
- 'HtmlWebpackPlugin',
66954
- 'HtmlRspackPlugin',
66955
- 'RsbuildHtmlPlugin',
66956
- ...excludedPlugins
66957
- ].includes(pluginName);
66958
- };
66959
- class VirtualEntryPlugin {
66960
- createEntry() {
66961
- const { sharedOptions, collectShared } = this;
66962
- const entryContent = sharedOptions.reduce((acc, cur, index)=>{
66963
- const importLine = `import shared_${index} from '${cur[0]}';\n`;
66964
- const logLine = collectShared ? `console.log(shared_${index});\n` : '';
66965
- return acc + importLine + logLine;
66966
- }, '');
66967
- return entryContent;
66968
- }
66969
- static entry() {
66970
- return {
66971
- [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66972
- };
66973
- }
66974
- apply(compiler) {
66975
- new compiler.rspack.experiments.VirtualModulesPlugin({
66976
- [VIRTUAL_ENTRY]: this.createEntry()
66977
- }).apply(compiler);
66978
- compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
66979
- compilation.hooks.processAssets.tap({
66980
- name: 'RemoveVirtualEntryAsset',
66981
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66982
- }, ()=>{
66983
- try {
66984
- const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66985
- chunk?.files.forEach((f)=>{
66986
- compilation.deleteAsset(f);
66987
- });
66988
- } catch (_e) {
66989
- console.error('Failed to remove virtual entry file!');
66990
- }
66991
- });
66992
- });
66993
- }
66994
- constructor(sharedOptions, collectShared){
66995
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66996
- IndependentSharedPlugin_define_property(this, "collectShared", false);
66997
- this.sharedOptions = sharedOptions;
66998
- this.collectShared = collectShared;
66999
- }
67000
- }
67001
- const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
67002
- class IndependentSharedPlugin {
67003
- apply(compiler) {
67004
- const { manifest } = this;
67005
- let runCount = 0;
67006
- compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
67007
- if (runCount) return;
67008
- await this.createIndependentCompilers(compiler);
67009
- runCount++;
67010
- });
67011
- compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
67012
- if (runCount) return;
67013
- await this.createIndependentCompilers(compiler);
67014
- runCount++;
67015
- });
67016
- compiler.hooks.shutdown.tapAsync('IndependentSharedPlugin', (callback)=>{
67017
- callback();
67018
- });
67019
- if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
67020
- compilation.hooks.processAssets.tap({
67021
- name: 'injectBuildAssets',
67022
- stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
67023
- }, ()=>{
67024
- const { statsFileName, manifestFileName } = getFileName(manifest);
67025
- const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
67026
- const stats = compilation.getAsset(filename);
67027
- if (!stats) return;
67028
- const statsContent = JSON.parse(stats.source.source().toString());
67029
- const { shared } = statsContent;
67030
- Object.entries(this.buildAssets).forEach(([key, item])=>{
67031
- const targetShared = shared.find((s)=>s.name === key);
67032
- if (!targetShared) return;
67033
- item.forEach(([entry, version, globalName])=>{
67034
- if (version === targetShared.version) {
67035
- targetShared.fallback = entry;
67036
- targetShared.fallbackName = globalName;
67037
- }
67038
- });
67039
- });
67040
- compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
67041
- };
67042
- injectBuildAssetsIntoStatsOrManifest(statsFileName);
67043
- injectBuildAssetsIntoStatsOrManifest(manifestFileName);
67044
- });
67045
- });
67046
- }
67047
- async createIndependentCompilers(parentCompiler) {
67048
- const { sharedOptions, buildAssets, outputDir } = this;
67049
- console.log('Start building shared fallback resources ...');
67050
- const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
67051
- await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
67052
- if (!shareConfig.treeShaking || false === shareConfig.import) return;
67053
- const shareRequests = shareRequestsMap[shareName].requests;
67054
- await Promise.all(shareRequests.map(async ([request, version])=>{
67055
- const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
67056
- const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
67057
- shareRequestsMap,
67058
- currentShare: {
67059
- shareName,
67060
- version,
67061
- request,
67062
- independentShareFileName: sharedConfig?.treeShaking?.filename
67063
- }
67064
- });
67065
- if ('string' == typeof shareFileName) {
67066
- buildAssets[shareName] ||= [];
67067
- buildAssets[shareName].push([
67068
- (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
67069
- sharedVersion,
67070
- globalName
67071
- ]);
67072
- }
67073
- }));
67074
- }));
67075
- console.log('All shared fallback have been compiled successfully!');
67076
- }
67077
- async createIndependentCompiler(parentCompiler, extraOptions) {
67078
- const { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this;
67079
- const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
67080
- const parentConfig = parentCompiler.options;
67081
- const finalPlugins = [];
67082
- const rspack = parentCompiler.rspack;
67083
- let extraPlugin;
67084
- extraPlugin = extraOptions ? new SharedContainerPlugin({
67085
- mfName,
67086
- library,
67087
- ...extraOptions.currentShare
67088
- }) : new CollectSharedEntryPlugin({
67089
- sharedOptions,
67090
- shareScope: 'default'
67091
- });
67092
- (parentConfig.plugins || []).forEach((plugin)=>{
67093
- if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeShakingSharedExcludePlugins)) finalPlugins.push(plugin);
67094
- });
67095
- plugins.forEach((plugin)=>{
67096
- finalPlugins.push(plugin);
67097
- });
67098
- finalPlugins.push(extraPlugin);
67099
- finalPlugins.push(new ConsumeSharedPlugin({
67100
- consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
67101
- [key]: {
67102
- import: extraOptions ? false : options.import,
67103
- shareKey: options.shareKey || key,
67104
- shareScope: options.shareScope,
67105
- requiredVersion: options.requiredVersion,
67106
- strictVersion: options.strictVersion,
67107
- singleton: options.singleton,
67108
- packageName: options.packageName,
67109
- eager: options.eager
67110
- }
67111
- })),
67112
- enhanced: true
67113
- }));
67114
- if (treeShaking) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports));
67115
- finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
67116
- const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
67117
- const compilerConfig = {
67118
- ...parentConfig,
67119
- module: {
67120
- ...parentConfig.module,
67121
- rules: [
67122
- {
67123
- test: /virtual-entry\.js$/,
67124
- type: "javascript/auto",
67125
- resolve: {
67126
- fullySpecified: false
67127
- },
67128
- use: {
67129
- loader: 'builtin:swc-loader'
67130
- }
67131
- },
67132
- ...parentConfig.module?.rules || []
67133
- ]
67134
- },
67135
- mode: parentConfig.mode || 'development',
67136
- entry: VirtualEntryPlugin.entry,
67137
- output: {
67138
- path: fullOutputDir,
67139
- clean: true,
67140
- publicPath: parentConfig.output?.publicPath || 'auto'
67141
- },
67142
- plugins: finalPlugins,
67143
- optimization: {
67144
- ...parentConfig.optimization,
67145
- splitChunks: false
67146
- }
67147
- };
67148
- const compiler = rspack.rspack(compilerConfig);
67149
- compiler.inputFileSystem = parentCompiler.inputFileSystem;
67150
- compiler.outputFileSystem = parentCompiler.outputFileSystem;
67151
- compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
67152
- const { currentShare } = extraOptions || {};
67153
- return new Promise((resolve, reject)=>{
67154
- compiler.run((err, stats)=>{
67155
- if (err || stats?.hasErrors()) {
67156
- const target = currentShare ? currentShare.shareName : 'Collect deps';
67157
- console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
67158
- reject(err || new Error(`${target} Compile failed`));
67159
- return;
67160
- }
67161
- currentShare && console.log(`${currentShare.shareName} Compile success`);
67162
- resolve(extraPlugin.getData());
67163
- });
67164
- });
67165
- }
67166
- constructor(options){
67167
- IndependentSharedPlugin_define_property(this, "mfName", void 0);
67168
- IndependentSharedPlugin_define_property(this, "shared", void 0);
67169
- IndependentSharedPlugin_define_property(this, "library", void 0);
67170
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
67171
- IndependentSharedPlugin_define_property(this, "outputDir", void 0);
67172
- IndependentSharedPlugin_define_property(this, "plugins", void 0);
67173
- IndependentSharedPlugin_define_property(this, "treeShaking", void 0);
67174
- IndependentSharedPlugin_define_property(this, "manifest", void 0);
67175
- IndependentSharedPlugin_define_property(this, "buildAssets", {});
67176
- IndependentSharedPlugin_define_property(this, "injectTreeShakingUsedExports", void 0);
67177
- IndependentSharedPlugin_define_property(this, "treeShakingSharedExcludePlugins", void 0);
67178
- IndependentSharedPlugin_define_property(this, "name", 'IndependentSharedPlugin');
67179
- const { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
67180
- this.shared = shared;
67181
- this.mfName = name;
67182
- this.outputDir = outputDir || 'independent-packages';
67183
- this.plugins = plugins || [];
67184
- this.treeShaking = treeShaking;
67185
- this.manifest = manifest;
67186
- this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
67187
- this.library = library;
67188
- this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [];
67189
- this.sharedOptions = parseOptions(shared, (item, key)=>{
67190
- if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
67191
- const config = item !== key && isRequiredVersion(item) ? {
67192
- import: key,
67193
- requiredVersion: item
67194
- } : {
67195
- import: item
67196
- };
67197
- return config;
67198
- }, (item)=>item);
67199
- }
67200
- }
67201
- function TreeShakingSharedPlugin_define_property(obj, key, value) {
67202
- if (key in obj) Object.defineProperty(obj, key, {
67203
- value: value,
67204
- enumerable: true,
67205
- configurable: true,
67206
- writable: true
67207
- });
67208
- else obj[key] = value;
67209
- return obj;
67210
- }
67211
- class TreeShakingSharedPlugin {
67212
- apply(compiler) {
67213
- const { mfConfig, outputDir, secondary } = this;
67214
- const { name, shared, library, treeShakingSharedPlugins } = mfConfig;
67215
- if (!shared) return;
67216
- const sharedOptions = normalizeSharedOptions(shared);
67217
- if (!sharedOptions.length) return;
67218
- if (sharedOptions.some(([_, config])=>config.treeShaking && false !== config.import)) {
67219
- if (!secondary) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler);
67220
- this._independentSharePlugin = new IndependentSharedPlugin({
67221
- name: name,
67222
- shared: shared,
67223
- outputDir,
67224
- plugins: treeShakingSharedPlugins?.map((p)=>{
67225
- const _constructor = require(p);
67226
- return new _constructor();
67227
- }) || [],
67228
- treeShaking: secondary,
67229
- library,
67230
- manifest: mfConfig.manifest,
67231
- treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
67232
- });
67233
- this._independentSharePlugin.apply(compiler);
67234
- }
67235
- }
67236
- get buildAssets() {
67237
- return this._independentSharePlugin?.buildAssets || {};
66399
+ return {
66400
+ statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66401
+ manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66402
+ };
66403
+ }
66404
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66405
+ raw(compiler) {
66406
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66407
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66408
+ const rawOptions = {
66409
+ name: this.opts.name,
66410
+ globalName: this.opts.globalName,
66411
+ fileName,
66412
+ filePath,
66413
+ manifestFileName,
66414
+ statsFileName,
66415
+ disableAssetsAnalyze,
66416
+ remoteAliasMap,
66417
+ exposes,
66418
+ shared,
66419
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
66420
+ };
66421
+ return createBuiltinPlugin(this.name, rawOptions);
67238
66422
  }
67239
- constructor(options){
67240
- TreeShakingSharedPlugin_define_property(this, "mfConfig", void 0);
67241
- TreeShakingSharedPlugin_define_property(this, "outputDir", void 0);
67242
- TreeShakingSharedPlugin_define_property(this, "secondary", void 0);
67243
- TreeShakingSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
67244
- TreeShakingSharedPlugin_define_property(this, "name", 'TreeShakingSharedPlugin');
67245
- const { mfConfig, secondary } = options;
67246
- this.mfConfig = mfConfig;
67247
- this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages';
67248
- this.secondary = Boolean(secondary);
66423
+ constructor(opts){
66424
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66425
+ this.opts = opts;
67249
66426
  }
67250
66427
  }
67251
66428
  const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66429
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66430
+ const array = (items)=>{
66431
+ for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66432
+ else if (item && 'object' == typeof item) object(item);
66433
+ else throw new Error('Unexpected options format');
66434
+ };
66435
+ const object = (obj)=>{
66436
+ for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66437
+ };
66438
+ if (!options) return;
66439
+ if (Array.isArray(options)) array(options);
66440
+ else if ('object' == typeof options) object(options);
66441
+ else throw new Error('Unexpected options format');
66442
+ };
66443
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66444
+ const items = [];
66445
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66446
+ items.push([
66447
+ key,
66448
+ value
66449
+ ]);
66450
+ });
66451
+ return items;
66452
+ };
67252
66453
  function ModuleFederationPlugin_define_property(obj, key, value) {
67253
66454
  if (key in obj) Object.defineProperty(obj, key, {
67254
66455
  value: value,
@@ -67268,50 +66469,101 @@ class ModuleFederationPlugin {
67268
66469
  '@module-federation/runtime': paths.runtime,
67269
66470
  ...compiler.options.resolve.alias
67270
66471
  };
67271
- const sharedOptions = getSharedOptions(this._options);
67272
- const treeShakingEntries = sharedOptions.filter(([, config])=>config.treeShaking);
67273
- if (treeShakingEntries.length > 0) {
67274
- this._treeShakingSharedPlugin = new TreeShakingSharedPlugin({
67275
- mfConfig: this._options,
67276
- secondary: false
67277
- });
67278
- this._treeShakingSharedPlugin.apply(compiler);
67279
- }
67280
- let runtimePluginApplied = false;
67281
- compiler.hooks.beforeRun.tap({
67282
- name: 'ModuleFederationPlugin',
67283
- stage: 100
67284
- }, ()=>{
67285
- if (runtimePluginApplied) return;
67286
- runtimePluginApplied = true;
67287
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets);
67288
- new ModuleFederationRuntimePlugin({
67289
- entryRuntime
67290
- }).apply(compiler);
67291
- });
67292
- compiler.hooks.watchRun.tap({
67293
- name: 'ModuleFederationPlugin',
67294
- stage: 100
67295
- }, ()=>{
67296
- if (runtimePluginApplied) return;
67297
- runtimePluginApplied = true;
67298
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {});
67299
- new ModuleFederationRuntimePlugin({
67300
- entryRuntime
67301
- }).apply(compiler);
67302
- });
66472
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66473
+ new ModuleFederationRuntimePlugin({
66474
+ entryRuntime
66475
+ }).apply(compiler);
67303
66476
  new webpack.container.ModuleFederationPluginV1({
67304
66477
  ...this._options,
67305
66478
  enhanced: true
67306
66479
  }).apply(compiler);
67307
- if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66480
+ if (this._options.manifest) {
66481
+ const manifestOptions = true === this._options.manifest ? {} : {
66482
+ ...this._options.manifest
66483
+ };
66484
+ const containerName = manifestOptions.name ?? this._options.name;
66485
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66486
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66487
+ if (cur[1].length > 1) return sum;
66488
+ const remoteInfo = cur[1][0];
66489
+ const { entry, alias, name } = remoteInfo;
66490
+ if (entry && name) sum[alias] = {
66491
+ name,
66492
+ entry
66493
+ };
66494
+ return sum;
66495
+ }, {});
66496
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66497
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66498
+ const manifestShared = collectManifestShared(this._options.shared);
66499
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66500
+ new ModuleFederationManifestPlugin({
66501
+ ...manifestOptions,
66502
+ name: containerName,
66503
+ globalName,
66504
+ remoteAliasMap
66505
+ }).apply(compiler);
66506
+ }
67308
66507
  }
67309
66508
  constructor(_options){
67310
66509
  ModuleFederationPlugin_define_property(this, "_options", void 0);
67311
- ModuleFederationPlugin_define_property(this, "_treeShakingSharedPlugin", void 0);
67312
66510
  this._options = _options;
67313
66511
  }
67314
66512
  }
66513
+ function collectManifestExposes(exposes) {
66514
+ if (!exposes) return;
66515
+ const parsed = parseOptions(exposes, (value)=>({
66516
+ import: Array.isArray(value) ? value : [
66517
+ value
66518
+ ],
66519
+ name: void 0
66520
+ }), (value)=>({
66521
+ import: Array.isArray(value.import) ? value.import : [
66522
+ value.import
66523
+ ],
66524
+ name: value.name ?? void 0
66525
+ }));
66526
+ const result = parsed.map(([exposeKey, info])=>{
66527
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66528
+ return {
66529
+ path: exposeKey,
66530
+ name: exposeName
66531
+ };
66532
+ });
66533
+ return result.length > 0 ? result : void 0;
66534
+ }
66535
+ function collectManifestShared(shared) {
66536
+ if (!shared) return;
66537
+ const parsed = parseOptions(shared, (item, key)=>{
66538
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66539
+ return item !== key && isRequiredVersion(item) ? {
66540
+ import: key,
66541
+ requiredVersion: item
66542
+ } : {
66543
+ import: item
66544
+ };
66545
+ }, (item)=>item);
66546
+ const result = parsed.map(([key, config])=>{
66547
+ const name = config.shareKey || key;
66548
+ const version = 'string' == typeof config.version ? config.version : void 0;
66549
+ const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66550
+ return {
66551
+ name,
66552
+ version,
66553
+ requiredVersion,
66554
+ singleton: config.singleton
66555
+ };
66556
+ });
66557
+ return result.length > 0 ? result : void 0;
66558
+ }
66559
+ function resolveLibraryGlobalName(library) {
66560
+ if (!library) return;
66561
+ const libName = library.name;
66562
+ if (!libName) return;
66563
+ if ('string' == typeof libName) return libName;
66564
+ if (Array.isArray(libName)) return libName[0];
66565
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66566
+ }
67315
66567
  function getRemoteInfos(options) {
67316
66568
  if (!options.remotes) return {};
67317
66569
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -67378,18 +66630,6 @@ function getRemoteInfos(options) {
67378
66630
  function getRuntimePlugins(options) {
67379
66631
  return options.runtimePlugins ?? [];
67380
66632
  }
67381
- function getSharedOptions(options) {
67382
- if (!options.shared) return [];
67383
- return parseOptions(options.shared, (item, key)=>{
67384
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
67385
- return item !== key && isRequiredVersion(item) ? {
67386
- import: key,
67387
- requiredVersion: item
67388
- } : {
67389
- import: item
67390
- };
67391
- }, (item)=>item);
67392
- }
67393
66633
  function getPaths(options) {
67394
66634
  return {
67395
66635
  runtimeTools: '@module-federation/runtime-tools',
@@ -67397,12 +66637,11 @@ function getPaths(options) {
67397
66637
  runtime: '@module-federation/runtime'
67398
66638
  };
67399
66639
  }
67400
- function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
66640
+ function getDefaultEntryRuntime(paths, options, compiler) {
67401
66641
  const runtimePlugins = getRuntimePlugins(options);
67402
66642
  const remoteInfos = getRemoteInfos(options);
67403
66643
  const runtimePluginImports = [];
67404
66644
  const runtimePluginVars = [];
67405
- const libraryType = options.library?.type || 'var';
67406
66645
  for(let i = 0; i < runtimePlugins.length; i++){
67407
66646
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67408
66647
  const pluginSpec = runtimePlugins[i];
@@ -67419,12 +66658,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
67419
66658
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67420
66659
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67421
66660
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
67422
- `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
67423
- `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
67424
- '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})}}'
66661
+ '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})}}'
67425
66662
  ].join(';');
67426
66663
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67427
66664
  }
66665
+ function ShareRuntimePlugin_define_property(obj, key, value) {
66666
+ if (key in obj) Object.defineProperty(obj, key, {
66667
+ value: value,
66668
+ enumerable: true,
66669
+ configurable: true,
66670
+ writable: true
66671
+ });
66672
+ else obj[key] = value;
66673
+ return obj;
66674
+ }
66675
+ const compilerSet = new WeakSet();
66676
+ function isSingleton(compiler) {
66677
+ return compilerSet.has(compiler);
66678
+ }
66679
+ function setSingleton(compiler) {
66680
+ compilerSet.add(compiler);
66681
+ }
66682
+ class ShareRuntimePlugin extends RspackBuiltinPlugin {
66683
+ raw(compiler) {
66684
+ if (isSingleton(compiler)) return;
66685
+ setSingleton(compiler);
66686
+ return createBuiltinPlugin(this.name, this.enhanced);
66687
+ }
66688
+ constructor(enhanced = false){
66689
+ 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;
66690
+ }
66691
+ }
66692
+ function ConsumeSharedPlugin_define_property(obj, key, value) {
66693
+ if (key in obj) Object.defineProperty(obj, key, {
66694
+ value: value,
66695
+ enumerable: true,
66696
+ configurable: true,
66697
+ writable: true
66698
+ });
66699
+ else obj[key] = value;
66700
+ return obj;
66701
+ }
66702
+ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66703
+ raw(compiler) {
66704
+ new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66705
+ const rawOptions = {
66706
+ consumes: this._options.consumes.map(([key, v])=>({
66707
+ key,
66708
+ ...v
66709
+ })),
66710
+ enhanced: this._options.enhanced
66711
+ };
66712
+ return createBuiltinPlugin(this.name, rawOptions);
66713
+ }
66714
+ constructor(options){
66715
+ super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66716
+ this._options = {
66717
+ consumes: parseOptions(options.consumes, (item, key)=>{
66718
+ if (Array.isArray(item)) throw new Error('Unexpected array in options');
66719
+ const result = item !== key && isRequiredVersion(item) ? {
66720
+ import: key,
66721
+ shareScope: options.shareScope || 'default',
66722
+ shareKey: key,
66723
+ requiredVersion: item,
66724
+ strictVersion: true,
66725
+ packageName: void 0,
66726
+ singleton: false,
66727
+ eager: false
66728
+ } : {
66729
+ import: key,
66730
+ shareScope: options.shareScope || 'default',
66731
+ shareKey: key,
66732
+ requiredVersion: void 0,
66733
+ packageName: void 0,
66734
+ strictVersion: false,
66735
+ singleton: false,
66736
+ eager: false
66737
+ };
66738
+ return result;
66739
+ }, (item, key)=>({
66740
+ import: false === item.import ? void 0 : item.import || key,
66741
+ shareScope: item.shareScope || options.shareScope || 'default',
66742
+ shareKey: item.shareKey || key,
66743
+ requiredVersion: item.requiredVersion,
66744
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66745
+ packageName: item.packageName,
66746
+ singleton: !!item.singleton,
66747
+ eager: !!item.eager
66748
+ })),
66749
+ enhanced: options.enhanced ?? false
66750
+ };
66751
+ }
66752
+ }
66753
+ function ProvideSharedPlugin_define_property(obj, key, value) {
66754
+ if (key in obj) Object.defineProperty(obj, key, {
66755
+ value: value,
66756
+ enumerable: true,
66757
+ configurable: true,
66758
+ writable: true
66759
+ });
66760
+ else obj[key] = value;
66761
+ return obj;
66762
+ }
66763
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66764
+ raw(compiler) {
66765
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66766
+ const rawOptions = this._provides.map(([key, v])=>({
66767
+ key,
66768
+ ...v
66769
+ }));
66770
+ return createBuiltinPlugin(this.name, rawOptions);
66771
+ }
66772
+ constructor(options){
66773
+ 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);
66774
+ this._provides = parseOptions(options.provides, (item)=>{
66775
+ if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66776
+ return {
66777
+ shareKey: item,
66778
+ version: void 0,
66779
+ shareScope: options.shareScope || 'default',
66780
+ eager: false
66781
+ };
66782
+ }, (item)=>{
66783
+ const raw = {
66784
+ shareKey: item.shareKey,
66785
+ version: item.version,
66786
+ shareScope: item.shareScope || options.shareScope || 'default',
66787
+ eager: !!item.eager
66788
+ };
66789
+ if (options.enhanced) {
66790
+ const enhancedItem = item;
66791
+ return {
66792
+ ...raw,
66793
+ singleton: enhancedItem.singleton,
66794
+ requiredVersion: enhancedItem.requiredVersion,
66795
+ strictVersion: enhancedItem.strictVersion
66796
+ };
66797
+ }
66798
+ return raw;
66799
+ });
66800
+ this._enhanced = options.enhanced;
66801
+ }
66802
+ }
66803
+ function SharePlugin_define_property(obj, key, value) {
66804
+ if (key in obj) Object.defineProperty(obj, key, {
66805
+ value: value,
66806
+ enumerable: true,
66807
+ configurable: true,
66808
+ writable: true
66809
+ });
66810
+ else obj[key] = value;
66811
+ return obj;
66812
+ }
66813
+ class SharePlugin {
66814
+ apply(compiler) {
66815
+ new ConsumeSharedPlugin({
66816
+ shareScope: this._shareScope,
66817
+ consumes: this._consumes,
66818
+ enhanced: this._enhanced
66819
+ }).apply(compiler);
66820
+ new ProvideSharedPlugin({
66821
+ shareScope: this._shareScope,
66822
+ provides: this._provides,
66823
+ enhanced: this._enhanced
66824
+ }).apply(compiler);
66825
+ }
66826
+ constructor(options){
66827
+ SharePlugin_define_property(this, "_shareScope", void 0);
66828
+ SharePlugin_define_property(this, "_consumes", void 0);
66829
+ SharePlugin_define_property(this, "_provides", void 0);
66830
+ SharePlugin_define_property(this, "_enhanced", void 0);
66831
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66832
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66833
+ const config = item !== key && isRequiredVersion(item) ? {
66834
+ import: key,
66835
+ requiredVersion: item
66836
+ } : {
66837
+ import: item
66838
+ };
66839
+ return config;
66840
+ }, (item)=>item);
66841
+ const consumes = sharedOptions.map(([key, options])=>({
66842
+ [key]: {
66843
+ import: options.import,
66844
+ shareKey: options.shareKey || key,
66845
+ shareScope: options.shareScope,
66846
+ requiredVersion: options.requiredVersion,
66847
+ strictVersion: options.strictVersion,
66848
+ singleton: options.singleton,
66849
+ packageName: options.packageName,
66850
+ eager: options.eager
66851
+ }
66852
+ }));
66853
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66854
+ [options.import || key]: {
66855
+ shareKey: options.shareKey || key,
66856
+ shareScope: options.shareScope,
66857
+ version: options.version,
66858
+ eager: options.eager,
66859
+ singleton: options.singleton,
66860
+ requiredVersion: options.requiredVersion,
66861
+ strictVersion: options.strictVersion
66862
+ }
66863
+ }));
66864
+ this._shareScope = options.shareScope;
66865
+ this._consumes = consumes;
66866
+ this._provides = provides;
66867
+ this._enhanced = options.enhanced ?? false;
66868
+ }
66869
+ }
67428
66870
  function ContainerPlugin_define_property(obj, key, value) {
67429
66871
  if (key in obj) Object.defineProperty(obj, key, {
67430
66872
  value: value,
@@ -67460,7 +66902,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67460
66902
  name: options.name,
67461
66903
  shareScope: options.shareScope || 'default',
67462
66904
  library: options.library || {
67463
- type: 'global',
66905
+ type: 'var',
67464
66906
  name: options.name
67465
66907
  },
67466
66908
  runtime: options.runtime,
@@ -67597,7 +67039,7 @@ function transformSync(source, options) {
67597
67039
  const _options = JSON.stringify(options || {});
67598
67040
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67599
67041
  }
67600
- const exports_rspackVersion = "1.7.3-canary-1138ed18-20260115124957";
67042
+ const exports_rspackVersion = "1.7.3-canary-ef467b46-20260115180501";
67601
67043
  const exports_version = "5.75.0";
67602
67044
  const exports_WebpackError = Error;
67603
67045
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67648,7 +67090,6 @@ const container = {
67648
67090
  };
67649
67091
  const sharing = {
67650
67092
  ProvideSharedPlugin: ProvideSharedPlugin,
67651
- TreeShakingSharedPlugin: TreeShakingSharedPlugin,
67652
67093
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67653
67094
  SharePlugin: SharePlugin
67654
67095
  };
@@ -67688,7 +67129,7 @@ const exports_experiments = {
67688
67129
  createNativePlugin: createNativePlugin,
67689
67130
  VirtualModulesPlugin: VirtualModulesPlugin
67690
67131
  };
67691
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67132
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67692
67133
  src_fn.rspack = src_fn;
67693
67134
  src_fn.webpack = src_fn;
67694
67135
  const src_rspack_0 = src_fn;