@rspack-canary/browser 1.7.0-canary-4941195f-20251224083309 → 1.7.0-canary-c8f933e3-20251224124051
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/Compiler.d.ts +0 -1
- package/dist/builtin-loader/swc/types.d.ts +0 -4
- package/dist/builtin-plugin/index.d.ts +0 -4
- package/dist/config/normalization.d.ts +4 -0
- package/dist/config/types.d.ts +5 -0
- package/dist/container/ModuleFederationManifestPlugin.d.ts +10 -3
- package/dist/container/ModuleFederationPlugin.d.ts +16 -1
- package/dist/exports.d.ts +5 -4
- package/dist/index.mjs +980 -656
- package/dist/napi-binding.d.ts +35 -10
- package/dist/rspack.wasi-browser.js +0 -1
- package/dist/rspack.wasm32-wasi.wasm +0 -0
- package/dist/sharing/CollectSharedEntryPlugin.d.ts +22 -0
- package/dist/sharing/ConsumeSharedPlugin.d.ts +16 -0
- package/dist/sharing/IndependentSharedPlugin.d.ts +35 -0
- package/dist/sharing/ProvideSharedPlugin.d.ts +19 -0
- package/dist/sharing/SharePlugin.d.ts +36 -0
- package/dist/sharing/SharedContainerPlugin.d.ts +23 -0
- package/dist/sharing/SharedUsedExportsOptimizerPlugin.d.ts +14 -0
- package/dist/sharing/TreeShakeSharedPlugin.d.ts +19 -0
- package/dist/sharing/utils.d.ts +1 -0
- package/package.json +1 -1
- package/dist/builtin-plugin/rsc/Coordinator.d.ts +0 -8
- package/dist/builtin-plugin/rsc/RscClientPlugin.d.ts +0 -10
- package/dist/builtin-plugin/rsc/RscServerPlugin.d.ts +0 -10
- package/dist/builtin-plugin/rsc/index.d.ts +0 -19
package/dist/index.mjs
CHANGED
|
@@ -50568,7 +50568,6 @@ __webpack_require__.d(exports_namespaceObject, {
|
|
|
50568
50568
|
ConcatenatedModule: ()=>external_rspack_wasi_browser_js_.ConcatenatedModule,
|
|
50569
50569
|
ContextModule: ()=>external_rspack_wasi_browser_js_.ContextModule,
|
|
50570
50570
|
ContextReplacementPlugin: ()=>ContextReplacementPlugin,
|
|
50571
|
-
Coordinator: ()=>Coordinator,
|
|
50572
50571
|
CopyRspackPlugin: ()=>CopyRspackPlugin,
|
|
50573
50572
|
CssExtractRspackPlugin: ()=>CssExtractRspackPlugin,
|
|
50574
50573
|
DefinePlugin: ()=>DefinePlugin,
|
|
@@ -50599,8 +50598,6 @@ __webpack_require__.d(exports_namespaceObject, {
|
|
|
50599
50598
|
NormalModuleReplacementPlugin: ()=>NormalModuleReplacementPlugin,
|
|
50600
50599
|
ProgressPlugin: ()=>ProgressPlugin,
|
|
50601
50600
|
ProvidePlugin: ()=>ProvidePlugin,
|
|
50602
|
-
RscClientPlugin: ()=>RscClientPlugin,
|
|
50603
|
-
RscServerPlugin: ()=>RscServerPlugin,
|
|
50604
50601
|
RspackOptionsApply: ()=>RspackOptionsApply,
|
|
50605
50602
|
RuntimeGlobals: ()=>DefaultRuntimeGlobals,
|
|
50606
50603
|
RuntimeModule: ()=>RuntimeModule,
|
|
@@ -56686,238 +56683,6 @@ const createRuntimePluginHooksRegisters = (getCompiler, createTap)=>({
|
|
|
56686
56683
|
};
|
|
56687
56684
|
})
|
|
56688
56685
|
});
|
|
56689
|
-
function Coordinator_check_private_redeclaration(obj, privateCollection) {
|
|
56690
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
56691
|
-
}
|
|
56692
|
-
function Coordinator_class_apply_descriptor_get(receiver, descriptor) {
|
|
56693
|
-
if (descriptor.get) return descriptor.get.call(receiver);
|
|
56694
|
-
return descriptor.value;
|
|
56695
|
-
}
|
|
56696
|
-
function Coordinator_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
56697
|
-
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
56698
|
-
else {
|
|
56699
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
56700
|
-
descriptor.value = value;
|
|
56701
|
-
}
|
|
56702
|
-
}
|
|
56703
|
-
function Coordinator_class_extract_field_descriptor(receiver, privateMap, action) {
|
|
56704
|
-
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
56705
|
-
return privateMap.get(receiver);
|
|
56706
|
-
}
|
|
56707
|
-
function Coordinator_class_private_field_get(receiver, privateMap) {
|
|
56708
|
-
var descriptor = Coordinator_class_extract_field_descriptor(receiver, privateMap, "get");
|
|
56709
|
-
return Coordinator_class_apply_descriptor_get(receiver, descriptor);
|
|
56710
|
-
}
|
|
56711
|
-
function Coordinator_class_private_field_init(obj, privateMap, value) {
|
|
56712
|
-
Coordinator_check_private_redeclaration(obj, privateMap);
|
|
56713
|
-
privateMap.set(obj, value);
|
|
56714
|
-
}
|
|
56715
|
-
function Coordinator_class_private_field_set(receiver, privateMap, value) {
|
|
56716
|
-
var descriptor = Coordinator_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
56717
|
-
Coordinator_class_apply_descriptor_set(receiver, descriptor, value);
|
|
56718
|
-
return value;
|
|
56719
|
-
}
|
|
56720
|
-
const Coordinator_PLUGIN_NAME = "RscPlugin";
|
|
56721
|
-
const GET_OR_INIT_BINDING = Symbol("GET_OR_INIT_BINDING");
|
|
56722
|
-
var _serverCompiler = /*#__PURE__*/ new WeakMap(), _clientCompiler = /*#__PURE__*/ new WeakMap(), _clientLastCompilation = /*#__PURE__*/ new WeakMap(), _binding = /*#__PURE__*/ new WeakMap();
|
|
56723
|
-
class Coordinator {
|
|
56724
|
-
applyServerCompiler(serverCompiler) {
|
|
56725
|
-
Coordinator_class_private_field_set(this, _serverCompiler, serverCompiler);
|
|
56726
|
-
serverCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
|
|
56727
|
-
if (Coordinator_class_private_field_get(this, _clientLastCompilation)) {
|
|
56728
|
-
stats.compilation.fileDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).fileDependencies);
|
|
56729
|
-
stats.compilation.contextDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).contextDependencies);
|
|
56730
|
-
stats.compilation.missingDependencies.addAll(Coordinator_class_private_field_get(this, _clientLastCompilation).missingDependencies);
|
|
56731
|
-
}
|
|
56732
|
-
});
|
|
56733
|
-
serverCompiler.hooks.watchRun.tap(Coordinator_PLUGIN_NAME, ()=>{
|
|
56734
|
-
Coordinator_class_private_field_get(this, _clientCompiler).watching.invalidateWithChangesAndRemovals(new Set(Coordinator_class_private_field_get(this, _serverCompiler).modifiedFiles), new Set(Coordinator_class_private_field_get(this, _serverCompiler).removedFiles));
|
|
56735
|
-
});
|
|
56736
|
-
}
|
|
56737
|
-
applyClientCompiler(clientCompiler) {
|
|
56738
|
-
Coordinator_class_private_field_set(this, _clientCompiler, clientCompiler);
|
|
56739
|
-
const originalWatch = clientCompiler.watch;
|
|
56740
|
-
clientCompiler.watch = function(watchOptions, handler) {
|
|
56741
|
-
watchOptions.ignored = ()=>true;
|
|
56742
|
-
return originalWatch.call(this, watchOptions, handler);
|
|
56743
|
-
};
|
|
56744
|
-
clientCompiler.hooks.done.tap(Coordinator_PLUGIN_NAME, (stats)=>{
|
|
56745
|
-
Coordinator_class_private_field_set(this, _clientLastCompilation, stats.compilation);
|
|
56746
|
-
});
|
|
56747
|
-
}
|
|
56748
|
-
constructor(){
|
|
56749
|
-
Coordinator_class_private_field_init(this, _serverCompiler, {
|
|
56750
|
-
writable: true,
|
|
56751
|
-
value: void 0
|
|
56752
|
-
});
|
|
56753
|
-
Coordinator_class_private_field_init(this, _clientCompiler, {
|
|
56754
|
-
writable: true,
|
|
56755
|
-
value: void 0
|
|
56756
|
-
});
|
|
56757
|
-
Coordinator_class_private_field_init(this, _clientLastCompilation, {
|
|
56758
|
-
writable: true,
|
|
56759
|
-
value: void 0
|
|
56760
|
-
});
|
|
56761
|
-
Coordinator_class_private_field_init(this, _binding, {
|
|
56762
|
-
writable: true,
|
|
56763
|
-
value: void 0
|
|
56764
|
-
});
|
|
56765
|
-
Object.defineProperty(this, GET_OR_INIT_BINDING, {
|
|
56766
|
-
enumerable: false,
|
|
56767
|
-
configurable: false,
|
|
56768
|
-
writable: false,
|
|
56769
|
-
value: ()=>{
|
|
56770
|
-
if (!Coordinator_class_private_field_get(this, _binding)) Coordinator_class_private_field_set(this, _binding, new external_rspack_wasi_browser_js_.JsCoordinator(()=>{
|
|
56771
|
-
if (!Coordinator_class_private_field_get(this, _serverCompiler)) throw new Error("[RscPlugin] Coordinator.getOrInitBinding() called before the server compiler was attached. Call coordinator.applyServerCompiler(serverCompiler) first.");
|
|
56772
|
-
return Coordinator_class_private_field_get(this, _serverCompiler)[GET_COMPILER_ID]();
|
|
56773
|
-
}));
|
|
56774
|
-
return Coordinator_class_private_field_get(this, _binding);
|
|
56775
|
-
}
|
|
56776
|
-
});
|
|
56777
|
-
}
|
|
56778
|
-
}
|
|
56779
|
-
function RscClientPlugin_check_private_redeclaration(obj, privateCollection) {
|
|
56780
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
56781
|
-
}
|
|
56782
|
-
function RscClientPlugin_class_apply_descriptor_get(receiver, descriptor) {
|
|
56783
|
-
if (descriptor.get) return descriptor.get.call(receiver);
|
|
56784
|
-
return descriptor.value;
|
|
56785
|
-
}
|
|
56786
|
-
function RscClientPlugin_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
56787
|
-
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
56788
|
-
else {
|
|
56789
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
56790
|
-
descriptor.value = value;
|
|
56791
|
-
}
|
|
56792
|
-
}
|
|
56793
|
-
function RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, action) {
|
|
56794
|
-
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
56795
|
-
return privateMap.get(receiver);
|
|
56796
|
-
}
|
|
56797
|
-
function RscClientPlugin_class_private_field_get(receiver, privateMap) {
|
|
56798
|
-
var descriptor = RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, "get");
|
|
56799
|
-
return RscClientPlugin_class_apply_descriptor_get(receiver, descriptor);
|
|
56800
|
-
}
|
|
56801
|
-
function RscClientPlugin_class_private_field_init(obj, privateMap, value) {
|
|
56802
|
-
RscClientPlugin_check_private_redeclaration(obj, privateMap);
|
|
56803
|
-
privateMap.set(obj, value);
|
|
56804
|
-
}
|
|
56805
|
-
function RscClientPlugin_class_private_field_set(receiver, privateMap, value) {
|
|
56806
|
-
var descriptor = RscClientPlugin_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
56807
|
-
RscClientPlugin_class_apply_descriptor_set(receiver, descriptor, value);
|
|
56808
|
-
return value;
|
|
56809
|
-
}
|
|
56810
|
-
function RscClientPlugin_define_property(obj, key, value) {
|
|
56811
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
56812
|
-
value: value,
|
|
56813
|
-
enumerable: true,
|
|
56814
|
-
configurable: true,
|
|
56815
|
-
writable: true
|
|
56816
|
-
});
|
|
56817
|
-
else obj[key] = value;
|
|
56818
|
-
return obj;
|
|
56819
|
-
}
|
|
56820
|
-
var _coordinator = /*#__PURE__*/ new WeakMap();
|
|
56821
|
-
class RscClientPlugin extends RspackBuiltinPlugin {
|
|
56822
|
-
raw(compiler) {
|
|
56823
|
-
RscClientPlugin_class_private_field_get(this, _coordinator).applyClientCompiler(compiler);
|
|
56824
|
-
return createBuiltinPlugin(this.name, RscClientPlugin_class_private_field_get(this, _coordinator)[GET_OR_INIT_BINDING]());
|
|
56825
|
-
}
|
|
56826
|
-
constructor(coordinator){
|
|
56827
|
-
super(), RscClientPlugin_define_property(this, "name", "RscClientPlugin"), RscClientPlugin_class_private_field_init(this, _coordinator, {
|
|
56828
|
-
writable: true,
|
|
56829
|
-
value: void 0
|
|
56830
|
-
});
|
|
56831
|
-
RscClientPlugin_class_private_field_set(this, _coordinator, coordinator);
|
|
56832
|
-
}
|
|
56833
|
-
}
|
|
56834
|
-
function RscServerPlugin_check_private_redeclaration(obj, privateCollection) {
|
|
56835
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
56836
|
-
}
|
|
56837
|
-
function RscServerPlugin_class_apply_descriptor_get(receiver, descriptor) {
|
|
56838
|
-
if (descriptor.get) return descriptor.get.call(receiver);
|
|
56839
|
-
return descriptor.value;
|
|
56840
|
-
}
|
|
56841
|
-
function RscServerPlugin_class_apply_descriptor_set(receiver, descriptor, value) {
|
|
56842
|
-
if (descriptor.set) descriptor.set.call(receiver, value);
|
|
56843
|
-
else {
|
|
56844
|
-
if (!descriptor.writable) throw new TypeError("attempted to set read only private field");
|
|
56845
|
-
descriptor.value = value;
|
|
56846
|
-
}
|
|
56847
|
-
}
|
|
56848
|
-
function RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, action) {
|
|
56849
|
-
if (!privateMap.has(receiver)) throw new TypeError("attempted to " + action + " private field on non-instance");
|
|
56850
|
-
return privateMap.get(receiver);
|
|
56851
|
-
}
|
|
56852
|
-
function RscServerPlugin_class_private_field_get(receiver, privateMap) {
|
|
56853
|
-
var descriptor = RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, "get");
|
|
56854
|
-
return RscServerPlugin_class_apply_descriptor_get(receiver, descriptor);
|
|
56855
|
-
}
|
|
56856
|
-
function RscServerPlugin_class_private_field_init(obj, privateMap, value) {
|
|
56857
|
-
RscServerPlugin_check_private_redeclaration(obj, privateMap);
|
|
56858
|
-
privateMap.set(obj, value);
|
|
56859
|
-
}
|
|
56860
|
-
function RscServerPlugin_class_private_field_set(receiver, privateMap, value) {
|
|
56861
|
-
var descriptor = RscServerPlugin_class_extract_field_descriptor(receiver, privateMap, "set");
|
|
56862
|
-
RscServerPlugin_class_apply_descriptor_set(receiver, descriptor, value);
|
|
56863
|
-
return value;
|
|
56864
|
-
}
|
|
56865
|
-
function RscServerPlugin_class_private_method_get(receiver, privateSet, fn) {
|
|
56866
|
-
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
56867
|
-
return fn;
|
|
56868
|
-
}
|
|
56869
|
-
function RscServerPlugin_class_private_method_init(obj, privateSet) {
|
|
56870
|
-
RscServerPlugin_check_private_redeclaration(obj, privateSet);
|
|
56871
|
-
privateSet.add(obj);
|
|
56872
|
-
}
|
|
56873
|
-
function RscServerPlugin_define_property(obj, key, value) {
|
|
56874
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
56875
|
-
value: value,
|
|
56876
|
-
enumerable: true,
|
|
56877
|
-
configurable: true,
|
|
56878
|
-
writable: true
|
|
56879
|
-
});
|
|
56880
|
-
else obj[key] = value;
|
|
56881
|
-
return obj;
|
|
56882
|
-
}
|
|
56883
|
-
var RscServerPlugin_coordinator = /*#__PURE__*/ new WeakMap(), _resolve = /*#__PURE__*/ new WeakSet();
|
|
56884
|
-
class RscServerPlugin extends RspackBuiltinPlugin {
|
|
56885
|
-
raw(compiler) {
|
|
56886
|
-
const bindingOptions = RscServerPlugin_class_private_method_get(this, _resolve, RscServerPlugin_resolve).call(this, compiler);
|
|
56887
|
-
return createBuiltinPlugin(this.name, bindingOptions);
|
|
56888
|
-
}
|
|
56889
|
-
constructor(coordinator){
|
|
56890
|
-
super(), RscServerPlugin_class_private_method_init(this, _resolve), RscServerPlugin_define_property(this, "name", "RscServerPlugin"), RscServerPlugin_class_private_field_init(this, RscServerPlugin_coordinator, {
|
|
56891
|
-
writable: true,
|
|
56892
|
-
value: void 0
|
|
56893
|
-
});
|
|
56894
|
-
RscServerPlugin_class_private_field_set(this, RscServerPlugin_coordinator, coordinator);
|
|
56895
|
-
}
|
|
56896
|
-
}
|
|
56897
|
-
function RscServerPlugin_resolve(serverCompiler) {
|
|
56898
|
-
RscServerPlugin_class_private_field_get(this, RscServerPlugin_coordinator).applyServerCompiler(serverCompiler);
|
|
56899
|
-
return RscServerPlugin_class_private_field_get(this, RscServerPlugin_coordinator)[GET_OR_INIT_BINDING]();
|
|
56900
|
-
}
|
|
56901
|
-
function createRscPlugins() {
|
|
56902
|
-
const coordinator = new Coordinator();
|
|
56903
|
-
return {
|
|
56904
|
-
ServerPlugin: class extends RscServerPlugin {
|
|
56905
|
-
constructor(){
|
|
56906
|
-
super(coordinator);
|
|
56907
|
-
}
|
|
56908
|
-
},
|
|
56909
|
-
ClientPlugin: class extends RscClientPlugin {
|
|
56910
|
-
constructor(){
|
|
56911
|
-
super(coordinator);
|
|
56912
|
-
}
|
|
56913
|
-
}
|
|
56914
|
-
};
|
|
56915
|
-
}
|
|
56916
|
-
const RSC_LAYERS_NAMES = {
|
|
56917
|
-
REACT_SERVER_COMPONENTS: "react-server-components",
|
|
56918
|
-
SERVER_SIDE_RENDERING: "server-side-rendering",
|
|
56919
|
-
ACTION_BROWSER: "action-browser"
|
|
56920
|
-
};
|
|
56921
56686
|
const SideEffectsFlagPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SideEffectsFlagPlugin, ()=>{}, "compilation");
|
|
56922
56687
|
const SizeLimitsPlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.SizeLimitsPlugin, (options)=>{
|
|
56923
56688
|
const hints = false === options.hints ? void 0 : options.hints;
|
|
@@ -58445,6 +58210,7 @@ const applyExperimentsDefaults = (experiments, { development })=>{
|
|
|
58445
58210
|
D(experiments.incremental, "emitAssets", true);
|
|
58446
58211
|
}
|
|
58447
58212
|
D(experiments, "rspackFuture", {});
|
|
58213
|
+
D(experiments, "parallelCodeSplitting", false);
|
|
58448
58214
|
D(experiments, "parallelLoader", false);
|
|
58449
58215
|
D(experiments, "useInputFileSystem", false);
|
|
58450
58216
|
D(experiments, "inlineConst", true);
|
|
@@ -58456,7 +58222,7 @@ const applybundlerInfoDefaults = (rspackFuture, library)=>{
|
|
|
58456
58222
|
if ("object" == typeof rspackFuture) {
|
|
58457
58223
|
D(rspackFuture, "bundlerInfo", {});
|
|
58458
58224
|
if ("object" == typeof rspackFuture.bundlerInfo) {
|
|
58459
|
-
D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-
|
|
58225
|
+
D(rspackFuture.bundlerInfo, "version", "1.7.0-canary-c8f933e3-20251224124051");
|
|
58460
58226
|
D(rspackFuture.bundlerInfo, "bundler", "rspack");
|
|
58461
58227
|
D(rspackFuture.bundlerInfo, "force", !library);
|
|
58462
58228
|
}
|
|
@@ -59327,6 +59093,7 @@ const getNormalizedRspackOptions = (config)=>({
|
|
|
59327
59093
|
experiments: nestedConfig(config.experiments, (experiments)=>{
|
|
59328
59094
|
if (experiments.layers) util_default().deprecate(()=>{}, "`experiments.layers` config has been deprecated and will be removed in Rspack v2.0. Feature layers will be always enabled. Please remove this option from your Rspack configuration.")();
|
|
59329
59095
|
if (false === experiments.topLevelAwait) util_default().deprecate(()=>{}, "`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration.")();
|
|
59096
|
+
if (experiments.parallelCodeSplitting) util_default().deprecate(()=>{}, "`experiments.parallelCodeSplitting` config has been deprecated and will be removed in next minor. It has huge regression in some edge cases where the chunk graph has lots of cycles, we'll improve the performance of build_chunk_graph in the future instead")();
|
|
59330
59097
|
if (experiments.lazyBarrel) util_default().deprecate(()=>{}, "`experiments.lazyBarrel` config has been deprecated and will be removed in Rspack v2.0. Lazy barrel is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
|
|
59331
59098
|
if (experiments.inlineConst) util_default().deprecate(()=>{}, "`experiments.inlineConst` config has been deprecated and will be removed in Rspack v2.0. Inline Const is already stable and enabled by default. Please remove this option from your Rspack configuration.")();
|
|
59332
59099
|
if (experiments.inlineEnum) util_default().deprecate(()=>{}, "`experiments.inlineEnum` config has been deprecated and will be removed in Rspack v2.0. Inline Enum is already stable. Please remove this option from your Rspack configuration.")();
|
|
@@ -59362,6 +59129,7 @@ const getNormalizedRspackOptions = (config)=>({
|
|
|
59362
59129
|
}),
|
|
59363
59130
|
lazyCompilation: optionalNestedConfig(experiments.lazyCompilation, (options)=>true === options ? {} : options),
|
|
59364
59131
|
incremental: optionalNestedConfig(experiments.incremental, (options)=>getNormalizedIncrementalOptions(options)),
|
|
59132
|
+
parallelCodeSplitting: experiments.parallelCodeSplitting,
|
|
59365
59133
|
buildHttp: experiments.buildHttp,
|
|
59366
59134
|
parallelLoader: experiments.parallelLoader,
|
|
59367
59135
|
useInputFileSystem: experiments.useInputFileSystem
|
|
@@ -60525,13 +60293,13 @@ function Resolver_class_private_field_set(receiver, privateMap, value) {
|
|
|
60525
60293
|
Resolver_class_apply_descriptor_set(receiver, descriptor, value);
|
|
60526
60294
|
return value;
|
|
60527
60295
|
}
|
|
60528
|
-
var
|
|
60296
|
+
var _binding = /*#__PURE__*/ new WeakMap();
|
|
60529
60297
|
class Resolver {
|
|
60530
60298
|
resolveSync(_context, path, request) {
|
|
60531
|
-
return Resolver_class_private_field_get(this,
|
|
60299
|
+
return Resolver_class_private_field_get(this, _binding).resolveSync(path, request) ?? false;
|
|
60532
60300
|
}
|
|
60533
60301
|
resolve(_context, path, request, resolveContext, callback) {
|
|
60534
|
-
Resolver_class_private_field_get(this,
|
|
60302
|
+
Resolver_class_private_field_get(this, _binding).resolve(path, request, (error, text)=>{
|
|
60535
60303
|
if (error) return void callback(error);
|
|
60536
60304
|
const req = text ? JSON.parse(text) : void 0;
|
|
60537
60305
|
if (req?.fileDependencies) req.fileDependencies.forEach((file)=>{
|
|
@@ -60544,11 +60312,11 @@ class Resolver {
|
|
|
60544
60312
|
});
|
|
60545
60313
|
}
|
|
60546
60314
|
constructor(binding){
|
|
60547
|
-
Resolver_class_private_field_init(this,
|
|
60315
|
+
Resolver_class_private_field_init(this, _binding, {
|
|
60548
60316
|
writable: true,
|
|
60549
60317
|
value: void 0
|
|
60550
60318
|
});
|
|
60551
|
-
Resolver_class_private_field_set(this,
|
|
60319
|
+
Resolver_class_private_field_set(this, _binding, binding);
|
|
60552
60320
|
}
|
|
60553
60321
|
}
|
|
60554
60322
|
function ResolverFactory_check_private_redeclaration(obj, privateCollection) {
|
|
@@ -61725,24 +61493,24 @@ class Watching {
|
|
|
61725
61493
|
compilation.endTime = Date.now();
|
|
61726
61494
|
const cbs = this.callbacks;
|
|
61727
61495
|
this.callbacks = [];
|
|
61496
|
+
const fileDependencies = new Set([
|
|
61497
|
+
...compilation.fileDependencies
|
|
61498
|
+
]);
|
|
61499
|
+
fileDependencies.added = new Set(compilation.__internal__addedFileDependencies);
|
|
61500
|
+
fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
|
|
61501
|
+
const contextDependencies = new Set([
|
|
61502
|
+
...compilation.contextDependencies
|
|
61503
|
+
]);
|
|
61504
|
+
contextDependencies.added = new Set(compilation.__internal__addedContextDependencies);
|
|
61505
|
+
contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
|
|
61506
|
+
const missingDependencies = new Set([
|
|
61507
|
+
...compilation.missingDependencies
|
|
61508
|
+
]);
|
|
61509
|
+
missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies);
|
|
61510
|
+
missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies);
|
|
61728
61511
|
this.compiler.hooks.done.callAsync(stats, (err)=>{
|
|
61729
61512
|
if (err) return handleError(err, cbs);
|
|
61730
61513
|
this.handler(null, stats);
|
|
61731
|
-
const fileDependencies = new Set([
|
|
61732
|
-
...compilation.fileDependencies
|
|
61733
|
-
]);
|
|
61734
|
-
fileDependencies.added = new Set(compilation.__internal__addedFileDependencies);
|
|
61735
|
-
fileDependencies.removed = new Set(compilation.__internal__removedFileDependencies);
|
|
61736
|
-
const contextDependencies = new Set([
|
|
61737
|
-
...compilation.contextDependencies
|
|
61738
|
-
]);
|
|
61739
|
-
contextDependencies.added = new Set(compilation.__internal__addedContextDependencies);
|
|
61740
|
-
contextDependencies.removed = new Set(compilation.__internal__removedContextDependencies);
|
|
61741
|
-
const missingDependencies = new Set([
|
|
61742
|
-
...compilation.missingDependencies
|
|
61743
|
-
]);
|
|
61744
|
-
missingDependencies.added = new Set(compilation.__internal__addedMissingDependencies);
|
|
61745
|
-
missingDependencies.removed = new Set(compilation.__internal__removedMissingDependencies);
|
|
61746
61514
|
Watching_process.nextTick(()=>{
|
|
61747
61515
|
if (!Watching_class_private_field_get(this, _closed)) this.watch(fileDependencies, contextDependencies, missingDependencies);
|
|
61748
61516
|
});
|
|
@@ -61948,7 +61716,6 @@ function Compiler_define_property(obj, key, value) {
|
|
|
61948
61716
|
return obj;
|
|
61949
61717
|
}
|
|
61950
61718
|
const COMPILATION_WEAK_MAP = new WeakMap();
|
|
61951
|
-
const GET_COMPILER_ID = Symbol("getCompilerId");
|
|
61952
61719
|
var _instance = /*#__PURE__*/ new WeakMap(), Compiler_initial = /*#__PURE__*/ new WeakMap(), Compiler_compilation = /*#__PURE__*/ new WeakMap(), _compilationParams = /*#__PURE__*/ new WeakMap(), _builtinPlugins = /*#__PURE__*/ new WeakMap(), _moduleExecutionResultsMap = /*#__PURE__*/ new WeakMap(), _nonSkippableRegisters = /*#__PURE__*/ new WeakMap(), _registers = /*#__PURE__*/ new WeakMap(), _ruleSet = /*#__PURE__*/ new WeakMap(), _build = /*#__PURE__*/ new WeakSet(), _resetThisCompilation = /*#__PURE__*/ new WeakSet(), _newCompilationParams = /*#__PURE__*/ new WeakSet(), _getInstance = /*#__PURE__*/ new WeakSet(), _createHooksRegisters = /*#__PURE__*/ new WeakSet(), _updateNonSkippableRegisters = /*#__PURE__*/ new WeakSet(), _decorateJsTaps = /*#__PURE__*/ new WeakSet(), _createHookRegisterTaps = /*#__PURE__*/ new WeakSet(), _createHookMapRegisterTaps = /*#__PURE__*/ new WeakSet();
|
|
61953
61720
|
class Compiler {
|
|
61954
61721
|
get recordsInputPath() {
|
|
@@ -62414,12 +62181,6 @@ class Compiler {
|
|
|
62414
62181
|
this.resolverFactory = new ResolverFactory(options.resolve.pnp ?? getPnpDefault(), options.resolve, options.resolveLoader);
|
|
62415
62182
|
new JsLoaderRspackPlugin(this).apply(this);
|
|
62416
62183
|
new ExecuteModulePlugin().apply(this);
|
|
62417
|
-
Object.defineProperty(this, GET_COMPILER_ID, {
|
|
62418
|
-
writable: false,
|
|
62419
|
-
configurable: false,
|
|
62420
|
-
enumerable: false,
|
|
62421
|
-
value: ()=>Compiler_class_private_field_get(this, _instance).getCompilerId()
|
|
62422
|
-
});
|
|
62423
62184
|
}
|
|
62424
62185
|
}
|
|
62425
62186
|
function build(callback) {
|
|
@@ -62621,7 +62382,7 @@ class MultiStats {
|
|
|
62621
62382
|
return obj;
|
|
62622
62383
|
});
|
|
62623
62384
|
if (childOptions.version) {
|
|
62624
|
-
obj.rspackVersion = "1.7.0-canary-
|
|
62385
|
+
obj.rspackVersion = "1.7.0-canary-c8f933e3-20251224124051";
|
|
62625
62386
|
obj.version = "5.75.0";
|
|
62626
62387
|
}
|
|
62627
62388
|
if (childOptions.hash) obj.hash = obj.children.map((j)=>j.hash).join("");
|
|
@@ -63937,7 +63698,7 @@ const SIMPLE_EXTRACTORS = {
|
|
|
63937
63698
|
},
|
|
63938
63699
|
version: (object)=>{
|
|
63939
63700
|
object.version = "5.75.0";
|
|
63940
|
-
object.rspackVersion = "1.7.0-canary-
|
|
63701
|
+
object.rspackVersion = "1.7.0-canary-c8f933e3-20251224124051";
|
|
63941
63702
|
},
|
|
63942
63703
|
env: (object, _compilation, _context, { _env })=>{
|
|
63943
63704
|
object.env = _env;
|
|
@@ -66366,101 +66127,6 @@ class NodeTemplatePlugin {
|
|
|
66366
66127
|
this._options = _options;
|
|
66367
66128
|
}
|
|
66368
66129
|
}
|
|
66369
|
-
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
66370
|
-
function isRequiredVersion(str) {
|
|
66371
|
-
return VERSION_PATTERN_REGEXP.test(str);
|
|
66372
|
-
}
|
|
66373
|
-
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
66374
|
-
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
66375
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66376
|
-
value: value,
|
|
66377
|
-
enumerable: true,
|
|
66378
|
-
configurable: true,
|
|
66379
|
-
writable: true
|
|
66380
|
-
});
|
|
66381
|
-
else obj[key] = value;
|
|
66382
|
-
return obj;
|
|
66383
|
-
}
|
|
66384
|
-
const MANIFEST_FILE_NAME = "mf-manifest.json";
|
|
66385
|
-
const STATS_FILE_NAME = "mf-stats.json";
|
|
66386
|
-
const LOCAL_BUILD_VERSION = "local";
|
|
66387
|
-
const JSON_EXT = ".json";
|
|
66388
|
-
function isPlainObject(value) {
|
|
66389
|
-
return Boolean(value) && "object" == typeof value && !Array.isArray(value);
|
|
66390
|
-
}
|
|
66391
|
-
function parseJSON(input, guard) {
|
|
66392
|
-
try {
|
|
66393
|
-
const parsed = JSON.parse(input);
|
|
66394
|
-
if (guard(parsed)) return parsed;
|
|
66395
|
-
} catch {}
|
|
66396
|
-
}
|
|
66397
|
-
function readPKGJson(root) {
|
|
66398
|
-
const base = root ? (0, path_browserify.resolve)(root) : ModuleFederationManifestPlugin_process.cwd();
|
|
66399
|
-
const pkgPath = (0, path_browserify.join)(base, "package.json");
|
|
66400
|
-
try {
|
|
66401
|
-
const content = (0, browser_fs.readFileSync)(pkgPath, "utf-8");
|
|
66402
|
-
const parsed = parseJSON(content, isPlainObject);
|
|
66403
|
-
if (parsed) {
|
|
66404
|
-
const filtered = {};
|
|
66405
|
-
for (const [key, value] of Object.entries(parsed))if ("string" == typeof value) filtered[key] = value;
|
|
66406
|
-
if (Object.keys(filtered).length > 0) return filtered;
|
|
66407
|
-
}
|
|
66408
|
-
} catch {}
|
|
66409
|
-
return {};
|
|
66410
|
-
}
|
|
66411
|
-
function getBuildInfo(isDev, root) {
|
|
66412
|
-
const rootPath = root || ModuleFederationManifestPlugin_process.cwd();
|
|
66413
|
-
const pkg = readPKGJson(rootPath);
|
|
66414
|
-
const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
|
|
66415
|
-
return {
|
|
66416
|
-
buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
66417
|
-
buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
66418
|
-
};
|
|
66419
|
-
}
|
|
66420
|
-
function getFileName(manifestOptions) {
|
|
66421
|
-
if (!manifestOptions) return {
|
|
66422
|
-
statsFileName: STATS_FILE_NAME,
|
|
66423
|
-
manifestFileName: MANIFEST_FILE_NAME
|
|
66424
|
-
};
|
|
66425
|
-
const filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "";
|
|
66426
|
-
const fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "";
|
|
66427
|
-
const addExt = (name)=>{
|
|
66428
|
-
if (name.endsWith(JSON_EXT)) return name;
|
|
66429
|
-
return `${name}${JSON_EXT}`;
|
|
66430
|
-
};
|
|
66431
|
-
const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
|
|
66432
|
-
const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
|
|
66433
|
-
const statsFileName = fileName ? insertSuffix(manifestFileName, "-stats") : STATS_FILE_NAME;
|
|
66434
|
-
return {
|
|
66435
|
-
statsFileName: (0, path_browserify.join)(filePath, statsFileName),
|
|
66436
|
-
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
66437
|
-
};
|
|
66438
|
-
}
|
|
66439
|
-
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66440
|
-
raw(compiler) {
|
|
66441
|
-
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = this.opts;
|
|
66442
|
-
const { statsFileName, manifestFileName } = getFileName(this.opts);
|
|
66443
|
-
const rawOptions = {
|
|
66444
|
-
name: this.opts.name,
|
|
66445
|
-
globalName: this.opts.globalName,
|
|
66446
|
-
fileName,
|
|
66447
|
-
filePath,
|
|
66448
|
-
manifestFileName,
|
|
66449
|
-
statsFileName,
|
|
66450
|
-
disableAssetsAnalyze,
|
|
66451
|
-
remoteAliasMap,
|
|
66452
|
-
exposes,
|
|
66453
|
-
shared,
|
|
66454
|
-
buildInfo: getBuildInfo("development" === compiler.options.mode, compiler.context)
|
|
66455
|
-
};
|
|
66456
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66457
|
-
}
|
|
66458
|
-
constructor(opts){
|
|
66459
|
-
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "opts", void 0);
|
|
66460
|
-
this.opts = opts;
|
|
66461
|
-
}
|
|
66462
|
-
}
|
|
66463
|
-
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
66464
66130
|
const options_process = (options, normalizeSimple, normalizeOptions, fn)=>{
|
|
66465
66131
|
const array = (items)=>{
|
|
66466
66132
|
for (const item of items)if ("string" == typeof item) fn(item, normalizeSimple(item, item));
|
|
@@ -66485,7 +66151,7 @@ const parseOptions = (options, normalizeSimple, normalizeOptions)=>{
|
|
|
66485
66151
|
});
|
|
66486
66152
|
return items;
|
|
66487
66153
|
};
|
|
66488
|
-
function
|
|
66154
|
+
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66489
66155
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66490
66156
|
value: value,
|
|
66491
66157
|
enumerable: true,
|
|
@@ -66495,57 +66161,318 @@ function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
|
66495
66161
|
else obj[key] = value;
|
|
66496
66162
|
return obj;
|
|
66497
66163
|
}
|
|
66498
|
-
|
|
66499
|
-
|
|
66500
|
-
|
|
66501
|
-
const paths = getPaths(this._options);
|
|
66502
|
-
compiler.options.resolve.alias = {
|
|
66503
|
-
"@module-federation/runtime-tools": paths.runtimeTools,
|
|
66504
|
-
"@module-federation/runtime": paths.runtime,
|
|
66505
|
-
...compiler.options.resolve.alias
|
|
66506
|
-
};
|
|
66507
|
-
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler);
|
|
66508
|
-
new ModuleFederationRuntimePlugin({
|
|
66509
|
-
entryRuntime
|
|
66510
|
-
}).apply(compiler);
|
|
66511
|
-
new webpack.container.ModuleFederationPluginV1({
|
|
66512
|
-
...this._options,
|
|
66513
|
-
enhanced: true
|
|
66514
|
-
}).apply(compiler);
|
|
66515
|
-
if (this._options.manifest) {
|
|
66516
|
-
const manifestOptions = true === this._options.manifest ? {} : {
|
|
66517
|
-
...this._options.manifest
|
|
66518
|
-
};
|
|
66519
|
-
const containerName = manifestOptions.name ?? this._options.name;
|
|
66520
|
-
const globalName = manifestOptions.globalName ?? resolveLibraryGlobalName(this._options.library) ?? containerName;
|
|
66521
|
-
const remoteAliasMap = Object.entries(getRemoteInfos(this._options)).reduce((sum, cur)=>{
|
|
66522
|
-
if (cur[1].length > 1) return sum;
|
|
66523
|
-
const remoteInfo = cur[1][0];
|
|
66524
|
-
const { entry, alias, name } = remoteInfo;
|
|
66525
|
-
if (entry && name) sum[alias] = {
|
|
66526
|
-
name,
|
|
66527
|
-
entry
|
|
66528
|
-
};
|
|
66529
|
-
return sum;
|
|
66530
|
-
}, {});
|
|
66531
|
-
const manifestExposes = collectManifestExposes(this._options.exposes);
|
|
66532
|
-
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66533
|
-
const manifestShared = collectManifestShared(this._options.shared);
|
|
66534
|
-
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66535
|
-
new ModuleFederationManifestPlugin({
|
|
66536
|
-
...manifestOptions,
|
|
66537
|
-
name: containerName,
|
|
66538
|
-
globalName,
|
|
66539
|
-
remoteAliasMap
|
|
66540
|
-
}).apply(compiler);
|
|
66541
|
-
}
|
|
66542
|
-
}
|
|
66543
|
-
constructor(_options){
|
|
66544
|
-
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
66545
|
-
this._options = _options;
|
|
66546
|
-
}
|
|
66164
|
+
const compilerSet = new WeakSet();
|
|
66165
|
+
function isSingleton(compiler) {
|
|
66166
|
+
return compilerSet.has(compiler);
|
|
66547
66167
|
}
|
|
66548
|
-
function
|
|
66168
|
+
function setSingleton(compiler) {
|
|
66169
|
+
compilerSet.add(compiler);
|
|
66170
|
+
}
|
|
66171
|
+
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66172
|
+
raw(compiler) {
|
|
66173
|
+
if (isSingleton(compiler)) return;
|
|
66174
|
+
setSingleton(compiler);
|
|
66175
|
+
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66176
|
+
}
|
|
66177
|
+
constructor(enhanced = false){
|
|
66178
|
+
super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
|
|
66179
|
+
}
|
|
66180
|
+
}
|
|
66181
|
+
const VERSION_PATTERN_REGEXP = /^([\d^=v<>~]|[*xX]$)/;
|
|
66182
|
+
function isRequiredVersion(str) {
|
|
66183
|
+
return VERSION_PATTERN_REGEXP.test(str);
|
|
66184
|
+
}
|
|
66185
|
+
const encodeName = function(name, prefix = "", withExt = false) {
|
|
66186
|
+
const ext = withExt ? ".js" : "";
|
|
66187
|
+
return `${prefix}${name.replace(/@/g, "scope_").replace(/-/g, "_").replace(/\//g, "__").replace(/\./g, "")}${ext}`;
|
|
66188
|
+
};
|
|
66189
|
+
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66190
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66191
|
+
value: value,
|
|
66192
|
+
enumerable: true,
|
|
66193
|
+
configurable: true,
|
|
66194
|
+
writable: true
|
|
66195
|
+
});
|
|
66196
|
+
else obj[key] = value;
|
|
66197
|
+
return obj;
|
|
66198
|
+
}
|
|
66199
|
+
function normalizeConsumeShareOptions(consumes, shareScope) {
|
|
66200
|
+
return parseOptions(consumes, (item, key)=>{
|
|
66201
|
+
if (Array.isArray(item)) throw new Error("Unexpected array in options");
|
|
66202
|
+
const result = item !== key && isRequiredVersion(item) ? {
|
|
66203
|
+
import: key,
|
|
66204
|
+
shareScope: shareScope || "default",
|
|
66205
|
+
shareKey: key,
|
|
66206
|
+
requiredVersion: item,
|
|
66207
|
+
strictVersion: true,
|
|
66208
|
+
packageName: void 0,
|
|
66209
|
+
singleton: false,
|
|
66210
|
+
eager: false,
|
|
66211
|
+
treeshakeStrategy: void 0
|
|
66212
|
+
} : {
|
|
66213
|
+
import: key,
|
|
66214
|
+
shareScope: shareScope || "default",
|
|
66215
|
+
shareKey: key,
|
|
66216
|
+
requiredVersion: void 0,
|
|
66217
|
+
packageName: void 0,
|
|
66218
|
+
strictVersion: false,
|
|
66219
|
+
singleton: false,
|
|
66220
|
+
eager: false,
|
|
66221
|
+
treeshakeStrategy: void 0
|
|
66222
|
+
};
|
|
66223
|
+
return result;
|
|
66224
|
+
}, (item, key)=>({
|
|
66225
|
+
import: false === item.import ? void 0 : item.import || key,
|
|
66226
|
+
shareScope: item.shareScope || shareScope || "default",
|
|
66227
|
+
shareKey: item.shareKey || key,
|
|
66228
|
+
requiredVersion: item.requiredVersion,
|
|
66229
|
+
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66230
|
+
packageName: item.packageName,
|
|
66231
|
+
singleton: !!item.singleton,
|
|
66232
|
+
eager: !!item.eager,
|
|
66233
|
+
treeshakeStrategy: item.treeshakeStrategy
|
|
66234
|
+
}));
|
|
66235
|
+
}
|
|
66236
|
+
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66237
|
+
raw(compiler) {
|
|
66238
|
+
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66239
|
+
const rawOptions = {
|
|
66240
|
+
consumes: this._options.consumes.map(([key, v])=>({
|
|
66241
|
+
key,
|
|
66242
|
+
...v
|
|
66243
|
+
})),
|
|
66244
|
+
enhanced: this._options.enhanced
|
|
66245
|
+
};
|
|
66246
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66247
|
+
}
|
|
66248
|
+
constructor(options){
|
|
66249
|
+
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66250
|
+
this._options = {
|
|
66251
|
+
consumes: normalizeConsumeShareOptions(options.consumes, options.shareScope),
|
|
66252
|
+
enhanced: options.enhanced ?? false
|
|
66253
|
+
};
|
|
66254
|
+
}
|
|
66255
|
+
}
|
|
66256
|
+
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66257
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66258
|
+
value: value,
|
|
66259
|
+
enumerable: true,
|
|
66260
|
+
configurable: true,
|
|
66261
|
+
writable: true
|
|
66262
|
+
});
|
|
66263
|
+
else obj[key] = value;
|
|
66264
|
+
return obj;
|
|
66265
|
+
}
|
|
66266
|
+
function normalizeProvideShareOptions(options, shareScope, enhanced) {
|
|
66267
|
+
return parseOptions(options, (item)=>{
|
|
66268
|
+
if (Array.isArray(item)) throw new Error("Unexpected array of provides");
|
|
66269
|
+
return {
|
|
66270
|
+
shareKey: item,
|
|
66271
|
+
version: void 0,
|
|
66272
|
+
shareScope: shareScope || "default",
|
|
66273
|
+
eager: false
|
|
66274
|
+
};
|
|
66275
|
+
}, (item)=>{
|
|
66276
|
+
const raw = {
|
|
66277
|
+
shareKey: item.shareKey,
|
|
66278
|
+
version: item.version,
|
|
66279
|
+
shareScope: item.shareScope || shareScope || "default",
|
|
66280
|
+
eager: !!item.eager
|
|
66281
|
+
};
|
|
66282
|
+
if (enhanced) {
|
|
66283
|
+
const enhancedItem = item;
|
|
66284
|
+
return {
|
|
66285
|
+
...raw,
|
|
66286
|
+
singleton: enhancedItem.singleton,
|
|
66287
|
+
requiredVersion: enhancedItem.requiredVersion,
|
|
66288
|
+
strictVersion: enhancedItem.strictVersion,
|
|
66289
|
+
treeshakeStrategy: enhancedItem.treeshakeStrategy
|
|
66290
|
+
};
|
|
66291
|
+
}
|
|
66292
|
+
return raw;
|
|
66293
|
+
});
|
|
66294
|
+
}
|
|
66295
|
+
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66296
|
+
raw(compiler) {
|
|
66297
|
+
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66298
|
+
const rawOptions = this._provides.map(([key, v])=>({
|
|
66299
|
+
key,
|
|
66300
|
+
...v
|
|
66301
|
+
}));
|
|
66302
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66303
|
+
}
|
|
66304
|
+
constructor(options){
|
|
66305
|
+
super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
|
|
66306
|
+
this._provides = normalizeProvideShareOptions(options.provides, options.shareScope, options.enhanced);
|
|
66307
|
+
this._enhanced = options.enhanced;
|
|
66308
|
+
}
|
|
66309
|
+
}
|
|
66310
|
+
function SharePlugin_define_property(obj, key, value) {
|
|
66311
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66312
|
+
value: value,
|
|
66313
|
+
enumerable: true,
|
|
66314
|
+
configurable: true,
|
|
66315
|
+
writable: true
|
|
66316
|
+
});
|
|
66317
|
+
else obj[key] = value;
|
|
66318
|
+
return obj;
|
|
66319
|
+
}
|
|
66320
|
+
function normalizeSharedOptions(shared) {
|
|
66321
|
+
return parseOptions(shared, (item, key)=>{
|
|
66322
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66323
|
+
const config = item !== key && isRequiredVersion(item) ? {
|
|
66324
|
+
import: key,
|
|
66325
|
+
requiredVersion: item
|
|
66326
|
+
} : {
|
|
66327
|
+
import: item
|
|
66328
|
+
};
|
|
66329
|
+
return config;
|
|
66330
|
+
}, (item)=>item);
|
|
66331
|
+
}
|
|
66332
|
+
function createProvideShareOptions(normalizedSharedOptions) {
|
|
66333
|
+
return normalizedSharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66334
|
+
[options.import || key]: {
|
|
66335
|
+
shareKey: options.shareKey || key,
|
|
66336
|
+
shareScope: options.shareScope,
|
|
66337
|
+
version: options.version,
|
|
66338
|
+
eager: options.eager,
|
|
66339
|
+
singleton: options.singleton,
|
|
66340
|
+
requiredVersion: options.requiredVersion,
|
|
66341
|
+
strictVersion: options.strictVersion,
|
|
66342
|
+
treeshakeStrategy: options.treeshake?.strategy
|
|
66343
|
+
}
|
|
66344
|
+
}));
|
|
66345
|
+
}
|
|
66346
|
+
function createConsumeShareOptions(normalizedSharedOptions) {
|
|
66347
|
+
return normalizedSharedOptions.map(([key, options])=>({
|
|
66348
|
+
[key]: {
|
|
66349
|
+
import: options.import,
|
|
66350
|
+
shareKey: options.shareKey || key,
|
|
66351
|
+
shareScope: options.shareScope,
|
|
66352
|
+
requiredVersion: options.requiredVersion,
|
|
66353
|
+
strictVersion: options.strictVersion,
|
|
66354
|
+
singleton: options.singleton,
|
|
66355
|
+
packageName: options.packageName,
|
|
66356
|
+
eager: options.eager,
|
|
66357
|
+
treeshakeStrategy: options.treeshake?.strategy
|
|
66358
|
+
}
|
|
66359
|
+
}));
|
|
66360
|
+
}
|
|
66361
|
+
class SharePlugin {
|
|
66362
|
+
apply(compiler) {
|
|
66363
|
+
new ConsumeSharedPlugin({
|
|
66364
|
+
shareScope: this._shareScope,
|
|
66365
|
+
consumes: this._consumes,
|
|
66366
|
+
enhanced: this._enhanced
|
|
66367
|
+
}).apply(compiler);
|
|
66368
|
+
new ProvideSharedPlugin({
|
|
66369
|
+
shareScope: this._shareScope,
|
|
66370
|
+
provides: this._provides,
|
|
66371
|
+
enhanced: this._enhanced
|
|
66372
|
+
}).apply(compiler);
|
|
66373
|
+
}
|
|
66374
|
+
constructor(options){
|
|
66375
|
+
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66376
|
+
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66377
|
+
SharePlugin_define_property(this, "_provides", void 0);
|
|
66378
|
+
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66379
|
+
SharePlugin_define_property(this, "_sharedOptions", void 0);
|
|
66380
|
+
const sharedOptions = normalizeSharedOptions(options.shared);
|
|
66381
|
+
const consumes = createConsumeShareOptions(sharedOptions);
|
|
66382
|
+
const provides = createProvideShareOptions(sharedOptions);
|
|
66383
|
+
this._shareScope = options.shareScope;
|
|
66384
|
+
this._consumes = consumes;
|
|
66385
|
+
this._provides = provides;
|
|
66386
|
+
this._enhanced = options.enhanced ?? false;
|
|
66387
|
+
this._sharedOptions = sharedOptions;
|
|
66388
|
+
}
|
|
66389
|
+
}
|
|
66390
|
+
var ModuleFederationManifestPlugin_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
66391
|
+
function ModuleFederationManifestPlugin_define_property(obj, key, value) {
|
|
66392
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66393
|
+
value: value,
|
|
66394
|
+
enumerable: true,
|
|
66395
|
+
configurable: true,
|
|
66396
|
+
writable: true
|
|
66397
|
+
});
|
|
66398
|
+
else obj[key] = value;
|
|
66399
|
+
return obj;
|
|
66400
|
+
}
|
|
66401
|
+
const MANIFEST_FILE_NAME = "mf-manifest.json";
|
|
66402
|
+
const STATS_FILE_NAME = "mf-stats.json";
|
|
66403
|
+
const LOCAL_BUILD_VERSION = "local";
|
|
66404
|
+
const JSON_EXT = ".json";
|
|
66405
|
+
function isPlainObject(value) {
|
|
66406
|
+
return Boolean(value) && "object" == typeof value && !Array.isArray(value);
|
|
66407
|
+
}
|
|
66408
|
+
function parseJSON(input, guard) {
|
|
66409
|
+
try {
|
|
66410
|
+
const parsed = JSON.parse(input);
|
|
66411
|
+
if (guard(parsed)) return parsed;
|
|
66412
|
+
} catch {}
|
|
66413
|
+
}
|
|
66414
|
+
function readPKGJson(root) {
|
|
66415
|
+
const base = root ? (0, path_browserify.resolve)(root) : ModuleFederationManifestPlugin_process.cwd();
|
|
66416
|
+
const pkgPath = (0, path_browserify.join)(base, "package.json");
|
|
66417
|
+
try {
|
|
66418
|
+
const content = (0, browser_fs.readFileSync)(pkgPath, "utf-8");
|
|
66419
|
+
const parsed = parseJSON(content, isPlainObject);
|
|
66420
|
+
if (parsed) {
|
|
66421
|
+
const filtered = {};
|
|
66422
|
+
for (const [key, value] of Object.entries(parsed))if ("string" == typeof value) filtered[key] = value;
|
|
66423
|
+
if (Object.keys(filtered).length > 0) return filtered;
|
|
66424
|
+
}
|
|
66425
|
+
} catch {}
|
|
66426
|
+
return {};
|
|
66427
|
+
}
|
|
66428
|
+
function getBuildInfo(isDev, compiler, mfConfig) {
|
|
66429
|
+
const rootPath = compiler.options.context || ModuleFederationManifestPlugin_process.cwd();
|
|
66430
|
+
const pkg = readPKGJson(rootPath);
|
|
66431
|
+
const buildVersion = isDev ? LOCAL_BUILD_VERSION : pkg?.version;
|
|
66432
|
+
const statsBuildInfo = {
|
|
66433
|
+
buildVersion: ModuleFederationManifestPlugin_process.env.MF_BUILD_VERSION || buildVersion || "UNKNOWN",
|
|
66434
|
+
buildName: ModuleFederationManifestPlugin_process.env.MF_BUILD_NAME || pkg?.name || "UNKNOWN"
|
|
66435
|
+
};
|
|
66436
|
+
const normalizedShared = normalizeSharedOptions(mfConfig.shared || {});
|
|
66437
|
+
const enableTreeshake = Object.values(normalizedShared).some((config)=>config[1].treeshake);
|
|
66438
|
+
if (enableTreeshake) {
|
|
66439
|
+
statsBuildInfo.target = Array.isArray(compiler.options.target) ? compiler.options.target : [];
|
|
66440
|
+
statsBuildInfo.plugins = mfConfig.treeshakeSharedExcludedPlugins || [];
|
|
66441
|
+
}
|
|
66442
|
+
return statsBuildInfo;
|
|
66443
|
+
}
|
|
66444
|
+
function getFileName(manifestOptions) {
|
|
66445
|
+
if (!manifestOptions) return {
|
|
66446
|
+
statsFileName: "",
|
|
66447
|
+
manifestFileName: ""
|
|
66448
|
+
};
|
|
66449
|
+
if ("boolean" == typeof manifestOptions) return {
|
|
66450
|
+
statsFileName: STATS_FILE_NAME,
|
|
66451
|
+
manifestFileName: MANIFEST_FILE_NAME
|
|
66452
|
+
};
|
|
66453
|
+
const filePath = "boolean" == typeof manifestOptions ? "" : manifestOptions.filePath || "";
|
|
66454
|
+
const fileName = "boolean" == typeof manifestOptions ? "" : manifestOptions.fileName || "";
|
|
66455
|
+
const addExt = (name)=>{
|
|
66456
|
+
if (name.endsWith(JSON_EXT)) return name;
|
|
66457
|
+
return `${name}${JSON_EXT}`;
|
|
66458
|
+
};
|
|
66459
|
+
const insertSuffix = (name, suffix)=>name.replace(JSON_EXT, `${suffix}${JSON_EXT}`);
|
|
66460
|
+
const manifestFileName = fileName ? addExt(fileName) : MANIFEST_FILE_NAME;
|
|
66461
|
+
const statsFileName = fileName ? insertSuffix(manifestFileName, "-stats") : STATS_FILE_NAME;
|
|
66462
|
+
return {
|
|
66463
|
+
statsFileName: (0, path_browserify.join)(filePath, statsFileName),
|
|
66464
|
+
manifestFileName: (0, path_browserify.join)(filePath, manifestFileName)
|
|
66465
|
+
};
|
|
66466
|
+
}
|
|
66467
|
+
function resolveLibraryGlobalName(library) {
|
|
66468
|
+
if (!library) return;
|
|
66469
|
+
const libName = library.name;
|
|
66470
|
+
if (!libName) return;
|
|
66471
|
+
if ("string" == typeof libName) return libName;
|
|
66472
|
+
if (Array.isArray(libName)) return libName[0];
|
|
66473
|
+
if ("object" == typeof libName) return libName.root?.[0] ?? libName.amd ?? libName.commonjs ?? void 0;
|
|
66474
|
+
}
|
|
66475
|
+
function collectManifestExposes(exposes) {
|
|
66549
66476
|
if (!exposes) return;
|
|
66550
66477
|
const parsed = parseOptions(exposes, (value)=>({
|
|
66551
66478
|
import: Array.isArray(value) ? value : [
|
|
@@ -66565,39 +66492,627 @@ function collectManifestExposes(exposes) {
|
|
|
66565
66492
|
name: exposeName
|
|
66566
66493
|
};
|
|
66567
66494
|
});
|
|
66568
|
-
return result.length > 0 ? result : void 0;
|
|
66495
|
+
return result.length > 0 ? result : void 0;
|
|
66496
|
+
}
|
|
66497
|
+
function collectManifestShared(shared) {
|
|
66498
|
+
if (!shared) return;
|
|
66499
|
+
const parsed = parseOptions(shared, (item, key)=>{
|
|
66500
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66501
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
66502
|
+
import: key,
|
|
66503
|
+
requiredVersion: item
|
|
66504
|
+
} : {
|
|
66505
|
+
import: item
|
|
66506
|
+
};
|
|
66507
|
+
}, (item)=>item);
|
|
66508
|
+
const result = parsed.map(([key, config])=>{
|
|
66509
|
+
const name = config.shareKey || key;
|
|
66510
|
+
const version = "string" == typeof config.version ? config.version : void 0;
|
|
66511
|
+
const requiredVersion = "string" == typeof config.requiredVersion ? config.requiredVersion : void 0;
|
|
66512
|
+
return {
|
|
66513
|
+
name,
|
|
66514
|
+
version,
|
|
66515
|
+
requiredVersion,
|
|
66516
|
+
singleton: config.singleton
|
|
66517
|
+
};
|
|
66518
|
+
});
|
|
66519
|
+
return result.length > 0 ? result : void 0;
|
|
66520
|
+
}
|
|
66521
|
+
function normalizeManifestOptions(mfConfig) {
|
|
66522
|
+
const manifestOptions = true === mfConfig.manifest ? {} : {
|
|
66523
|
+
...mfConfig.manifest
|
|
66524
|
+
};
|
|
66525
|
+
const containerName = mfConfig.name;
|
|
66526
|
+
const globalName = resolveLibraryGlobalName(mfConfig.library) ?? containerName;
|
|
66527
|
+
const remoteAliasMap = Object.entries(getRemoteInfos(mfConfig)).reduce((sum, cur)=>{
|
|
66528
|
+
if (cur[1].length > 1) return sum;
|
|
66529
|
+
const remoteInfo = cur[1][0];
|
|
66530
|
+
const { entry, alias, name } = remoteInfo;
|
|
66531
|
+
if (entry && name) sum[alias] = {
|
|
66532
|
+
name,
|
|
66533
|
+
entry
|
|
66534
|
+
};
|
|
66535
|
+
return sum;
|
|
66536
|
+
}, {});
|
|
66537
|
+
const manifestExposes = collectManifestExposes(mfConfig.exposes);
|
|
66538
|
+
if (void 0 === manifestOptions.exposes && manifestExposes) manifestOptions.exposes = manifestExposes;
|
|
66539
|
+
const manifestShared = collectManifestShared(mfConfig.shared);
|
|
66540
|
+
if (void 0 === manifestOptions.shared && manifestShared) manifestOptions.shared = manifestShared;
|
|
66541
|
+
return {
|
|
66542
|
+
...manifestOptions,
|
|
66543
|
+
remoteAliasMap,
|
|
66544
|
+
globalName,
|
|
66545
|
+
name: containerName
|
|
66546
|
+
};
|
|
66547
|
+
}
|
|
66548
|
+
class ModuleFederationManifestPlugin extends RspackBuiltinPlugin {
|
|
66549
|
+
raw(compiler) {
|
|
66550
|
+
const opts = normalizeManifestOptions(this.rawOpts);
|
|
66551
|
+
const { fileName, filePath, disableAssetsAnalyze, remoteAliasMap, exposes, shared } = opts;
|
|
66552
|
+
const { statsFileName, manifestFileName } = getFileName(opts);
|
|
66553
|
+
const rawOptions = {
|
|
66554
|
+
name: opts.name,
|
|
66555
|
+
globalName: opts.globalName,
|
|
66556
|
+
fileName,
|
|
66557
|
+
filePath,
|
|
66558
|
+
manifestFileName,
|
|
66559
|
+
statsFileName,
|
|
66560
|
+
disableAssetsAnalyze,
|
|
66561
|
+
remoteAliasMap,
|
|
66562
|
+
exposes,
|
|
66563
|
+
shared,
|
|
66564
|
+
buildInfo: getBuildInfo("development" === compiler.options.mode, compiler, this.rawOpts)
|
|
66565
|
+
};
|
|
66566
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66567
|
+
}
|
|
66568
|
+
constructor(opts){
|
|
66569
|
+
super(), ModuleFederationManifestPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationManifestPlugin), ModuleFederationManifestPlugin_define_property(this, "rawOpts", void 0);
|
|
66570
|
+
this.rawOpts = opts;
|
|
66571
|
+
}
|
|
66572
|
+
}
|
|
66573
|
+
function CollectSharedEntryPlugin_define_property(obj, key, value) {
|
|
66574
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66575
|
+
value: value,
|
|
66576
|
+
enumerable: true,
|
|
66577
|
+
configurable: true,
|
|
66578
|
+
writable: true
|
|
66579
|
+
});
|
|
66580
|
+
else obj[key] = value;
|
|
66581
|
+
return obj;
|
|
66582
|
+
}
|
|
66583
|
+
const SHARE_ENTRY_ASSET = "collect-shared-entries.json";
|
|
66584
|
+
class CollectSharedEntryPlugin extends RspackBuiltinPlugin {
|
|
66585
|
+
getData() {
|
|
66586
|
+
return this._collectedEntries;
|
|
66587
|
+
}
|
|
66588
|
+
getFilename() {
|
|
66589
|
+
return SHARE_ENTRY_ASSET;
|
|
66590
|
+
}
|
|
66591
|
+
apply(compiler) {
|
|
66592
|
+
super.apply(compiler);
|
|
66593
|
+
compiler.hooks.thisCompilation.tap("Collect shared entry", (compilation)=>{
|
|
66594
|
+
compilation.hooks.processAssets.tapPromise({
|
|
66595
|
+
name: "CollectSharedEntry",
|
|
66596
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
|
|
66597
|
+
}, async ()=>{
|
|
66598
|
+
compilation.getAssets().forEach((asset)=>{
|
|
66599
|
+
if (asset.name === SHARE_ENTRY_ASSET) this._collectedEntries = JSON.parse(asset.source.source().toString());
|
|
66600
|
+
compilation.deleteAsset(asset.name);
|
|
66601
|
+
});
|
|
66602
|
+
});
|
|
66603
|
+
});
|
|
66604
|
+
}
|
|
66605
|
+
raw() {
|
|
66606
|
+
const consumeShareOptions = createConsumeShareOptions(this.sharedOptions);
|
|
66607
|
+
const normalizedConsumeShareOptions = normalizeConsumeShareOptions(consumeShareOptions);
|
|
66608
|
+
const rawOptions = {
|
|
66609
|
+
consumes: normalizedConsumeShareOptions.map(([key, v])=>({
|
|
66610
|
+
key,
|
|
66611
|
+
...v
|
|
66612
|
+
})),
|
|
66613
|
+
filename: this.getFilename()
|
|
66614
|
+
};
|
|
66615
|
+
return createBuiltinPlugin(this.name, rawOptions);
|
|
66616
|
+
}
|
|
66617
|
+
constructor(options){
|
|
66618
|
+
super(), CollectSharedEntryPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.CollectSharedEntryPlugin), CollectSharedEntryPlugin_define_property(this, "sharedOptions", void 0), CollectSharedEntryPlugin_define_property(this, "_collectedEntries", void 0);
|
|
66619
|
+
const { sharedOptions } = options;
|
|
66620
|
+
this.sharedOptions = sharedOptions;
|
|
66621
|
+
this._collectedEntries = {};
|
|
66622
|
+
}
|
|
66623
|
+
}
|
|
66624
|
+
function SharedContainerPlugin_define_property(obj, key, value) {
|
|
66625
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66626
|
+
value: value,
|
|
66627
|
+
enumerable: true,
|
|
66628
|
+
configurable: true,
|
|
66629
|
+
writable: true
|
|
66630
|
+
});
|
|
66631
|
+
else obj[key] = value;
|
|
66632
|
+
return obj;
|
|
66633
|
+
}
|
|
66634
|
+
function assert(condition, msg) {
|
|
66635
|
+
if (!condition) throw new Error(msg);
|
|
66636
|
+
}
|
|
66637
|
+
const HOT_UPDATE_SUFFIX = ".hot-update";
|
|
66638
|
+
class SharedContainerPlugin extends RspackBuiltinPlugin {
|
|
66639
|
+
getData() {
|
|
66640
|
+
return [
|
|
66641
|
+
this._options.fileName,
|
|
66642
|
+
this._globalName,
|
|
66643
|
+
this._options.version
|
|
66644
|
+
];
|
|
66645
|
+
}
|
|
66646
|
+
raw(compiler) {
|
|
66647
|
+
const { library } = this._options;
|
|
66648
|
+
if (!compiler.options.output.enabledLibraryTypes.includes(library.type)) compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
66649
|
+
return createBuiltinPlugin(this.name, this._options);
|
|
66650
|
+
}
|
|
66651
|
+
apply(compiler) {
|
|
66652
|
+
super.apply(compiler);
|
|
66653
|
+
const shareName = this._shareName;
|
|
66654
|
+
compiler.hooks.thisCompilation.tap(this.name, (compilation)=>{
|
|
66655
|
+
compilation.hooks.processAssets.tapPromise({
|
|
66656
|
+
name: "getShareContainerFile"
|
|
66657
|
+
}, async ()=>{
|
|
66658
|
+
const remoteEntryPoint = compilation.entrypoints.get(shareName);
|
|
66659
|
+
assert(remoteEntryPoint, `Can not get shared ${shareName} entryPoint!`);
|
|
66660
|
+
const remoteEntryNameChunk = compilation.namedChunks.get(shareName);
|
|
66661
|
+
assert(remoteEntryNameChunk, `Can not get shared ${shareName} chunk!`);
|
|
66662
|
+
const files = Array.from(remoteEntryNameChunk.files).filter((f)=>!f.includes(HOT_UPDATE_SUFFIX) && !f.endsWith(".css"));
|
|
66663
|
+
assert(files.length > 0, `no files found for shared ${shareName} chunk`);
|
|
66664
|
+
assert(1 === files.length, `shared ${shareName} chunk should not have multiple files!, current files: ${files.join(",")}`);
|
|
66665
|
+
this.filename = files[0];
|
|
66666
|
+
});
|
|
66667
|
+
});
|
|
66668
|
+
}
|
|
66669
|
+
constructor(options){
|
|
66670
|
+
super(), SharedContainerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedContainerPlugin), SharedContainerPlugin_define_property(this, "filename", ""), SharedContainerPlugin_define_property(this, "_options", void 0), SharedContainerPlugin_define_property(this, "_shareName", void 0), SharedContainerPlugin_define_property(this, "_globalName", void 0);
|
|
66671
|
+
const { shareName, library, request, independentShareFileName, mfName } = options;
|
|
66672
|
+
const version = options.version || "0.0.0";
|
|
66673
|
+
this._globalName = encodeName(`${mfName}_${shareName}_${version}`);
|
|
66674
|
+
const fileName = independentShareFileName || `${version}/share-entry.js`;
|
|
66675
|
+
this._shareName = shareName;
|
|
66676
|
+
this._options = {
|
|
66677
|
+
name: shareName,
|
|
66678
|
+
request: request,
|
|
66679
|
+
library: (library ? {
|
|
66680
|
+
...library,
|
|
66681
|
+
name: this._globalName
|
|
66682
|
+
} : void 0) || {
|
|
66683
|
+
type: "global",
|
|
66684
|
+
name: this._globalName
|
|
66685
|
+
},
|
|
66686
|
+
version,
|
|
66687
|
+
fileName
|
|
66688
|
+
};
|
|
66689
|
+
}
|
|
66690
|
+
}
|
|
66691
|
+
function SharedUsedExportsOptimizerPlugin_define_property(obj, key, value) {
|
|
66692
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66693
|
+
value: value,
|
|
66694
|
+
enumerable: true,
|
|
66695
|
+
configurable: true,
|
|
66696
|
+
writable: true
|
|
66697
|
+
});
|
|
66698
|
+
else obj[key] = value;
|
|
66699
|
+
return obj;
|
|
66700
|
+
}
|
|
66701
|
+
class SharedUsedExportsOptimizerPlugin extends RspackBuiltinPlugin {
|
|
66702
|
+
buildOptions() {
|
|
66703
|
+
const shared = this.sharedOptions.map(([shareKey, config])=>({
|
|
66704
|
+
shareKey,
|
|
66705
|
+
treeshake: !!config.treeshake,
|
|
66706
|
+
usedExports: config.treeshake?.usedExports
|
|
66707
|
+
}));
|
|
66708
|
+
const { manifestFileName, statsFileName } = getFileName(this.manifestOptions);
|
|
66709
|
+
return {
|
|
66710
|
+
shared,
|
|
66711
|
+
injectUsedExports: this.injectUsedExports,
|
|
66712
|
+
manifestFileName,
|
|
66713
|
+
statsFileName
|
|
66714
|
+
};
|
|
66715
|
+
}
|
|
66716
|
+
raw() {
|
|
66717
|
+
if (!this.sharedOptions.length) return;
|
|
66718
|
+
return createBuiltinPlugin(this.name, this.buildOptions());
|
|
66719
|
+
}
|
|
66720
|
+
constructor(sharedOptions, injectUsedExports, manifestOptions){
|
|
66721
|
+
super(), SharedUsedExportsOptimizerPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.SharedUsedExportsOptimizerPlugin), SharedUsedExportsOptimizerPlugin_define_property(this, "sharedOptions", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "injectUsedExports", void 0), SharedUsedExportsOptimizerPlugin_define_property(this, "manifestOptions", void 0);
|
|
66722
|
+
this.sharedOptions = sharedOptions;
|
|
66723
|
+
this.injectUsedExports = injectUsedExports ?? true;
|
|
66724
|
+
this.manifestOptions = manifestOptions ?? {};
|
|
66725
|
+
}
|
|
66726
|
+
}
|
|
66727
|
+
function IndependentSharedPlugin_define_property(obj, key, value) {
|
|
66728
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
66729
|
+
value: value,
|
|
66730
|
+
enumerable: true,
|
|
66731
|
+
configurable: true,
|
|
66732
|
+
writable: true
|
|
66733
|
+
});
|
|
66734
|
+
else obj[key] = value;
|
|
66735
|
+
return obj;
|
|
66736
|
+
}
|
|
66737
|
+
const VIRTUAL_ENTRY = "./virtual-entry.js";
|
|
66738
|
+
const VIRTUAL_ENTRY_NAME = "virtual-entry";
|
|
66739
|
+
const filterPlugin = (plugin, excludedPlugins = [])=>{
|
|
66740
|
+
if (!plugin) return true;
|
|
66741
|
+
const pluginName = plugin.name || plugin.constructor?.name;
|
|
66742
|
+
if (!pluginName) return true;
|
|
66743
|
+
return ![
|
|
66744
|
+
"TreeShakeSharedPlugin",
|
|
66745
|
+
"IndependentSharedPlugin",
|
|
66746
|
+
"ModuleFederationPlugin",
|
|
66747
|
+
"SharedUsedExportsOptimizerPlugin",
|
|
66748
|
+
"HtmlWebpackPlugin",
|
|
66749
|
+
"HtmlRspackPlugin",
|
|
66750
|
+
"RsbuildHtmlPlugin",
|
|
66751
|
+
...excludedPlugins
|
|
66752
|
+
].includes(pluginName);
|
|
66753
|
+
};
|
|
66754
|
+
class VirtualEntryPlugin {
|
|
66755
|
+
createEntry() {
|
|
66756
|
+
const { sharedOptions, collectShared } = this;
|
|
66757
|
+
const entryContent = sharedOptions.reduce((acc, cur, index)=>{
|
|
66758
|
+
const importLine = `import shared_${index} from '${cur[0]}';\n`;
|
|
66759
|
+
const logLine = collectShared ? `console.log(shared_${index});\n` : "";
|
|
66760
|
+
return acc + importLine + logLine;
|
|
66761
|
+
}, "");
|
|
66762
|
+
return entryContent;
|
|
66763
|
+
}
|
|
66764
|
+
static entry() {
|
|
66765
|
+
return {
|
|
66766
|
+
[VIRTUAL_ENTRY_NAME]: VIRTUAL_ENTRY
|
|
66767
|
+
};
|
|
66768
|
+
}
|
|
66769
|
+
apply(compiler) {
|
|
66770
|
+
new compiler.rspack.experiments.VirtualModulesPlugin({
|
|
66771
|
+
[VIRTUAL_ENTRY]: this.createEntry()
|
|
66772
|
+
}).apply(compiler);
|
|
66773
|
+
compiler.hooks.thisCompilation.tap("RemoveVirtualEntryAsset", (compilation)=>{
|
|
66774
|
+
compilation.hooks.processAssets.tapPromise({
|
|
66775
|
+
name: "RemoveVirtualEntryAsset",
|
|
66776
|
+
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE
|
|
66777
|
+
}, async ()=>{
|
|
66778
|
+
try {
|
|
66779
|
+
const chunk = compilation.namedChunks.get(VIRTUAL_ENTRY_NAME);
|
|
66780
|
+
chunk?.files.forEach((f)=>{
|
|
66781
|
+
compilation.deleteAsset(f);
|
|
66782
|
+
});
|
|
66783
|
+
} catch (_e) {
|
|
66784
|
+
console.error("Failed to remove virtual entry file!");
|
|
66785
|
+
}
|
|
66786
|
+
});
|
|
66787
|
+
});
|
|
66788
|
+
}
|
|
66789
|
+
constructor(sharedOptions, collectShared){
|
|
66790
|
+
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66791
|
+
IndependentSharedPlugin_define_property(this, "collectShared", false);
|
|
66792
|
+
this.sharedOptions = sharedOptions;
|
|
66793
|
+
this.collectShared = collectShared;
|
|
66794
|
+
}
|
|
66795
|
+
}
|
|
66796
|
+
const resolveOutputDir = (outputDir, shareName)=>shareName ? (0, path_browserify.join)(outputDir, encodeName(shareName)) : outputDir;
|
|
66797
|
+
class IndependentSharedPlugin {
|
|
66798
|
+
apply(compiler) {
|
|
66799
|
+
const { manifest } = this;
|
|
66800
|
+
let runCount = 0;
|
|
66801
|
+
compiler.hooks.beforeRun.tapPromise("IndependentSharedPlugin", async ()=>{
|
|
66802
|
+
if (runCount) return;
|
|
66803
|
+
await this.createIndependentCompilers(compiler);
|
|
66804
|
+
runCount++;
|
|
66805
|
+
});
|
|
66806
|
+
compiler.hooks.watchRun.tapPromise("IndependentSharedPlugin", async ()=>{
|
|
66807
|
+
if (runCount) return;
|
|
66808
|
+
await this.createIndependentCompilers(compiler);
|
|
66809
|
+
runCount++;
|
|
66810
|
+
});
|
|
66811
|
+
compiler.hooks.shutdown.tapAsync("IndependentSharedPlugin", (callback)=>{
|
|
66812
|
+
callback();
|
|
66813
|
+
});
|
|
66814
|
+
if (manifest) compiler.hooks.compilation.tap("IndependentSharedPlugin", (compilation)=>{
|
|
66815
|
+
compilation.hooks.processAssets.tapPromise({
|
|
66816
|
+
name: "injectBuildAssets",
|
|
66817
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER
|
|
66818
|
+
}, async ()=>{
|
|
66819
|
+
const { statsFileName, manifestFileName } = getFileName(manifest);
|
|
66820
|
+
const injectBuildAssetsIntoStatsOrManifest = (filename)=>{
|
|
66821
|
+
const stats = compilation.getAsset(filename);
|
|
66822
|
+
if (!stats) return;
|
|
66823
|
+
const statsContent = JSON.parse(stats.source.source().toString());
|
|
66824
|
+
const { shared } = statsContent;
|
|
66825
|
+
Object.entries(this.buildAssets).forEach(([key, item])=>{
|
|
66826
|
+
const targetShared = shared.find((s)=>s.name === key);
|
|
66827
|
+
if (!targetShared) return;
|
|
66828
|
+
item.forEach(([entry, version, globalName])=>{
|
|
66829
|
+
if (version === targetShared.version) {
|
|
66830
|
+
targetShared.fallback = entry;
|
|
66831
|
+
targetShared.fallbackName = globalName;
|
|
66832
|
+
}
|
|
66833
|
+
});
|
|
66834
|
+
});
|
|
66835
|
+
compilation.updateAsset(filename, new compiler.webpack.sources.RawSource(JSON.stringify(statsContent)));
|
|
66836
|
+
};
|
|
66837
|
+
injectBuildAssetsIntoStatsOrManifest(statsFileName);
|
|
66838
|
+
injectBuildAssetsIntoStatsOrManifest(manifestFileName);
|
|
66839
|
+
});
|
|
66840
|
+
});
|
|
66841
|
+
}
|
|
66842
|
+
async createIndependentCompilers(parentCompiler) {
|
|
66843
|
+
const { sharedOptions, buildAssets, outputDir } = this;
|
|
66844
|
+
console.log("🚀 Start creating a standalone compiler...");
|
|
66845
|
+
const shareRequestsMap = await this.createIndependentCompiler(parentCompiler);
|
|
66846
|
+
await Promise.all(sharedOptions.map(async ([shareName, shareConfig])=>{
|
|
66847
|
+
if (!shareConfig.treeshake || false === shareConfig.import) return;
|
|
66848
|
+
const shareRequests = shareRequestsMap[shareName].requests;
|
|
66849
|
+
await Promise.all(shareRequests.map(async ([request, version])=>{
|
|
66850
|
+
const sharedConfig = sharedOptions.find(([name])=>name === shareName)?.[1];
|
|
66851
|
+
const [shareFileName, globalName, sharedVersion] = await this.createIndependentCompiler(parentCompiler, {
|
|
66852
|
+
shareRequestsMap,
|
|
66853
|
+
currentShare: {
|
|
66854
|
+
shareName,
|
|
66855
|
+
version,
|
|
66856
|
+
request,
|
|
66857
|
+
independentShareFileName: sharedConfig?.treeshake?.filename
|
|
66858
|
+
}
|
|
66859
|
+
});
|
|
66860
|
+
if ("string" == typeof shareFileName) {
|
|
66861
|
+
buildAssets[shareName] ||= [];
|
|
66862
|
+
buildAssets[shareName].push([
|
|
66863
|
+
(0, path_browserify.join)(resolveOutputDir(outputDir, shareName), shareFileName),
|
|
66864
|
+
sharedVersion,
|
|
66865
|
+
globalName
|
|
66866
|
+
]);
|
|
66867
|
+
}
|
|
66868
|
+
}));
|
|
66869
|
+
}));
|
|
66870
|
+
console.log("✅ All independent packages have been compiled successfully");
|
|
66871
|
+
}
|
|
66872
|
+
async createIndependentCompiler(parentCompiler, extraOptions) {
|
|
66873
|
+
const { mfName, plugins, outputDir, sharedOptions, treeshake, library, treeshakeSharedExcludedPlugins } = this;
|
|
66874
|
+
const outputDirWithShareName = resolveOutputDir(outputDir, extraOptions?.currentShare?.shareName || "");
|
|
66875
|
+
const parentConfig = parentCompiler.options;
|
|
66876
|
+
const finalPlugins = [];
|
|
66877
|
+
const rspack = parentCompiler.rspack;
|
|
66878
|
+
let extraPlugin;
|
|
66879
|
+
extraPlugin = extraOptions ? new SharedContainerPlugin({
|
|
66880
|
+
mfName,
|
|
66881
|
+
library,
|
|
66882
|
+
...extraOptions.currentShare
|
|
66883
|
+
}) : new CollectSharedEntryPlugin({
|
|
66884
|
+
sharedOptions,
|
|
66885
|
+
shareScope: "default"
|
|
66886
|
+
});
|
|
66887
|
+
(parentConfig.plugins || []).forEach((plugin)=>{
|
|
66888
|
+
if (void 0 !== plugin && "string" != typeof plugin && filterPlugin(plugin, treeshakeSharedExcludedPlugins)) finalPlugins.push(plugin);
|
|
66889
|
+
});
|
|
66890
|
+
plugins.forEach((plugin)=>{
|
|
66891
|
+
finalPlugins.push(plugin);
|
|
66892
|
+
});
|
|
66893
|
+
finalPlugins.push(extraPlugin);
|
|
66894
|
+
finalPlugins.push(new ConsumeSharedPlugin({
|
|
66895
|
+
consumes: sharedOptions.filter(([key, options])=>extraOptions?.currentShare.shareName !== (options.shareKey || key)).map(([key, options])=>({
|
|
66896
|
+
[key]: {
|
|
66897
|
+
import: extraOptions ? false : options.import,
|
|
66898
|
+
shareKey: options.shareKey || key,
|
|
66899
|
+
shareScope: options.shareScope,
|
|
66900
|
+
requiredVersion: options.requiredVersion,
|
|
66901
|
+
strictVersion: options.strictVersion,
|
|
66902
|
+
singleton: options.singleton,
|
|
66903
|
+
packageName: options.packageName,
|
|
66904
|
+
eager: options.eager
|
|
66905
|
+
}
|
|
66906
|
+
})),
|
|
66907
|
+
enhanced: true
|
|
66908
|
+
}));
|
|
66909
|
+
if (treeshake) finalPlugins.push(new SharedUsedExportsOptimizerPlugin(sharedOptions, this.injectUsedExports));
|
|
66910
|
+
finalPlugins.push(new VirtualEntryPlugin(sharedOptions, !extraOptions));
|
|
66911
|
+
const fullOutputDir = (0, path_browserify.resolve)(parentCompiler.outputPath, outputDirWithShareName);
|
|
66912
|
+
const compilerConfig = {
|
|
66913
|
+
...parentConfig,
|
|
66914
|
+
module: {
|
|
66915
|
+
...parentConfig.module,
|
|
66916
|
+
rules: [
|
|
66917
|
+
{
|
|
66918
|
+
test: /virtual-entry\.js$/,
|
|
66919
|
+
type: "javascript/auto",
|
|
66920
|
+
resolve: {
|
|
66921
|
+
fullySpecified: false
|
|
66922
|
+
},
|
|
66923
|
+
use: {
|
|
66924
|
+
loader: "builtin:swc-loader"
|
|
66925
|
+
}
|
|
66926
|
+
},
|
|
66927
|
+
...parentConfig.module?.rules || []
|
|
66928
|
+
]
|
|
66929
|
+
},
|
|
66930
|
+
mode: parentConfig.mode || "development",
|
|
66931
|
+
entry: VirtualEntryPlugin.entry,
|
|
66932
|
+
output: {
|
|
66933
|
+
path: fullOutputDir,
|
|
66934
|
+
clean: true,
|
|
66935
|
+
publicPath: parentConfig.output?.publicPath || "auto"
|
|
66936
|
+
},
|
|
66937
|
+
plugins: finalPlugins,
|
|
66938
|
+
optimization: {
|
|
66939
|
+
...parentConfig.optimization,
|
|
66940
|
+
splitChunks: false
|
|
66941
|
+
}
|
|
66942
|
+
};
|
|
66943
|
+
const compiler = rspack.rspack(compilerConfig);
|
|
66944
|
+
compiler.inputFileSystem = parentCompiler.inputFileSystem;
|
|
66945
|
+
compiler.outputFileSystem = parentCompiler.outputFileSystem;
|
|
66946
|
+
compiler.intermediateFileSystem = parentCompiler.intermediateFileSystem;
|
|
66947
|
+
const { currentShare } = extraOptions || {};
|
|
66948
|
+
return new Promise((resolve, reject)=>{
|
|
66949
|
+
compiler.run((err, stats)=>{
|
|
66950
|
+
if (err || stats?.hasErrors()) {
|
|
66951
|
+
const target = currentShare ? currentShare.shareName : "收集依赖";
|
|
66952
|
+
console.error(`❌ ${target} 编译失败:`, err || stats.toJson().errors.map((e)=>e.message).join("\n"));
|
|
66953
|
+
reject(err || new Error(`${target} 编译失败`));
|
|
66954
|
+
return;
|
|
66955
|
+
}
|
|
66956
|
+
currentShare && console.log(`✅ 独立包 ${currentShare.shareName} 编译成功`);
|
|
66957
|
+
if (stats) {
|
|
66958
|
+
currentShare && console.log(`📊 ${currentShare.shareName} 编译统计:`);
|
|
66959
|
+
console.log(stats.toString({
|
|
66960
|
+
colors: true,
|
|
66961
|
+
chunks: false,
|
|
66962
|
+
modules: false
|
|
66963
|
+
}));
|
|
66964
|
+
}
|
|
66965
|
+
resolve(extraPlugin.getData());
|
|
66966
|
+
});
|
|
66967
|
+
});
|
|
66968
|
+
}
|
|
66969
|
+
constructor(options){
|
|
66970
|
+
IndependentSharedPlugin_define_property(this, "mfName", void 0);
|
|
66971
|
+
IndependentSharedPlugin_define_property(this, "shared", void 0);
|
|
66972
|
+
IndependentSharedPlugin_define_property(this, "library", void 0);
|
|
66973
|
+
IndependentSharedPlugin_define_property(this, "sharedOptions", void 0);
|
|
66974
|
+
IndependentSharedPlugin_define_property(this, "outputDir", void 0);
|
|
66975
|
+
IndependentSharedPlugin_define_property(this, "plugins", void 0);
|
|
66976
|
+
IndependentSharedPlugin_define_property(this, "treeshake", void 0);
|
|
66977
|
+
IndependentSharedPlugin_define_property(this, "manifest", void 0);
|
|
66978
|
+
IndependentSharedPlugin_define_property(this, "buildAssets", {});
|
|
66979
|
+
IndependentSharedPlugin_define_property(this, "injectUsedExports", void 0);
|
|
66980
|
+
IndependentSharedPlugin_define_property(this, "treeshakeSharedExcludedPlugins", void 0);
|
|
66981
|
+
IndependentSharedPlugin_define_property(this, "name", "IndependentSharedPlugin");
|
|
66982
|
+
const { outputDir, plugins, treeshake, shared, name, manifest, injectUsedExports, library, treeshakeSharedExcludedPlugins } = options;
|
|
66983
|
+
this.shared = shared;
|
|
66984
|
+
this.mfName = name;
|
|
66985
|
+
this.outputDir = outputDir || "independent-packages";
|
|
66986
|
+
this.plugins = plugins || [];
|
|
66987
|
+
this.treeshake = treeshake;
|
|
66988
|
+
this.manifest = manifest;
|
|
66989
|
+
this.injectUsedExports = injectUsedExports ?? true;
|
|
66990
|
+
this.library = library;
|
|
66991
|
+
this.treeshakeSharedExcludedPlugins = treeshakeSharedExcludedPlugins || [];
|
|
66992
|
+
this.sharedOptions = parseOptions(shared, (item, key)=>{
|
|
66993
|
+
if ("string" != typeof item) throw new Error(`Unexpected array in shared configuration for key "${key}"`);
|
|
66994
|
+
const config = item !== key && isRequiredVersion(item) ? {
|
|
66995
|
+
import: key,
|
|
66996
|
+
requiredVersion: item
|
|
66997
|
+
} : {
|
|
66998
|
+
import: item
|
|
66999
|
+
};
|
|
67000
|
+
return config;
|
|
67001
|
+
}, (item)=>item);
|
|
67002
|
+
}
|
|
67003
|
+
}
|
|
67004
|
+
function TreeShakeSharedPlugin_define_property(obj, key, value) {
|
|
67005
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
67006
|
+
value: value,
|
|
67007
|
+
enumerable: true,
|
|
67008
|
+
configurable: true,
|
|
67009
|
+
writable: true
|
|
67010
|
+
});
|
|
67011
|
+
else obj[key] = value;
|
|
67012
|
+
return obj;
|
|
66569
67013
|
}
|
|
66570
|
-
|
|
66571
|
-
|
|
66572
|
-
|
|
66573
|
-
|
|
66574
|
-
|
|
66575
|
-
|
|
66576
|
-
|
|
66577
|
-
|
|
66578
|
-
|
|
66579
|
-
|
|
66580
|
-
|
|
66581
|
-
|
|
66582
|
-
|
|
66583
|
-
|
|
66584
|
-
|
|
66585
|
-
|
|
66586
|
-
|
|
66587
|
-
|
|
66588
|
-
|
|
66589
|
-
|
|
66590
|
-
}
|
|
67014
|
+
class TreeShakeSharedPlugin {
|
|
67015
|
+
apply(compiler) {
|
|
67016
|
+
const { mfConfig, outputDir, plugins, reShake } = this;
|
|
67017
|
+
const { name, shared, library } = mfConfig;
|
|
67018
|
+
if (!shared) return;
|
|
67019
|
+
const sharedOptions = normalizeSharedOptions(shared);
|
|
67020
|
+
if (!sharedOptions.length) return;
|
|
67021
|
+
if (sharedOptions.some(([_, config])=>config.treeshake && false !== config.import)) {
|
|
67022
|
+
if (!reShake) new SharedUsedExportsOptimizerPlugin(sharedOptions, mfConfig.injectUsedExports, mfConfig.manifest).apply(compiler);
|
|
67023
|
+
this._independentSharePlugin = new IndependentSharedPlugin({
|
|
67024
|
+
name: name,
|
|
67025
|
+
shared: shared,
|
|
67026
|
+
outputDir,
|
|
67027
|
+
plugins,
|
|
67028
|
+
treeshake: reShake,
|
|
67029
|
+
library,
|
|
67030
|
+
manifest: mfConfig.manifest,
|
|
67031
|
+
treeshakeSharedExcludedPlugins: mfConfig.treeshakeSharedExcludedPlugins
|
|
67032
|
+
});
|
|
67033
|
+
this._independentSharePlugin.apply(compiler);
|
|
67034
|
+
}
|
|
67035
|
+
}
|
|
67036
|
+
get buildAssets() {
|
|
67037
|
+
return this._independentSharePlugin?.buildAssets || {};
|
|
67038
|
+
}
|
|
67039
|
+
constructor(options){
|
|
67040
|
+
TreeShakeSharedPlugin_define_property(this, "mfConfig", void 0);
|
|
67041
|
+
TreeShakeSharedPlugin_define_property(this, "outputDir", void 0);
|
|
67042
|
+
TreeShakeSharedPlugin_define_property(this, "plugins", void 0);
|
|
67043
|
+
TreeShakeSharedPlugin_define_property(this, "reShake", void 0);
|
|
67044
|
+
TreeShakeSharedPlugin_define_property(this, "_independentSharePlugin", void 0);
|
|
67045
|
+
TreeShakeSharedPlugin_define_property(this, "name", "TreeShakeSharedPlugin");
|
|
67046
|
+
const { mfConfig, plugins, reShake } = options;
|
|
67047
|
+
this.mfConfig = mfConfig;
|
|
67048
|
+
this.outputDir = mfConfig.independentShareDir || "independent-packages";
|
|
67049
|
+
this.plugins = plugins;
|
|
67050
|
+
this.reShake = Boolean(reShake);
|
|
67051
|
+
}
|
|
67052
|
+
}
|
|
67053
|
+
const ModuleFederationRuntimePlugin = base_create(external_rspack_wasi_browser_js_.BuiltinPluginName.ModuleFederationRuntimePlugin, (options = {})=>options);
|
|
67054
|
+
function ModuleFederationPlugin_define_property(obj, key, value) {
|
|
67055
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
67056
|
+
value: value,
|
|
67057
|
+
enumerable: true,
|
|
67058
|
+
configurable: true,
|
|
67059
|
+
writable: true
|
|
66591
67060
|
});
|
|
66592
|
-
|
|
67061
|
+
else obj[key] = value;
|
|
67062
|
+
return obj;
|
|
66593
67063
|
}
|
|
66594
|
-
|
|
66595
|
-
|
|
66596
|
-
|
|
66597
|
-
|
|
66598
|
-
|
|
66599
|
-
|
|
66600
|
-
|
|
67064
|
+
class ModuleFederationPlugin {
|
|
67065
|
+
apply(compiler) {
|
|
67066
|
+
const { webpack } = compiler;
|
|
67067
|
+
const paths = getPaths(this._options);
|
|
67068
|
+
compiler.options.resolve.alias = {
|
|
67069
|
+
"@module-federation/runtime-tools": paths.runtimeTools,
|
|
67070
|
+
"@module-federation/runtime": paths.runtime,
|
|
67071
|
+
...compiler.options.resolve.alias
|
|
67072
|
+
};
|
|
67073
|
+
const sharedOptions = getSharedOptions(this._options);
|
|
67074
|
+
const treeshakeEntries = sharedOptions.filter(([, config])=>config.treeshake);
|
|
67075
|
+
if (treeshakeEntries.length > 0) {
|
|
67076
|
+
this._treeShakeSharedPlugin = new TreeShakeSharedPlugin({
|
|
67077
|
+
mfConfig: this._options,
|
|
67078
|
+
reShake: false
|
|
67079
|
+
});
|
|
67080
|
+
this._treeShakeSharedPlugin.apply(compiler);
|
|
67081
|
+
}
|
|
67082
|
+
let runtimePluginApplied = false;
|
|
67083
|
+
compiler.hooks.beforeRun.tapPromise({
|
|
67084
|
+
name: "ModuleFederationPlugin",
|
|
67085
|
+
stage: 100
|
|
67086
|
+
}, async ()=>{
|
|
67087
|
+
if (runtimePluginApplied) return;
|
|
67088
|
+
runtimePluginApplied = true;
|
|
67089
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
|
|
67090
|
+
new ModuleFederationRuntimePlugin({
|
|
67091
|
+
entryRuntime
|
|
67092
|
+
}).apply(compiler);
|
|
67093
|
+
});
|
|
67094
|
+
compiler.hooks.watchRun.tapPromise({
|
|
67095
|
+
name: "ModuleFederationPlugin",
|
|
67096
|
+
stage: 100
|
|
67097
|
+
}, async ()=>{
|
|
67098
|
+
if (runtimePluginApplied) return;
|
|
67099
|
+
runtimePluginApplied = true;
|
|
67100
|
+
const entryRuntime = getDefaultEntryRuntime(paths, this._options, compiler, this._treeShakeSharedPlugin?.buildAssets || {});
|
|
67101
|
+
new ModuleFederationRuntimePlugin({
|
|
67102
|
+
entryRuntime
|
|
67103
|
+
}).apply(compiler);
|
|
67104
|
+
});
|
|
67105
|
+
new webpack.container.ModuleFederationPluginV1({
|
|
67106
|
+
...this._options,
|
|
67107
|
+
enhanced: true
|
|
67108
|
+
}).apply(compiler);
|
|
67109
|
+
if (this._options.manifest) new ModuleFederationManifestPlugin(this._options).apply(compiler);
|
|
67110
|
+
}
|
|
67111
|
+
constructor(_options){
|
|
67112
|
+
ModuleFederationPlugin_define_property(this, "_options", void 0);
|
|
67113
|
+
ModuleFederationPlugin_define_property(this, "_treeShakeSharedPlugin", void 0);
|
|
67114
|
+
this._options = _options;
|
|
67115
|
+
}
|
|
66601
67116
|
}
|
|
66602
67117
|
function getRemoteInfos(options) {
|
|
66603
67118
|
if (!options.remotes) return {};
|
|
@@ -66665,6 +67180,18 @@ function getRemoteInfos(options) {
|
|
|
66665
67180
|
function getRuntimePlugins(options) {
|
|
66666
67181
|
return options.runtimePlugins ?? [];
|
|
66667
67182
|
}
|
|
67183
|
+
function getSharedOptions(options) {
|
|
67184
|
+
if (!options.shared) return [];
|
|
67185
|
+
return parseOptions(options.shared, (item, key)=>{
|
|
67186
|
+
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
67187
|
+
return item !== key && isRequiredVersion(item) ? {
|
|
67188
|
+
import: key,
|
|
67189
|
+
requiredVersion: item
|
|
67190
|
+
} : {
|
|
67191
|
+
import: item
|
|
67192
|
+
};
|
|
67193
|
+
}, (item)=>item);
|
|
67194
|
+
}
|
|
66668
67195
|
function getPaths(options) {
|
|
66669
67196
|
return {
|
|
66670
67197
|
runtimeTools: "@module-federation/runtime-tools",
|
|
@@ -66672,11 +67199,12 @@ function getPaths(options) {
|
|
|
66672
67199
|
runtime: "@module-federation/runtime"
|
|
66673
67200
|
};
|
|
66674
67201
|
}
|
|
66675
|
-
function getDefaultEntryRuntime(paths, options, compiler) {
|
|
67202
|
+
function getDefaultEntryRuntime(paths, options, compiler, treeshakeShareFallbacks) {
|
|
66676
67203
|
const runtimePlugins = getRuntimePlugins(options);
|
|
66677
67204
|
const remoteInfos = getRemoteInfos(options);
|
|
66678
67205
|
const runtimePluginImports = [];
|
|
66679
67206
|
const runtimePluginVars = [];
|
|
67207
|
+
const libraryType = options.library?.type || "var";
|
|
66680
67208
|
for(let i = 0; i < runtimePlugins.length; i++){
|
|
66681
67209
|
const runtimePluginVar = `__module_federation_runtime_plugin_${i}__`;
|
|
66682
67210
|
const pluginSpec = runtimePlugins[i];
|
|
@@ -66693,215 +67221,12 @@ function getDefaultEntryRuntime(paths, options, compiler) {
|
|
|
66693
67221
|
`const __module_federation_remote_infos__ = ${JSON.stringify(remoteInfos)}`,
|
|
66694
67222
|
`const __module_federation_container_name__ = ${JSON.stringify(options.name ?? compiler.options.output.uniqueName)}`,
|
|
66695
67223
|
`const __module_federation_share_strategy__ = ${JSON.stringify(options.shareStrategy ?? "version-first")}`,
|
|
66696
|
-
|
|
67224
|
+
`const __module_federation_share_fallbacks__ = ${JSON.stringify(treeshakeShareFallbacks)}`,
|
|
67225
|
+
`const __module_federation_library_type__ = ${JSON.stringify(libraryType)}`,
|
|
67226
|
+
'if((__webpack_require__.initializeSharingData||__webpack_require__.initializeExposesData)&&__webpack_require__.federation){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;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=[];obj[key].push(...value)}else if(typeof value==="object"&&value!==null){var _obj1,_key1;var _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;var _;(_=(_obj=obj)[_key=key])!==null&&_!==void 0?_:_obj[_key]=initial()};var _ref;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:{};var _ref1;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:{};var _ref2;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:{};var _ref3;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:{};var _ref4;const consumesLoadingModuleToConsumeDataMapping=(_ref4=(__webpack_require___consumesLoadingData1=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData1===void 0?void 0:__webpack_require___consumesLoadingData1.moduleIdToConsumeDataMapping)!==null&&_ref4!==void 0?_ref4:{};const consumesLoadinginstalledModules={};const initializeSharingInitPromises=[];const initializeSharingInitTokens={};const containerShareScope=(__webpack_require___initializeExposesData=__webpack_require__.initializeExposesData)===null||__webpack_require___initializeExposesData===void 0?void 0:__webpack_require___initializeExposesData.shareScope;for(const key in __module_federation_bundler_runtime__){__webpack_require__.federation[key]=__module_federation_bundler_runtime__[key]}early(__webpack_require__.federation,"libraryType",()=>__module_federation_library_type__);early(__webpack_require__.federation,"sharedFallback",()=>__module_federation_share_fallbacks__);const sharedFallback=__webpack_require__.federation.sharedFallback;early(__webpack_require__.federation,"consumesLoadingModuleToHandlerMapping",()=>{const consumesLoadingModuleToHandlerMapping={};for(let[moduleId,data]of Object.entries(consumesLoadingModuleToConsumeDataMapping)){var __webpack_require___federation_bundlerRuntime;consumesLoadingModuleToHandlerMapping[moduleId]={getter:sharedFallback?(__webpack_require___federation_bundlerRuntime=__webpack_require__.federation.bundlerRuntime)===null||__webpack_require___federation_bundlerRuntime===void 0?void 0:__webpack_require___federation_bundlerRuntime.getSharedFallbackGetter({shareKey:data.shareKey,factory:data.fallback,webpackRequire:__webpack_require__,libraryType:__webpack_require__.federation.libraryType}):data.fallback,treeshakeGetter:sharedFallback?data.fallback:undefined,shareInfo:{shareConfig:{fixedDependencies:false,requiredVersion:data.requiredVersion,strictVersion:data.strictVersion,singleton:data.singleton,eager:data.eager},scope:[data.shareScope]},shareKey:data.shareKey,treeshake:__webpack_require__.federation.sharedFallback?{get:data.fallback,strategy:data.treeshakeStrategy}:undefined}}return consumesLoadingModuleToHandlerMapping});early(__webpack_require__.federation,"initOptions",()=>({}));early(__webpack_require__.federation.initOptions,"name",()=>__module_federation_container_name__);early(__webpack_require__.federation.initOptions,"shareStrategy",()=>__module_federation_share_strategy__);early(__webpack_require__.federation.initOptions,"shared",()=>{const shared={};for(let[scope,stages]of Object.entries(initializeSharingScopeToInitDataMapping)){for(let stage of stages){if(typeof stage==="object"&&stage!==null){const{name,version,factory,eager,singleton,requiredVersion,strictVersion,treeshakeStrategy}=stage;const shareConfig={};const isValidValue=function(val){return typeof val!=="undefined"};if(isValidValue(singleton)){shareConfig.singleton=singleton}if(isValidValue(requiredVersion)){shareConfig.requiredVersion=requiredVersion}if(isValidValue(eager)){shareConfig.eager=eager}if(isValidValue(strictVersion)){shareConfig.strictVersion=strictVersion}const options={version,scope:[scope],shareConfig,get:factory,treeshake:treeshakeStrategy?{strategy:treeshakeStrategy}:undefined};if(shared[name]){shared[name].push(options)}else{shared[name]=[options]}}}}return shared});merge(__webpack_require__.federation.initOptions,"remotes",()=>Object.values(__module_federation_remote_infos__).flat().filter(remote=>remote.externalType==="script"));merge(__webpack_require__.federation.initOptions,"plugins",()=>__module_federation_runtime_plugins__);early(__webpack_require__.federation,"bundlerRuntimeOptions",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions,"remotes",()=>({}));early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"chunkMapping",()=>remotesLoadingChunkMapping);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"remoteInfos",()=>__module_federation_remote_infos__);early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToExternalAndNameMapping",()=>{const remotesLoadingIdToExternalAndNameMappingMapping={};for(let[moduleId,data]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){remotesLoadingIdToExternalAndNameMappingMapping[moduleId]=[data.shareScope,data.name,data.externalModuleId,data.remoteName]}return remotesLoadingIdToExternalAndNameMappingMapping});early(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"webpackRequire",()=>__webpack_require__);merge(__webpack_require__.federation.bundlerRuntimeOptions.remotes,"idToRemoteMap",()=>{const idToRemoteMap={};for(let[id,remoteData]of Object.entries(remotesLoadingModuleIdToRemoteDataMapping)){const info=__module_federation_remote_infos__[remoteData.remoteName];if(info)idToRemoteMap[id]=info}return idToRemoteMap});override(__webpack_require__,"S",__webpack_require__.federation.bundlerRuntime.S);if(__webpack_require__.federation.attachShareScopeMap){__webpack_require__.federation.attachShareScopeMap(__webpack_require__)}override(__webpack_require__.f,"remotes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.remotes({chunkId,promises,chunkMapping:remotesLoadingChunkMapping,idToExternalAndNameMapping:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToExternalAndNameMapping,idToRemoteMap:__webpack_require__.federation.bundlerRuntimeOptions.remotes.idToRemoteMap,webpackRequire:__webpack_require__}));override(__webpack_require__.f,"consumes",(chunkId,promises)=>__webpack_require__.federation.bundlerRuntime.consumes({chunkId,promises,chunkMapping:consumesLoadingChunkMapping,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping,installedModules:consumesLoadinginstalledModules,webpackRequire:__webpack_require__}));override(__webpack_require__,"I",(name,initScope)=>__webpack_require__.federation.bundlerRuntime.I({shareScopeName:name,initScope,initPromises:initializeSharingInitPromises,initTokens:initializeSharingInitTokens,webpackRequire:__webpack_require__}));override(__webpack_require__,"initContainer",(shareScope,initScope,remoteEntryInitOptions)=>__webpack_require__.federation.bundlerRuntime.initContainerEntry({shareScope,initScope,remoteEntryInitOptions,shareScopeKey:containerShareScope,webpackRequire:__webpack_require__}));override(__webpack_require__,"getContainer",(module1,getScope)=>{var moduleMap=__webpack_require__.initializeExposesData.moduleMap;__webpack_require__.R=getScope;getScope=Object.prototype.hasOwnProperty.call(moduleMap,module1)?moduleMap[module1]():Promise.resolve().then(()=>{throw new Error(\'Module "\'+module1+\'" does not exist in container.\')});__webpack_require__.R=undefined;return getScope});__webpack_require__.federation.instance=__webpack_require__.federation.bundlerRuntime.init({webpackRequire:__webpack_require__});if((__webpack_require___consumesLoadingData2=__webpack_require__.consumesLoadingData)===null||__webpack_require___consumesLoadingData2===void 0?void 0:__webpack_require___consumesLoadingData2.initialConsumes){__webpack_require__.federation.bundlerRuntime.installInitialConsumes({webpackRequire:__webpack_require__,installedModules:consumesLoadinginstalledModules,initialConsumes:__webpack_require__.consumesLoadingData.initialConsumes,moduleToHandlerMapping:__webpack_require__.federation.consumesLoadingModuleToHandlerMapping})}}'
|
|
66697
67227
|
].join(";");
|
|
66698
67228
|
return `@module-federation/runtime/rspack.js!=!data:text/javascript,${content}`;
|
|
66699
67229
|
}
|
|
66700
|
-
function ShareRuntimePlugin_define_property(obj, key, value) {
|
|
66701
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66702
|
-
value: value,
|
|
66703
|
-
enumerable: true,
|
|
66704
|
-
configurable: true,
|
|
66705
|
-
writable: true
|
|
66706
|
-
});
|
|
66707
|
-
else obj[key] = value;
|
|
66708
|
-
return obj;
|
|
66709
|
-
}
|
|
66710
|
-
const compilerSet = new WeakSet();
|
|
66711
|
-
function isSingleton(compiler) {
|
|
66712
|
-
return compilerSet.has(compiler);
|
|
66713
|
-
}
|
|
66714
|
-
function setSingleton(compiler) {
|
|
66715
|
-
compilerSet.add(compiler);
|
|
66716
|
-
}
|
|
66717
|
-
class ShareRuntimePlugin extends RspackBuiltinPlugin {
|
|
66718
|
-
raw(compiler) {
|
|
66719
|
-
if (isSingleton(compiler)) return;
|
|
66720
|
-
setSingleton(compiler);
|
|
66721
|
-
return createBuiltinPlugin(this.name, this.enhanced);
|
|
66722
|
-
}
|
|
66723
|
-
constructor(enhanced = false){
|
|
66724
|
-
super(), ShareRuntimePlugin_define_property(this, "enhanced", void 0), ShareRuntimePlugin_define_property(this, "name", void 0), this.enhanced = enhanced, this.name = external_rspack_wasi_browser_js_.BuiltinPluginName.ShareRuntimePlugin;
|
|
66725
|
-
}
|
|
66726
|
-
}
|
|
66727
|
-
function ConsumeSharedPlugin_define_property(obj, key, value) {
|
|
66728
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66729
|
-
value: value,
|
|
66730
|
-
enumerable: true,
|
|
66731
|
-
configurable: true,
|
|
66732
|
-
writable: true
|
|
66733
|
-
});
|
|
66734
|
-
else obj[key] = value;
|
|
66735
|
-
return obj;
|
|
66736
|
-
}
|
|
66737
|
-
class ConsumeSharedPlugin extends RspackBuiltinPlugin {
|
|
66738
|
-
raw(compiler) {
|
|
66739
|
-
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
|
|
66740
|
-
const rawOptions = {
|
|
66741
|
-
consumes: this._options.consumes.map(([key, v])=>({
|
|
66742
|
-
key,
|
|
66743
|
-
...v
|
|
66744
|
-
})),
|
|
66745
|
-
enhanced: this._options.enhanced
|
|
66746
|
-
};
|
|
66747
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66748
|
-
}
|
|
66749
|
-
constructor(options){
|
|
66750
|
-
super(), ConsumeSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ConsumeSharedPlugin), ConsumeSharedPlugin_define_property(this, "_options", void 0);
|
|
66751
|
-
this._options = {
|
|
66752
|
-
consumes: parseOptions(options.consumes, (item, key)=>{
|
|
66753
|
-
if (Array.isArray(item)) throw new Error("Unexpected array in options");
|
|
66754
|
-
const result = item !== key && isRequiredVersion(item) ? {
|
|
66755
|
-
import: key,
|
|
66756
|
-
shareScope: options.shareScope || "default",
|
|
66757
|
-
shareKey: key,
|
|
66758
|
-
requiredVersion: item,
|
|
66759
|
-
strictVersion: true,
|
|
66760
|
-
packageName: void 0,
|
|
66761
|
-
singleton: false,
|
|
66762
|
-
eager: false
|
|
66763
|
-
} : {
|
|
66764
|
-
import: key,
|
|
66765
|
-
shareScope: options.shareScope || "default",
|
|
66766
|
-
shareKey: key,
|
|
66767
|
-
requiredVersion: void 0,
|
|
66768
|
-
packageName: void 0,
|
|
66769
|
-
strictVersion: false,
|
|
66770
|
-
singleton: false,
|
|
66771
|
-
eager: false
|
|
66772
|
-
};
|
|
66773
|
-
return result;
|
|
66774
|
-
}, (item, key)=>({
|
|
66775
|
-
import: false === item.import ? void 0 : item.import || key,
|
|
66776
|
-
shareScope: item.shareScope || options.shareScope || "default",
|
|
66777
|
-
shareKey: item.shareKey || key,
|
|
66778
|
-
requiredVersion: item.requiredVersion,
|
|
66779
|
-
strictVersion: "boolean" == typeof item.strictVersion ? item.strictVersion : false !== item.import && !item.singleton,
|
|
66780
|
-
packageName: item.packageName,
|
|
66781
|
-
singleton: !!item.singleton,
|
|
66782
|
-
eager: !!item.eager
|
|
66783
|
-
})),
|
|
66784
|
-
enhanced: options.enhanced ?? false
|
|
66785
|
-
};
|
|
66786
|
-
}
|
|
66787
|
-
}
|
|
66788
|
-
function ProvideSharedPlugin_define_property(obj, key, value) {
|
|
66789
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66790
|
-
value: value,
|
|
66791
|
-
enumerable: true,
|
|
66792
|
-
configurable: true,
|
|
66793
|
-
writable: true
|
|
66794
|
-
});
|
|
66795
|
-
else obj[key] = value;
|
|
66796
|
-
return obj;
|
|
66797
|
-
}
|
|
66798
|
-
class ProvideSharedPlugin extends RspackBuiltinPlugin {
|
|
66799
|
-
raw(compiler) {
|
|
66800
|
-
new ShareRuntimePlugin(this._enhanced ?? false).apply(compiler);
|
|
66801
|
-
const rawOptions = this._provides.map(([key, v])=>({
|
|
66802
|
-
key,
|
|
66803
|
-
...v
|
|
66804
|
-
}));
|
|
66805
|
-
return createBuiltinPlugin(this.name, rawOptions);
|
|
66806
|
-
}
|
|
66807
|
-
constructor(options){
|
|
66808
|
-
super(), ProvideSharedPlugin_define_property(this, "name", external_rspack_wasi_browser_js_.BuiltinPluginName.ProvideSharedPlugin), ProvideSharedPlugin_define_property(this, "_provides", void 0), ProvideSharedPlugin_define_property(this, "_enhanced", void 0);
|
|
66809
|
-
this._provides = parseOptions(options.provides, (item)=>{
|
|
66810
|
-
if (Array.isArray(item)) throw new Error("Unexpected array of provides");
|
|
66811
|
-
return {
|
|
66812
|
-
shareKey: item,
|
|
66813
|
-
version: void 0,
|
|
66814
|
-
shareScope: options.shareScope || "default",
|
|
66815
|
-
eager: false
|
|
66816
|
-
};
|
|
66817
|
-
}, (item)=>{
|
|
66818
|
-
const raw = {
|
|
66819
|
-
shareKey: item.shareKey,
|
|
66820
|
-
version: item.version,
|
|
66821
|
-
shareScope: item.shareScope || options.shareScope || "default",
|
|
66822
|
-
eager: !!item.eager
|
|
66823
|
-
};
|
|
66824
|
-
if (options.enhanced) {
|
|
66825
|
-
const enhancedItem = item;
|
|
66826
|
-
return {
|
|
66827
|
-
...raw,
|
|
66828
|
-
singleton: enhancedItem.singleton,
|
|
66829
|
-
requiredVersion: enhancedItem.requiredVersion,
|
|
66830
|
-
strictVersion: enhancedItem.strictVersion
|
|
66831
|
-
};
|
|
66832
|
-
}
|
|
66833
|
-
return raw;
|
|
66834
|
-
});
|
|
66835
|
-
this._enhanced = options.enhanced;
|
|
66836
|
-
}
|
|
66837
|
-
}
|
|
66838
|
-
function SharePlugin_define_property(obj, key, value) {
|
|
66839
|
-
if (key in obj) Object.defineProperty(obj, key, {
|
|
66840
|
-
value: value,
|
|
66841
|
-
enumerable: true,
|
|
66842
|
-
configurable: true,
|
|
66843
|
-
writable: true
|
|
66844
|
-
});
|
|
66845
|
-
else obj[key] = value;
|
|
66846
|
-
return obj;
|
|
66847
|
-
}
|
|
66848
|
-
class SharePlugin {
|
|
66849
|
-
apply(compiler) {
|
|
66850
|
-
new ConsumeSharedPlugin({
|
|
66851
|
-
shareScope: this._shareScope,
|
|
66852
|
-
consumes: this._consumes,
|
|
66853
|
-
enhanced: this._enhanced
|
|
66854
|
-
}).apply(compiler);
|
|
66855
|
-
new ProvideSharedPlugin({
|
|
66856
|
-
shareScope: this._shareScope,
|
|
66857
|
-
provides: this._provides,
|
|
66858
|
-
enhanced: this._enhanced
|
|
66859
|
-
}).apply(compiler);
|
|
66860
|
-
}
|
|
66861
|
-
constructor(options){
|
|
66862
|
-
SharePlugin_define_property(this, "_shareScope", void 0);
|
|
66863
|
-
SharePlugin_define_property(this, "_consumes", void 0);
|
|
66864
|
-
SharePlugin_define_property(this, "_provides", void 0);
|
|
66865
|
-
SharePlugin_define_property(this, "_enhanced", void 0);
|
|
66866
|
-
const sharedOptions = parseOptions(options.shared, (item, key)=>{
|
|
66867
|
-
if ("string" != typeof item) throw new Error("Unexpected array in shared");
|
|
66868
|
-
const config = item !== key && isRequiredVersion(item) ? {
|
|
66869
|
-
import: key,
|
|
66870
|
-
requiredVersion: item
|
|
66871
|
-
} : {
|
|
66872
|
-
import: item
|
|
66873
|
-
};
|
|
66874
|
-
return config;
|
|
66875
|
-
}, (item)=>item);
|
|
66876
|
-
const consumes = sharedOptions.map(([key, options])=>({
|
|
66877
|
-
[key]: {
|
|
66878
|
-
import: options.import,
|
|
66879
|
-
shareKey: options.shareKey || key,
|
|
66880
|
-
shareScope: options.shareScope,
|
|
66881
|
-
requiredVersion: options.requiredVersion,
|
|
66882
|
-
strictVersion: options.strictVersion,
|
|
66883
|
-
singleton: options.singleton,
|
|
66884
|
-
packageName: options.packageName,
|
|
66885
|
-
eager: options.eager
|
|
66886
|
-
}
|
|
66887
|
-
}));
|
|
66888
|
-
const provides = sharedOptions.filter(([, options])=>false !== options.import).map(([key, options])=>({
|
|
66889
|
-
[options.import || key]: {
|
|
66890
|
-
shareKey: options.shareKey || key,
|
|
66891
|
-
shareScope: options.shareScope,
|
|
66892
|
-
version: options.version,
|
|
66893
|
-
eager: options.eager,
|
|
66894
|
-
singleton: options.singleton,
|
|
66895
|
-
requiredVersion: options.requiredVersion,
|
|
66896
|
-
strictVersion: options.strictVersion
|
|
66897
|
-
}
|
|
66898
|
-
}));
|
|
66899
|
-
this._shareScope = options.shareScope;
|
|
66900
|
-
this._consumes = consumes;
|
|
66901
|
-
this._provides = provides;
|
|
66902
|
-
this._enhanced = options.enhanced ?? false;
|
|
66903
|
-
}
|
|
66904
|
-
}
|
|
66905
67230
|
function ContainerPlugin_define_property(obj, key, value) {
|
|
66906
67231
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
66907
67232
|
value: value,
|
|
@@ -66937,7 +67262,7 @@ class ContainerPlugin extends RspackBuiltinPlugin {
|
|
|
66937
67262
|
name: options.name,
|
|
66938
67263
|
shareScope: options.shareScope || "default",
|
|
66939
67264
|
library: options.library || {
|
|
66940
|
-
type: "
|
|
67265
|
+
type: "global",
|
|
66941
67266
|
name: options.name
|
|
66942
67267
|
},
|
|
66943
67268
|
runtime: options.runtime,
|
|
@@ -67074,7 +67399,7 @@ function transformSync(source, options) {
|
|
|
67074
67399
|
const _options = JSON.stringify(options || {});
|
|
67075
67400
|
return external_rspack_wasi_browser_js_["default"].transformSync(source, _options);
|
|
67076
67401
|
}
|
|
67077
|
-
const exports_rspackVersion = "1.7.0-canary-
|
|
67402
|
+
const exports_rspackVersion = "1.7.0-canary-c8f933e3-20251224124051";
|
|
67078
67403
|
const exports_version = "5.75.0";
|
|
67079
67404
|
const exports_WebpackError = Error;
|
|
67080
67405
|
const sources = __webpack_require__("../../node_modules/.pnpm/webpack-sources@3.3.3_patch_hash=b2a26650f08a2359d0a3cd81fa6fa272aa7441a28dd7e601792da5ed5d2b4aee/node_modules/webpack-sources/lib/index.js");
|
|
@@ -67125,6 +67450,7 @@ const container = {
|
|
|
67125
67450
|
};
|
|
67126
67451
|
const sharing = {
|
|
67127
67452
|
ProvideSharedPlugin: ProvideSharedPlugin,
|
|
67453
|
+
TreeShakeSharedPlugin: TreeShakeSharedPlugin,
|
|
67128
67454
|
ConsumeSharedPlugin: ConsumeSharedPlugin,
|
|
67129
67455
|
SharePlugin: SharePlugin
|
|
67130
67456
|
};
|
|
@@ -67162,9 +67488,7 @@ const exports_experiments = {
|
|
|
67162
67488
|
},
|
|
67163
67489
|
CssChunkingPlugin: CssChunkingPlugin,
|
|
67164
67490
|
createNativePlugin: createNativePlugin,
|
|
67165
|
-
VirtualModulesPlugin: VirtualModulesPlugin
|
|
67166
|
-
createRscPlugins: createRscPlugins,
|
|
67167
|
-
RSC_LAYERS_NAMES: RSC_LAYERS_NAMES
|
|
67491
|
+
VirtualModulesPlugin: VirtualModulesPlugin
|
|
67168
67492
|
};
|
|
67169
67493
|
const ERROR_PREFIX = "Invalid Rspack configuration:";
|
|
67170
67494
|
const validateContext = ({ context })=>{
|
|
@@ -67235,7 +67559,7 @@ function createCompiler(userOptions) {
|
|
|
67235
67559
|
function isMultiRspackOptions(o) {
|
|
67236
67560
|
return Array.isArray(o);
|
|
67237
67561
|
}
|
|
67238
|
-
function
|
|
67562
|
+
function rspack_rspack(options, callback) {
|
|
67239
67563
|
try {
|
|
67240
67564
|
if (isMultiRspackOptions(options)) for (const option of options)validateRspackConfig(option);
|
|
67241
67565
|
else validateRspackConfig(options);
|
|
@@ -67285,7 +67609,7 @@ function rspack(options, callback) {
|
|
|
67285
67609
|
return compiler;
|
|
67286
67610
|
}
|
|
67287
67611
|
}
|
|
67288
|
-
const src_fn = Object.assign(
|
|
67612
|
+
const src_fn = Object.assign(rspack_rspack, exports_namespaceObject);
|
|
67289
67613
|
src_fn.rspack = src_fn;
|
|
67290
67614
|
src_fn.webpack = src_fn;
|
|
67291
67615
|
const src_rspack_0 = src_fn;
|
|
@@ -67487,4 +67811,4 @@ var __webpack_exports__EntryDependency = external_rspack_wasi_browser_js_.EntryD
|
|
|
67487
67811
|
var __webpack_exports__ExternalModule = external_rspack_wasi_browser_js_.ExternalModule;
|
|
67488
67812
|
var __webpack_exports__Module = external_rspack_wasi_browser_js_.Module;
|
|
67489
67813
|
var __webpack_exports__NormalModule = external_rspack_wasi_browser_js_.NormalModule;
|
|
67490
|
-
export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin,
|
|
67814
|
+
export { BannerPlugin, BrowserHttpImportEsmPlugin, BrowserRequirePlugin, CircularDependencyRspackPlugin, Compilation, Compiler, ContextReplacementPlugin, CopyRspackPlugin, CssExtractRspackPlugin, DefinePlugin, DllPlugin, DllReferencePlugin, DynamicEntryPlugin, lib_EntryOptionPlugin as EntryOptionPlugin, EntryPlugin, EnvironmentPlugin, EvalDevToolModulePlugin, EvalSourceMapDevToolPlugin, ExternalsPlugin, HotModuleReplacementPlugin, HtmlRspackPlugin, IgnorePlugin, LightningCssMinimizerRspackPlugin, LoaderOptionsPlugin, LoaderTargetPlugin, ModuleFilenameHelpers_namespaceObject as ModuleFilenameHelpers, MultiCompiler, MultiStats, NoEmitOnErrorsPlugin, NormalModuleReplacementPlugin, ProgressPlugin, ProvidePlugin, RspackOptionsApply, DefaultRuntimeGlobals as RuntimeGlobals, RuntimeModule, RuntimePlugin, SourceMapDevToolPlugin, Stats, statsFactoryUtils_StatsErrorCode as StatsErrorCode, SubresourceIntegrityPlugin, SwcJsMinimizerRspackPlugin, Template, ValidationError, WarnCaseSensitiveModulesPlugin, exports_WebpackError as WebpackError, RspackOptionsApply as WebpackOptionsApply, builtinMemFs, exports_config as config, container, electron, exports_experiments as experiments, javascript, lazyCompilationMiddleware, exports_library as library, exports_node as node, optimize, src_rspack_0 as rspack, exports_rspackVersion as rspackVersion, sharing, sources, exports_util as util, exports_version as version, exports_wasm as wasm, web, webworker, __webpack_exports__AsyncDependenciesBlock as AsyncDependenciesBlock, __webpack_exports__ConcatenatedModule as ConcatenatedModule, __webpack_exports__ContextModule as ContextModule, __webpack_exports__Dependency as Dependency, __webpack_exports__EntryDependency as EntryDependency, __webpack_exports__ExternalModule as ExternalModule, __webpack_exports__Module as Module, __webpack_exports__NormalModule as NormalModule };
|