@rspack-debug/browser 2.0.0-beta.0 → 2.0.0-beta.1

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.js CHANGED
@@ -15344,6 +15344,459 @@ __webpack_require__.add({
15344
15344
  const cached = (function*() {}).constructor;
15345
15345
  module.exports = ()=>cached;
15346
15346
  },
15347
+ "../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js" (module, __unused_rspack_exports, __webpack_require__) {
15348
+ var undefined;
15349
+ var $Object = __webpack_require__("../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js");
15350
+ var $Error = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js");
15351
+ var $EvalError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js");
15352
+ var $RangeError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js");
15353
+ var $ReferenceError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js");
15354
+ var $SyntaxError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js");
15355
+ var $TypeError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js");
15356
+ var $URIError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js");
15357
+ var abs = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js");
15358
+ var floor = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js");
15359
+ var max = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js");
15360
+ var min = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js");
15361
+ var pow = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js");
15362
+ var round = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js");
15363
+ var sign = __webpack_require__("../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js");
15364
+ var $Function = Function;
15365
+ var getEvalledConstructor = function(expressionSyntax) {
15366
+ try {
15367
+ return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
15368
+ } catch (e) {}
15369
+ };
15370
+ var $gOPD = __webpack_require__("../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js");
15371
+ var $defineProperty = __webpack_require__("../../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js");
15372
+ var throwTypeError = function() {
15373
+ throw new $TypeError();
15374
+ };
15375
+ var ThrowTypeError = $gOPD ? function() {
15376
+ try {
15377
+ arguments.callee;
15378
+ return throwTypeError;
15379
+ } catch (calleeThrows) {
15380
+ try {
15381
+ return $gOPD(arguments, 'callee').get;
15382
+ } catch (gOPDthrows) {
15383
+ return throwTypeError;
15384
+ }
15385
+ }
15386
+ }() : throwTypeError;
15387
+ var hasSymbols = __webpack_require__("../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js")();
15388
+ var getProto = __webpack_require__("../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js");
15389
+ var $ObjectGPO = __webpack_require__("../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js");
15390
+ var $ReflectGPO = __webpack_require__("../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js");
15391
+ var $apply = __webpack_require__("../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js");
15392
+ var $call = __webpack_require__("../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js");
15393
+ var needsEval = {};
15394
+ var TypedArray = "u" > typeof Uint8Array && getProto ? getProto(Uint8Array) : undefined;
15395
+ var INTRINSICS = {
15396
+ __proto__: null,
15397
+ '%AggregateError%': "u" < typeof AggregateError ? undefined : AggregateError,
15398
+ '%Array%': Array,
15399
+ '%ArrayBuffer%': "u" < typeof ArrayBuffer ? undefined : ArrayBuffer,
15400
+ '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
15401
+ '%AsyncFromSyncIteratorPrototype%': undefined,
15402
+ '%AsyncFunction%': needsEval,
15403
+ '%AsyncGenerator%': needsEval,
15404
+ '%AsyncGeneratorFunction%': needsEval,
15405
+ '%AsyncIteratorPrototype%': needsEval,
15406
+ '%Atomics%': "u" < typeof Atomics ? undefined : Atomics,
15407
+ '%BigInt%': "u" < typeof BigInt ? undefined : BigInt,
15408
+ '%BigInt64Array%': "u" < typeof BigInt64Array ? undefined : BigInt64Array,
15409
+ '%BigUint64Array%': "u" < typeof BigUint64Array ? undefined : BigUint64Array,
15410
+ '%Boolean%': Boolean,
15411
+ '%DataView%': "u" < typeof DataView ? undefined : DataView,
15412
+ '%Date%': Date,
15413
+ '%decodeURI%': decodeURI,
15414
+ '%decodeURIComponent%': decodeURIComponent,
15415
+ '%encodeURI%': encodeURI,
15416
+ '%encodeURIComponent%': encodeURIComponent,
15417
+ '%Error%': $Error,
15418
+ '%eval%': eval,
15419
+ '%EvalError%': $EvalError,
15420
+ '%Float16Array%': "u" < typeof Float16Array ? undefined : Float16Array,
15421
+ '%Float32Array%': "u" < typeof Float32Array ? undefined : Float32Array,
15422
+ '%Float64Array%': "u" < typeof Float64Array ? undefined : Float64Array,
15423
+ '%FinalizationRegistry%': "u" < typeof FinalizationRegistry ? undefined : FinalizationRegistry,
15424
+ '%Function%': $Function,
15425
+ '%GeneratorFunction%': needsEval,
15426
+ '%Int8Array%': "u" < typeof Int8Array ? undefined : Int8Array,
15427
+ '%Int16Array%': "u" < typeof Int16Array ? undefined : Int16Array,
15428
+ '%Int32Array%': "u" < typeof Int32Array ? undefined : Int32Array,
15429
+ '%isFinite%': isFinite,
15430
+ '%isNaN%': isNaN,
15431
+ '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
15432
+ '%JSON%': 'object' == typeof JSON ? JSON : undefined,
15433
+ '%Map%': "u" < typeof Map ? undefined : Map,
15434
+ '%MapIteratorPrototype%': "u" > typeof Map && hasSymbols && getProto ? getProto(new Map()[Symbol.iterator]()) : undefined,
15435
+ '%Math%': Math,
15436
+ '%Number%': Number,
15437
+ '%Object%': $Object,
15438
+ "%Object.getOwnPropertyDescriptor%": $gOPD,
15439
+ '%parseFloat%': parseFloat,
15440
+ '%parseInt%': parseInt,
15441
+ '%Promise%': "u" < typeof Promise ? undefined : Promise,
15442
+ '%Proxy%': "u" < typeof Proxy ? undefined : Proxy,
15443
+ '%RangeError%': $RangeError,
15444
+ '%ReferenceError%': $ReferenceError,
15445
+ '%Reflect%': "u" < typeof Reflect ? undefined : Reflect,
15446
+ '%RegExp%': RegExp,
15447
+ '%Set%': "u" < typeof Set ? undefined : Set,
15448
+ '%SetIteratorPrototype%': "u" > typeof Set && hasSymbols && getProto ? getProto(new Set()[Symbol.iterator]()) : undefined,
15449
+ '%SharedArrayBuffer%': "u" < typeof SharedArrayBuffer ? undefined : SharedArrayBuffer,
15450
+ '%String%': String,
15451
+ '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
15452
+ '%Symbol%': hasSymbols ? Symbol : undefined,
15453
+ '%SyntaxError%': $SyntaxError,
15454
+ '%ThrowTypeError%': ThrowTypeError,
15455
+ '%TypedArray%': TypedArray,
15456
+ '%TypeError%': $TypeError,
15457
+ '%Uint8Array%': "u" < typeof Uint8Array ? undefined : Uint8Array,
15458
+ '%Uint8ClampedArray%': "u" < typeof Uint8ClampedArray ? undefined : Uint8ClampedArray,
15459
+ '%Uint16Array%': "u" < typeof Uint16Array ? undefined : Uint16Array,
15460
+ '%Uint32Array%': "u" < typeof Uint32Array ? undefined : Uint32Array,
15461
+ '%URIError%': $URIError,
15462
+ '%WeakMap%': "u" < typeof WeakMap ? undefined : WeakMap,
15463
+ '%WeakRef%': "u" < typeof WeakRef ? undefined : WeakRef,
15464
+ '%WeakSet%': "u" < typeof WeakSet ? undefined : WeakSet,
15465
+ '%Function.prototype.call%': $call,
15466
+ '%Function.prototype.apply%': $apply,
15467
+ '%Object.defineProperty%': $defineProperty,
15468
+ '%Object.getPrototypeOf%': $ObjectGPO,
15469
+ '%Math.abs%': abs,
15470
+ '%Math.floor%': floor,
15471
+ '%Math.max%': max,
15472
+ '%Math.min%': min,
15473
+ '%Math.pow%': pow,
15474
+ '%Math.round%': round,
15475
+ '%Math.sign%': sign,
15476
+ '%Reflect.getPrototypeOf%': $ReflectGPO
15477
+ };
15478
+ if (getProto) try {
15479
+ null.error;
15480
+ } catch (e) {
15481
+ var errorProto = getProto(getProto(e));
15482
+ INTRINSICS['%Error.prototype%'] = errorProto;
15483
+ }
15484
+ var doEval = function doEval(name) {
15485
+ var value;
15486
+ if ('%AsyncFunction%' === name) value = getEvalledConstructor('async function () {}');
15487
+ else if ('%GeneratorFunction%' === name) value = getEvalledConstructor('function* () {}');
15488
+ else if ('%AsyncGeneratorFunction%' === name) value = getEvalledConstructor('async function* () {}');
15489
+ else if ('%AsyncGenerator%' === name) {
15490
+ var fn = doEval('%AsyncGeneratorFunction%');
15491
+ if (fn) value = fn.prototype;
15492
+ } else if ('%AsyncIteratorPrototype%' === name) {
15493
+ var gen = doEval('%AsyncGenerator%');
15494
+ if (gen && getProto) value = getProto(gen.prototype);
15495
+ }
15496
+ INTRINSICS[name] = value;
15497
+ return value;
15498
+ };
15499
+ var LEGACY_ALIASES = {
15500
+ __proto__: null,
15501
+ '%ArrayBufferPrototype%': [
15502
+ 'ArrayBuffer',
15503
+ 'prototype'
15504
+ ],
15505
+ '%ArrayPrototype%': [
15506
+ 'Array',
15507
+ 'prototype'
15508
+ ],
15509
+ '%ArrayProto_entries%': [
15510
+ 'Array',
15511
+ 'prototype',
15512
+ 'entries'
15513
+ ],
15514
+ '%ArrayProto_forEach%': [
15515
+ 'Array',
15516
+ 'prototype',
15517
+ 'forEach'
15518
+ ],
15519
+ '%ArrayProto_keys%': [
15520
+ 'Array',
15521
+ 'prototype',
15522
+ 'keys'
15523
+ ],
15524
+ '%ArrayProto_values%': [
15525
+ 'Array',
15526
+ 'prototype',
15527
+ 'values'
15528
+ ],
15529
+ '%AsyncFunctionPrototype%': [
15530
+ 'AsyncFunction',
15531
+ 'prototype'
15532
+ ],
15533
+ '%AsyncGenerator%': [
15534
+ 'AsyncGeneratorFunction',
15535
+ 'prototype'
15536
+ ],
15537
+ '%AsyncGeneratorPrototype%': [
15538
+ 'AsyncGeneratorFunction',
15539
+ 'prototype',
15540
+ 'prototype'
15541
+ ],
15542
+ '%BooleanPrototype%': [
15543
+ 'Boolean',
15544
+ 'prototype'
15545
+ ],
15546
+ '%DataViewPrototype%': [
15547
+ 'DataView',
15548
+ 'prototype'
15549
+ ],
15550
+ '%DatePrototype%': [
15551
+ 'Date',
15552
+ 'prototype'
15553
+ ],
15554
+ '%ErrorPrototype%': [
15555
+ 'Error',
15556
+ 'prototype'
15557
+ ],
15558
+ '%EvalErrorPrototype%': [
15559
+ 'EvalError',
15560
+ 'prototype'
15561
+ ],
15562
+ '%Float32ArrayPrototype%': [
15563
+ 'Float32Array',
15564
+ 'prototype'
15565
+ ],
15566
+ '%Float64ArrayPrototype%': [
15567
+ 'Float64Array',
15568
+ 'prototype'
15569
+ ],
15570
+ '%FunctionPrototype%': [
15571
+ 'Function',
15572
+ 'prototype'
15573
+ ],
15574
+ '%Generator%': [
15575
+ 'GeneratorFunction',
15576
+ 'prototype'
15577
+ ],
15578
+ '%GeneratorPrototype%': [
15579
+ 'GeneratorFunction',
15580
+ 'prototype',
15581
+ 'prototype'
15582
+ ],
15583
+ '%Int8ArrayPrototype%': [
15584
+ 'Int8Array',
15585
+ 'prototype'
15586
+ ],
15587
+ '%Int16ArrayPrototype%': [
15588
+ 'Int16Array',
15589
+ 'prototype'
15590
+ ],
15591
+ '%Int32ArrayPrototype%': [
15592
+ 'Int32Array',
15593
+ 'prototype'
15594
+ ],
15595
+ '%JSONParse%': [
15596
+ 'JSON',
15597
+ 'parse'
15598
+ ],
15599
+ '%JSONStringify%': [
15600
+ 'JSON',
15601
+ 'stringify'
15602
+ ],
15603
+ '%MapPrototype%': [
15604
+ 'Map',
15605
+ 'prototype'
15606
+ ],
15607
+ '%NumberPrototype%': [
15608
+ 'Number',
15609
+ 'prototype'
15610
+ ],
15611
+ '%ObjectPrototype%': [
15612
+ 'Object',
15613
+ 'prototype'
15614
+ ],
15615
+ '%ObjProto_toString%': [
15616
+ 'Object',
15617
+ 'prototype',
15618
+ 'toString'
15619
+ ],
15620
+ '%ObjProto_valueOf%': [
15621
+ 'Object',
15622
+ 'prototype',
15623
+ 'valueOf'
15624
+ ],
15625
+ '%PromisePrototype%': [
15626
+ 'Promise',
15627
+ 'prototype'
15628
+ ],
15629
+ '%PromiseProto_then%': [
15630
+ 'Promise',
15631
+ 'prototype',
15632
+ 'then'
15633
+ ],
15634
+ '%Promise_all%': [
15635
+ 'Promise',
15636
+ 'all'
15637
+ ],
15638
+ '%Promise_reject%': [
15639
+ 'Promise',
15640
+ 'reject'
15641
+ ],
15642
+ '%Promise_resolve%': [
15643
+ 'Promise',
15644
+ 'resolve'
15645
+ ],
15646
+ '%RangeErrorPrototype%': [
15647
+ 'RangeError',
15648
+ 'prototype'
15649
+ ],
15650
+ '%ReferenceErrorPrototype%': [
15651
+ 'ReferenceError',
15652
+ 'prototype'
15653
+ ],
15654
+ '%RegExpPrototype%': [
15655
+ 'RegExp',
15656
+ 'prototype'
15657
+ ],
15658
+ '%SetPrototype%': [
15659
+ 'Set',
15660
+ 'prototype'
15661
+ ],
15662
+ '%SharedArrayBufferPrototype%': [
15663
+ 'SharedArrayBuffer',
15664
+ 'prototype'
15665
+ ],
15666
+ '%StringPrototype%': [
15667
+ 'String',
15668
+ 'prototype'
15669
+ ],
15670
+ '%SymbolPrototype%': [
15671
+ 'Symbol',
15672
+ 'prototype'
15673
+ ],
15674
+ '%SyntaxErrorPrototype%': [
15675
+ 'SyntaxError',
15676
+ 'prototype'
15677
+ ],
15678
+ '%TypedArrayPrototype%': [
15679
+ 'TypedArray',
15680
+ 'prototype'
15681
+ ],
15682
+ '%TypeErrorPrototype%': [
15683
+ 'TypeError',
15684
+ 'prototype'
15685
+ ],
15686
+ '%Uint8ArrayPrototype%': [
15687
+ 'Uint8Array',
15688
+ 'prototype'
15689
+ ],
15690
+ '%Uint8ClampedArrayPrototype%': [
15691
+ 'Uint8ClampedArray',
15692
+ 'prototype'
15693
+ ],
15694
+ '%Uint16ArrayPrototype%': [
15695
+ 'Uint16Array',
15696
+ 'prototype'
15697
+ ],
15698
+ '%Uint32ArrayPrototype%': [
15699
+ 'Uint32Array',
15700
+ 'prototype'
15701
+ ],
15702
+ '%URIErrorPrototype%': [
15703
+ 'URIError',
15704
+ 'prototype'
15705
+ ],
15706
+ '%WeakMapPrototype%': [
15707
+ 'WeakMap',
15708
+ 'prototype'
15709
+ ],
15710
+ '%WeakSetPrototype%': [
15711
+ 'WeakSet',
15712
+ 'prototype'
15713
+ ]
15714
+ };
15715
+ var bind = __webpack_require__("../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js");
15716
+ var hasOwn = __webpack_require__("../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js");
15717
+ var $concat = bind.call($call, Array.prototype.concat);
15718
+ var $spliceApply = bind.call($apply, Array.prototype.splice);
15719
+ var $replace = bind.call($call, String.prototype.replace);
15720
+ var $strSlice = bind.call($call, String.prototype.slice);
15721
+ var $exec = bind.call($call, RegExp.prototype.exec);
15722
+ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
15723
+ var reEscapeChar = /\\(\\)?/g;
15724
+ var stringToPath = function(string) {
15725
+ var first = $strSlice(string, 0, 1);
15726
+ var last = $strSlice(string, -1);
15727
+ if ('%' === first && '%' !== last) throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
15728
+ if ('%' === last && '%' !== first) throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
15729
+ var result = [];
15730
+ $replace(string, rePropName, function(match, number, quote, subString) {
15731
+ result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
15732
+ });
15733
+ return result;
15734
+ };
15735
+ var getBaseIntrinsic = function(name, allowMissing) {
15736
+ var intrinsicName = name;
15737
+ var alias;
15738
+ if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
15739
+ alias = LEGACY_ALIASES[intrinsicName];
15740
+ intrinsicName = '%' + alias[0] + '%';
15741
+ }
15742
+ if (hasOwn(INTRINSICS, intrinsicName)) {
15743
+ var value = INTRINSICS[intrinsicName];
15744
+ if (value === needsEval) value = doEval(intrinsicName);
15745
+ if (void 0 === value && !allowMissing) throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
15746
+ return {
15747
+ alias: alias,
15748
+ name: intrinsicName,
15749
+ value: value
15750
+ };
15751
+ }
15752
+ throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
15753
+ };
15754
+ module.exports = function(name, allowMissing) {
15755
+ if ('string' != typeof name || 0 === name.length) throw new $TypeError('intrinsic name must be a non-empty string');
15756
+ if (arguments.length > 1 && 'boolean' != typeof allowMissing) throw new $TypeError('"allowMissing" argument must be a boolean');
15757
+ if (null === $exec(/^%?[^%]*%?$/, name)) throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
15758
+ var parts = stringToPath(name);
15759
+ var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
15760
+ var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
15761
+ var intrinsicRealName = intrinsic.name;
15762
+ var value = intrinsic.value;
15763
+ var skipFurtherCaching = false;
15764
+ var alias = intrinsic.alias;
15765
+ if (alias) {
15766
+ intrinsicBaseName = alias[0];
15767
+ $spliceApply(parts, $concat([
15768
+ 0,
15769
+ 1
15770
+ ], alias));
15771
+ }
15772
+ for(var i = 1, isOwn = true; i < parts.length; i += 1){
15773
+ var part = parts[i];
15774
+ var first = $strSlice(part, 0, 1);
15775
+ var last = $strSlice(part, -1);
15776
+ if (('"' === first || "'" === first || '`' === first || '"' === last || "'" === last || '`' === last) && first !== last) throw new $SyntaxError('property names with quotes must have matching quotes');
15777
+ if ('constructor' === part || !isOwn) skipFurtherCaching = true;
15778
+ intrinsicBaseName += '.' + part;
15779
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
15780
+ if (hasOwn(INTRINSICS, intrinsicRealName)) value = INTRINSICS[intrinsicRealName];
15781
+ else if (null != value) {
15782
+ if (!(part in value)) {
15783
+ if (!allowMissing) throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
15784
+ return;
15785
+ }
15786
+ if ($gOPD && i + 1 >= parts.length) {
15787
+ var desc = $gOPD(value, part);
15788
+ isOwn = !!desc;
15789
+ value = isOwn && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[part];
15790
+ } else {
15791
+ isOwn = hasOwn(value, part);
15792
+ value = value[part];
15793
+ }
15794
+ if (isOwn && !skipFurtherCaching) INTRINSICS[intrinsicRealName] = value;
15795
+ }
15796
+ }
15797
+ return value;
15798
+ };
15799
+ },
15347
15800
  "../../node_modules/.pnpm/get-intrinsic@1.3.1/node_modules/get-intrinsic/index.js" (module, __unused_rspack_exports, __webpack_require__) {
15348
15801
  var undefined;
15349
15802
  var $Object = __webpack_require__("../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js");
@@ -29480,7 +29933,7 @@ __webpack_require__.add({
29480
29933
  };
29481
29934
  },
29482
29935
  "../../node_modules/.pnpm/side-channel-map@1.0.1/node_modules/side-channel-map/index.js" (module, __unused_rspack_exports, __webpack_require__) {
29483
- var GetIntrinsic = __webpack_require__("../../node_modules/.pnpm/get-intrinsic@1.3.1/node_modules/get-intrinsic/index.js");
29936
+ var GetIntrinsic = __webpack_require__("../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js");
29484
29937
  var callBound = __webpack_require__("../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js");
29485
29938
  var inspect = __webpack_require__("../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/index.js");
29486
29939
  var $TypeError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js");
@@ -29520,7 +29973,7 @@ __webpack_require__.add({
29520
29973
  };
29521
29974
  },
29522
29975
  "../../node_modules/.pnpm/side-channel-weakmap@1.0.2/node_modules/side-channel-weakmap/index.js" (module, __unused_rspack_exports, __webpack_require__) {
29523
- var GetIntrinsic = __webpack_require__("../../node_modules/.pnpm/get-intrinsic@1.3.1/node_modules/get-intrinsic/index.js");
29976
+ var GetIntrinsic = __webpack_require__("../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js");
29524
29977
  var callBound = __webpack_require__("../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js");
29525
29978
  var inspect = __webpack_require__("../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/index.js");
29526
29979
  var getSideChannelMap = __webpack_require__("../../node_modules/.pnpm/side-channel-map@1.0.1/node_modules/side-channel-map/index.js");
@@ -51734,6 +52187,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
51734
52187
  'chunks',
51735
52188
  'modules'
51736
52189
  ]),
52190
+ beforeModuleIds: new SyncHook([
52191
+ 'modules'
52192
+ ]),
51737
52193
  finishModules: new AsyncSeriesHook([
51738
52194
  'modules'
51739
52195
  ]),
@@ -53714,24 +54170,6 @@ class BulkUpdateDecorator extends Hash {
53714
54170
  return result;
53715
54171
  }
53716
54172
  }
53717
- class DebugHash extends Hash {
53718
- string;
53719
- constructor(){
53720
- super();
53721
- this.string = '';
53722
- }
53723
- update(data) {
53724
- let normalizedData;
53725
- normalizedData = createHash_Buffer.isBuffer(data) ? data.toString('utf-8') : data;
53726
- if (normalizedData.startsWith('debug-digest-')) normalizedData = createHash_Buffer.from(normalizedData.slice(13), 'hex').toString();
53727
- this.string += `[${normalizedData}](${new Error().stack?.split('\n', 3)[2]})\n`;
53728
- return this;
53729
- }
53730
- digest(encoding) {
53731
- const result = `debug-digest-${createHash_Buffer.from(this.string).toString('hex')}`;
53732
- return encoding ? result : createHash_Buffer.from(result);
53733
- }
53734
- }
53735
54173
  class WasmHashAdapter extends Hash {
53736
54174
  wasmHash;
53737
54175
  constructor(wasmHash){
@@ -53750,8 +54188,6 @@ class WasmHashAdapter extends Hash {
53750
54188
  const createHash_createHash = (algorithm)=>{
53751
54189
  if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
53752
54190
  switch(algorithm){
53753
- case 'debug':
53754
- return new DebugHash();
53755
54191
  case 'xxhash64':
53756
54192
  {
53757
54193
  const hash = hash_xxhash64();
@@ -55019,7 +55455,6 @@ function getRawJavascriptParserOptions(parser) {
55019
55455
  exportsPresence: false === parser.exportsPresence ? 'false' : parser.exportsPresence,
55020
55456
  importExportsPresence: false === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
55021
55457
  reexportExportsPresence: false === parser.reexportExportsPresence ? 'false' : parser.reexportExportsPresence,
55022
- strictExportPresence: parser.strictExportPresence,
55023
55458
  worker: 'boolean' == typeof parser.worker ? parser.worker ? [
55024
55459
  '...'
55025
55460
  ] : [] : parser.worker,
@@ -55053,7 +55488,8 @@ function getRawAssetParserDataUrl(dataUrlCondition) {
55053
55488
  function getRawCssParserOptions(parser) {
55054
55489
  return {
55055
55490
  namedExports: parser.namedExports,
55056
- url: parser.url
55491
+ url: parser.url,
55492
+ resolveImport: parser.resolveImport
55057
55493
  };
55058
55494
  }
55059
55495
  function getRawJsonParserOptions(parser) {
@@ -57584,7 +58020,7 @@ const applyRspackOptionsDefaults = (options)=>{
57584
58020
  if ('function' != typeof options.entry) for (const key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
57585
58021
  './src'
57586
58022
  ]);
57587
- F(options, 'devtool', ()=>development ? 'eval' : false);
58023
+ F(options, 'devtool', ()=>development ? 'cheap-module-source-map' : false);
57588
58024
  D(options, 'watch', false);
57589
58025
  D(options, 'lazyCompilation', false);
57590
58026
  D(options, 'bail', false);
@@ -57697,8 +58133,8 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
57697
58133
  D(parserOptions, 'unknownContextCritical', true);
57698
58134
  D(parserOptions, 'wrappedContextCritical', false);
57699
58135
  D(parserOptions, 'wrappedContextRegExp', /.*/);
57700
- D(parserOptions, 'strictExportPresence', false);
57701
- D(parserOptions, 'requireAsExpression', false);
58136
+ D(parserOptions, 'exportsPresence', 'error');
58137
+ D(parserOptions, 'requireAsExpression', true);
57702
58138
  D(parserOptions, 'requireAlias', false);
57703
58139
  D(parserOptions, 'requireDynamic', true);
57704
58140
  D(parserOptions, 'requireResolve', true);
@@ -58089,7 +58525,7 @@ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffecte
58089
58525
  });
58090
58526
  D(output, 'bundlerInfo', {});
58091
58527
  if ('object' == typeof output.bundlerInfo) {
58092
- D(output.bundlerInfo, 'version', "2.0.0-beta.0");
58528
+ D(output.bundlerInfo, 'version', "2.0.0-beta.1");
58093
58529
  D(output.bundlerInfo, 'bundler', 'rspack');
58094
58530
  D(output.bundlerInfo, 'force', !output.library);
58095
58531
  }
@@ -58529,7 +58965,8 @@ const getNormalizedRspackOptions = (config)=>({
58529
58965
  type: 'filesystem',
58530
58966
  directory: path_browserify_default().resolve(config.context || normalization_process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
58531
58967
  },
58532
- portable: cache.portable
58968
+ portable: cache.portable,
58969
+ readonly: cache.readonly
58533
58970
  };
58534
58971
  }),
58535
58972
  stats: nestedConfig(config.stats, (stats)=>{
@@ -59749,7 +60186,7 @@ class MultiStats {
59749
60186
  return obj;
59750
60187
  });
59751
60188
  if (childOptions.version) {
59752
- obj.rspackVersion = "2.0.0-beta.0";
60189
+ obj.rspackVersion = "2.0.0-beta.1";
59753
60190
  obj.version = "5.75.0";
59754
60191
  }
59755
60192
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -61435,7 +61872,7 @@ const SIMPLE_EXTRACTORS = {
61435
61872
  },
61436
61873
  version: (object)=>{
61437
61874
  object.version = "5.75.0";
61438
- object.rspackVersion = "2.0.0-beta.0";
61875
+ object.rspackVersion = "2.0.0-beta.1";
61439
61876
  },
61440
61877
  env: (object, _compilation, _context, { _env })=>{
61441
61878
  object.env = _env;
@@ -63166,7 +63603,7 @@ function createCompiler(userOptions) {
63166
63603
  function isMultiRspackOptions(o) {
63167
63604
  return Array.isArray(o);
63168
63605
  }
63169
- function rspack(options, callback) {
63606
+ function rspack_rspack(options, callback) {
63170
63607
  try {
63171
63608
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
63172
63609
  else validateRspackConfig(options);
@@ -63475,6 +63912,41 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
63475
63912
  return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
63476
63913
  };
63477
63914
  }),
63915
+ registerCompilationBeforeModuleIdsTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationBeforeModuleIds, function() {
63916
+ return getCompiler().__internal__get_compilation().hooks.beforeModuleIds;
63917
+ }, function(queried) {
63918
+ return function(arg) {
63919
+ const compilation = getCompiler().__internal__get_compilation();
63920
+ const assignments = new Map();
63921
+ const modulesByIdentifier = new Map();
63922
+ for (const module of compilation.modules)modulesByIdentifier.set(module.identifier(), module);
63923
+ const proxiedModules = arg.modules.map((m)=>{
63924
+ const realModule = modulesByIdentifier.get(m.identifier);
63925
+ return new Proxy(realModule, {
63926
+ get (target, prop) {
63927
+ if ('id' === prop) return assignments.get(m.identifier) ?? null;
63928
+ if ('identifier' === prop) return m.identifier;
63929
+ const value = Reflect.get(target, prop);
63930
+ return 'function' == typeof value ? value.bind(target) : value;
63931
+ },
63932
+ set (_target, prop, value) {
63933
+ if ('id' === prop && null !== value) {
63934
+ assignments.set(m.identifier, value);
63935
+ return true;
63936
+ }
63937
+ return false;
63938
+ }
63939
+ });
63940
+ });
63941
+ queried.call(proxiedModules);
63942
+ return {
63943
+ assignments: Object.fromEntries(Array.from(assignments.entries()).map(([k, v])=>[
63944
+ k,
63945
+ String(v)
63946
+ ]))
63947
+ };
63948
+ };
63949
+ }),
63478
63950
  registerCompilationChunkHashTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationChunkHash, function() {
63479
63951
  return getCompiler().__internal__get_compilation().hooks.chunkHash;
63480
63952
  }, function(queried) {
@@ -64293,7 +64765,7 @@ class Compiler {
64293
64765
  });
64294
64766
  const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
64295
64767
  const compilerFn = function(...params) {
64296
- return rspack(...params);
64768
+ return rspack_rspack(...params);
64297
64769
  };
64298
64770
  const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
64299
64771
  RuntimeGlobals: compilerRuntimeGlobals
@@ -65023,10 +65495,233 @@ class NodeTemplatePlugin {
65023
65495
  new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
65024
65496
  }
65025
65497
  }
65498
+ const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65499
+ const array = (items)=>{
65500
+ for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
65501
+ else if (item && 'object' == typeof item) object(item);
65502
+ else throw new Error('Unexpected options format');
65503
+ };
65504
+ const object = (obj)=>{
65505
+ for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65506
+ };
65507
+ if (!options) return;
65508
+ if (Array.isArray(options)) array(options);
65509
+ else if ('object' == typeof options) object(options);
65510
+ else throw new Error('Unexpected options format');
65511
+ };
65512
+ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65513
+ const items = [];
65514
+ options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65515
+ items.push([
65516
+ key,
65517
+ value
65518
+ ]);
65519
+ });
65520
+ return items;
65521
+ };
65522
+ const compilerSet = new WeakSet();
65523
+ function isSingleton(compiler) {
65524
+ return compilerSet.has(compiler);
65525
+ }
65526
+ function setSingleton(compiler) {
65527
+ compilerSet.add(compiler);
65528
+ }
65529
+ class ShareRuntimePlugin extends RspackBuiltinPlugin {
65530
+ enhanced;
65531
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
65532
+ constructor(enhanced = false){
65533
+ super(), this.enhanced = enhanced;
65534
+ }
65535
+ raw(compiler) {
65536
+ if (isSingleton(compiler)) return;
65537
+ setSingleton(compiler);
65538
+ return createBuiltinPlugin(this.name, this.enhanced);
65539
+ }
65540
+ }
65026
65541
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65027
65542
  function isRequiredVersion(str) {
65028
65543
  return VERSION_PATTERN_REGEXP.test(str);
65029
65544
  }
65545
+ const encodeName = function(name, prefix = '', withExt = false) {
65546
+ const ext = withExt ? '.js' : '';
65547
+ return `${prefix}${name.replace(/@/g, 'scope_').replace(/-/g, '_').replace(/\//g, '__').replace(/\./g, '')}${ext}`;
65548
+ };
65549
+ function normalizeConsumeShareOptions(consumes, shareScope) {
65550
+ return parseOptions(consumes, (item, key)=>{
65551
+ if (Array.isArray(item)) throw new Error('Unexpected array in options');
65552
+ const result = item !== key && isRequiredVersion(item) ? {
65553
+ import: key,
65554
+ shareScope: shareScope || 'default',
65555
+ shareKey: key,
65556
+ requiredVersion: item,
65557
+ strictVersion: true,
65558
+ packageName: void 0,
65559
+ singleton: false,
65560
+ eager: false,
65561
+ treeShakingMode: void 0
65562
+ } : {
65563
+ import: key,
65564
+ shareScope: shareScope || 'default',
65565
+ shareKey: key,
65566
+ requiredVersion: void 0,
65567
+ packageName: void 0,
65568
+ strictVersion: false,
65569
+ singleton: false,
65570
+ eager: false,
65571
+ treeShakingMode: void 0
65572
+ };
65573
+ return result;
65574
+ }, (item, key)=>({
65575
+ import: false === item.import ? void 0 : item.import || key,
65576
+ shareScope: item.shareScope || shareScope || 'default',
65577
+ shareKey: item.shareKey || key,
65578
+ requiredVersion: item.requiredVersion,
65579
+ strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
65580
+ packageName: item.packageName,
65581
+ singleton: !!item.singleton,
65582
+ eager: !!item.eager,
65583
+ treeShakingMode: item.treeShakingMode
65584
+ }));
65585
+ }
65586
+ class ConsumeSharedPlugin extends RspackBuiltinPlugin {
65587
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin;
65588
+ _options;
65589
+ constructor(options){
65590
+ super();
65591
+ this._options = {
65592
+ consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
65593
+ enhanced: options.enhanced ?? false
65594
+ };
65595
+ }
65596
+ raw(compiler) {
65597
+ new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
65598
+ const rawOptions = {
65599
+ consumes: this._options.consumes.map(([key, v])=>({
65600
+ key,
65601
+ ...v
65602
+ })),
65603
+ enhanced: this._options.enhanced
65604
+ };
65605
+ return createBuiltinPlugin(this.name, rawOptions);
65606
+ }
65607
+ }
65608
+ function normalizeProvideShareOptions(options, shareScope, enhanced) {
65609
+ return parseOptions(options, (item)=>{
65610
+ if (Array.isArray(item)) throw new Error('Unexpected array of provides');
65611
+ return {
65612
+ shareKey: item,
65613
+ version: void 0,
65614
+ shareScope: shareScope || 'default',
65615
+ eager: false
65616
+ };
65617
+ }, (item)=>{
65618
+ const raw = {
65619
+ shareKey: item.shareKey,
65620
+ version: item.version,
65621
+ shareScope: item.shareScope || shareScope || 'default',
65622
+ eager: !!item.eager
65623
+ };
65624
+ if (enhanced) {
65625
+ const enhancedItem = item;
65626
+ return {
65627
+ ...raw,
65628
+ singleton: enhancedItem.singleton,
65629
+ requiredVersion: enhancedItem.requiredVersion,
65630
+ strictVersion: enhancedItem.strictVersion,
65631
+ treeShakingMode: enhancedItem.treeShakingMode
65632
+ };
65633
+ }
65634
+ return raw;
65635
+ });
65636
+ }
65637
+ class ProvideSharedPlugin extends RspackBuiltinPlugin {
65638
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin;
65639
+ _provides;
65640
+ _enhanced;
65641
+ constructor(options){
65642
+ super();
65643
+ this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
65644
+ this._enhanced = options.enhanced;
65645
+ }
65646
+ raw(compiler) {
65647
+ new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
65648
+ const rawOptions = this._provides.map(([key, v])=>({
65649
+ key,
65650
+ ...v
65651
+ }));
65652
+ return createBuiltinPlugin(this.name, rawOptions);
65653
+ }
65654
+ }
65655
+ function normalizeSharedOptions(shared) {
65656
+ return parseOptions(shared, (item, key)=>{
65657
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
65658
+ const config = item !== key && isRequiredVersion(item) ? {
65659
+ import: key,
65660
+ requiredVersion: item
65661
+ } : {
65662
+ import: item
65663
+ };
65664
+ return config;
65665
+ }, (item)=>item);
65666
+ }
65667
+ function createProvideShareOptions(normalizedSharedOptions) {
65668
+ return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
65669
+ [options.import || key]: {
65670
+ shareKey: options.shareKey || key,
65671
+ shareScope: options.shareScope,
65672
+ version: options.version,
65673
+ eager: options.eager,
65674
+ singleton: options.singleton,
65675
+ requiredVersion: options.requiredVersion,
65676
+ strictVersion: options.strictVersion,
65677
+ treeShakingMode: options.treeShaking?.mode
65678
+ }
65679
+ }));
65680
+ }
65681
+ function createConsumeShareOptions(normalizedSharedOptions) {
65682
+ return normalizedSharedOptions.map(([key, options])=>({
65683
+ [key]: {
65684
+ import: options.import,
65685
+ shareKey: options.shareKey || key,
65686
+ shareScope: options.shareScope,
65687
+ requiredVersion: options.requiredVersion,
65688
+ strictVersion: options.strictVersion,
65689
+ singleton: options.singleton,
65690
+ packageName: options.packageName,
65691
+ eager: options.eager,
65692
+ treeShakingMode: options.treeShaking?.mode
65693
+ }
65694
+ }));
65695
+ }
65696
+ class SharePlugin {
65697
+ _shareScope;
65698
+ _consumes;
65699
+ _provides;
65700
+ _enhanced;
65701
+ _sharedOptions;
65702
+ constructor(options){
65703
+ const sharedOptions = normalizeSharedOptions(options.shared);
65704
+ const consumes = createConsumeShareOptions(sharedOptions);
65705
+ const provides = createProvideShareOptions(sharedOptions);
65706
+ this._shareScope = options.shareScope;
65707
+ this._consumes = consumes;
65708
+ this._provides = provides;
65709
+ this._enhanced = options.enhanced ?? false;
65710
+ this._sharedOptions = sharedOptions;
65711
+ }
65712
+ apply(compiler) {
65713
+ new ConsumeSharedPlugin({
65714
+ shareScope: this._shareScope,
65715
+ consumes: this._consumes,
65716
+ enhanced: this._enhanced
65717
+ }).apply(compiler);
65718
+ new ProvideSharedPlugin({
65719
+ shareScope: this._shareScope,
65720
+ provides: this._provides,
65721
+ enhanced: this._enhanced
65722
+ }).apply(compiler);
65723
+ }
65724
+ }
65030
65725
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
65031
65726
  const MANIFEST_FILE_NAME = 'mf-manifest.json';
65032
65727
  const STATS_FILE_NAME = 'mf-stats.json';
@@ -65055,17 +65750,29 @@ function readPKGJson(root) {
65055
65750
  } catch {}
65056
65751
  return {};
65057
65752
  }
65058
- function getBuildInfo(isDev, root) {
65059
- const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
65753
+ function getBuildInfo(isDev, compiler, mfConfig) {
65754
+ const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
65060
65755
  const pkg = readPKGJson(rootPath);
65061
65756
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
65062
- return {
65757
+ const statsBuildInfo = {
65063
65758
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
65064
65759
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
65065
65760
  };
65761
+ const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
65762
+ const enableTreeShaking = Object.values(normalizedShared).some((config)=>config[1].treeShaking);
65763
+ if (enableTreeShaking) {
65764
+ statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
65765
+ statsBuildInfo.plugins = mfConfig.treeShakingSharedPlugins || [];
65766
+ statsBuildInfo.excludePlugins = mfConfig.treeShakingSharedExcludePlugins || [];
65767
+ }
65768
+ return statsBuildInfo;
65066
65769
  }
65067
65770
  function getFileName(manifestOptions) {
65068
65771
  if (!manifestOptions) return {
65772
+ statsFileName: '',
65773
+ manifestFileName: ''
65774
+ };
65775
+ if ('boolean' == typeof manifestOptions) return {
65069
65776
  statsFileName: STATS_FILE_NAME,
65070
65777
  manifestFileName: MANIFEST_FILE_NAME
65071
65778
  };
@@ -65083,19 +65790,101 @@ function getFileName(manifestOptions) {
65083
65790
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
65084
65791
  };
65085
65792
  }
65793
+ function resolveLibraryGlobalName(library) {
65794
+ if (!library) return;
65795
+ const libName = library.name;
65796
+ if (!libName) return;
65797
+ if ('string' == typeof libName) return libName;
65798
+ if (Array.isArray(libName)) return libName[0];
65799
+ if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
65800
+ }
65801
+ function collectManifestExposes(exposes) {
65802
+ if (!exposes) return;
65803
+ const parsed = parseOptions(exposes, (value)=>({
65804
+ import: Array.isArray(value) ? value : [
65805
+ value
65806
+ ],
65807
+ name: void 0
65808
+ }), (value)=>({
65809
+ import: Array.isArray(value.import) ? value.import : [
65810
+ value.import
65811
+ ],
65812
+ name: value.name ?? void 0
65813
+ }));
65814
+ const result = parsed.map(([exposeKey, info])=>{
65815
+ const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
65816
+ return {
65817
+ path: exposeKey,
65818
+ name: exposeName
65819
+ };
65820
+ });
65821
+ return result.length > 0 ? result : void 0;
65822
+ }
65823
+ function collectManifestShared(shared) {
65824
+ if (!shared) return;
65825
+ const parsed = parseOptions(shared, (item, key)=>{
65826
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
65827
+ return item !== key && isRequiredVersion(item) ? {
65828
+ import: key,
65829
+ requiredVersion: item
65830
+ } : {
65831
+ import: item
65832
+ };
65833
+ }, (item)=>item);
65834
+ const result = parsed.map(([key, config])=>{
65835
+ const name = config.shareKey || key;
65836
+ const version = 'string' == typeof config.version ? config.version : void 0;
65837
+ const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
65838
+ return {
65839
+ name,
65840
+ version,
65841
+ requiredVersion,
65842
+ singleton: config.singleton
65843
+ };
65844
+ });
65845
+ return result.length > 0 ? result : void 0;
65846
+ }
65847
+ function normalizeManifestOptions(mfConfig) {
65848
+ const manifestOptions = true === mfConfig.manifest ? {} : {
65849
+ ...mfConfig.manifest
65850
+ };
65851
+ const containerName = mfConfig.name;
65852
+ const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
65853
+ const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
65854
+ if (cur[1].length > 1) return sum;
65855
+ const remoteInfo = cur[1][0];
65856
+ const { entry, alias, name } = remoteInfo;
65857
+ if (entry && name) sum[alias] = {
65858
+ name,
65859
+ entry
65860
+ };
65861
+ return sum;
65862
+ }, {});
65863
+ const manifestExposes = collectManifestExposes(mfConfig.exposes);
65864
+ if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65865
+ const manifestShared = collectManifestShared(mfConfig.shared);
65866
+ if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65867
+ return {
65868
+ ...manifestOptions,
65869
+ remoteAliasMap,
65870
+ globalName,
65871
+ name: containerName
65872
+ };
65873
+ }
65086
65874
  class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65087
65875
  name = external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin;
65088
- opts;
65876
+ rawOpts;
65089
65877
  constructor(opts){
65090
65878
  super();
65091
- this.opts = opts;
65879
+ this.rawOpts = opts;
65092
65880
  }
65093
65881
  raw(compiler) {
65094
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
65095
- const { statsFileName, manifestFileName } = getFileName(this.opts);
65882
+ const opts = normalizeManifestOptions(this.rawOpts);
65883
+ const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
65884
+ const { statsFileName, manifestFileName } = getFileName(opts);
65096
65885
  const rawOptions = {
65097
- name: this.opts.name,
65098
- globalName: this.opts.globalName,
65886
+ name: opts.name,
65887
+ globalName: opts.globalName,
65099
65888
  fileName,
65100
65889
  filePath,
65101
65890
  manifestFileName,
@@ -65104,38 +65893,447 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65104
65893
  remoteAliasMap,
65105
65894
  exposes,
65106
65895
  shared,
65107
- buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
65896
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
65108
65897
  };
65109
65898
  return createBuiltinPlugin(this.name, rawOptions);
65110
65899
  }
65111
65900
  }
65112
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65113
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65114
- const array = (items)=>{
65115
- for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
65116
- else if (item && 'object' == typeof item) object(item);
65117
- else throw new Error('Unexpected options format');
65118
- };
65119
- const object = (obj)=>{
65120
- for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65121
- };
65122
- if (!options) return;
65123
- if (Array.isArray(options)) array(options);
65124
- else if ('object' == typeof options) object(options);
65125
- else throw new Error('Unexpected options format');
65126
- };
65127
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65128
- const items = [];
65129
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65130
- items.push([
65131
- key,
65132
- value
65133
- ]);
65134
- });
65135
- return items;
65901
+ const SHARE_ENTRY_ASSET = 'collect-shared-entries.json';
65902
+ class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
65903
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.CollectSharedEntryPlugin;
65904
+ sharedOptions;
65905
+ _collectedEntries;
65906
+ constructor(options){
65907
+ super();
65908
+ const { sharedOptions } = options;
65909
+ this.sharedOptions = sharedOptions;
65910
+ this._collectedEntries = {};
65911
+ }
65912
+ getData() {
65913
+ return this._collectedEntries;
65914
+ }
65915
+ getFilename() {
65916
+ return SHARE_ENTRY_ASSET;
65917
+ }
65918
+ apply(compiler) {
65919
+ super.apply(compiler);
65920
+ compiler.hooks.thisCompilation.tap('Collect shared entry', (compilation)=>{
65921
+ compilation.hooks.processAssets.tap({
65922
+ name: 'CollectSharedEntry',
65923
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
65924
+ }, ()=>{
65925
+ compilation.getAssets().forEach((asset)=>{
65926
+ if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
65927
+ compilation.deleteAsset(asset.name);
65928
+ });
65929
+ });
65930
+ });
65931
+ }
65932
+ raw() {
65933
+ const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
65934
+ const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
65935
+ const rawOptions = {
65936
+ consumes: normalizedConsumeShareOptions.map(([key, v])=>({
65937
+ key,
65938
+ ...v
65939
+ })),
65940
+ filename: this.getFilename()
65941
+ };
65942
+ return createBuiltinPlugin(this.name, rawOptions);
65943
+ }
65944
+ }
65945
+ function assert(condition, msg) {
65946
+ if (!condition) throw new Error(msg);
65947
+ }
65948
+ const HOT_UPDATE_SUFFIX = '.hot-update';
65949
+ class SharedContainerPlugin extends RspackBuiltinPlugin {
65950
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.SharedContainerPlugin;
65951
+ filename = '';
65952
+ _options;
65953
+ _shareName;
65954
+ _globalName;
65955
+ constructor(options){
65956
+ super();
65957
+ const { shareName, library, request, independentShareFileName, mfName } = options;
65958
+ const version = options.version || '0.0.0';
65959
+ this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
65960
+ const fileName = independentShareFileName || `${version}/share-entry.js`;
65961
+ this._shareName = shareName;
65962
+ this._options = {
65963
+ name: shareName,
65964
+ request: request,
65965
+ library: (library ? {
65966
+ ...library,
65967
+ name: this._globalName
65968
+ } : void 0) || {
65969
+ type: 'global',
65970
+ name: this._globalName
65971
+ },
65972
+ version,
65973
+ fileName
65974
+ };
65975
+ }
65976
+ getData() {
65977
+ return [
65978
+ this._options.fileName,
65979
+ this._globalName,
65980
+ this._options.version
65981
+ ];
65982
+ }
65983
+ raw(compiler) {
65984
+ const { library } = this._options;
65985
+ if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
65986
+ return createBuiltinPlugin(this.name, this._options);
65987
+ }
65988
+ apply(compiler) {
65989
+ super.apply(compiler);
65990
+ const shareName = this._shareName;
65991
+ compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
65992
+ compilation.hooks.processAssets.tap({
65993
+ name: 'getShareContainerFile'
65994
+ }, ()=>{
65995
+ const remoteEntryPoint = compilation.entrypoints.get(shareName);
65996
+ assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
65997
+ const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
65998
+ assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
65999
+ const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith('.css'));
66000
+ assert(files.length > 0, `no files found for shared ${shareName} chunk`);
66001
+ assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(',')}`);
66002
+ this.filename = files[0];
66003
+ });
66004
+ });
66005
+ }
66006
+ }
66007
+ class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
66008
+ name = external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin;
66009
+ sharedOptions;
66010
+ injectTreeShakingUsedExports;
66011
+ manifestOptions;
66012
+ constructor(sharedOptions, injectTreeShakingUsedExports, manifestOptions){
66013
+ super();
66014
+ this.sharedOptions = sharedOptions;
66015
+ this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
66016
+ this.manifestOptions = manifestOptions ?? {};
66017
+ }
66018
+ buildOptions() {
66019
+ const shared = this.sharedOptions.map(([shareKey, config])=>({
66020
+ shareKey,
66021
+ treeShaking: !!config.treeShaking,
66022
+ usedExports: config.treeShaking?.usedExports
66023
+ }));
66024
+ const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
66025
+ return {
66026
+ shared,
66027
+ injectTreeShakingUsedExports: this.injectTreeShakingUsedExports,
66028
+ manifestFileName,
66029
+ statsFileName
66030
+ };
66031
+ }
66032
+ raw() {
66033
+ if (!this.sharedOptions.length) return;
66034
+ return createBuiltinPlugin(this.name, this.buildOptions());
66035
+ }
66036
+ }
66037
+ const VIRTUAL_ENTRY = './virtual-entry.js';
66038
+ const VIRTUAL_ENTRY_NAME = 'virtual-entry';
66039
+ const filterPlugin = (plugin, excludedPlugins = [])=>{
66040
+ if (!plugin) return true;
66041
+ const pluginName = plugin.name || plugin.constructor?.name;
66042
+ if (!pluginName) return true;
66043
+ return ![
66044
+ 'TreeShakingSharedPlugin',
66045
+ 'IndependentSharedPlugin',
66046
+ 'ModuleFederationPlugin',
66047
+ 'SharedUsedExportsOptimizerPlugin',
66048
+ 'HtmlWebpackPlugin',
66049
+ 'HtmlRspackPlugin',
66050
+ 'RsbuildHtmlPlugin',
66051
+ ...excludedPlugins
66052
+ ].includes(pluginName);
65136
66053
  };
66054
+ class VirtualEntryPlugin {
66055
+ sharedOptions;
66056
+ collectShared = false;
66057
+ constructor(sharedOptions, collectShared){
66058
+ this.sharedOptions = sharedOptions;
66059
+ this.collectShared = collectShared;
66060
+ }
66061
+ createEntry() {
66062
+ const { sharedOptions, collectShared } = this;
66063
+ const entryContent = sharedOptions.reduce((acc, cur, index)=>{
66064
+ const importLine = `import shared_${index} from '${cur[0]}';\n`;
66065
+ const logLine = collectShared ? `console.log(shared_${index});\n` : '';
66066
+ return acc + importLine + logLine;
66067
+ }, '');
66068
+ return entryContent;
66069
+ }
66070
+ static entry() {
66071
+ return {
66072
+ [VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
66073
+ };
66074
+ }
66075
+ apply(compiler) {
66076
+ new compiler.rspack.experiments.VirtualModulesPlugin({
66077
+ [VIRTUAL_ENTRY]: this.createEntry()
66078
+ }).apply(compiler);
66079
+ compiler.hooks.thisCompilation.tap('RemoveVirtualEntryAsset', (compilation)=>{
66080
+ compilation.hooks.processAssets.tap({
66081
+ name: 'RemoveVirtualEntryAsset',
66082
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
66083
+ }, ()=>{
66084
+ try {
66085
+ const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
66086
+ chunk?.files.forEach((f)=>{
66087
+ compilation.deleteAsset(f);
66088
+ });
66089
+ } catch (_e) {
66090
+ console.error('Failed to remove virtual entry file!');
66091
+ }
66092
+ });
66093
+ });
66094
+ }
66095
+ }
66096
+ const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
66097
+ class IndependentSharedPlugin {
66098
+ mfName;
66099
+ shared;
66100
+ library;
66101
+ sharedOptions;
66102
+ outputDir;
66103
+ plugins;
66104
+ treeShaking;
66105
+ manifest;
66106
+ buildAssets = {};
66107
+ injectTreeShakingUsedExports;
66108
+ treeShakingSharedExcludePlugins;
66109
+ name = 'IndependentSharedPlugin';
66110
+ constructor(options){
66111
+ const { outputDir, plugins, treeShaking, shared, name, manifest, injectTreeShakingUsedExports, library, treeShakingSharedExcludePlugins } = options;
66112
+ this.shared = shared;
66113
+ this.mfName = name;
66114
+ this.outputDir = outputDir || 'independent-packages';
66115
+ this.plugins = plugins || [];
66116
+ this.treeShaking = treeShaking;
66117
+ this.manifest = manifest;
66118
+ this.injectTreeShakingUsedExports = injectTreeShakingUsedExports ?? true;
66119
+ this.library = library;
66120
+ this.treeShakingSharedExcludePlugins = treeShakingSharedExcludePlugins || [];
66121
+ this.sharedOptions = parseOptions(shared, (item, key)=>{
66122
+ if ('string' != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
66123
+ const config = item !== key && isRequiredVersion(item) ? {
66124
+ import: key,
66125
+ requiredVersion: item
66126
+ } : {
66127
+ import: item
66128
+ };
66129
+ return config;
66130
+ }, (item)=>item);
66131
+ }
66132
+ apply(compiler) {
66133
+ const { manifest } = this;
66134
+ let runCount = 0;
66135
+ compiler.hooks.beforeRun.tapPromise('IndependentSharedPlugin', async ()=>{
66136
+ if (runCount) return;
66137
+ await this.createIndependentCompilers(compiler);
66138
+ runCount++;
66139
+ });
66140
+ compiler.hooks.watchRun.tapPromise('IndependentSharedPlugin', async ()=>{
66141
+ if (runCount) return;
66142
+ await this.createIndependentCompilers(compiler);
66143
+ runCount++;
66144
+ });
66145
+ if (manifest) compiler.hooks.compilation.tap('IndependentSharedPlugin', (compilation)=>{
66146
+ compilation.hooks.processAssets.tap({
66147
+ name: 'injectBuildAssets',
66148
+ stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
66149
+ }, ()=>{
66150
+ const { statsFileName, manifestFileName } = getFileName(manifest);
66151
+ const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
66152
+ const stats = compilation.getAsset(filename);
66153
+ if (!stats) return;
66154
+ const statsContent = JSON.parse(stats.source.source().toString());
66155
+ const { shared } = statsContent;
66156
+ Object.entries(this.buildAssets).forEach(([key, item])=>{
66157
+ const targetShared = shared.find((s)=>s.name === key);
66158
+ if (!targetShared) return;
66159
+ item.forEach(([entry, version, globalName])=>{
66160
+ if (version === targetShared.version) {
66161
+ targetShared.fallback = entry;
66162
+ targetShared.fallbackName = globalName;
66163
+ }
66164
+ });
66165
+ });
66166
+ compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
66167
+ };
66168
+ injectBuildAssetsIntoStatsOrManifest(statsFileName);
66169
+ injectBuildAssetsIntoStatsOrManifest(manifestFileName);
66170
+ });
66171
+ });
66172
+ }
66173
+ async createIndependentCompilers(parentCompiler) {
66174
+ const { sharedOptions, buildAssets, outputDir } = this;
66175
+ console.log('Start building shared fallback resources ...');
66176
+ const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
66177
+ await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
66178
+ if (!shareConfig.treeShaking || false === shareConfig.import) return;
66179
+ const shareRequests = shareRequestsMap[shareName].requests;
66180
+ await Promise.all(shareRequests.map(async ([request, version])=>{
66181
+ const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
66182
+ const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
66183
+ shareRequestsMap,
66184
+ currentShare: {
66185
+ shareName,
66186
+ version,
66187
+ request,
66188
+ independentShareFileName: sharedConfig?.treeShaking?.filename
66189
+ }
66190
+ });
66191
+ if ('string' == typeof shareFileName) {
66192
+ buildAssets[shareName] ||= [];
66193
+ buildAssets[shareName].push([
66194
+ (0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
66195
+ sharedVersion,
66196
+ globalName
66197
+ ]);
66198
+ }
66199
+ }));
66200
+ }));
66201
+ console.log('All shared fallback have been compiled successfully!');
66202
+ }
66203
+ async createIndependentCompiler(parentCompiler, extraOptions) {
66204
+ const { mfName, plugins, outputDir, sharedOptions, treeShaking, library, treeShakingSharedExcludePlugins } = this;
66205
+ const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || '');
66206
+ const parentConfig = parentCompiler.options;
66207
+ const finalPlugins = [];
66208
+ const rspack = parentCompiler.rspack;
66209
+ let extraPlugin;
66210
+ extraPlugin = extraOptions ? new SharedContainerPlugin({
66211
+ mfName: `${mfName}_${treeShaking ? 't' : 'f'}`,
66212
+ library,
66213
+ ...extraOptions.currentShare
66214
+ }) : new CollectSharedEntryPlugin({
66215
+ sharedOptions,
66216
+ shareScope: 'default'
66217
+ });
66218
+ (parentConfig.plugins || []).forEach((plugin)=>{
66219
+ if (void 0 !== plugin && 'string' != typeof plugin && filterPlugin(plugin, treeShakingSharedExcludePlugins)) finalPlugins.push(plugin);
66220
+ });
66221
+ plugins.forEach((plugin)=>{
66222
+ finalPlugins.push(plugin);
66223
+ });
66224
+ finalPlugins.push(extraPlugin);
66225
+ finalPlugins.push(new ConsumeSharedPlugin({
66226
+ consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
66227
+ [key]: {
66228
+ import: extraOptions ? false : options.import,
66229
+ shareKey: options.shareKey || key,
66230
+ shareScope: options.shareScope,
66231
+ requiredVersion: options.requiredVersion,
66232
+ strictVersion: options.strictVersion,
66233
+ singleton: options.singleton,
66234
+ packageName: options.packageName,
66235
+ eager: options.eager
66236
+ }
66237
+ })),
66238
+ enhanced: true
66239
+ }));
66240
+ if (treeShaking) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectTreeShakingUsedExports));
66241
+ finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
66242
+ const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
66243
+ const compilerConfig = {
66244
+ ...parentConfig,
66245
+ module: {
66246
+ ...parentConfig.module,
66247
+ rules: [
66248
+ {
66249
+ test: /virtual-entry\.js$/,
66250
+ type: "javascript/auto",
66251
+ resolve: {
66252
+ fullySpecified: false
66253
+ },
66254
+ use: {
66255
+ loader: 'builtin:swc-loader'
66256
+ }
66257
+ },
66258
+ ...parentConfig.module?.rules || []
66259
+ ]
66260
+ },
66261
+ mode: parentConfig.mode || 'development',
66262
+ entry: VirtualEntryPlugin.entry,
66263
+ output: {
66264
+ path: fullOutputDir,
66265
+ clean: true,
66266
+ publicPath: parentConfig.output?.publicPath || 'auto'
66267
+ },
66268
+ plugins: finalPlugins,
66269
+ optimization: {
66270
+ ...parentConfig.optimization,
66271
+ splitChunks: false
66272
+ }
66273
+ };
66274
+ const compiler = rspack.rspack(compilerConfig);
66275
+ compiler.inputFileSystem = parentCompiler.inputFileSystem;
66276
+ compiler.outputFileSystem = parentCompiler.outputFileSystem;
66277
+ compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
66278
+ const { currentShare } = extraOptions || {};
66279
+ return new Promise((resolve, reject)=>{
66280
+ compiler.run((err, stats)=>{
66281
+ if (err || stats?.hasErrors()) {
66282
+ const target = currentShare ? currentShare.shareName : 'Collect deps';
66283
+ console.error(`${target} Compile failed:`, err || stats.toJson().errors.map((e)=>e.message).join('\n'));
66284
+ reject(err || new Error(`${target} Compile failed`));
66285
+ return;
66286
+ }
66287
+ currentShare && console.log(`${currentShare.shareName} Compile success`);
66288
+ resolve(extraPlugin.getData());
66289
+ });
66290
+ });
66291
+ }
66292
+ }
66293
+ class TreeShakingSharedPlugin {
66294
+ mfConfig;
66295
+ outputDir;
66296
+ secondary;
66297
+ _independentSharePlugin;
66298
+ name = 'TreeShakingSharedPlugin';
66299
+ constructor(options){
66300
+ const { mfConfig, secondary } = options;
66301
+ this.mfConfig = mfConfig;
66302
+ this.outputDir = mfConfig.treeShakingSharedDir || 'independent-packages';
66303
+ this.secondary = Boolean(secondary);
66304
+ }
66305
+ apply(compiler) {
66306
+ const { mfConfig, outputDir, secondary } = this;
66307
+ const { name, shared, library, treeShakingSharedPlugins } = mfConfig;
66308
+ if (!shared) return;
66309
+ const sharedOptions = normalizeSharedOptions(shared);
66310
+ if (!sharedOptions.length) return;
66311
+ if (sharedOptions.some(([_, config])=>config.treeShaking && false !== config.import)) {
66312
+ if (!secondary) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectTreeShakingUsedExports, mfConfig.manifest).apply(compiler);
66313
+ this._independentSharePlugin = new IndependentSharedPlugin({
66314
+ name: name,
66315
+ shared: shared,
66316
+ outputDir,
66317
+ plugins: treeShakingSharedPlugins?.map((p)=>{
66318
+ const _constructor = require(p);
66319
+ return new _constructor();
66320
+ }) || [],
66321
+ treeShaking: secondary,
66322
+ library,
66323
+ manifest: mfConfig.manifest,
66324
+ treeShakingSharedExcludePlugins: mfConfig.treeShakingSharedExcludePlugins
66325
+ });
66326
+ this._independentSharePlugin.apply(compiler);
66327
+ }
66328
+ }
66329
+ get buildAssets() {
66330
+ return this._independentSharePlugin?.buildAssets || {};
66331
+ }
66332
+ }
66333
+ const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65137
66334
  class ModuleFederationPlugin {
65138
66335
  _options;
66336
+ _treeShakingSharedPlugin;
65139
66337
  constructor(_options){
65140
66338
  this._options = _options;
65141
66339
  }
@@ -65147,15 +66345,44 @@ class ModuleFederationPlugin {
65147
66345
  '@module-federation/runtime': paths.runtime,
65148
66346
  ...compiler.options.resolve.alias
65149
66347
  };
65150
- const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
66348
+ const sharedOptions = getSharedOptions(this._options);
66349
+ const treeShakingEntries = sharedOptions.filter(([, config])=>config.treeShaking);
66350
+ if (treeShakingEntries.length > 0) {
66351
+ this._treeShakingSharedPlugin = new TreeShakingSharedPlugin({
66352
+ mfConfig: this._options,
66353
+ secondary: false
66354
+ });
66355
+ this._treeShakingSharedPlugin.apply(compiler);
66356
+ }
65151
66357
  const asyncStartup = this._options.experiments?.asyncStartup ?? false;
65152
66358
  const runtimeExperiments = {
65153
66359
  asyncStartup
65154
66360
  };
65155
- new ModuleFederationRuntimePlugin({
65156
- entryRuntime,
65157
- experiments: runtimeExperiments
65158
- }).apply(compiler);
66361
+ let runtimePluginApplied = false;
66362
+ compiler.hooks.beforeRun.tap({
66363
+ name: 'ModuleFederationPlugin',
66364
+ stage: 100
66365
+ }, ()=>{
66366
+ if (runtimePluginApplied) return;
66367
+ runtimePluginApplied = true;
66368
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets);
66369
+ new ModuleFederationRuntimePlugin({
66370
+ entryRuntime,
66371
+ experiments: runtimeExperiments
66372
+ }).apply(compiler);
66373
+ });
66374
+ compiler.hooks.watchRun.tap({
66375
+ name: 'ModuleFederationPlugin',
66376
+ stage: 100
66377
+ }, ()=>{
66378
+ if (runtimePluginApplied) return;
66379
+ runtimePluginApplied = true;
66380
+ const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakingSharedPlugin?.buildAssets || {});
66381
+ new ModuleFederationRuntimePlugin({
66382
+ entryRuntime,
66383
+ experiments: runtimeExperiments
66384
+ }).apply(compiler);
66385
+ });
65159
66386
  const v1Options = {
65160
66387
  name: this._options.name,
65161
66388
  exposes: this._options.exposes,
@@ -65169,89 +66396,9 @@ class ModuleFederationPlugin {
65169
66396
  enhanced: true
65170
66397
  };
65171
66398
  new webpack.container.ModuleFederationPluginV1(v1Options).apply(compiler);
65172
- if (this._options.manifest) {
65173
- const manifestOptions = true === this._options.manifest ? {} : {
65174
- ...this._options.manifest
65175
- };
65176
- const containerName = manifestOptions.name ?? this._options.name;
65177
- const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
65178
- const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
65179
- if (cur[1].length > 1) return sum;
65180
- const remoteInfo = cur[1][0];
65181
- const { entry, alias, name } = remoteInfo;
65182
- if (entry && name) sum[alias] = {
65183
- name,
65184
- entry
65185
- };
65186
- return sum;
65187
- }, {});
65188
- const manifestExposes = collectManifestExposes(this._options.exposes);
65189
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65190
- const manifestShared = collectManifestShared(this._options.shared);
65191
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65192
- new ModuleFederationManifestPlugin({
65193
- ...manifestOptions,
65194
- name: containerName,
65195
- globalName,
65196
- remoteAliasMap
65197
- }).apply(compiler);
65198
- }
66399
+ if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
65199
66400
  }
65200
66401
  }
65201
- function collectManifestExposes(exposes) {
65202
- if (!exposes) return;
65203
- const parsed = parseOptions(exposes, (value)=>({
65204
- import: Array.isArray(value) ? value : [
65205
- value
65206
- ],
65207
- name: void 0
65208
- }), (value)=>({
65209
- import: Array.isArray(value.import) ? value.import : [
65210
- value.import
65211
- ],
65212
- name: value.name ?? void 0
65213
- }));
65214
- const result = parsed.map(([exposeKey, info])=>{
65215
- const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
65216
- return {
65217
- path: exposeKey,
65218
- name: exposeName
65219
- };
65220
- });
65221
- return result.length > 0 ? result : void 0;
65222
- }
65223
- function collectManifestShared(shared) {
65224
- if (!shared) return;
65225
- const parsed = parseOptions(shared, (item, key)=>{
65226
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
65227
- return item !== key && isRequiredVersion(item) ? {
65228
- import: key,
65229
- requiredVersion: item
65230
- } : {
65231
- import: item
65232
- };
65233
- }, (item)=>item);
65234
- const result = parsed.map(([key, config])=>{
65235
- const name = config.shareKey || key;
65236
- const version = 'string' == typeof config.version ? config.version : void 0;
65237
- const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
65238
- return {
65239
- name,
65240
- version,
65241
- requiredVersion,
65242
- singleton: config.singleton
65243
- };
65244
- });
65245
- return result.length > 0 ? result : void 0;
65246
- }
65247
- function resolveLibraryGlobalName(library) {
65248
- if (!library) return;
65249
- const libName = library.name;
65250
- if (!libName) return;
65251
- if ('string' == typeof libName) return libName;
65252
- if (Array.isArray(libName)) return libName[0];
65253
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
65254
- }
65255
66402
  function getRemoteInfos(options) {
65256
66403
  if (!options.remotes) return {};
65257
66404
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -65318,6 +66465,18 @@ function getRemoteInfos(options) {
65318
66465
  function getRuntimePlugins(options) {
65319
66466
  return options.runtimePlugins ?? [];
65320
66467
  }
66468
+ function getSharedOptions(options) {
66469
+ if (!options.shared) return [];
66470
+ return parseOptions(options.shared, (item, key)=>{
66471
+ if ('string' != typeof item) throw new Error('Unexpected array in shared');
66472
+ return item !== key && isRequiredVersion(item) ? {
66473
+ import: key,
66474
+ requiredVersion: item
66475
+ } : {
66476
+ import: item
66477
+ };
66478
+ }, (item)=>item);
66479
+ }
65321
66480
  function getPaths(options, compiler) {
65322
66481
  return {
65323
66482
  runtimeTools: '@module-federation/runtime-tools',
@@ -65325,11 +66484,12 @@ function getPaths(options, compiler) {
65325
66484
  runtime: '@module-federation/runtime'
65326
66485
  };
65327
66486
  }
65328
- function getDefaultEntryRuntime(paths, options, compiler) {
66487
+ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
65329
66488
  const runtimePlugins = getRuntimePlugins(options);
65330
66489
  const remoteInfos = getRemoteInfos(options);
65331
66490
  const runtimePluginImports = [];
65332
66491
  const runtimePluginVars = [];
66492
+ const libraryType = options.library?.type || 'var';
65333
66493
  for(let i = 0; i < runtimePlugins.length; i++){
65334
66494
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
65335
66495
  const pluginSpec = runtimePlugins[i];
@@ -65346,182 +66506,12 @@ function getDefaultEntryRuntime(paths, options, compiler) {
65346
66506
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
65347
66507
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
65348
66508
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
65349
- '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",(module,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module)?moduleMap[module]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module+\'" 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})}}'
66509
+ `const __module_federation_share_fallbacks__ = ${JSON.stringify(treeShakingShareFallbacks)}`,
66510
+ `const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
66511
+ '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",(module,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module)?moduleMap[module]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module+\'" 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})}}'
65350
66512
  ].join(';');
65351
66513
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
65352
66514
  }
65353
- const compilerSet = new WeakSet();
65354
- function isSingleton(compiler) {
65355
- return compilerSet.has(compiler);
65356
- }
65357
- function setSingleton(compiler) {
65358
- compilerSet.add(compiler);
65359
- }
65360
- class ShareRuntimePlugin extends RspackBuiltinPlugin {
65361
- enhanced;
65362
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
65363
- constructor(enhanced = false){
65364
- super(), this.enhanced = enhanced;
65365
- }
65366
- raw(compiler) {
65367
- if (isSingleton(compiler)) return;
65368
- setSingleton(compiler);
65369
- return createBuiltinPlugin(this.name, this.enhanced);
65370
- }
65371
- }
65372
- class ConsumeSharedPlugin extends RspackBuiltinPlugin {
65373
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin;
65374
- _options;
65375
- constructor(options){
65376
- super();
65377
- this._options = {
65378
- consumes: parseOptions(options.consumes, (item, key)=>{
65379
- if (Array.isArray(item)) throw new Error('Unexpected array in options');
65380
- const result = item !== key && isRequiredVersion(item) ? {
65381
- import: key,
65382
- shareScope: options.shareScope || 'default',
65383
- shareKey: key,
65384
- requiredVersion: item,
65385
- strictVersion: true,
65386
- packageName: void 0,
65387
- singleton: false,
65388
- eager: false
65389
- } : {
65390
- import: key,
65391
- shareScope: options.shareScope || 'default',
65392
- shareKey: key,
65393
- requiredVersion: void 0,
65394
- packageName: void 0,
65395
- strictVersion: false,
65396
- singleton: false,
65397
- eager: false
65398
- };
65399
- return result;
65400
- }, (item, key)=>({
65401
- import: false === item.import ? void 0 : item.import || key,
65402
- shareScope: item.shareScope || options.shareScope || 'default',
65403
- shareKey: item.shareKey || key,
65404
- requiredVersion: item.requiredVersion,
65405
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
65406
- packageName: item.packageName,
65407
- singleton: !!item.singleton,
65408
- eager: !!item.eager
65409
- })),
65410
- enhanced: options.enhanced ?? false
65411
- };
65412
- }
65413
- raw(compiler) {
65414
- new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
65415
- const rawOptions = {
65416
- consumes: this._options.consumes.map(([key, v])=>({
65417
- key,
65418
- ...v
65419
- })),
65420
- enhanced: this._options.enhanced
65421
- };
65422
- return createBuiltinPlugin(this.name, rawOptions);
65423
- }
65424
- }
65425
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
65426
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin;
65427
- _provides;
65428
- _enhanced;
65429
- constructor(options){
65430
- super();
65431
- this._provides = parseOptions(options.provides, (item)=>{
65432
- if (Array.isArray(item)) throw new Error('Unexpected array of provides');
65433
- return {
65434
- shareKey: item,
65435
- version: void 0,
65436
- shareScope: options.shareScope || 'default',
65437
- eager: false
65438
- };
65439
- }, (item)=>{
65440
- const raw = {
65441
- shareKey: item.shareKey,
65442
- version: item.version,
65443
- shareScope: item.shareScope || options.shareScope || 'default',
65444
- eager: !!item.eager
65445
- };
65446
- if (options.enhanced) {
65447
- const enhancedItem = item;
65448
- return {
65449
- ...raw,
65450
- singleton: enhancedItem.singleton,
65451
- requiredVersion: enhancedItem.requiredVersion,
65452
- strictVersion: enhancedItem.strictVersion
65453
- };
65454
- }
65455
- return raw;
65456
- });
65457
- this._enhanced = options.enhanced;
65458
- }
65459
- raw(compiler) {
65460
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
65461
- const rawOptions = this._provides.map(([key, v])=>({
65462
- key,
65463
- ...v
65464
- }));
65465
- return createBuiltinPlugin(this.name, rawOptions);
65466
- }
65467
- }
65468
- class SharePlugin {
65469
- _shareScope;
65470
- _consumes;
65471
- _provides;
65472
- _enhanced;
65473
- constructor(options){
65474
- const sharedOptions = parseOptions(options.shared, (item, key)=>{
65475
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
65476
- const config = item !== key && isRequiredVersion(item) ? {
65477
- import: key,
65478
- requiredVersion: item
65479
- } : {
65480
- import: item
65481
- };
65482
- return config;
65483
- }, (item)=>item);
65484
- const consumes = sharedOptions.map(([key, options])=>({
65485
- [key]: {
65486
- import: options.import,
65487
- shareKey: options.shareKey || key,
65488
- shareScope: options.shareScope,
65489
- requiredVersion: options.requiredVersion,
65490
- strictVersion: options.strictVersion,
65491
- singleton: options.singleton,
65492
- packageName: options.packageName,
65493
- eager: options.eager
65494
- }
65495
- }));
65496
- const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
65497
- [options.import || key]: {
65498
- shareKey: options.shareKey || key,
65499
- shareScope: options.shareScope,
65500
- version: options.version,
65501
- eager: options.eager,
65502
- singleton: options.singleton,
65503
- requiredVersion: options.requiredVersion,
65504
- strictVersion: options.strictVersion
65505
- }
65506
- }));
65507
- this._shareScope = options.shareScope;
65508
- this._consumes = consumes;
65509
- this._provides = provides;
65510
- this._enhanced = options.enhanced ?? false;
65511
- }
65512
- apply(compiler) {
65513
- new ConsumeSharedPlugin({
65514
- shareScope: this._shareScope,
65515
- consumes: this._consumes,
65516
- enhanced: this._enhanced
65517
- }).apply(compiler);
65518
- new ProvideSharedPlugin({
65519
- shareScope: this._shareScope,
65520
- provides: this._provides,
65521
- enhanced: this._enhanced
65522
- }).apply(compiler);
65523
- }
65524
- }
65525
66515
  class ContainerPlugin extends RspackBuiltinPlugin {
65526
66516
  name = external_rspack_wasi_browser_js_.BuiltinPluginName.ContainerPlugin;
65527
66517
  _options;
@@ -65531,7 +66521,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
65531
66521
  name: options.name,
65532
66522
  shareScope: options.shareScope || 'default',
65533
66523
  library: options.library || {
65534
- type: 'var',
66524
+ type: 'global',
65535
66525
  name: options.name
65536
66526
  },
65537
66527
  runtime: options.runtime,
@@ -65673,7 +66663,7 @@ function transformSync(source, options) {
65673
66663
  const _options = JSON.stringify(options || {});
65674
66664
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
65675
66665
  }
65676
- const exports_rspackVersion = "2.0.0-beta.0";
66666
+ const exports_rspackVersion = "2.0.0-beta.1";
65677
66667
  const exports_version = "5.75.0";
65678
66668
  const exports_WebpackError = Error;
65679
66669
  const exports_config = {
@@ -65723,6 +66713,7 @@ const container = {
65723
66713
  };
65724
66714
  const sharing = {
65725
66715
  ProvideSharedPlugin: ProvideSharedPlugin,
66716
+ TreeShakingSharedPlugin: TreeShakingSharedPlugin,
65726
66717
  ConsumeSharedPlugin: ConsumeSharedPlugin,
65727
66718
  SharePlugin: SharePlugin
65728
66719
  };
@@ -65760,7 +66751,7 @@ const exports_experiments = {
65760
66751
  VirtualModulesPlugin: VirtualModulesPlugin,
65761
66752
  rsc: rsc
65762
66753
  };
65763
- const src_fn = Object.assign(rspack, exports_namespaceObject);
66754
+ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
65764
66755
  src_fn.rspack = src_fn;
65765
66756
  src_fn.webpack = src_fn;
65766
66757
  const src_rspack_0 = src_fn;