@rspack-canary/browser 1.7.2-canary-cad7e7a3-20260113065652 → 1.7.2-canary-a47337bf-20260113093003

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
@@ -58215,7 +58215,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58215
58215
  if ('object' == typeof rspackFuture) {
58216
58216
  D(rspackFuture, 'bundlerInfo', {});
58217
58217
  if ('object' == typeof rspackFuture.bundlerInfo) {
58218
- D(rspackFuture.bundlerInfo, 'version', "1.7.2-canary-cad7e7a3-20260113065652");
58218
+ D(rspackFuture.bundlerInfo, 'version', "1.7.2-canary-a47337bf-20260113093003");
58219
58219
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58220
58220
  D(rspackFuture.bundlerInfo, 'force', !library);
58221
58221
  }
@@ -60485,7 +60485,7 @@ class MultiStats {
60485
60485
  return obj;
60486
60486
  });
60487
60487
  if (childOptions.version) {
60488
- obj.rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
60488
+ obj.rspackVersion = "1.7.2-canary-a47337bf-20260113093003";
60489
60489
  obj.version = "5.75.0";
60490
60490
  }
60491
60491
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -62317,7 +62317,7 @@ const SIMPLE_EXTRACTORS = {
62317
62317
  },
62318
62318
  version: (object)=>{
62319
62319
  object.version = "5.75.0";
62320
- object.rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
62320
+ object.rspackVersion = "1.7.2-canary-a47337bf-20260113093003";
62321
62321
  },
62322
62322
  env: (object, _compilation, _context, { _env })=>{
62323
62323
  object.env = _env;
@@ -64112,7 +64112,7 @@ function createCompiler(userOptions) {
64112
64112
  function isMultiRspackOptions(o) {
64113
64113
  return Array.isArray(o);
64114
64114
  }
64115
- function rspack_rspack(options, callback) {
64115
+ function rspack(options, callback) {
64116
64116
  try {
64117
64117
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
64118
64118
  else validateRspackConfig(options);
@@ -65777,7 +65777,7 @@ class Compiler {
65777
65777
  };
65778
65778
  const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
65779
65779
  const compilerFn = function(...params) {
65780
- return rspack_rspack(...params);
65780
+ return rspack(...params);
65781
65781
  };
65782
65782
  const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
65783
65783
  RuntimeGlobals: compilerRuntimeGlobals
@@ -66279,266 +66279,10 @@ class NodeTemplatePlugin {
66279
66279
  this._options = _options;
66280
66280
  }
66281
66281
  }
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
66282
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66334
66283
  function isRequiredVersion(str) {
66335
66284
  return VERSION_PATTERN_REGEXP.test(str);
66336
66285
  }
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
66286
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66543
66287
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66544
66288
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66577,29 +66321,17 @@ function readPKGJson(root) {
66577
66321
  } catch {}
66578
66322
  return {};
66579
66323
  }
66580
- function getBuildInfo(isDev, compiler, mfConfig) {
66581
- const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
66324
+ function getBuildInfo(isDev, root) {
66325
+ const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
66582
66326
  const pkg = readPKGJson(rootPath);
66583
66327
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
66584
- const statsBuildInfo = {
66328
+ return {
66585
66329
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
66586
66330
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
66587
66331
  };
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
66332
  }
66597
66333
  function getFileName(manifestOptions) {
66598
66334
  if (!manifestOptions) return {
66599
- statsFileName: '',
66600
- manifestFileName: ''
66601
- };
66602
- if ('boolean' == typeof manifestOptions) return {
66603
66335
  statsFileName: STATS_FILE_NAME,
66604
66336
  manifestFileName: MANIFEST_FILE_NAME
66605
66337
  };
@@ -66612,591 +66344,60 @@ function getFileName(manifestOptions) {
66612
66344
  const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
66613
66345
  const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
66614
66346
  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 || {};
66347
+ return {
66348
+ statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66349
+ manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66350
+ };
66351
+ }
66352
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66353
+ raw(compiler) {
66354
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66355
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66356
+ const rawOptions = {
66357
+ name: this.opts.name,
66358
+ globalName: this.opts.globalName,
66359
+ fileName,
66360
+ filePath,
66361
+ manifestFileName,
66362
+ statsFileName,
66363
+ disableAssetsAnalyze,
66364
+ remoteAliasMap,
66365
+ exposes,
66366
+ shared,
66367
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
66368
+ };
66369
+ return createBuiltinPlugin(this.name, rawOptions);
67186
66370
  }
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);
66371
+ constructor(opts){
66372
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66373
+ this.opts = opts;
67197
66374
  }
67198
66375
  }
67199
66376
  const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66377
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66378
+ const array = (items)=>{
66379
+ for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66380
+ else if (item && 'object' == typeof item) object(item);
66381
+ else throw new Error('Unexpected options format');
66382
+ };
66383
+ const object = (obj)=>{
66384
+ for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66385
+ };
66386
+ if (!options) return;
66387
+ if (Array.isArray(options)) array(options);
66388
+ else if ('object' == typeof options) object(options);
66389
+ else throw new Error('Unexpected options format');
66390
+ };
66391
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66392
+ const items = [];
66393
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66394
+ items.push([
66395
+ key,
66396
+ value
66397
+ ]);
66398
+ });
66399
+ return items;
66400
+ };
67200
66401
  function ModuleFederationPlugin_define_property(obj, key, value) {
67201
66402
  if (key in obj) Object.defineProperty(obj, key, {
67202
66403
  value: value,
@@ -67216,50 +66417,101 @@ class ModuleFederationPlugin {
67216
66417
  '@module-federation/runtime': paths.runtime,
67217
66418
  ...compiler.options.resolve.alias
67218
66419
  };
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
- });
66420
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66421
+ new ModuleFederationRuntimePlugin({
66422
+ entryRuntime
66423
+ }).apply(compiler);
67251
66424
  new webpack.container.ModuleFederationPluginV1({
67252
66425
  ...this._options,
67253
66426
  enhanced: true
67254
66427
  }).apply(compiler);
67255
- if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66428
+ if (this._options.manifest) {
66429
+ const manifestOptions = true === this._options.manifest ? {} : {
66430
+ ...this._options.manifest
66431
+ };
66432
+ const containerName = manifestOptions.name ?? this._options.name;
66433
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66434
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66435
+ if (cur[1].length > 1) return sum;
66436
+ const remoteInfo = cur[1][0];
66437
+ const { entry, alias, name } = remoteInfo;
66438
+ if (entry && name) sum[alias] = {
66439
+ name,
66440
+ entry
66441
+ };
66442
+ return sum;
66443
+ }, {});
66444
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66445
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66446
+ const manifestShared = collectManifestShared(this._options.shared);
66447
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66448
+ new ModuleFederationManifestPlugin({
66449
+ ...manifestOptions,
66450
+ name: containerName,
66451
+ globalName,
66452
+ remoteAliasMap
66453
+ }).apply(compiler);
66454
+ }
67256
66455
  }
67257
66456
  constructor(_options){
67258
66457
  ModuleFederationPlugin_define_property(this, "_options", void 0);
67259
- ModuleFederationPlugin_define_property(this, "_treeShakingSharedPlugin", void 0);
67260
66458
  this._options = _options;
67261
66459
  }
67262
66460
  }
66461
+ function collectManifestExposes(exposes) {
66462
+ if (!exposes) return;
66463
+ const parsed = parseOptions(exposes, (value)=>({
66464
+ import: Array.isArray(value) ? value : [
66465
+ value
66466
+ ],
66467
+ name: void 0
66468
+ }), (value)=>({
66469
+ import: Array.isArray(value.import) ? value.import : [
66470
+ value.import
66471
+ ],
66472
+ name: value.name ?? void 0
66473
+ }));
66474
+ const result = parsed.map(([exposeKey, info])=>{
66475
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66476
+ return {
66477
+ path: exposeKey,
66478
+ name: exposeName
66479
+ };
66480
+ });
66481
+ return result.length > 0 ? result : void 0;
66482
+ }
66483
+ function collectManifestShared(shared) {
66484
+ if (!shared) return;
66485
+ const parsed = parseOptions(shared, (item, key)=>{
66486
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66487
+ return item !== key && isRequiredVersion(item) ? {
66488
+ import: key,
66489
+ requiredVersion: item
66490
+ } : {
66491
+ import: item
66492
+ };
66493
+ }, (item)=>item);
66494
+ const result = parsed.map(([key, config])=>{
66495
+ const name = config.shareKey || key;
66496
+ const version = 'string' == typeof config.version ? config.version : void 0;
66497
+ const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66498
+ return {
66499
+ name,
66500
+ version,
66501
+ requiredVersion,
66502
+ singleton: config.singleton
66503
+ };
66504
+ });
66505
+ return result.length > 0 ? result : void 0;
66506
+ }
66507
+ function resolveLibraryGlobalName(library) {
66508
+ if (!library) return;
66509
+ const libName = library.name;
66510
+ if (!libName) return;
66511
+ if ('string' == typeof libName) return libName;
66512
+ if (Array.isArray(libName)) return libName[0];
66513
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66514
+ }
67263
66515
  function getRemoteInfos(options) {
67264
66516
  if (!options.remotes) return {};
67265
66517
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -67326,18 +66578,6 @@ function getRemoteInfos(options) {
67326
66578
  function getRuntimePlugins(options) {
67327
66579
  return options.runtimePlugins ?? [];
67328
66580
  }
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
66581
  function getPaths(options) {
67342
66582
  return {
67343
66583
  runtimeTools: '@module-federation/runtime-tools',
@@ -67345,12 +66585,11 @@ function getPaths(options) {
67345
66585
  runtime: '@module-federation/runtime'
67346
66586
  };
67347
66587
  }
67348
- function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
66588
+ function getDefaultEntryRuntime(paths, options, compiler) {
67349
66589
  const runtimePlugins = getRuntimePlugins(options);
67350
66590
  const remoteInfos = getRemoteInfos(options);
67351
66591
  const runtimePluginImports = [];
67352
66592
  const runtimePluginVars = [];
67353
- const libraryType = options.library?.type || 'var';
67354
66593
  for(let i = 0; i < runtimePlugins.length; i++){
67355
66594
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67356
66595
  const pluginSpec = runtimePlugins[i];
@@ -67367,12 +66606,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallba
67367
66606
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67368
66607
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67369
66608
  `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})}}'
66609
+ '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
66610
  ].join(';');
67374
66611
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67375
66612
  }
66613
+ function ShareRuntimePlugin_define_property(obj, key, value) {
66614
+ if (key in obj) Object.defineProperty(obj, key, {
66615
+ value: value,
66616
+ enumerable: true,
66617
+ configurable: true,
66618
+ writable: true
66619
+ });
66620
+ else obj[key] = value;
66621
+ return obj;
66622
+ }
66623
+ const compilerSet = new WeakSet();
66624
+ function isSingleton(compiler) {
66625
+ return compilerSet.has(compiler);
66626
+ }
66627
+ function setSingleton(compiler) {
66628
+ compilerSet.add(compiler);
66629
+ }
66630
+ class ShareRuntimePlugin extends RspackBuiltinPlugin {
66631
+ raw(compiler) {
66632
+ if (isSingleton(compiler)) return;
66633
+ setSingleton(compiler);
66634
+ return createBuiltinPlugin(this.name, this.enhanced);
66635
+ }
66636
+ constructor(enhanced = false){
66637
+ 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;
66638
+ }
66639
+ }
66640
+ function ConsumeSharedPlugin_define_property(obj, key, value) {
66641
+ if (key in obj) Object.defineProperty(obj, key, {
66642
+ value: value,
66643
+ enumerable: true,
66644
+ configurable: true,
66645
+ writable: true
66646
+ });
66647
+ else obj[key] = value;
66648
+ return obj;
66649
+ }
66650
+ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66651
+ raw(compiler) {
66652
+ new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66653
+ const rawOptions = {
66654
+ consumes: this._options.consumes.map(([key, v])=>({
66655
+ key,
66656
+ ...v
66657
+ })),
66658
+ enhanced: this._options.enhanced
66659
+ };
66660
+ return createBuiltinPlugin(this.name, rawOptions);
66661
+ }
66662
+ constructor(options){
66663
+ super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66664
+ this._options = {
66665
+ consumes: parseOptions(options.consumes, (item, key)=>{
66666
+ if (Array.isArray(item)) throw new Error('Unexpected array in options');
66667
+ const result = item !== key && isRequiredVersion(item) ? {
66668
+ import: key,
66669
+ shareScope: options.shareScope || 'default',
66670
+ shareKey: key,
66671
+ requiredVersion: item,
66672
+ strictVersion: true,
66673
+ packageName: void 0,
66674
+ singleton: false,
66675
+ eager: false
66676
+ } : {
66677
+ import: key,
66678
+ shareScope: options.shareScope || 'default',
66679
+ shareKey: key,
66680
+ requiredVersion: void 0,
66681
+ packageName: void 0,
66682
+ strictVersion: false,
66683
+ singleton: false,
66684
+ eager: false
66685
+ };
66686
+ return result;
66687
+ }, (item, key)=>({
66688
+ import: false === item.import ? void 0 : item.import || key,
66689
+ shareScope: item.shareScope || options.shareScope || 'default',
66690
+ shareKey: item.shareKey || key,
66691
+ requiredVersion: item.requiredVersion,
66692
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66693
+ packageName: item.packageName,
66694
+ singleton: !!item.singleton,
66695
+ eager: !!item.eager
66696
+ })),
66697
+ enhanced: options.enhanced ?? false
66698
+ };
66699
+ }
66700
+ }
66701
+ function ProvideSharedPlugin_define_property(obj, key, value) {
66702
+ if (key in obj) Object.defineProperty(obj, key, {
66703
+ value: value,
66704
+ enumerable: true,
66705
+ configurable: true,
66706
+ writable: true
66707
+ });
66708
+ else obj[key] = value;
66709
+ return obj;
66710
+ }
66711
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66712
+ raw(compiler) {
66713
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66714
+ const rawOptions = this._provides.map(([key, v])=>({
66715
+ key,
66716
+ ...v
66717
+ }));
66718
+ return createBuiltinPlugin(this.name, rawOptions);
66719
+ }
66720
+ constructor(options){
66721
+ 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);
66722
+ this._provides = parseOptions(options.provides, (item)=>{
66723
+ if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66724
+ return {
66725
+ shareKey: item,
66726
+ version: void 0,
66727
+ shareScope: options.shareScope || 'default',
66728
+ eager: false
66729
+ };
66730
+ }, (item)=>{
66731
+ const raw = {
66732
+ shareKey: item.shareKey,
66733
+ version: item.version,
66734
+ shareScope: item.shareScope || options.shareScope || 'default',
66735
+ eager: !!item.eager
66736
+ };
66737
+ if (options.enhanced) {
66738
+ const enhancedItem = item;
66739
+ return {
66740
+ ...raw,
66741
+ singleton: enhancedItem.singleton,
66742
+ requiredVersion: enhancedItem.requiredVersion,
66743
+ strictVersion: enhancedItem.strictVersion
66744
+ };
66745
+ }
66746
+ return raw;
66747
+ });
66748
+ this._enhanced = options.enhanced;
66749
+ }
66750
+ }
66751
+ function SharePlugin_define_property(obj, key, value) {
66752
+ if (key in obj) Object.defineProperty(obj, key, {
66753
+ value: value,
66754
+ enumerable: true,
66755
+ configurable: true,
66756
+ writable: true
66757
+ });
66758
+ else obj[key] = value;
66759
+ return obj;
66760
+ }
66761
+ class SharePlugin {
66762
+ apply(compiler) {
66763
+ new ConsumeSharedPlugin({
66764
+ shareScope: this._shareScope,
66765
+ consumes: this._consumes,
66766
+ enhanced: this._enhanced
66767
+ }).apply(compiler);
66768
+ new ProvideSharedPlugin({
66769
+ shareScope: this._shareScope,
66770
+ provides: this._provides,
66771
+ enhanced: this._enhanced
66772
+ }).apply(compiler);
66773
+ }
66774
+ constructor(options){
66775
+ SharePlugin_define_property(this, "_shareScope", void 0);
66776
+ SharePlugin_define_property(this, "_consumes", void 0);
66777
+ SharePlugin_define_property(this, "_provides", void 0);
66778
+ SharePlugin_define_property(this, "_enhanced", void 0);
66779
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66780
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66781
+ const config = item !== key && isRequiredVersion(item) ? {
66782
+ import: key,
66783
+ requiredVersion: item
66784
+ } : {
66785
+ import: item
66786
+ };
66787
+ return config;
66788
+ }, (item)=>item);
66789
+ const consumes = sharedOptions.map(([key, options])=>({
66790
+ [key]: {
66791
+ import: options.import,
66792
+ shareKey: options.shareKey || key,
66793
+ shareScope: options.shareScope,
66794
+ requiredVersion: options.requiredVersion,
66795
+ strictVersion: options.strictVersion,
66796
+ singleton: options.singleton,
66797
+ packageName: options.packageName,
66798
+ eager: options.eager
66799
+ }
66800
+ }));
66801
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66802
+ [options.import || key]: {
66803
+ shareKey: options.shareKey || key,
66804
+ shareScope: options.shareScope,
66805
+ version: options.version,
66806
+ eager: options.eager,
66807
+ singleton: options.singleton,
66808
+ requiredVersion: options.requiredVersion,
66809
+ strictVersion: options.strictVersion
66810
+ }
66811
+ }));
66812
+ this._shareScope = options.shareScope;
66813
+ this._consumes = consumes;
66814
+ this._provides = provides;
66815
+ this._enhanced = options.enhanced ?? false;
66816
+ }
66817
+ }
67376
66818
  function ContainerPlugin_define_property(obj, key, value) {
67377
66819
  if (key in obj) Object.defineProperty(obj, key, {
67378
66820
  value: value,
@@ -67408,7 +66850,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67408
66850
  name: options.name,
67409
66851
  shareScope: options.shareScope || 'default',
67410
66852
  library: options.library || {
67411
- type: 'global',
66853
+ type: 'var',
67412
66854
  name: options.name
67413
66855
  },
67414
66856
  runtime: options.runtime,
@@ -67545,7 +66987,7 @@ function transformSync(source, options) {
67545
66987
  const _options = JSON.stringify(options || {});
67546
66988
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67547
66989
  }
67548
- const exports_rspackVersion = "1.7.2-canary-cad7e7a3-20260113065652";
66990
+ const exports_rspackVersion = "1.7.2-canary-a47337bf-20260113093003";
67549
66991
  const exports_version = "5.75.0";
67550
66992
  const exports_WebpackError = Error;
67551
66993
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67596,7 +67038,6 @@ const container = {
67596
67038
  };
67597
67039
  const sharing = {
67598
67040
  ProvideSharedPlugin: ProvideSharedPlugin,
67599
- TreeShakingSharedPlugin: TreeShakingSharedPlugin,
67600
67041
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67601
67042
  SharePlugin: SharePlugin
67602
67043
  };
@@ -67636,7 +67077,7 @@ const exports_experiments = {
67636
67077
  createNativePlugin: createNativePlugin,
67637
67078
  VirtualModulesPlugin: VirtualModulesPlugin
67638
67079
  };
67639
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67080
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67640
67081
  src_fn.rspack = src_fn;
67641
67082
  src_fn.webpack = src_fn;
67642
67083
  const src_rspack_0 = src_fn;