@rspack-debug/browser 2.0.0-alpha.1 → 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");
@@ -16681,92 +17134,6 @@ __webpack_require__.add({
16681
17134
  return hasSymbols() && !!Symbol.toStringTag;
16682
17135
  };
16683
17136
  },
16684
- "../../node_modules/.pnpm/hash-base@3.0.5/node_modules/hash-base/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16685
- var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
16686
- var Transform = __webpack_require__("../../node_modules/.pnpm/stream-browserify@3.0.0/node_modules/stream-browserify/index.js").Transform;
16687
- var inherits = __webpack_require__("../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js");
16688
- function HashBase(blockSize) {
16689
- Transform.call(this);
16690
- this._block = Buffer.allocUnsafe(blockSize);
16691
- this._blockSize = blockSize;
16692
- this._blockOffset = 0;
16693
- this._length = [
16694
- 0,
16695
- 0,
16696
- 0,
16697
- 0
16698
- ];
16699
- this._finalized = false;
16700
- }
16701
- inherits(HashBase, Transform);
16702
- HashBase.prototype._transform = function(chunk, encoding, callback) {
16703
- var error = null;
16704
- try {
16705
- this.update(chunk, encoding);
16706
- } catch (err) {
16707
- error = err;
16708
- }
16709
- callback(error);
16710
- };
16711
- HashBase.prototype._flush = function(callback) {
16712
- var error = null;
16713
- try {
16714
- this.push(this.digest());
16715
- } catch (err) {
16716
- error = err;
16717
- }
16718
- callback(error);
16719
- };
16720
- var useUint8Array = "u" > typeof Uint8Array;
16721
- var useArrayBuffer = "u" > typeof ArrayBuffer && "u" > typeof Uint8Array && ArrayBuffer.isView && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT);
16722
- function toBuffer(data, encoding) {
16723
- if (data instanceof Buffer) return data;
16724
- if ('string' == typeof data) return Buffer.from(data, encoding);
16725
- if (useArrayBuffer && ArrayBuffer.isView(data)) {
16726
- if (0 === data.byteLength) return Buffer.alloc(0);
16727
- var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength);
16728
- if (res.byteLength === data.byteLength) return res;
16729
- }
16730
- if (useUint8Array && data instanceof Uint8Array) return Buffer.from(data);
16731
- if (Buffer.isBuffer(data) && data.constructor && 'function' == typeof data.constructor.isBuffer && data.constructor.isBuffer(data)) return Buffer.from(data);
16732
- throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');
16733
- }
16734
- HashBase.prototype.update = function(data, encoding) {
16735
- if (this._finalized) throw new Error('Digest already called');
16736
- data = toBuffer(data, encoding);
16737
- var block = this._block;
16738
- var offset = 0;
16739
- while(this._blockOffset + data.length - offset >= this._blockSize){
16740
- for(var i = this._blockOffset; i < this._blockSize;)block[i++] = data[offset++];
16741
- this._update();
16742
- this._blockOffset = 0;
16743
- }
16744
- while(offset < data.length)block[this._blockOffset++] = data[offset++];
16745
- for(var j = 0, carry = 8 * data.length; carry > 0; ++j){
16746
- this._length[j] += carry;
16747
- carry = this._length[j] / 0x0100000000 | 0;
16748
- if (carry > 0) this._length[j] -= 0x0100000000 * carry;
16749
- }
16750
- return this;
16751
- };
16752
- HashBase.prototype._update = function() {
16753
- throw new Error('_update is not implemented');
16754
- };
16755
- HashBase.prototype.digest = function(encoding) {
16756
- if (this._finalized) throw new Error('Digest already called');
16757
- this._finalized = true;
16758
- var digest = this._digest();
16759
- if (void 0 !== encoding) digest = digest.toString(encoding);
16760
- this._block.fill(0);
16761
- this._blockOffset = 0;
16762
- for(var i = 0; i < 4; ++i)this._length[i] = 0;
16763
- return digest;
16764
- };
16765
- HashBase.prototype._digest = function() {
16766
- throw new Error('_digest is not implemented');
16767
- };
16768
- module.exports = HashBase;
16769
- },
16770
17137
  "../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/index.js" (module, __unused_rspack_exports, __webpack_require__) {
16771
17138
  var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
16772
17139
  var toBuffer = __webpack_require__("../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/to-buffer.js");
@@ -18680,7 +19047,7 @@ __webpack_require__.add({
18680
19047
  },
18681
19048
  "../../node_modules/.pnpm/md5.js@1.3.5/node_modules/md5.js/index.js" (module, __unused_rspack_exports, __webpack_require__) {
18682
19049
  var inherits = __webpack_require__("../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js");
18683
- var HashBase = __webpack_require__("../../node_modules/.pnpm/hash-base@3.0.5/node_modules/hash-base/index.js");
19050
+ var HashBase = __webpack_require__("../../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/index.js");
18684
19051
  var Buffer = __webpack_require__("../../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js").Buffer;
18685
19052
  var ARRAY16 = new Array(16);
18686
19053
  function MD5() {
@@ -29566,7 +29933,7 @@ __webpack_require__.add({
29566
29933
  };
29567
29934
  },
29568
29935
  "../../node_modules/.pnpm/side-channel-map@1.0.1/node_modules/side-channel-map/index.js" (module, __unused_rspack_exports, __webpack_require__) {
29569
- 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");
29570
29937
  var callBound = __webpack_require__("../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js");
29571
29938
  var inspect = __webpack_require__("../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/index.js");
29572
29939
  var $TypeError = __webpack_require__("../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js");
@@ -29606,7 +29973,7 @@ __webpack_require__.add({
29606
29973
  };
29607
29974
  },
29608
29975
  "../../node_modules/.pnpm/side-channel-weakmap@1.0.2/node_modules/side-channel-weakmap/index.js" (module, __unused_rspack_exports, __webpack_require__) {
29609
- 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");
29610
29977
  var callBound = __webpack_require__("../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js");
29611
29978
  var inspect = __webpack_require__("../../node_modules/.pnpm/object-inspect@1.13.4/node_modules/object-inspect/index.js");
29612
29979
  var getSideChannelMap = __webpack_require__("../../node_modules/.pnpm/side-channel-map@1.0.1/node_modules/side-channel-map/index.js");
@@ -51820,6 +52187,9 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
51820
52187
  'chunks',
51821
52188
  'modules'
51822
52189
  ]),
52190
+ beforeModuleIds: new SyncHook([
52191
+ 'modules'
52192
+ ]),
51823
52193
  finishModules: new AsyncSeriesHook([
51824
52194
  'modules'
51825
52195
  ]),
@@ -51879,6 +52249,17 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
51879
52249
  afterSeal: new AsyncSeriesHook([]),
51880
52250
  needAdditionalPass: new SyncBailHook([])
51881
52251
  };
52252
+ const availableHooks = Object.keys(this.hooks);
52253
+ this.hooks = new Proxy(this.hooks, {
52254
+ get (target, prop, receiver) {
52255
+ const value = Reflect.get(target, prop, receiver);
52256
+ if (void 0 === value && 'string' == typeof prop) {
52257
+ const hooksList = availableHooks.join(', ');
52258
+ throw new Error(`Compilation.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compilation hooks: ${hooksList}`);
52259
+ }
52260
+ return value;
52261
+ }
52262
+ });
51882
52263
  this.compiler = compiler;
51883
52264
  this.resolverFactory = compiler.resolverFactory;
51884
52265
  this.inputFileSystem = compiler.inputFileSystem;
@@ -52825,7 +53206,6 @@ function applyLimits(options) {
52825
53206
  options.optimization.concatenateModules = false;
52826
53207
  options.optimization.removeEmptyChunks = false;
52827
53208
  options.output.chunkFormat = false;
52828
- options.output.module = true;
52829
53209
  if (options.output.chunkLoading && 'import' !== options.output.chunkLoading) options.output.chunkLoading = 'import';
52830
53210
  if (void 0 === options.output.chunkLoading) options.output.chunkLoading = 'import';
52831
53211
  let { splitChunks } = options.optimization;
@@ -53790,24 +54170,6 @@ class BulkUpdateDecorator extends Hash {
53790
54170
  return result;
53791
54171
  }
53792
54172
  }
53793
- class DebugHash extends Hash {
53794
- string;
53795
- constructor(){
53796
- super();
53797
- this.string = '';
53798
- }
53799
- update(data) {
53800
- let normalizedData;
53801
- normalizedData = createHash_Buffer.isBuffer(data) ? data.toString('utf-8') : data;
53802
- if (normalizedData.startsWith('debug-digest-')) normalizedData = createHash_Buffer.from(normalizedData.slice(13), 'hex').toString();
53803
- this.string += `[${normalizedData}](${new Error().stack?.split('\n', 3)[2]})\n`;
53804
- return this;
53805
- }
53806
- digest(encoding) {
53807
- const result = `debug-digest-${createHash_Buffer.from(this.string).toString('hex')}`;
53808
- return encoding ? result : createHash_Buffer.from(result);
53809
- }
53810
- }
53811
54173
  class WasmHashAdapter extends Hash {
53812
54174
  wasmHash;
53813
54175
  constructor(wasmHash){
@@ -53826,8 +54188,6 @@ class WasmHashAdapter extends Hash {
53826
54188
  const createHash_createHash = (algorithm)=>{
53827
54189
  if ('function' == typeof algorithm) return new BulkUpdateDecorator(()=>new algorithm());
53828
54190
  switch(algorithm){
53829
- case 'debug':
53830
- return new DebugHash();
53831
54191
  case 'xxhash64':
53832
54192
  {
53833
54193
  const hash = hash_xxhash64();
@@ -54915,8 +55275,7 @@ function getRawModule(module, options) {
54915
55275
  rules,
54916
55276
  parser: getRawParserOptionsMap(module.parser),
54917
55277
  generator: getRawGeneratorOptionsMap(module.generator),
54918
- noParse: module.noParse,
54919
- unsafeCache: module.unsafeCache
55278
+ noParse: module.noParse
54920
55279
  };
54921
55280
  }
54922
55281
  function tryMatch(payload, condition) {
@@ -55096,7 +55455,6 @@ function getRawJavascriptParserOptions(parser) {
55096
55455
  exportsPresence: false === parser.exportsPresence ? 'false' : parser.exportsPresence,
55097
55456
  importExportsPresence: false === parser.importExportsPresence ? 'false' : parser.importExportsPresence,
55098
55457
  reexportExportsPresence: false === parser.reexportExportsPresence ? 'false' : parser.reexportExportsPresence,
55099
- strictExportPresence: parser.strictExportPresence,
55100
55458
  worker: 'boolean' == typeof parser.worker ? parser.worker ? [
55101
55459
  '...'
55102
55460
  ] : [] : parser.worker,
@@ -55130,7 +55488,8 @@ function getRawAssetParserDataUrl(dataUrlCondition) {
55130
55488
  function getRawCssParserOptions(parser) {
55131
55489
  return {
55132
55490
  namedExports: parser.namedExports,
55133
- url: parser.url
55491
+ url: parser.url,
55492
+ resolveImport: parser.resolveImport
55134
55493
  };
55135
55494
  }
55136
55495
  function getRawJsonParserOptions(parser) {
@@ -57661,7 +58020,7 @@ const applyRspackOptionsDefaults = (options)=>{
57661
58020
  if ('function' != typeof options.entry) for (const key of Object.keys(options.entry))F(options.entry[key], 'import', ()=>[
57662
58021
  './src'
57663
58022
  ]);
57664
- F(options, 'devtool', ()=>development ? 'eval' : false);
58023
+ F(options, 'devtool', ()=>development ? 'cheap-module-source-map' : false);
57665
58024
  D(options, 'watch', false);
57666
58025
  D(options, 'lazyCompilation', false);
57667
58026
  D(options, 'bail', false);
@@ -57676,7 +58035,6 @@ const applyRspackOptionsDefaults = (options)=>{
57676
58035
  production
57677
58036
  });
57678
58037
  applyModuleDefaults(options.module, {
57679
- cache: !!options.cache,
57680
58038
  asyncWebAssembly: options.experiments.asyncWebAssembly,
57681
58039
  targetProperties,
57682
58040
  mode: options.mode,
@@ -57687,7 +58045,6 @@ const applyRspackOptionsDefaults = (options)=>{
57687
58045
  context: options.context,
57688
58046
  targetProperties,
57689
58047
  isAffectedByBrowserslist: void 0 === target || 'string' == typeof target && target.startsWith('browserslist') || Array.isArray(target) && target.some((target)=>target.startsWith('browserslist')),
57690
- outputModule: options.experiments.outputModule,
57691
58048
  entry: options.entry
57692
58049
  });
57693
58050
  applyExternalsPresetsDefaults(options.externalsPresets, {
@@ -57754,7 +58111,7 @@ const applyIncrementalDefaults = (options)=>{
57754
58111
  D(options.incremental, 'buildModuleGraph', true);
57755
58112
  D(options.incremental, 'finishModules', true);
57756
58113
  D(options.incremental, 'optimizeDependencies', true);
57757
- D(options.incremental, 'buildChunkGraph', false);
58114
+ D(options.incremental, 'buildChunkGraph', true);
57758
58115
  D(options.incremental, 'moduleIds', true);
57759
58116
  D(options.incremental, 'chunkIds', true);
57760
58117
  D(options.incremental, 'modulesHashes', true);
@@ -57776,8 +58133,8 @@ const applyJavascriptParserOptionsDefaults = (parserOptions, { deferImport })=>{
57776
58133
  D(parserOptions, 'unknownContextCritical', true);
57777
58134
  D(parserOptions, 'wrappedContextCritical', false);
57778
58135
  D(parserOptions, 'wrappedContextRegExp', /.*/);
57779
- D(parserOptions, 'strictExportPresence', false);
57780
- D(parserOptions, 'requireAsExpression', false);
58136
+ D(parserOptions, 'exportsPresence', 'error');
58137
+ D(parserOptions, 'requireAsExpression', true);
57781
58138
  D(parserOptions, 'requireAlias', false);
57782
58139
  D(parserOptions, 'requireDynamic', true);
57783
58140
  D(parserOptions, 'requireResolve', true);
@@ -57798,10 +58155,9 @@ const applyCssGeneratorOptionsDefaults = (generatorOptions, { targetProperties }
57798
58155
  const applyJsonGeneratorOptionsDefaults = (generatorOptions)=>{
57799
58156
  D(generatorOptions, 'JSONParse', true);
57800
58157
  };
57801
- const applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
58158
+ const applyModuleDefaults = (module, { asyncWebAssembly, targetProperties, mode, uniqueName, deferImport })=>{
57802
58159
  assertNotNill(module.parser);
57803
58160
  assertNotNill(module.generator);
57804
- cache ? D(module, 'unsafeCache', /[\\/]node_modules[\\/]/) : D(module, 'unsafeCache', false);
57805
58161
  F(module.parser, "asset", ()=>({}));
57806
58162
  assertNotNill(module.parser.asset);
57807
58163
  F(module.parser.asset, 'dataUrlCondition', ()=>({}));
@@ -57961,7 +58317,7 @@ const applyModuleDefaults = (module, { cache, asyncWebAssembly, targetProperties
57961
58317
  return rules;
57962
58318
  });
57963
58319
  };
57964
- const applyOutputDefaults = (options, { context, outputModule, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
58320
+ const applyOutputDefaults = (options, { context, targetProperties: tp, isAffectedByBrowserslist, entry })=>{
57965
58321
  const { output } = options;
57966
58322
  const getLibraryName = (library)=>{
57967
58323
  const libraryName = 'object' == typeof library && library && !Array.isArray(library) ? library.name : library;
@@ -57990,7 +58346,24 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
57990
58346
  }
57991
58347
  });
57992
58348
  F(output, 'devtoolNamespace', ()=>output.uniqueName);
57993
- F(output, 'module', ()=>!!outputModule);
58349
+ if (output.library) F(output.library, 'type', ()=>output.module ? 'modern-module' : 'var');
58350
+ const forEachEntry = (fn)=>{
58351
+ if ('function' == typeof entry) return;
58352
+ for (const name of Object.keys(entry))fn(entry[name]);
58353
+ };
58354
+ A(output, 'enabledLibraryTypes', ()=>{
58355
+ const enabledLibraryTypes = [];
58356
+ if (output.library) enabledLibraryTypes.push(output.library.type);
58357
+ forEachEntry((desc)=>{
58358
+ if (desc.library) enabledLibraryTypes.push(desc.library.type);
58359
+ });
58360
+ if (enabledLibraryTypes.includes('modern-module')) applyLimits(options);
58361
+ return enabledLibraryTypes;
58362
+ });
58363
+ D(output, 'module', [
58364
+ 'modern-module',
58365
+ 'module'
58366
+ ].some((ty)=>output.enabledLibraryTypes.includes(ty)));
57994
58367
  const environment = output.environment;
57995
58368
  const optimistic = (v)=>v || void 0 === v;
57996
58369
  const conditionallyOptimistic = (v, c)=>void 0 === v && c || v;
@@ -58049,7 +58422,6 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
58049
58422
  D(output, 'hashDigest', 'hex');
58050
58423
  D(output, 'hashDigestLength', 16);
58051
58424
  D(output, 'strictModuleErrorHandling', false);
58052
- if (output.library) F(output.library, 'type', ()=>output.module ? 'module' : 'var');
58053
58425
  F(output, 'chunkFormat', ()=>{
58054
58426
  if (tp) {
58055
58427
  const helpMessage = isAffectedByBrowserslist ? "Make sure that your 'browserslist' includes only platforms that support these features or select an appropriate 'target' to allow selecting a chunk format by default. Alternatively specify the 'output.chunkFormat' directly." : "Select an appropriate 'target' to allow selecting one by default, or specify the 'output.chunkFormat' directly.";
@@ -58133,19 +58505,6 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
58133
58505
  F(trustedTypes, 'policyName', ()=>output.uniqueName.replace(/[^a-zA-Z0-9\-#=_/@.%]+/g, '_') || 'rspack');
58134
58506
  D(trustedTypes, 'onPolicyCreationFailure', 'stop');
58135
58507
  }
58136
- const forEachEntry = (fn)=>{
58137
- if ('function' == typeof entry) return;
58138
- for (const name of Object.keys(entry))fn(entry[name]);
58139
- };
58140
- A(output, 'enabledLibraryTypes', ()=>{
58141
- const enabledLibraryTypes = [];
58142
- if (output.library) enabledLibraryTypes.push(output.library.type);
58143
- forEachEntry((desc)=>{
58144
- if (desc.library) enabledLibraryTypes.push(desc.library.type);
58145
- });
58146
- if (enabledLibraryTypes.includes('modern-module')) applyLimits(options);
58147
- return enabledLibraryTypes;
58148
- });
58149
58508
  A(output, 'enabledChunkLoadingTypes', ()=>{
58150
58509
  const enabledChunkLoadingTypes = new Set();
58151
58510
  if (output.chunkLoading) enabledChunkLoadingTypes.add(output.chunkLoading);
@@ -58166,7 +58525,7 @@ const applyOutputDefaults = (options, { context, outputModule, targetProperties:
58166
58525
  });
58167
58526
  D(output, 'bundlerInfo', {});
58168
58527
  if ('object' == typeof output.bundlerInfo) {
58169
- D(output.bundlerInfo, 'version', "2.0.0-alpha.1");
58528
+ D(output.bundlerInfo, 'version', "2.0.0-beta.1");
58170
58529
  D(output.bundlerInfo, 'bundler', 'rspack');
58171
58530
  D(output.bundlerInfo, 'force', !output.library);
58172
58531
  }
@@ -58568,8 +58927,7 @@ const getNormalizedRspackOptions = (config)=>({
58568
58927
  ]),
58569
58928
  rules: nestedArray(module.rules, (r)=>[
58570
58929
  ...r
58571
- ]),
58572
- unsafeCache: module.unsafeCache
58930
+ ])
58573
58931
  })),
58574
58932
  target: config.target,
58575
58933
  externals: config.externals,
@@ -58606,7 +58964,9 @@ const getNormalizedRspackOptions = (config)=>({
58606
58964
  storage: {
58607
58965
  type: 'filesystem',
58608
58966
  directory: path_browserify_default().resolve(config.context || normalization_process.cwd(), cache.storage?.directory || 'node_modules/.cache/rspack')
58609
- }
58967
+ },
58968
+ portable: cache.portable,
58969
+ readonly: cache.readonly
58610
58970
  };
58611
58971
  }),
58612
58972
  stats: nestedConfig(config.stats, (stats)=>{
@@ -58719,7 +59079,7 @@ const getNormalizedIncrementalOptions = (incremental)=>{
58719
59079
  buildModuleGraph: true,
58720
59080
  finishModules: false,
58721
59081
  optimizeDependencies: false,
58722
- buildChunkGraph: false,
59082
+ buildChunkGraph: true,
58723
59083
  moduleIds: false,
58724
59084
  chunkIds: false,
58725
59085
  modulesHashes: false,
@@ -59826,7 +60186,7 @@ class MultiStats {
59826
60186
  return obj;
59827
60187
  });
59828
60188
  if (childOptions.version) {
59829
- obj.rspackVersion = "2.0.0-alpha.1";
60189
+ obj.rspackVersion = "2.0.0-beta.1";
59830
60190
  obj.version = "5.75.0";
59831
60191
  }
59832
60192
  if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join('');
@@ -61512,7 +61872,7 @@ const SIMPLE_EXTRACTORS = {
61512
61872
  },
61513
61873
  version: (object)=>{
61514
61874
  object.version = "5.75.0";
61515
- object.rspackVersion = "2.0.0-alpha.1";
61875
+ object.rspackVersion = "2.0.0-beta.1";
61516
61876
  },
61517
61877
  env: (object, _compilation, _context, { _env })=>{
61518
61878
  object.env = _env;
@@ -63243,7 +63603,7 @@ function createCompiler(userOptions) {
63243
63603
  function isMultiRspackOptions(o) {
63244
63604
  return Array.isArray(o);
63245
63605
  }
63246
- function rspack(options, callback) {
63606
+ function rspack_rspack(options, callback) {
63247
63607
  try {
63248
63608
  if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
63249
63609
  else validateRspackConfig(options);
@@ -63552,6 +63912,41 @@ const createCompilationHooksRegisters = (getCompiler, createTap, createMapTap)=>
63552
63912
  return queried.promise(getCompiler().__internal__get_compilation().chunks, getCompiler().__internal__get_compilation().modules);
63553
63913
  };
63554
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
+ }),
63555
63950
  registerCompilationChunkHashTaps: createTap(external_rspack_wasi_browser_js_["default"].RegisterJsTapKind.CompilationChunkHash, function() {
63556
63951
  return getCompiler().__internal__get_compilation().hooks.chunkHash;
63557
63952
  }, function(queried) {
@@ -64357,9 +64752,20 @@ class Compiler {
64357
64752
  ]),
64358
64753
  additionalPass: new AsyncSeriesHook([])
64359
64754
  };
64755
+ const availableCompilerHooks = Object.keys(this.hooks);
64756
+ this.hooks = new Proxy(this.hooks, {
64757
+ get (target, prop, receiver) {
64758
+ const value = Reflect.get(target, prop, receiver);
64759
+ if (void 0 === value && 'string' == typeof prop) {
64760
+ const hooksList = availableCompilerHooks.join(', ');
64761
+ throw new Error(`Compiler.hooks.${prop} is not supported in rspack. This typically happens when using webpack plugins that rely on webpack-specific hooks. Consider using an rspack-compatible alternative or removing the incompatible plugin.\n\nAvailable compiler hooks: ${hooksList}`);
64762
+ }
64763
+ return value;
64764
+ }
64765
+ });
64360
64766
  const compilerRuntimeGlobals = createCompilerRuntimeGlobals(options);
64361
64767
  const compilerFn = function(...params) {
64362
- return rspack(...params);
64768
+ return rspack_rspack(...params);
64363
64769
  };
64364
64770
  const compilerRspack = Object.assign(compilerFn, exports_namespaceObject, {
64365
64771
  RuntimeGlobals: compilerRuntimeGlobals
@@ -65089,10 +65495,233 @@ class NodeTemplatePlugin {
65089
65495
  new EnableChunkLoadingPlugin(chunkLoading).apply(compiler);
65090
65496
  }
65091
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
+ }
65092
65541
  const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
65093
65542
  function isRequiredVersion(str) {
65094
65543
  return VERSION_PATTERN_REGEXP.test(str);
65095
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
+ }
65096
65725
  var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
65097
65726
  const MANIFEST_FILE_NAME = 'mf-manifest.json';
65098
65727
  const STATS_FILE_NAME = 'mf-stats.json';
@@ -65121,17 +65750,29 @@ function readPKGJson(root) {
65121
65750
  } catch {}
65122
65751
  return {};
65123
65752
  }
65124
- function getBuildInfo(isDev, root) {
65125
- const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
65753
+ function getBuildInfo(isDev, compiler, mfConfig) {
65754
+ const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
65126
65755
  const pkg = readPKGJson(rootPath);
65127
65756
  const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
65128
- return {
65757
+ const statsBuildInfo = {
65129
65758
  buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || 'UNKNOWN',
65130
65759
  buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || 'UNKNOWN'
65131
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;
65132
65769
  }
65133
65770
  function getFileName(manifestOptions) {
65134
65771
  if (!manifestOptions) return {
65772
+ statsFileName: '',
65773
+ manifestFileName: ''
65774
+ };
65775
+ if ('boolean' == typeof manifestOptions) return {
65135
65776
  statsFileName: STATS_FILE_NAME,
65136
65777
  manifestFileName: MANIFEST_FILE_NAME
65137
65778
  };
@@ -65149,19 +65790,101 @@ function getFileName(manifestOptions) {
65149
65790
  manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
65150
65791
  };
65151
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
+ }
65152
65874
  class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65153
65875
  name = external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin;
65154
- opts;
65876
+ rawOpts;
65155
65877
  constructor(opts){
65156
65878
  super();
65157
- this.opts = opts;
65879
+ this.rawOpts = opts;
65158
65880
  }
65159
65881
  raw(compiler) {
65160
- const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
65161
- 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);
65162
65885
  const rawOptions = {
65163
- name: this.opts.name,
65164
- globalName: this.opts.globalName,
65886
+ name: opts.name,
65887
+ globalName: opts.globalName,
65165
65888
  fileName,
65166
65889
  filePath,
65167
65890
  manifestFileName,
@@ -65170,38 +65893,447 @@ class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
65170
65893
  remoteAliasMap,
65171
65894
  exposes,
65172
65895
  shared,
65173
- buildInfo: getBuildInfo('development' === compiler.options.mode, compiler.context)
65896
+ buildInfo: getBuildInfo('development' === compiler.options.mode, compiler, this.rawOpts)
65174
65897
  };
65175
65898
  return createBuiltinPlugin(this.name, rawOptions);
65176
65899
  }
65177
65900
  }
65178
- const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
65179
- const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
65180
- const array = (items)=>{
65181
- for (const item of items)if ('string' == typeof item) fn(item, normalizeSimple(item, item));
65182
- else if (item && 'object' == typeof item) object(item);
65183
- else throw new Error('Unexpected options format');
65184
- };
65185
- const object = (obj)=>{
65186
- for (const [key, value] of Object.entries(obj))'string' == typeof value || Array.isArray(value) ? fn(key, normalizeSimple(value, key)) : fn(key, normalizeOptions(value, key));
65187
- };
65188
- if (!options) return;
65189
- if (Array.isArray(options)) array(options);
65190
- else if ('object' == typeof options) object(options);
65191
- else throw new Error('Unexpected options format');
65192
- };
65193
- const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
65194
- const items = [];
65195
- options_process(options, normalizeSimple, normalizeOptions, (key, value)=>{
65196
- items.push([
65197
- key,
65198
- value
65199
- ]);
65200
- });
65201
- 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);
65202
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);
65203
66334
  class ModuleFederationPlugin {
65204
66335
  _options;
66336
+ _treeShakingSharedPlugin;
65205
66337
  constructor(_options){
65206
66338
  this._options = _options;
65207
66339
  }
@@ -65213,15 +66345,44 @@ class ModuleFederationPlugin {
65213
66345
  '@module-federation/runtime': paths.runtime,
65214
66346
  ...compiler.options.resolve.alias
65215
66347
  };
65216
- 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
+ }
65217
66357
  const asyncStartup = this._options.experiments?.asyncStartup ?? false;
65218
66358
  const runtimeExperiments = {
65219
66359
  asyncStartup
65220
66360
  };
65221
- new ModuleFederationRuntimePlugin({
65222
- entryRuntime,
65223
- experiments: runtimeExperiments
65224
- }).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
+ });
65225
66386
  const v1Options = {
65226
66387
  name: this._options.name,
65227
66388
  exposes: this._options.exposes,
@@ -65235,89 +66396,9 @@ class ModuleFederationPlugin {
65235
66396
  enhanced: true
65236
66397
  };
65237
66398
  new webpack.container.ModuleFederationPluginV1(v1Options).apply(compiler);
65238
- if (this._options.manifest) {
65239
- const manifestOptions = true === this._options.manifest ? {} : {
65240
- ...this._options.manifest
65241
- };
65242
- const containerName = manifestOptions.name ?? this._options.name;
65243
- const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
65244
- const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
65245
- if (cur[1].length > 1) return sum;
65246
- const remoteInfo = cur[1][0];
65247
- const { entry, alias, name } = remoteInfo;
65248
- if (entry && name) sum[alias] = {
65249
- name,
65250
- entry
65251
- };
65252
- return sum;
65253
- }, {});
65254
- const manifestExposes = collectManifestExposes(this._options.exposes);
65255
- if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
65256
- const manifestShared = collectManifestShared(this._options.shared);
65257
- if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
65258
- new ModuleFederationManifestPlugin({
65259
- ...manifestOptions,
65260
- name: containerName,
65261
- globalName,
65262
- remoteAliasMap
65263
- }).apply(compiler);
65264
- }
66399
+ if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
65265
66400
  }
65266
66401
  }
65267
- function collectManifestExposes(exposes) {
65268
- if (!exposes) return;
65269
- const parsed = parseOptions(exposes, (value)=>({
65270
- import: Array.isArray(value) ? value : [
65271
- value
65272
- ],
65273
- name: void 0
65274
- }), (value)=>({
65275
- import: Array.isArray(value.import) ? value.import : [
65276
- value.import
65277
- ],
65278
- name: value.name ?? void 0
65279
- }));
65280
- const result = parsed.map(([exposeKey, info])=>{
65281
- const exposeName = info.name ?? exposeKey.replace(/^\.\//, '');
65282
- return {
65283
- path: exposeKey,
65284
- name: exposeName
65285
- };
65286
- });
65287
- return result.length > 0 ? result : void 0;
65288
- }
65289
- function collectManifestShared(shared) {
65290
- if (!shared) return;
65291
- const parsed = parseOptions(shared, (item, key)=>{
65292
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
65293
- return item !== key && isRequiredVersion(item) ? {
65294
- import: key,
65295
- requiredVersion: item
65296
- } : {
65297
- import: item
65298
- };
65299
- }, (item)=>item);
65300
- const result = parsed.map(([key, config])=>{
65301
- const name = config.shareKey || key;
65302
- const version = 'string' == typeof config.version ? config.version : void 0;
65303
- const requiredVersion = 'string' == typeof config.requiredVersion ? config.requiredVersion : void 0;
65304
- return {
65305
- name,
65306
- version,
65307
- requiredVersion,
65308
- singleton: config.singleton
65309
- };
65310
- });
65311
- return result.length > 0 ? result : void 0;
65312
- }
65313
- function resolveLibraryGlobalName(library) {
65314
- if (!library) return;
65315
- const libName = library.name;
65316
- if (!libName) return;
65317
- if ('string' == typeof libName) return libName;
65318
- if (Array.isArray(libName)) return libName[0];
65319
- if ('object' == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
65320
- }
65321
66402
  function getRemoteInfos(options) {
65322
66403
  if (!options.remotes) return {};
65323
66404
  function extractUrlAndGlobal(urlAndGlobal) {
@@ -65384,6 +66465,18 @@ function getRemoteInfos(options) {
65384
66465
  function getRuntimePlugins(options) {
65385
66466
  return options.runtimePlugins ?? [];
65386
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
+ }
65387
66480
  function getPaths(options, compiler) {
65388
66481
  return {
65389
66482
  runtimeTools: '@module-federation/runtime-tools',
@@ -65391,11 +66484,12 @@ function getPaths(options, compiler) {
65391
66484
  runtime: '@module-federation/runtime'
65392
66485
  };
65393
66486
  }
65394
- function getDefaultEntryRuntime(paths, options, compiler) {
66487
+ function getDefaultEntryRuntime(paths, options, compiler, treeShakingShareFallbacks) {
65395
66488
  const runtimePlugins = getRuntimePlugins(options);
65396
66489
  const remoteInfos = getRemoteInfos(options);
65397
66490
  const runtimePluginImports = [];
65398
66491
  const runtimePluginVars = [];
66492
+ const libraryType = options.library?.type || 'var';
65399
66493
  for(let i = 0; i < runtimePlugins.length; i++){
65400
66494
  const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
65401
66495
  const pluginSpec = runtimePlugins[i];
@@ -65412,182 +66506,12 @@ function getDefaultEntryRuntime(paths, options, compiler) {
65412
66506
  `const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
65413
66507
  `const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
65414
66508
  `const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? 'version-first')}`,
65415
- '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})}}'
65416
66512
  ].join(';');
65417
66513
  return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
65418
66514
  }
65419
- const compilerSet = new WeakSet();
65420
- function isSingleton(compiler) {
65421
- return compilerSet.has(compiler);
65422
- }
65423
- function setSingleton(compiler) {
65424
- compilerSet.add(compiler);
65425
- }
65426
- class ShareRuntimePlugin extends RspackBuiltinPlugin {
65427
- enhanced;
65428
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
65429
- constructor(enhanced = false){
65430
- super(), this.enhanced = enhanced;
65431
- }
65432
- raw(compiler) {
65433
- if (isSingleton(compiler)) return;
65434
- setSingleton(compiler);
65435
- return createBuiltinPlugin(this.name, this.enhanced);
65436
- }
65437
- }
65438
- class ConsumeSharedPlugin extends RspackBuiltinPlugin {
65439
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin;
65440
- _options;
65441
- constructor(options){
65442
- super();
65443
- this._options = {
65444
- consumes: parseOptions(options.consumes, (item, key)=>{
65445
- if (Array.isArray(item)) throw new Error('Unexpected array in options');
65446
- const result = item !== key && isRequiredVersion(item) ? {
65447
- import: key,
65448
- shareScope: options.shareScope || 'default',
65449
- shareKey: key,
65450
- requiredVersion: item,
65451
- strictVersion: true,
65452
- packageName: void 0,
65453
- singleton: false,
65454
- eager: false
65455
- } : {
65456
- import: key,
65457
- shareScope: options.shareScope || 'default',
65458
- shareKey: key,
65459
- requiredVersion: void 0,
65460
- packageName: void 0,
65461
- strictVersion: false,
65462
- singleton: false,
65463
- eager: false
65464
- };
65465
- return result;
65466
- }, (item, key)=>({
65467
- import: false === item.import ? void 0 : item.import || key,
65468
- shareScope: item.shareScope || options.shareScope || 'default',
65469
- shareKey: item.shareKey || key,
65470
- requiredVersion: item.requiredVersion,
65471
- strictVersion: 'boolean' == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
65472
- packageName: item.packageName,
65473
- singleton: !!item.singleton,
65474
- eager: !!item.eager
65475
- })),
65476
- enhanced: options.enhanced ?? false
65477
- };
65478
- }
65479
- raw(compiler) {
65480
- new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
65481
- const rawOptions = {
65482
- consumes: this._options.consumes.map(([key, v])=>({
65483
- key,
65484
- ...v
65485
- })),
65486
- enhanced: this._options.enhanced
65487
- };
65488
- return createBuiltinPlugin(this.name, rawOptions);
65489
- }
65490
- }
65491
- class ProvideSharedPlugin extends RspackBuiltinPlugin {
65492
- name = external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin;
65493
- _provides;
65494
- _enhanced;
65495
- constructor(options){
65496
- super();
65497
- this._provides = parseOptions(options.provides, (item)=>{
65498
- if (Array.isArray(item)) throw new Error('Unexpected array of provides');
65499
- return {
65500
- shareKey: item,
65501
- version: void 0,
65502
- shareScope: options.shareScope || 'default',
65503
- eager: false
65504
- };
65505
- }, (item)=>{
65506
- const raw = {
65507
- shareKey: item.shareKey,
65508
- version: item.version,
65509
- shareScope: item.shareScope || options.shareScope || 'default',
65510
- eager: !!item.eager
65511
- };
65512
- if (options.enhanced) {
65513
- const enhancedItem = item;
65514
- return {
65515
- ...raw,
65516
- singleton: enhancedItem.singleton,
65517
- requiredVersion: enhancedItem.requiredVersion,
65518
- strictVersion: enhancedItem.strictVersion
65519
- };
65520
- }
65521
- return raw;
65522
- });
65523
- this._enhanced = options.enhanced;
65524
- }
65525
- raw(compiler) {
65526
- new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
65527
- const rawOptions = this._provides.map(([key, v])=>({
65528
- key,
65529
- ...v
65530
- }));
65531
- return createBuiltinPlugin(this.name, rawOptions);
65532
- }
65533
- }
65534
- class SharePlugin {
65535
- _shareScope;
65536
- _consumes;
65537
- _provides;
65538
- _enhanced;
65539
- constructor(options){
65540
- const sharedOptions = parseOptions(options.shared, (item, key)=>{
65541
- if ('string' != typeof item) throw new Error('Unexpected array in shared');
65542
- const config = item !== key && isRequiredVersion(item) ? {
65543
- import: key,
65544
- requiredVersion: item
65545
- } : {
65546
- import: item
65547
- };
65548
- return config;
65549
- }, (item)=>item);
65550
- const consumes = sharedOptions.map(([key, options])=>({
65551
- [key]: {
65552
- import: options.import,
65553
- shareKey: options.shareKey || key,
65554
- shareScope: options.shareScope,
65555
- requiredVersion: options.requiredVersion,
65556
- strictVersion: options.strictVersion,
65557
- singleton: options.singleton,
65558
- packageName: options.packageName,
65559
- eager: options.eager
65560
- }
65561
- }));
65562
- const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
65563
- [options.import || key]: {
65564
- shareKey: options.shareKey || key,
65565
- shareScope: options.shareScope,
65566
- version: options.version,
65567
- eager: options.eager,
65568
- singleton: options.singleton,
65569
- requiredVersion: options.requiredVersion,
65570
- strictVersion: options.strictVersion
65571
- }
65572
- }));
65573
- this._shareScope = options.shareScope;
65574
- this._consumes = consumes;
65575
- this._provides = provides;
65576
- this._enhanced = options.enhanced ?? false;
65577
- }
65578
- apply(compiler) {
65579
- new ConsumeSharedPlugin({
65580
- shareScope: this._shareScope,
65581
- consumes: this._consumes,
65582
- enhanced: this._enhanced
65583
- }).apply(compiler);
65584
- new ProvideSharedPlugin({
65585
- shareScope: this._shareScope,
65586
- provides: this._provides,
65587
- enhanced: this._enhanced
65588
- }).apply(compiler);
65589
- }
65590
- }
65591
66515
  class ContainerPlugin extends RspackBuiltinPlugin {
65592
66516
  name = external_rspack_wasi_browser_js_.BuiltinPluginName.ContainerPlugin;
65593
66517
  _options;
@@ -65597,7 +66521,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
65597
66521
  name: options.name,
65598
66522
  shareScope: options.shareScope || 'default',
65599
66523
  library: options.library || {
65600
- type: 'var',
66524
+ type: 'global',
65601
66525
  name: options.name
65602
66526
  },
65603
66527
  runtime: options.runtime,
@@ -65739,7 +66663,7 @@ function transformSync(source, options) {
65739
66663
  const _options = JSON.stringify(options || {});
65740
66664
  return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
65741
66665
  }
65742
- const exports_rspackVersion = "2.0.0-alpha.1";
66666
+ const exports_rspackVersion = "2.0.0-beta.1";
65743
66667
  const exports_version = "5.75.0";
65744
66668
  const exports_WebpackError = Error;
65745
66669
  const exports_config = {
@@ -65789,6 +66713,7 @@ const container = {
65789
66713
  };
65790
66714
  const sharing = {
65791
66715
  ProvideSharedPlugin: ProvideSharedPlugin,
66716
+ TreeShakingSharedPlugin: TreeShakingSharedPlugin,
65792
66717
  ConsumeSharedPlugin: ConsumeSharedPlugin,
65793
66718
  SharePlugin: SharePlugin
65794
66719
  };
@@ -65826,7 +66751,7 @@ const exports_experiments = {
65826
66751
  VirtualModulesPlugin: VirtualModulesPlugin,
65827
66752
  rsc: rsc
65828
66753
  };
65829
- const src_fn = Object.assign(rspack, exports_namespaceObject);
66754
+ const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
65830
66755
  src_fn.rspack = src_fn;
65831
66756
  src_fn.webpack = src_fn;
65832
66757
  const src_rspack_0 = src_fn;
@@ -65999,4 +66924,4 @@ const builtinMemFs = {
65999
66924
  volume: fs_0.volume,
66000
66925
  memfs: fs_0.memfs
66001
66926
  };
66002
- export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, javascript, lazyCompilationMiddleware, lib as sources, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };
66927
+ export { AsyncDependenciesBlock, BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CaseSensitivePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ConcatenatedModule, ContextModule, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefaultRuntimeGlobals as RuntimeGlobals, DefinePlugin, Dependency, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, EntryDependency, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalModule, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, Module, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModule, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, RspackOptionsApply as WebpackOptionsApply, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, builtinMemFs, container, electron, exports_WebpackError as WebpackError, exports_config as config, exports_experiments as experiments, exports_library as library, exports_node as node, exports_rspackVersion as rspackVersion, exports_version as version, exports_wasm as wasm, javascript, lazyCompilationMiddleware, lib as sources, lib_EntryOptionPlugin as EntryOptionPlugin, optimize, sharing, src_rspack_0 as "module.exports", src_rspack_0 as rspack, statsFactoryUtils_StatsErrorCode as StatsErrorCode, util, web, webworker };