@rspack-canary/browser 1.7.1-canary-cf4486a4-20260104102432 → 1.7.1-canary-47901fb5-20260104173636

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
@@ -58172,7 +58172,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
58172
58172
  if ('object' == typeof rspackFuture) {
58173
58173
  D(rspackFuture, 'bundlerInfo', {});
58174
58174
  if ('object' == typeof rspackFuture.bundlerInfo) {
58175
- D(rspackFuture.bundlerInfo, 'version', "1.7.1-canary-cf4486a4-20260104102432");
58175
+ D(rspackFuture.bundlerInfo, 'version', "1.7.1-canary-47901fb5-20260104173636");
58176
58176
  D(rspackFuture.bundlerInfo, 'bundler', 'rspack');
58177
58177
  D(rspackFuture.bundlerInfo, 'force', !library);
58178
58178
  }
@@ -62365,7 +62365,7 @@ class MultiStats {
62365
62365
  return obj;
62366
62366
  });
62367
62367
  if (childOptions.version) {
62368
- obj.rspackVersion = "1.7.1-canary-cf4486a4-20260104102432";
62368
+ obj.rspackVersion = "1.7.1-canary-47901fb5-20260104173636";
62369
62369
  obj.version = "5.75.0";
62370
62370
  }
62371
62371
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -63681,7 +63681,7 @@ const SIMPLE_EXTRACTORS = {
63681
63681
  },
63682
63682
  version: (object)=>{
63683
63683
  object.version = "5.75.0";
63684
- object.rspackVersion = "1.7.1-canary-cf4486a4-20260104102432";
63684
+ object.rspackVersion = "1.7.1-canary-47901fb5-20260104173636";
63685
63685
  },
63686
63686
  env: (object, _compilation, _context, { _env })=>{
63687
63687
  object.env = _env;
@@ -66110,266 +66110,10 @@ class NodeTemplatePlugin {
66110
66110
  this._options = _options;
66111
66111
  }
66112
66112
  }
66113
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66114
- const array = (items)=>{
66115
- for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66116
- else if (item && 'object' == typeof item) object(item);
66117
- else throw new Error('Unexpected options format');
66118
- };
66119
- const object = (obj)=>{
66120
- for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66121
- };
66122
- if (!options) return;
66123
- if (Array.isArray(options)) array(options);
66124
- else if ('object' == typeof options) object(options);
66125
- else throw new Error('Unexpected options format');
66126
- };
66127
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66128
- const items = [];
66129
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66130
- items.push([
66131
- key,
66132
- value
66133
- ]);
66134
- });
66135
- return items;
66136
- };
66137
- function ShareRuntimePlugin_define_property(obj, key, value) {
66138
- if (key in obj) Object.defineProperty(obj, key, {
66139
- value: value,
66140
- enumerable: true,
66141
- configurable: true,
66142
- writable: true
66143
- });
66144
- else obj[key] = value;
66145
- return obj;
66146
- }
66147
- const compilerSet = new WeakSet();
66148
- function isSingleton(compiler) {
66149
- return compilerSet.has(compiler);
66150
- }
66151
- function setSingleton(compiler) {
66152
- compilerSet.add(compiler);
66153
- }
66154
- class ShareRuntimePlugin extends RspackBuiltinPlugin {
66155
- raw(compiler) {
66156
- if (isSingleton(compiler)) return;
66157
- setSingleton(compiler);
66158
- return createBuiltinPlugin(this.name, this.enhanced);
66159
- }
66160
- constructor(enhanced = false){
66161
- 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;
66162
- }
66163
- }
66164
66113
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
66165
66114
  function isRequiredVersion(str) {
66166
66115
  return VERSION_PATTERN_REGEXP.test(str);
66167
66116
  }
66168
- const encodeName = function(name, prefix = '', withExt = false) {
66169
- const ext = withExt ? '.js' : '';
66170
- return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
66171
- };
66172
- function ConsumeSharedPlugin_define_property(obj, key, value) {
66173
- if (key in obj) Object.defineProperty(obj, key, {
66174
- value: value,
66175
- enumerable: true,
66176
- configurable: true,
66177
- writable: true
66178
- });
66179
- else obj[key] = value;
66180
- return obj;
66181
- }
66182
- function normalizeConsumeShareOptions(consumes, shareScope) {
66183
- return parseOptions(consumes, (item, key)=>{
66184
- if (Array.isArray(item)) throw new Error('Unexpected array in options');
66185
- const result = item !== key && isRequiredVersion(item) ? {
66186
- import: key,
66187
- shareScope: shareScope || 'default',
66188
- shareKey: key,
66189
- requiredVersion: item,
66190
- strictVersion: true,
66191
- packageName: void 0,
66192
- singleton: false,
66193
- eager: false,
66194
- treeshakeStrategy: void 0
66195
- } : {
66196
- import: key,
66197
- shareScope: shareScope || 'default',
66198
- shareKey: key,
66199
- requiredVersion: void 0,
66200
- packageName: void 0,
66201
- strictVersion: false,
66202
- singleton: false,
66203
- eager: false,
66204
- treeshakeStrategy: void 0
66205
- };
66206
- return result;
66207
- }, (item, key)=>({
66208
- import: false === item.import ? void 0 : item.import || key,
66209
- shareScope: item.shareScope || shareScope || 'default',
66210
- shareKey: item.shareKey || key,
66211
- requiredVersion: item.requiredVersion,
66212
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66213
- packageName: item.packageName,
66214
- singleton: !!item.singleton,
66215
- eager: !!item.eager,
66216
- treeshakeStrategy: item.treeshakeStrategy
66217
- }));
66218
- }
66219
- class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66220
- raw(compiler) {
66221
- new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66222
- const rawOptions = {
66223
- consumes: this._options.consumes.map(([key, v])=>({
66224
- key,
66225
- ...v
66226
- })),
66227
- enhanced: this._options.enhanced
66228
- };
66229
- return createBuiltinPlugin(this.name, rawOptions);
66230
- }
66231
- constructor(options){
66232
- super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66233
- this._options = {
66234
- consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
66235
- enhanced: options.enhanced ?? false
66236
- };
66237
- }
66238
- }
66239
- function ProvideSharedPlugin_define_property(obj, key, value) {
66240
- if (key in obj) Object.defineProperty(obj, key, {
66241
- value: value,
66242
- enumerable: true,
66243
- configurable: true,
66244
- writable: true
66245
- });
66246
- else obj[key] = value;
66247
- return obj;
66248
- }
66249
- function normalizeProvideShareOptions(options, shareScope, enhanced) {
66250
- return parseOptions(options, (item)=>{
66251
- if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66252
- return {
66253
- shareKey: item,
66254
- version: void 0,
66255
- shareScope: shareScope || 'default',
66256
- eager: false
66257
- };
66258
- }, (item)=>{
66259
- const raw = {
66260
- shareKey: item.shareKey,
66261
- version: item.version,
66262
- shareScope: item.shareScope || shareScope || 'default',
66263
- eager: !!item.eager
66264
- };
66265
- if (enhanced) {
66266
- const enhancedItem = item;
66267
- return {
66268
- ...raw,
66269
- singleton: enhancedItem.singleton,
66270
- requiredVersion: enhancedItem.requiredVersion,
66271
- strictVersion: enhancedItem.strictVersion,
66272
- treeshakeStrategy: enhancedItem.treeshakeStrategy
66273
- };
66274
- }
66275
- return raw;
66276
- });
66277
- }
66278
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
66279
- raw(compiler) {
66280
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66281
- const rawOptions = this._provides.map(([key, v])=>({
66282
- key,
66283
- ...v
66284
- }));
66285
- return createBuiltinPlugin(this.name, rawOptions);
66286
- }
66287
- constructor(options){
66288
- 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);
66289
- this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
66290
- this._enhanced = options.enhanced;
66291
- }
66292
- }
66293
- function SharePlugin_define_property(obj, key, value) {
66294
- if (key in obj) Object.defineProperty(obj, key, {
66295
- value: value,
66296
- enumerable: true,
66297
- configurable: true,
66298
- writable: true
66299
- });
66300
- else obj[key] = value;
66301
- return obj;
66302
- }
66303
- function normalizeSharedOptions(shared) {
66304
- return parseOptions(shared, (item, key)=>{
66305
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66306
- const config = item !== key && isRequiredVersion(item) ? {
66307
- import: key,
66308
- requiredVersion: item
66309
- } : {
66310
- import: item
66311
- };
66312
- return config;
66313
- }, (item)=>item);
66314
- }
66315
- function createProvideShareOptions(normalizedSharedOptions) {
66316
- return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66317
- [options.import || key]: {
66318
- shareKey: options.shareKey || key,
66319
- shareScope: options.shareScope,
66320
- version: options.version,
66321
- eager: options.eager,
66322
- singleton: options.singleton,
66323
- requiredVersion: options.requiredVersion,
66324
- strictVersion: options.strictVersion,
66325
- treeshakeStrategy: options.treeshake?.strategy
66326
- }
66327
- }));
66328
- }
66329
- function createConsumeShareOptions(normalizedSharedOptions) {
66330
- return normalizedSharedOptions.map(([key, options])=>({
66331
- [key]: {
66332
- import: options.import,
66333
- shareKey: options.shareKey || key,
66334
- shareScope: options.shareScope,
66335
- requiredVersion: options.requiredVersion,
66336
- strictVersion: options.strictVersion,
66337
- singleton: options.singleton,
66338
- packageName: options.packageName,
66339
- eager: options.eager,
66340
- treeshakeStrategy: options.treeshake?.strategy
66341
- }
66342
- }));
66343
- }
66344
- class SharePlugin {
66345
- apply(compiler) {
66346
- new ConsumeSharedPlugin({
66347
- shareScope: this._shareScope,
66348
- consumes: this._consumes,
66349
- enhanced: this._enhanced
66350
- }).apply(compiler);
66351
- new ProvideSharedPlugin({
66352
- shareScope: this._shareScope,
66353
- provides: this._provides,
66354
- enhanced: this._enhanced
66355
- }).apply(compiler);
66356
- }
66357
- constructor(options){
66358
- SharePlugin_define_property(this, "_shareScope", void 0);
66359
- SharePlugin_define_property(this, "_consumes", void 0);
66360
- SharePlugin_define_property(this, "_provides", void 0);
66361
- SharePlugin_define_property(this, "_enhanced", void 0);
66362
- SharePlugin_define_property(this, "_sharedOptions", void 0);
66363
- const sharedOptions = normalizeSharedOptions(options.shared);
66364
- const consumes = createConsumeShareOptions(sharedOptions);
66365
- const provides = createProvideShareOptions(sharedOptions);
66366
- this._shareScope = options.shareScope;
66367
- this._consumes = consumes;
66368
- this._provides = provides;
66369
- this._enhanced = options.enhanced ?? false;
66370
- this._sharedOptions = sharedOptions;
66371
- }
66372
- }
66373
66117
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
66374
66118
  function ModuleFederationManifestPlugin_define_property(obj, key, value) {
66375
66119
  if (key in obj) Object.defineProperty(obj, key, {
@@ -66408,29 +66152,17 @@ function readPKGJson(root) {
66408
66152
  } catch {}
66409
66153
  return {};
66410
66154
  }
66411
- function getBuildInfo(isDev, compiler, mfConfig) {
66412
- const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
66155
+ function getBuildInfo(isDev, root) {
66156
+ const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
66413
66157
  const pkg = readPKGJson(rootPath);
66414
66158
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
66415
- const statsBuildInfo = {
66159
+ return {
66416
66160
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
66417
66161
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
66418
66162
  };
66419
- const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
66420
- const enableTreeshake = Object.values(normalizedShared).some((config)=>config[1].treeshake);
66421
- if (enableTreeshake) {
66422
- statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
66423
- statsBuildInfo.plugins = mfConfig.treeshakeSharedPlugins || [];
66424
- statsBuildInfo.excludePlugins = mfConfig.treeshakeSharedExcludePlugins || [];
66425
- }
66426
- return statsBuildInfo;
66427
66163
  }
66428
66164
  function getFileName(manifestOptions) {
66429
66165
  if (!manifestOptions) return {
66430
- statsFileName: '',
66431
- manifestFileName: ''
66432
- };
66433
- if ('boolean' == typeof manifestOptions) return {
66434
66166
  statsFileName: STATS_FILE_NAME,
66435
66167
  manifestFileName: MANIFEST_FILE_NAME
66436
66168
  };
@@ -66445,594 +66177,58 @@ function getFileName(manifestOptions) {
66445
66177
  const statsFileName = fileName ? insertSuffix(manifestFileName, '-stats') : STATS_FILE_NAME;
66446
66178
  return {
66447
66179
  statsFileName: (0, path_browserify.join)(filePath, statsFileName),
66448
- manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66449
- };
66450
- }
66451
- function resolveLibraryGlobalName(library) {
66452
- if (!library) return;
66453
- const libName = library.name;
66454
- if (!libName) return;
66455
- if ('string' == typeof libName) return libName;
66456
- if (Array.isArray(libName)) return libName[0];
66457
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66458
- }
66459
- function collectManifestExposes(exposes) {
66460
- if (!exposes) return;
66461
- const parsed = parseOptions(exposes, (value)=>({
66462
- import: Array.isArray(value) ? value : [
66463
- value
66464
- ],
66465
- name: void 0
66466
- }), (value)=>({
66467
- import: Array.isArray(value.import) ? value.import : [
66468
- value.import
66469
- ],
66470
- name: value.name ?? void 0
66471
- }));
66472
- const result = parsed.map(([exposeKey, info])=>{
66473
- const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66474
- return {
66475
- path: exposeKey,
66476
- name: exposeName
66477
- };
66478
- });
66479
- return result.length > 0 ? result : void 0;
66480
- }
66481
- function collectManifestShared(shared) {
66482
- if (!shared) return;
66483
- const parsed = parseOptions(shared, (item, key)=>{
66484
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
66485
- return item !== key && isRequiredVersion(item) ? {
66486
- import: key,
66487
- requiredVersion: item
66488
- } : {
66489
- import: item
66490
- };
66491
- }, (item)=>item);
66492
- const result = parsed.map(([key, config])=>{
66493
- const name = config.shareKey || key;
66494
- const version = 'string' == typeof config.version ? config.version : void 0;
66495
- const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66496
- return {
66497
- name,
66498
- version,
66499
- requiredVersion,
66500
- singleton: config.singleton
66501
- };
66502
- });
66503
- return result.length > 0 ? result : void 0;
66504
- }
66505
- function normalizeManifestOptions(mfConfig) {
66506
- const manifestOptions = true === mfConfig.manifest ? {} : {
66507
- ...mfConfig.manifest
66508
- };
66509
- const containerName = mfConfig.name;
66510
- const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
66511
- const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
66512
- if (cur[1].length > 1) return sum;
66513
- const remoteInfo = cur[1][0];
66514
- const { entry, alias, name } = remoteInfo;
66515
- if (entry && name) sum[alias] = {
66516
- name,
66517
- entry
66518
- };
66519
- return sum;
66520
- }, {});
66521
- const manifestExposes = collectManifestExposes(mfConfig.exposes);
66522
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66523
- const manifestShared = collectManifestShared(mfConfig.shared);
66524
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66525
- return {
66526
- ...manifestOptions,
66527
- remoteAliasMap,
66528
- globalName,
66529
- name: containerName
66530
- };
66531
- }
66532
- class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66533
- raw(compiler) {
66534
- const opts = normalizeManifestOptions(this.rawOpts);
66535
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
66536
- const { statsFileName, manifestFileName } = getFileName(opts);
66537
- const rawOptions = {
66538
- name: opts.name,
66539
- globalName: opts.globalName,
66540
- fileName,
66541
- filePath,
66542
- manifestFileName,
66543
- statsFileName,
66544
- disableAssetsAnalyze,
66545
- remoteAliasMap,
66546
- exposes,
66547
- shared,
66548
- buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
66549
- };
66550
- return createBuiltinPlugin(this.name, rawOptions);
66551
- }
66552
- constructor(opts){
66553
- super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "rawOpts", void 0);
66554
- this.rawOpts = opts;
66555
- }
66556
- }
66557
- function CollectSharedEntryPlugin_define_property(obj, key, value) {
66558
- if (key in obj) Object.defineProperty(obj, key, {
66559
- value: value,
66560
- enumerable: true,
66561
- configurable: true,
66562
- writable: true
66563
- });
66564
- else obj[key] = value;
66565
- return obj;
66566
- }
66567
- const SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
66568
- class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
66569
- getData() {
66570
- return this._collectedEntries;
66571
- }
66572
- getFilename() {
66573
- return SHARE_ENTRY_ASSET;
66574
- }
66575
- apply(compiler) {
66576
- super.apply(compiler);
66577
- compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
66578
- compilation.hooks.processAssets.tapPromise({
66579
- name: 'CollectSharedEntry',
66580
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
66581
- }, async ()=>{
66582
- compilation.getAssets().forEach((asset)=>{
66583
- if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
66584
- compilation.deleteAsset(asset.name);
66585
- });
66586
- });
66587
- });
66588
- }
66589
- raw() {
66590
- const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
66591
- const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
66592
- const rawOptions = {
66593
- consumes: normalizedConsumeShareOptions.map(([key, v])=>({
66594
- key,
66595
- ...v
66596
- })),
66597
- filename: this.getFilename()
66598
- };
66599
- return createBuiltinPlugin(this.name, rawOptions);
66600
- }
66601
- constructor(options){
66602
- 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);
66603
- const { sharedOptions } = options;
66604
- this.sharedOptions = sharedOptions;
66605
- this._collectedEntries = {};
66606
- }
66607
- }
66608
- function SharedContainerPlugin_define_property(obj, key, value) {
66609
- if (key in obj) Object.defineProperty(obj, key, {
66610
- value: value,
66611
- enumerable: true,
66612
- configurable: true,
66613
- writable: true
66614
- });
66615
- else obj[key] = value;
66616
- return obj;
66617
- }
66618
- function assert(condition, msg) {
66619
- if (!condition) throw new Error(msg);
66620
- }
66621
- const HOT_UPDATE_SUFFIX = '.hot-update';
66622
- class SharedContainerPlugin extends RspackBuiltinPlugin {
66623
- getData() {
66624
- return [
66625
- this._options.fileName,
66626
- this._globalName,
66627
- this._options.version
66628
- ];
66629
- }
66630
- raw(compiler) {
66631
- const { library } = this._options;
66632
- if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
66633
- return createBuiltinPlugin(this.name, this._options);
66634
- }
66635
- apply(compiler) {
66636
- super.apply(compiler);
66637
- const shareName = this._shareName;
66638
- compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
66639
- compilation.hooks.processAssets.tapPromise({
66640
- name: 'getShareContainerFile'
66641
- }, async ()=>{
66642
- const remoteEntryPoint = compilation.entrypoints.get(shareName);
66643
- assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
66644
- const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
66645
- assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
66646
- const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
66647
- assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66648
- assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
66649
- this.filename = files[0];
66650
- });
66651
- });
66652
- }
66653
- constructor(options){
66654
- 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);
66655
- const { shareName, library, request, independentShareFileName, mfName } = options;
66656
- const version = options.version || '0.0.0';
66657
- this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
66658
- const fileName = independentShareFileName || `${version}/share-entry.js`;
66659
- this._shareName = shareName;
66660
- this._options = {
66661
- name: shareName,
66662
- request: request,
66663
- library: (library ? {
66664
- ...library,
66665
- name: this._globalName
66666
- } : void 0) || {
66667
- type: 'global',
66668
- name: this._globalName
66669
- },
66670
- version,
66671
- fileName
66672
- };
66673
- }
66674
- }
66675
- function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
66676
- if (key in obj) Object.defineProperty(obj, key, {
66677
- value: value,
66678
- enumerable: true,
66679
- configurable: true,
66680
- writable: true
66681
- });
66682
- else obj[key] = value;
66683
- return obj;
66684
- }
66685
- class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66686
- buildOptions() {
66687
- const shared = this.sharedOptions.map(([shareKey, config])=>({
66688
- shareKey,
66689
- treeshake: !!config.treeshake,
66690
- usedExports: config.treeshake?.usedExports
66691
- }));
66692
- const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66693
- return {
66694
- shared,
66695
- injectUsedExports: this.injectUsedExports,
66696
- manifestFileName,
66697
- statsFileName
66698
- };
66699
- }
66700
- raw() {
66701
- if (!this.sharedOptions.length) return;
66702
- return createBuiltinPlugin(this.name, this.buildOptions());
66703
- }
66704
- constructor(sharedOptions, injectUsedExports, manifestOptions){
66705
- super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
66706
- this.sharedOptions = sharedOptions;
66707
- this.injectUsedExports = injectUsedExports ?? true;
66708
- this.manifestOptions = manifestOptions ?? {};
66709
- }
66710
- }
66711
- function IndependentSharedPlugin_define_property(obj, key, value) {
66712
- if (key in obj) Object.defineProperty(obj, key, {
66713
- value: value,
66714
- enumerable: true,
66715
- configurable: true,
66716
- writable: true
66717
- });
66718
- else obj[key] = value;
66719
- return obj;
66720
- }
66721
- const VIRTUAL_ENTRY = './virtual-entry.js';
66722
- const VIRTUAL_ENTRY_NAME = 'virtual-entry';
66723
- const filterPlugin = (plugin, excludedPlugins = [])=>{
66724
- if (!plugin) return true;
66725
- const pluginName = plugin.name || plugin.constructor?.name;
66726
- if (!pluginName) return true;
66727
- return ![
66728
- 'TreeShakeSharedPlugin',
66729
- 'IndependentSharedPlugin',
66730
- 'ModuleFederationPlugin',
66731
- 'SharedUsedExportsOptimizerPlugin',
66732
- 'HtmlWebpackPlugin',
66733
- 'HtmlRspackPlugin',
66734
- 'RsbuildHtmlPlugin',
66735
- ...excludedPlugins
66736
- ].includes(pluginName);
66737
- };
66738
- class VirtualEntryPlugin {
66739
- createEntry() {
66740
- const { sharedOptions, collectShared } = this;
66741
- const entryContent = sharedOptions.reduce((acc, cur, index)=>{
66742
- const importLine = `import shared_${index} from '${cur[0]}';\n`;
66743
- const logLine = collectShared ? `console.log(shared_${index});\n` : '';
66744
- return acc + importLine + logLine;
66745
- }, '');
66746
- return entryContent;
66747
- }
66748
- static entry() {
66749
- return {
66750
- [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66751
- };
66752
- }
66753
- apply(compiler) {
66754
- new compiler.rspack.experiments.VirtualModulesPlugin({
66755
- [VIRTUAL_ENTRY]: this.createEntry()
66756
- }).apply(compiler);
66757
- compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
66758
- compilation.hooks.processAssets.tapPromise({
66759
- name: 'RemoveVirtualEntryAsset',
66760
- stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66761
- }, async ()=>{
66762
- try {
66763
- const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66764
- chunk?.files.forEach((f)=>{
66765
- compilation.deleteAsset(f);
66766
- });
66767
- } catch (_e) {
66768
- console.error('Failed to remove virtual entry file!');
66769
- }
66770
- });
66771
- });
66772
- }
66773
- constructor(sharedOptions, collectShared){
66774
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66775
- IndependentSharedPlugin_define_property(this, "collectShared", false);
66776
- this.sharedOptions = sharedOptions;
66777
- this.collectShared = collectShared;
66778
- }
66779
- }
66780
- const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
66781
- class IndependentSharedPlugin {
66782
- apply(compiler) {
66783
- const { manifest } = this;
66784
- let runCount = 0;
66785
- compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
66786
- if (runCount) return;
66787
- await this.createIndependentCompilers(compiler);
66788
- runCount++;
66789
- });
66790
- compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
66791
- if (runCount) return;
66792
- await this.createIndependentCompilers(compiler);
66793
- runCount++;
66794
- });
66795
- compiler.hooks.shutdown.tapAsync('IndependentSharedPlugin', (callback)=>{
66796
- callback();
66797
- });
66798
- if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
66799
- compilation.hooks.processAssets.tapPromise({
66800
- name: 'injectBuildAssets',
66801
- stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66802
- }, async ()=>{
66803
- const { statsFileName, manifestFileName } = getFileName(manifest);
66804
- const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66805
- const stats = compilation.getAsset(filename);
66806
- if (!stats) return;
66807
- const statsContent = JSON.parse(stats.source.source().toString());
66808
- const { shared } = statsContent;
66809
- Object.entries(this.buildAssets).forEach(([key, item])=>{
66810
- const targetShared = shared.find((s)=>s.name === key);
66811
- if (!targetShared) return;
66812
- item.forEach(([entry, version, globalName])=>{
66813
- if (version === targetShared.version) {
66814
- targetShared.fallback = entry;
66815
- targetShared.fallbackName = globalName;
66816
- }
66817
- });
66818
- });
66819
- compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66820
- };
66821
- injectBuildAssetsIntoStatsOrManifest(statsFileName);
66822
- injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66823
- });
66824
- });
66825
- }
66826
- async createIndependentCompilers(parentCompiler) {
66827
- const { sharedOptions, buildAssets, outputDir } = this;
66828
- console.log('🚀 Start creating a standalone compiler...');
66829
- const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
66830
- await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66831
- if (!shareConfig.treeshake || false === shareConfig.import) return;
66832
- const shareRequests = shareRequestsMap[shareName].requests;
66833
- await Promise.all(shareRequests.map(async ([request, version])=>{
66834
- const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66835
- const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
66836
- shareRequestsMap,
66837
- currentShare: {
66838
- shareName,
66839
- version,
66840
- request,
66841
- independentShareFileName: sharedConfig?.treeshake?.filename
66842
- }
66843
- });
66844
- if ('string' == typeof shareFileName) {
66845
- buildAssets[shareName] ||= [];
66846
- buildAssets[shareName].push([
66847
- (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
66848
- sharedVersion,
66849
- globalName
66850
- ]);
66851
- }
66852
- }));
66853
- }));
66854
- console.log('✅ All independent packages have been compiled successfully');
66855
- }
66856
- async createIndependentCompiler(parentCompiler, extraOptions) {
66857
- const { mfName, plugins, outputDir, sharedOptions, treeshake, library, treeshakeSharedExcludePlugins } = this;
66858
- const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
66859
- const parentConfig = parentCompiler.options;
66860
- const finalPlugins = [];
66861
- const rspack = parentCompiler.rspack;
66862
- let extraPlugin;
66863
- extraPlugin = extraOptions ? new SharedContainerPlugin({
66864
- mfName,
66865
- library,
66866
- ...extraOptions.currentShare
66867
- }) : new CollectSharedEntryPlugin({
66868
- sharedOptions,
66869
- shareScope: 'default'
66870
- });
66871
- (parentConfig.plugins || []).forEach((plugin)=>{
66872
- if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeshakeSharedExcludePlugins)) finalPlugins.push(plugin);
66873
- });
66874
- plugins.forEach((plugin)=>{
66875
- finalPlugins.push(plugin);
66876
- });
66877
- finalPlugins.push(extraPlugin);
66878
- finalPlugins.push(new ConsumeSharedPlugin({
66879
- consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66880
- [key]: {
66881
- import: extraOptions ? false : options.import,
66882
- shareKey: options.shareKey || key,
66883
- shareScope: options.shareScope,
66884
- requiredVersion: options.requiredVersion,
66885
- strictVersion: options.strictVersion,
66886
- singleton: options.singleton,
66887
- packageName: options.packageName,
66888
- eager: options.eager
66889
- }
66890
- })),
66891
- enhanced: true
66892
- }));
66893
- if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
66894
- finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
66895
- const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66896
- const compilerConfig = {
66897
- ...parentConfig,
66898
- module: {
66899
- ...parentConfig.module,
66900
- rules: [
66901
- {
66902
- test: /virtual-entry\.js$/,
66903
- type: "javascript/auto",
66904
- resolve: {
66905
- fullySpecified: false
66906
- },
66907
- use: {
66908
- loader: 'builtin:swc-loader'
66909
- }
66910
- },
66911
- ...parentConfig.module?.rules || []
66912
- ]
66913
- },
66914
- mode: parentConfig.mode || 'development',
66915
- entry: VirtualEntryPlugin.entry,
66916
- output: {
66917
- path: fullOutputDir,
66918
- clean: true,
66919
- publicPath: parentConfig.output?.publicPath || 'auto'
66920
- },
66921
- plugins: finalPlugins,
66922
- optimization: {
66923
- ...parentConfig.optimization,
66924
- splitChunks: false
66925
- }
66926
- };
66927
- const compiler = rspack.rspack(compilerConfig);
66928
- compiler.inputFileSystem = parentCompiler.inputFileSystem;
66929
- compiler.outputFileSystem = parentCompiler.outputFileSystem;
66930
- compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66931
- const { currentShare } = extraOptions || {};
66932
- return new Promise((resolve, reject)=>{
66933
- compiler.run((err, stats)=>{
66934
- if (err || stats?.hasErrors()) {
66935
- const target = currentShare ? currentShare.shareName : '收集依赖';
66936
- console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
66937
- reject(err || new Error(`${target} 编译失败`));
66938
- return;
66939
- }
66940
- currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
66941
- if (stats) {
66942
- currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
66943
- console.log(stats.toString({
66944
- colors: true,
66945
- chunks: false,
66946
- modules: false
66947
- }));
66948
- }
66949
- resolve(extraPlugin.getData());
66950
- });
66951
- });
66952
- }
66953
- constructor(options){
66954
- IndependentSharedPlugin_define_property(this, "mfName", void 0);
66955
- IndependentSharedPlugin_define_property(this, "shared", void 0);
66956
- IndependentSharedPlugin_define_property(this, "library", void 0);
66957
- IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
66958
- IndependentSharedPlugin_define_property(this, "outputDir", void 0);
66959
- IndependentSharedPlugin_define_property(this, "plugins", void 0);
66960
- IndependentSharedPlugin_define_property(this, "treeshake", void 0);
66961
- IndependentSharedPlugin_define_property(this, "manifest", void 0);
66962
- IndependentSharedPlugin_define_property(this, "buildAssets", {});
66963
- IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
66964
- IndependentSharedPlugin_define_property(this, "treeshakeSharedExcludePlugins", void 0);
66965
- IndependentSharedPlugin_define_property(this, "name", 'IndependentSharedPlugin');
66966
- const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library, treeshakeSharedExcludePlugins } = options;
66967
- this.shared = shared;
66968
- this.mfName = name;
66969
- this.outputDir = outputDir || 'independent-packages';
66970
- this.plugins = plugins || [];
66971
- this.treeshake = treeshake;
66972
- this.manifest = manifest;
66973
- this.injectUsedExports = injectUsedExports ?? true;
66974
- this.library = library;
66975
- this.treeshakeSharedExcludePlugins = treeshakeSharedExcludePlugins || [];
66976
- this.sharedOptions = parseOptions(shared, (item, key)=>{
66977
- if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66978
- const config = item !== key && isRequiredVersion(item) ? {
66979
- import: key,
66980
- requiredVersion: item
66981
- } : {
66982
- import: item
66983
- };
66984
- return config;
66985
- }, (item)=>item);
66986
- }
66987
- }
66988
- function TreeShakeSharedPlugin_define_property(obj, key, value) {
66989
- if (key in obj) Object.defineProperty(obj, key, {
66990
- value: value,
66991
- enumerable: true,
66992
- configurable: true,
66993
- writable: true
66994
- });
66995
- else obj[key] = value;
66996
- return obj;
66180
+ manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
66181
+ };
66997
66182
  }
66998
- class TreeShakeSharedPlugin {
66999
- apply(compiler) {
67000
- const { mfConfig, outputDir, reShake } = this;
67001
- const { name, shared, library, treeshakeSharedPlugins } = mfConfig;
67002
- if (!shared) return;
67003
- const sharedOptions = normalizeSharedOptions(shared);
67004
- if (!sharedOptions.length) return;
67005
- if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
67006
- if (!reShake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
67007
- this._independentSharePlugin = new IndependentSharedPlugin({
67008
- name: name,
67009
- shared: shared,
67010
- outputDir,
67011
- plugins: treeshakeSharedPlugins?.map((p)=>require(p)) || [],
67012
- treeshake: reShake,
67013
- library,
67014
- manifest: mfConfig.manifest,
67015
- treeshakeSharedExcludePlugins: mfConfig.treeshakeSharedExcludePlugins
67016
- });
67017
- this._independentSharePlugin.apply(compiler);
67018
- }
67019
- }
67020
- get buildAssets() {
67021
- return this._independentSharePlugin?.buildAssets || {};
66183
+ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
66184
+ raw(compiler) {
66185
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
66186
+ const { statsFileName, manifestFileName } = getFileName(this.opts);
66187
+ const rawOptions = {
66188
+ name: this.opts.name,
66189
+ globalName: this.opts.globalName,
66190
+ fileName,
66191
+ filePath,
66192
+ manifestFileName,
66193
+ statsFileName,
66194
+ disableAssetsAnalyze,
66195
+ remoteAliasMap,
66196
+ exposes,
66197
+ shared,
66198
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
66199
+ };
66200
+ return createBuiltinPlugin(this.name, rawOptions);
67022
66201
  }
67023
- constructor(options){
67024
- TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
67025
- TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
67026
- TreeShakeSharedPlugin_define_property(this, "reShake", void 0);
67027
- TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
67028
- TreeShakeSharedPlugin_define_property(this, "name", 'TreeShakeSharedPlugin');
67029
- const { mfConfig, reShake } = options;
67030
- this.mfConfig = mfConfig;
67031
- this.outputDir = mfConfig.independentShareDir || 'independent-packages';
67032
- this.reShake = Boolean(reShake);
66202
+ constructor(opts){
66203
+ super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
66204
+ this.opts = opts;
67033
66205
  }
67034
66206
  }
67035
66207
  const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
66208
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
66209
+ const array = (items)=>{
66210
+ for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
66211
+ else if (item && 'object' == typeof item) object(item);
66212
+ else throw new Error('Unexpected options format');
66213
+ };
66214
+ const object = (obj)=>{
66215
+ for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
66216
+ };
66217
+ if (!options) return;
66218
+ if (Array.isArray(options)) array(options);
66219
+ else if ('object' == typeof options) object(options);
66220
+ else throw new Error('Unexpected options format');
66221
+ };
66222
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
66223
+ const items = [];
66224
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
66225
+ items.push([
66226
+ key,
66227
+ value
66228
+ ]);
66229
+ });
66230
+ return items;
66231
+ };
67036
66232
  function ModuleFederationPlugin_define_property(obj, key, value) {
67037
66233
  if (key in obj) Object.defineProperty(obj, key, {
67038
66234
  value: value,
@@ -67052,50 +66248,101 @@ class ModuleFederationPlugin {
67052
66248
  '@module-federation/runtime': paths.runtime,
67053
66249
  ...compiler.options.resolve.alias
67054
66250
  };
67055
- const sharedOptions = getSharedOptions(this._options);
67056
- const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
67057
- if (treeshakeEntries.length > 0) {
67058
- this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
67059
- mfConfig: this._options,
67060
- reShake: false
67061
- });
67062
- this._treeShakeSharedPlugin.apply(compiler);
67063
- }
67064
- let runtimePluginApplied = false;
67065
- compiler.hooks.beforeRun.tapPromise({
67066
- name: 'ModuleFederationPlugin',
67067
- stage: 100
67068
- }, async ()=>{
67069
- if (runtimePluginApplied) return;
67070
- runtimePluginApplied = true;
67071
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
67072
- new ModuleFederationRuntimePlugin({
67073
- entryRuntime
67074
- }).apply(compiler);
67075
- });
67076
- compiler.hooks.watchRun.tapPromise({
67077
- name: 'ModuleFederationPlugin',
67078
- stage: 100
67079
- }, async ()=>{
67080
- if (runtimePluginApplied) return;
67081
- runtimePluginApplied = true;
67082
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
67083
- new ModuleFederationRuntimePlugin({
67084
- entryRuntime
67085
- }).apply(compiler);
67086
- });
66251
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66252
+ new ModuleFederationRuntimePlugin({
66253
+ entryRuntime
66254
+ }).apply(compiler);
67087
66255
  new webpack.container.ModuleFederationPluginV1({
67088
66256
  ...this._options,
67089
66257
  enhanced: true
67090
66258
  }).apply(compiler);
67091
- if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
66259
+ if (this._options.manifest) {
66260
+ const manifestOptions = true === this._options.manifest ? {} : {
66261
+ ...this._options.manifest
66262
+ };
66263
+ const containerName = manifestOptions.name ?? this._options.name;
66264
+ const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
66265
+ const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
66266
+ if (cur[1].length > 1) return sum;
66267
+ const remoteInfo = cur[1][0];
66268
+ const { entry, alias, name } = remoteInfo;
66269
+ if (entry && name) sum[alias] = {
66270
+ name,
66271
+ entry
66272
+ };
66273
+ return sum;
66274
+ }, {});
66275
+ const manifestExposes = collectManifestExposes(this._options.exposes);
66276
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
66277
+ const manifestShared = collectManifestShared(this._options.shared);
66278
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
66279
+ new ModuleFederationManifestPlugin({
66280
+ ...manifestOptions,
66281
+ name: containerName,
66282
+ globalName,
66283
+ remoteAliasMap
66284
+ }).apply(compiler);
66285
+ }
67092
66286
  }
67093
66287
  constructor(_options){
67094
66288
  ModuleFederationPlugin_define_property(this, "_options", void 0);
67095
- ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
67096
66289
  this._options = _options;
67097
66290
  }
67098
66291
  }
66292
+ function collectManifestExposes(exposes) {
66293
+ if (!exposes) return;
66294
+ const parsed = parseOptions(exposes, (value)=>({
66295
+ import: Array.isArray(value) ? value : [
66296
+ value
66297
+ ],
66298
+ name: void 0
66299
+ }), (value)=>({
66300
+ import: Array.isArray(value.import) ? value.import : [
66301
+ value.import
66302
+ ],
66303
+ name: value.name ?? void 0
66304
+ }));
66305
+ const result = parsed.map(([exposeKey, info])=>{
66306
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
66307
+ return {
66308
+ path: exposeKey,
66309
+ name: exposeName
66310
+ };
66311
+ });
66312
+ return result.length > 0 ? result : void 0;
66313
+ }
66314
+ function collectManifestShared(shared) {
66315
+ if (!shared) return;
66316
+ const parsed = parseOptions(shared, (item, key)=>{
66317
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66318
+ return item !== key && isRequiredVersion(item) ? {
66319
+ import: key,
66320
+ requiredVersion: item
66321
+ } : {
66322
+ import: item
66323
+ };
66324
+ }, (item)=>item);
66325
+ const result = parsed.map(([key, config])=>{
66326
+ const name = config.shareKey || key;
66327
+ const version = 'string' == typeof config.version ? config.version : void 0;
66328
+ const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
66329
+ return {
66330
+ name,
66331
+ version,
66332
+ requiredVersion,
66333
+ singleton: config.singleton
66334
+ };
66335
+ });
66336
+ return result.length > 0 ? result : void 0;
66337
+ }
66338
+ function resolveLibraryGlobalName(library) {
66339
+ if (!library) return;
66340
+ const libName = library.name;
66341
+ if (!libName) return;
66342
+ if ('string' == typeof libName) return libName;
66343
+ if (Array.isArray(libName)) return libName[0];
66344
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
66345
+ }
67099
66346
  function getRemoteInfos(options) {
67100
66347
  if (!options.remotes) return {};
67101
66348
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -67162,18 +66409,6 @@ function getRemoteInfos(options) {
67162
66409
  function getRuntimePlugins(options) {
67163
66410
  return options.runtimePlugins ?? [];
67164
66411
  }
67165
- function getSharedOptions(options) {
67166
- if (!options.shared) return [];
67167
- return parseOptions(options.shared, (item, key)=>{
67168
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
67169
- return item !== key && isRequiredVersion(item) ? {
67170
- import: key,
67171
- requiredVersion: item
67172
- } : {
67173
- import: item
67174
- };
67175
- }, (item)=>item);
67176
- }
67177
66412
  function getPaths(options) {
67178
66413
  return {
67179
66414
  runtimeTools: '@module-federation/runtime-tools',
@@ -67181,12 +66416,11 @@ function getPaths(options) {
67181
66416
  runtime: '@module-federation/runtime'
67182
66417
  };
67183
66418
  }
67184
- function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
66419
+ function getDefaultEntryRuntime(paths, options, compiler) {
67185
66420
  const runtimePlugins = getRuntimePlugins(options);
67186
66421
  const remoteInfos = getRemoteInfos(options);
67187
66422
  const runtimePluginImports = [];
67188
66423
  const runtimePluginVars = [];
67189
- const libraryType = options.library?.type || 'var';
67190
66424
  for(let i = 0; i < runtimePlugins.length; i++){
67191
66425
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
67192
66426
  const pluginSpec = runtimePlugins[i];
@@ -67203,12 +66437,215 @@ function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallback
67203
66437
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
67204
66438
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
67205
66439
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
67206
- `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
67207
- `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
67208
- '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,treeshakeGetter: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,treeshake:__webpack_require__.federation.sharedFallback?{get:data.fallback,strategy:data.treeshakeStrategy}: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,treeshakeStrategy}=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,treeshake:treeshakeStrategy?{strategy:treeshakeStrategy}: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})}}'
66440
+ '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})}}'
67209
66441
  ].join(';');
67210
66442
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
67211
66443
  }
66444
+ function ShareRuntimePlugin_define_property(obj, key, value) {
66445
+ if (key in obj) Object.defineProperty(obj, key, {
66446
+ value: value,
66447
+ enumerable: true,
66448
+ configurable: true,
66449
+ writable: true
66450
+ });
66451
+ else obj[key] = value;
66452
+ return obj;
66453
+ }
66454
+ const compilerSet = new WeakSet();
66455
+ function isSingleton(compiler) {
66456
+ return compilerSet.has(compiler);
66457
+ }
66458
+ function setSingleton(compiler) {
66459
+ compilerSet.add(compiler);
66460
+ }
66461
+ class ShareRuntimePlugin extends RspackBuiltinPlugin {
66462
+ raw(compiler) {
66463
+ if (isSingleton(compiler)) return;
66464
+ setSingleton(compiler);
66465
+ return createBuiltinPlugin(this.name, this.enhanced);
66466
+ }
66467
+ constructor(enhanced = false){
66468
+ 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;
66469
+ }
66470
+ }
66471
+ function ConsumeSharedPlugin_define_property(obj, key, value) {
66472
+ if (key in obj) Object.defineProperty(obj, key, {
66473
+ value: value,
66474
+ enumerable: true,
66475
+ configurable: true,
66476
+ writable: true
66477
+ });
66478
+ else obj[key] = value;
66479
+ return obj;
66480
+ }
66481
+ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
66482
+ raw(compiler) {
66483
+ new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
66484
+ const rawOptions = {
66485
+ consumes: this._options.consumes.map(([key, v])=>({
66486
+ key,
66487
+ ...v
66488
+ })),
66489
+ enhanced: this._options.enhanced
66490
+ };
66491
+ return createBuiltinPlugin(this.name, rawOptions);
66492
+ }
66493
+ constructor(options){
66494
+ super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
66495
+ this._options = {
66496
+ consumes: parseOptions(options.consumes, (item, key)=>{
66497
+ if (Array.isArray(item)) throw new Error('Unexpected array in options');
66498
+ const result = item !== key && isRequiredVersion(item) ? {
66499
+ import: key,
66500
+ shareScope: options.shareScope || 'default',
66501
+ shareKey: key,
66502
+ requiredVersion: item,
66503
+ strictVersion: true,
66504
+ packageName: void 0,
66505
+ singleton: false,
66506
+ eager: false
66507
+ } : {
66508
+ import: key,
66509
+ shareScope: options.shareScope || 'default',
66510
+ shareKey: key,
66511
+ requiredVersion: void 0,
66512
+ packageName: void 0,
66513
+ strictVersion: false,
66514
+ singleton: false,
66515
+ eager: false
66516
+ };
66517
+ return result;
66518
+ }, (item, key)=>({
66519
+ import: false === item.import ? void 0 : item.import || key,
66520
+ shareScope: item.shareScope || options.shareScope || 'default',
66521
+ shareKey: item.shareKey || key,
66522
+ requiredVersion: item.requiredVersion,
66523
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
66524
+ packageName: item.packageName,
66525
+ singleton: !!item.singleton,
66526
+ eager: !!item.eager
66527
+ })),
66528
+ enhanced: options.enhanced ?? false
66529
+ };
66530
+ }
66531
+ }
66532
+ function ProvideSharedPlugin_define_property(obj, key, value) {
66533
+ if (key in obj) Object.defineProperty(obj, key, {
66534
+ value: value,
66535
+ enumerable: true,
66536
+ configurable: true,
66537
+ writable: true
66538
+ });
66539
+ else obj[key] = value;
66540
+ return obj;
66541
+ }
66542
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
66543
+ raw(compiler) {
66544
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
66545
+ const rawOptions = this._provides.map(([key, v])=>({
66546
+ key,
66547
+ ...v
66548
+ }));
66549
+ return createBuiltinPlugin(this.name, rawOptions);
66550
+ }
66551
+ constructor(options){
66552
+ 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);
66553
+ this._provides = parseOptions(options.provides, (item)=>{
66554
+ if (Array.isArray(item)) throw new Error('Unexpected array of provides');
66555
+ return {
66556
+ shareKey: item,
66557
+ version: void 0,
66558
+ shareScope: options.shareScope || 'default',
66559
+ eager: false
66560
+ };
66561
+ }, (item)=>{
66562
+ const raw = {
66563
+ shareKey: item.shareKey,
66564
+ version: item.version,
66565
+ shareScope: item.shareScope || options.shareScope || 'default',
66566
+ eager: !!item.eager
66567
+ };
66568
+ if (options.enhanced) {
66569
+ const enhancedItem = item;
66570
+ return {
66571
+ ...raw,
66572
+ singleton: enhancedItem.singleton,
66573
+ requiredVersion: enhancedItem.requiredVersion,
66574
+ strictVersion: enhancedItem.strictVersion
66575
+ };
66576
+ }
66577
+ return raw;
66578
+ });
66579
+ this._enhanced = options.enhanced;
66580
+ }
66581
+ }
66582
+ function SharePlugin_define_property(obj, key, value) {
66583
+ if (key in obj) Object.defineProperty(obj, key, {
66584
+ value: value,
66585
+ enumerable: true,
66586
+ configurable: true,
66587
+ writable: true
66588
+ });
66589
+ else obj[key] = value;
66590
+ return obj;
66591
+ }
66592
+ class SharePlugin {
66593
+ apply(compiler) {
66594
+ new ConsumeSharedPlugin({
66595
+ shareScope: this._shareScope,
66596
+ consumes: this._consumes,
66597
+ enhanced: this._enhanced
66598
+ }).apply(compiler);
66599
+ new ProvideSharedPlugin({
66600
+ shareScope: this._shareScope,
66601
+ provides: this._provides,
66602
+ enhanced: this._enhanced
66603
+ }).apply(compiler);
66604
+ }
66605
+ constructor(options){
66606
+ SharePlugin_define_property(this, "_shareScope", void 0);
66607
+ SharePlugin_define_property(this, "_consumes", void 0);
66608
+ SharePlugin_define_property(this, "_provides", void 0);
66609
+ SharePlugin_define_property(this, "_enhanced", void 0);
66610
+ const sharedOptions = parseOptions(options.shared, (item, key)=>{
66611
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66612
+ const config = item !== key && isRequiredVersion(item) ? {
66613
+ import: key,
66614
+ requiredVersion: item
66615
+ } : {
66616
+ import: item
66617
+ };
66618
+ return config;
66619
+ }, (item)=>item);
66620
+ const consumes = sharedOptions.map(([key, options])=>({
66621
+ [key]: {
66622
+ import: options.import,
66623
+ shareKey: options.shareKey || key,
66624
+ shareScope: options.shareScope,
66625
+ requiredVersion: options.requiredVersion,
66626
+ strictVersion: options.strictVersion,
66627
+ singleton: options.singleton,
66628
+ packageName: options.packageName,
66629
+ eager: options.eager
66630
+ }
66631
+ }));
66632
+ const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
66633
+ [options.import || key]: {
66634
+ shareKey: options.shareKey || key,
66635
+ shareScope: options.shareScope,
66636
+ version: options.version,
66637
+ eager: options.eager,
66638
+ singleton: options.singleton,
66639
+ requiredVersion: options.requiredVersion,
66640
+ strictVersion: options.strictVersion
66641
+ }
66642
+ }));
66643
+ this._shareScope = options.shareScope;
66644
+ this._consumes = consumes;
66645
+ this._provides = provides;
66646
+ this._enhanced = options.enhanced ?? false;
66647
+ }
66648
+ }
67212
66649
  function ContainerPlugin_define_property(obj, key, value) {
67213
66650
  if (key in obj) Object.defineProperty(obj, key, {
67214
66651
  value: value,
@@ -67244,7 +66681,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
67244
66681
  name: options.name,
67245
66682
  shareScope: options.shareScope || 'default',
67246
66683
  library: options.library || {
67247
- type: 'global',
66684
+ type: 'var',
67248
66685
  name: options.name
67249
66686
  },
67250
66687
  runtime: options.runtime,
@@ -67381,7 +66818,7 @@ function transformSync(source, options) {
67381
66818
  const _options = JSON.stringify(options || {});
67382
66819
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
67383
66820
  }
67384
- const exports_rspackVersion = "1.7.1-canary-cf4486a4-20260104102432";
66821
+ const exports_rspackVersion = "1.7.1-canary-47901fb5-20260104173636";
67385
66822
  const exports_version = "5.75.0";
67386
66823
  const exports_WebpackError = Error;
67387
66824
  const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
@@ -67432,7 +66869,6 @@ const container = {
67432
66869
  };
67433
66870
  const sharing = {
67434
66871
  ProvideSharedPlugin: ProvideSharedPlugin,
67435
- TreeShakeSharedPlugin: TreeShakeSharedPlugin,
67436
66872
  ConsumeSharedPlugin: ConsumeSharedPlugin,
67437
66873
  SharePlugin: SharePlugin
67438
66874
  };
@@ -67542,7 +66978,7 @@ function createCompiler(userOptions) {
67542
66978
  function isMultiRspackOptions(o) {
67543
66979
  return Array.isArray(o);
67544
66980
  }
67545
- function rspack_rspack(options, callback) {
66981
+ function rspack(options, callback) {
67546
66982
  try {
67547
66983
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
67548
66984
  else validateRspackConfig(options);
@@ -67592,7 +67028,7 @@ function rspack_rspack(options, callback) {
67592
67028
  return compiler;
67593
67029
  }
67594
67030
  }
67595
- const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
67031
+ const src_fn = Object.assign(rspack, exports_namespaceObject);
67596
67032
  src_fn.rspack = src_fn;
67597
67033
  src_fn.webpack = src_fn;
67598
67034
  const src_rspack_0 = src_fn;