@module-federation/enhanced 2.1.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +2375 -0
- package/dist/README.md +213 -0
- package/dist/rstestmigrate.md +140 -0
- package/dist/src/_virtual/_rolldown/runtime.js +47 -0
- package/dist/src/index.d.ts +22 -19
- package/dist/src/index.js +47 -43
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/Constants.d.ts +25 -29
- package/dist/src/lib/Constants.js +136 -116
- package/dist/src/lib/Constants.js.map +1 -1
- package/dist/src/lib/container/AsyncBoundaryPlugin.d.ts +20 -16
- package/dist/src/lib/container/AsyncBoundaryPlugin.js +137 -200
- package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryDependency.d.ts +28 -23
- package/dist/src/lib/container/ContainerEntryDependency.js +39 -39
- package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModule.d.ts +93 -84
- package/dist/src/lib/container/ContainerEntryModule.js +219 -234
- package/dist/src/lib/container/ContainerEntryModule.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +15 -10
- package/dist/src/lib/container/ContainerEntryModuleFactory.js +21 -25
- package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
- package/dist/src/lib/container/ContainerExposedDependency.d.ts +29 -24
- package/dist/src/lib/container/ContainerExposedDependency.js +47 -47
- package/dist/src/lib/container/ContainerExposedDependency.js.map +1 -1
- package/dist/src/lib/container/ContainerPlugin.d.ts +12 -8
- package/dist/src/lib/container/ContainerPlugin.js +147 -211
- package/dist/src/lib/container/ContainerPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerReferencePlugin.d.ts +16 -12
- package/dist/src/lib/container/ContainerReferencePlugin.js +74 -102
- package/dist/src/lib/container/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/lib/container/FallbackDependency.d.ts +24 -19
- package/dist/src/lib/container/FallbackDependency.js +46 -44
- package/dist/src/lib/container/FallbackDependency.js.map +1 -1
- package/dist/src/lib/container/FallbackItemDependency.d.ts +13 -8
- package/dist/src/lib/container/FallbackItemDependency.js +24 -24
- package/dist/src/lib/container/FallbackItemDependency.js.map +1 -1
- package/dist/src/lib/container/FallbackModule.d.ts +82 -71
- package/dist/src/lib/container/FallbackModule.js +133 -145
- package/dist/src/lib/container/FallbackModule.js.map +1 -1
- package/dist/src/lib/container/FallbackModuleFactory.d.ts +15 -10
- package/dist/src/lib/container/FallbackModuleFactory.js +20 -24
- package/dist/src/lib/container/FallbackModuleFactory.js.map +1 -1
- package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +11 -7
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js +125 -188
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -1
- package/dist/src/lib/container/ModuleFederationPlugin.d.ts +20 -16
- package/dist/src/lib/container/ModuleFederationPlugin.js +143 -181
- package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/lib/container/RemoteModule.d.ts +79 -74
- package/dist/src/lib/container/RemoteModule.js +143 -153
- package/dist/src/lib/container/RemoteModule.js.map +1 -1
- package/dist/src/lib/container/RemoteRuntimeModule.d.ts +12 -7
- package/dist/src/lib/container/RemoteRuntimeModule.js +86 -132
- package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/RemoteToExternalDependency.d.ts +13 -8
- package/dist/src/lib/container/RemoteToExternalDependency.js +25 -23
- package/dist/src/lib/container/RemoteToExternalDependency.js.map +1 -1
- package/dist/src/lib/container/constant.d.ts +3 -0
- package/dist/src/lib/container/constant.js +11 -14
- package/dist/src/lib/container/constant.js.map +1 -1
- package/dist/src/lib/container/options.d.ts +7 -3
- package/dist/src/lib/container/options.js +51 -69
- package/dist/src/lib/container/options.js.map +1 -1
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.d.ts +14 -9
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js +56 -64
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.d.ts +23 -19
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js +71 -101
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationModulesPlugin.d.ts +20 -16
- package/dist/src/lib/container/runtime/FederationModulesPlugin.js +55 -47
- package/dist/src/lib/container/runtime/FederationModulesPlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.d.ts +9 -4
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.js +16 -12
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +16 -11
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js +39 -46
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +31 -20
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +265 -358
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +9 -4
- package/dist/src/lib/container/runtime/getFederationGlobal.js +43 -41
- package/dist/src/lib/container/runtime/getFederationGlobal.js.map +1 -1
- package/dist/src/lib/container/runtime/utils.d.ts +24 -13
- package/dist/src/lib/container/runtime/utils.js +83 -101
- package/dist/src/lib/container/runtime/utils.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +15 -10
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +27 -25
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +77 -68
- package/dist/src/lib/sharing/ConsumeSharedModule.js +186 -214
- package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +13 -9
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js +308 -475
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +16 -11
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +107 -137
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +14 -9
- package/dist/src/lib/sharing/ProvideForSharedDependency.js +25 -25
- package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +44 -39
- package/dist/src/lib/sharing/ProvideSharedDependency.js +72 -76
- package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModule.d.ts +91 -82
- package/dist/src/lib/sharing/ProvideSharedModule.js +177 -184
- package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +14 -9
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +19 -25
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +27 -21
- package/dist/src/lib/sharing/ProvideSharedPlugin.js +341 -550
- package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/SharePlugin.d.ts +53 -49
- package/dist/src/lib/sharing/SharePlugin.js +86 -100
- package/dist/src/lib/sharing/SharePlugin.js.map +1 -1
- package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
- package/dist/src/lib/sharing/ShareRuntimeModule.js +81 -103
- package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +11 -7
- package/dist/src/lib/sharing/resolveMatchedConfigs.js +58 -71
- package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.d.ts +18 -14
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js +74 -128
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.d.ts +39 -34
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js +234 -328
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.d.ts +16 -11
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js +30 -28
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.d.ts +28 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js +91 -95
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.d.ts +29 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js +47 -43
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.d.ts +20 -15
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js +33 -29
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts +85 -77
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js +141 -153
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts +15 -10
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js +20 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.d.ts +21 -16
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js +157 -231
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.d.ts +14 -9
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js +26 -27
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.d.ts +18 -13
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js +41 -49
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/utils.d.ts +27 -24
- package/dist/src/lib/sharing/utils.js +224 -367
- package/dist/src/lib/sharing/utils.js.map +1 -1
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.d.ts +11 -7
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js +56 -75
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js.map +1 -1
- package/dist/src/lib/startup/StartupHelpers.d.ts +11 -6
- package/dist/src/lib/startup/StartupHelpers.js +128 -178
- package/dist/src/lib/startup/StartupHelpers.js.map +1 -1
- package/dist/src/prefetch.d.ts +3 -2
- package/dist/src/prefetch.js +17 -8
- package/dist/src/rspack.d.ts +3 -2
- package/dist/src/rspack.js +35 -11
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +8 -4
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -16
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -1
- package/dist/src/runtime.d.ts +1 -1
- package/dist/src/runtime.js +11 -18
- package/dist/src/schemas/container/ContainerPlugin.check.d.ts +13 -5
- package/dist/src/schemas/container/ContainerPlugin.check.js +958 -1218
- package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ContainerPlugin.d.ts +271 -268
- package/dist/src/schemas/container/ContainerPlugin.js +273 -361
- package/dist/src/schemas/container/ContainerPlugin.js.map +1 -1
- package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +13 -5
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js +335 -443
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +102 -99
- package/dist/src/schemas/container/ContainerReferencePlugin.js +122 -162
- package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/schemas/container/ExternalsType.check.d.ts +13 -5
- package/dist/src/schemas/container/ExternalsType.check.js +36 -62
- package/dist/src/schemas/container/ExternalsType.check.js.map +1 -1
- package/dist/src/schemas/container/ExternalsType.d.ts +5 -2
- package/dist/src/schemas/container/ExternalsType.js +8 -11
- package/dist/src/schemas/container/ExternalsType.js.map +1 -1
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js +3001 -4812
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +819 -814
- package/dist/src/schemas/container/ModuleFederationPlugin.js +780 -1053
- package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js +568 -768
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.d.ts +197 -194
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.js +212 -238
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js +598 -804
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ProvideSharedPlugin.d.ts +184 -181
- package/dist/src/schemas/sharing/ProvideSharedPlugin.js +196 -229
- package/dist/src/schemas/sharing/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +12 -4
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +285 -482
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +103 -100
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js +104 -126
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/SharePlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/SharePlugin.check.js +749 -965
- package/dist/src/schemas/sharing/SharePlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/SharePlugin.d.ts +245 -242
- package/dist/src/schemas/sharing/SharePlugin.js +256 -293
- package/dist/src/schemas/sharing/SharePlugin.js.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.js +35 -26
- package/dist/src/utils.js.map +1 -1
- package/dist/src/webpack.d.ts +2 -2
- package/dist/src/webpack.js +6 -40
- package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +9 -4
- package/dist/src/wrapper/AsyncBoundaryPlugin.js +12 -11
- package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -1
- package/dist/src/wrapper/BaseWrapperPlugin.d.ts +18 -13
- package/dist/src/wrapper/BaseWrapperPlugin.js +39 -39
- package/dist/src/wrapper/BaseWrapperPlugin.js.map +1 -1
- package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +10 -4
- package/dist/src/wrapper/ConsumeSharedPlugin.js +12 -11
- package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/wrapper/ContainerPlugin.d.ts +9 -4
- package/dist/src/wrapper/ContainerPlugin.js +12 -11
- package/dist/src/wrapper/ContainerPlugin.js.map +1 -1
- package/dist/src/wrapper/ContainerReferencePlugin.d.ts +9 -4
- package/dist/src/wrapper/ContainerReferencePlugin.js +12 -11
- package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/wrapper/FederationModulesPlugin.d.ts +18 -10
- package/dist/src/wrapper/FederationModulesPlugin.js +19 -19
- package/dist/src/wrapper/FederationModulesPlugin.js.map +1 -1
- package/dist/src/wrapper/FederationRuntimePlugin.d.ts +11 -6
- package/dist/src/wrapper/FederationRuntimePlugin.js +18 -17
- package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -1
- package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +8 -3
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js +12 -11
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -1
- package/dist/src/wrapper/ModuleFederationPlugin.d.ts +12 -7
- package/dist/src/wrapper/ModuleFederationPlugin.js +73 -99
- package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/wrapper/ProvideSharedPlugin.d.ts +10 -4
- package/dist/src/wrapper/ProvideSharedPlugin.js +12 -11
- package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/wrapper/SharePlugin.d.ts +10 -4
- package/dist/src/wrapper/SharePlugin.js +12 -11
- package/dist/src/wrapper/SharePlugin.js.map +1 -1
- package/dist/src/wrapper/TreeShakingSharedPlugin.d.ts +9 -4
- package/dist/src/wrapper/TreeShakingSharedPlugin.js +12 -11
- package/dist/src/wrapper/TreeShakingSharedPlugin.js.map +1 -1
- package/package.json +23 -14
- package/dist/package.json +0 -110
- package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +0 -57
- package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +0 -33
- package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +0 -4
- package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +0 -28
- package/dist/src/declarations/plugins/container/Template.d.ts +0 -198
- package/dist/src/declarations/plugins/container/WebpackError.d.ts +0 -33
- package/dist/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts +0 -86
- package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +0 -100
- package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +0 -102
- package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +0 -116
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.d.ts +0 -20
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js +0 -222
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js.map +0 -1
- package/dist/src/prefetch.js.map +0 -1
- package/dist/src/rspack.js.map +0 -1
- package/dist/src/runtime.js.map +0 -1
- package/dist/src/types/runtime.d.ts +0 -10
- package/dist/src/types/runtime.js +0 -3
- package/dist/src/types/runtime.js.map +0 -1
- package/dist/src/webpack.js.map +0 -1
|
@@ -1,104 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const { RuntimeGlobals } = require((0,
|
|
11
|
-
const PLUGIN_NAME =
|
|
12
|
-
const federationGlobal =
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
const require_lib_container_runtime_FederationModulesPlugin = require('./FederationModulesPlugin.js');
|
|
4
|
+
const require_lib_container_runtime_utils = require('./utils.js');
|
|
5
|
+
const require_lib_container_runtime_EmbedFederationRuntimeModule = require('./EmbedFederationRuntimeModule.js');
|
|
6
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
7
|
+
|
|
8
|
+
//#region src/lib/container/runtime/EmbedFederationRuntimePlugin.ts
|
|
9
|
+
require_lib_container_runtime_FederationModulesPlugin.init_FederationModulesPlugin();
|
|
10
|
+
const { RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
11
|
+
const PLUGIN_NAME = "EmbedFederationRuntimePlugin";
|
|
12
|
+
const federationGlobal = require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals);
|
|
13
13
|
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);
|
|
76
|
-
});
|
|
77
|
-
// Collect federation runtime dependencies.
|
|
78
|
-
federationHooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dependency) => {
|
|
79
|
-
containerEntrySet.add(dependency);
|
|
80
|
-
});
|
|
81
|
-
// Handle additional runtime requirements when federation is enabled.
|
|
82
|
-
const handleRuntimeRequirements = (chunk, runtimeRequirements) => {
|
|
83
|
-
if (!this.isEnabledForChunk(chunk)) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
// Skip if already processed or if not a federation chunk.
|
|
87
|
-
if (runtimeRequirements.has('embeddedFederationRuntime'))
|
|
88
|
-
return;
|
|
89
|
-
if (!runtimeRequirements.has(federationGlobal)) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
// Mark as embedded and add the runtime module.
|
|
93
|
-
runtimeRequirements.add('embeddedFederationRuntime');
|
|
94
|
-
const runtimeModule = new EmbedFederationRuntimeModule_1.default(containerEntrySet);
|
|
95
|
-
compilation.addRuntimeModule(chunk, runtimeModule);
|
|
96
|
-
};
|
|
97
|
-
compilation.hooks.runtimeRequirementInTree
|
|
98
|
-
.for(federationGlobal)
|
|
99
|
-
.tap(PLUGIN_NAME, handleRuntimeRequirements);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
14
|
+
* Plugin that embeds Module Federation runtime code into chunks.
|
|
15
|
+
* It ensures proper initialization of federated modules and manages runtime requirements.
|
|
16
|
+
*/
|
|
17
|
+
var EmbedFederationRuntimePlugin = class {
|
|
18
|
+
constructor(options = {}) {
|
|
19
|
+
this.processedChunks = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
this.options = {
|
|
21
|
+
enableForAllChunks: false,
|
|
22
|
+
...options
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Determines if runtime embedding should be enabled for a given chunk.
|
|
27
|
+
*/
|
|
28
|
+
isEnabledForChunk(chunk) {
|
|
29
|
+
if (chunk.id === "build time chunk") return false;
|
|
30
|
+
return this.options.enableForAllChunks || chunk.hasRuntime();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a hook has already been tapped by this plugin.
|
|
34
|
+
*/
|
|
35
|
+
isHookAlreadyTapped(taps, hookName) {
|
|
36
|
+
return taps.some((tap) => tap.name === hookName);
|
|
37
|
+
}
|
|
38
|
+
apply(compiler) {
|
|
39
|
+
const compilationTaps = compiler.hooks.thisCompilation.taps || [];
|
|
40
|
+
if (this.isHookAlreadyTapped(compilationTaps, PLUGIN_NAME)) return;
|
|
41
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
42
|
+
const { renderStartup } = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
43
|
+
renderStartup.tap(PLUGIN_NAME, (startupSource, _lastInlinedModule, renderContext) => {
|
|
44
|
+
const { chunk, chunkGraph } = renderContext;
|
|
45
|
+
if (!this.isEnabledForChunk(chunk)) return startupSource;
|
|
46
|
+
const runtimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
|
|
47
|
+
if (chunkGraph.getNumberOfEntryModules(chunk) > 0 || runtimeRequirements.has(RuntimeGlobals.startupNoDefault)) return startupSource;
|
|
48
|
+
return new compiler.webpack.sources.ConcatSource(startupSource, "\n// Custom hook: appended startup call because none was added automatically\n", `${RuntimeGlobals.startup}();\n`);
|
|
49
|
+
});
|
|
50
|
+
const federationHooks = require_lib_container_runtime_FederationModulesPlugin.default.getCompilationHooks(compilation);
|
|
51
|
+
const containerEntrySet = /* @__PURE__ */ new Set();
|
|
52
|
+
compilation.hooks.additionalChunkRuntimeRequirements.tap(PLUGIN_NAME, (chunk, runtimeRequirements) => {
|
|
53
|
+
if (!this.isEnabledForChunk(chunk)) return;
|
|
54
|
+
runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);
|
|
55
|
+
});
|
|
56
|
+
federationHooks.addFederationRuntimeDependency.tap(PLUGIN_NAME, (dependency) => {
|
|
57
|
+
containerEntrySet.add(dependency);
|
|
58
|
+
});
|
|
59
|
+
const handleRuntimeRequirements = (chunk, runtimeRequirements) => {
|
|
60
|
+
if (!this.isEnabledForChunk(chunk)) return;
|
|
61
|
+
if (runtimeRequirements.has("embeddedFederationRuntime")) return;
|
|
62
|
+
if (!runtimeRequirements.has(federationGlobal)) return;
|
|
63
|
+
runtimeRequirements.add("embeddedFederationRuntime");
|
|
64
|
+
const runtimeModule = new require_lib_container_runtime_EmbedFederationRuntimeModule.default(containerEntrySet);
|
|
65
|
+
compilation.addRuntimeModule(chunk, runtimeModule);
|
|
66
|
+
};
|
|
67
|
+
compilation.hooks.runtimeRequirementInTree.for(federationGlobal).tap(PLUGIN_NAME, handleRuntimeRequirements);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
103
73
|
exports.default = EmbedFederationRuntimePlugin;
|
|
104
74
|
//# sourceMappingURL=EmbedFederationRuntimePlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedFederationRuntimePlugin.js","
|
|
1
|
+
{"version":3,"file":"EmbedFederationRuntimePlugin.js","names":["getFederationGlobalScope","FederationModulesPlugin","EmbedFederationRuntimeModule"],"sources":["../../../../../src/lib/container/runtime/EmbedFederationRuntimePlugin.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport EmbedFederationRuntimeModule from './EmbedFederationRuntimeModule';\nimport FederationModulesPlugin from './FederationModulesPlugin';\nimport type { Compiler, Chunk, Compilation } from 'webpack';\nimport { getFederationGlobalScope } from './utils';\nimport ContainerEntryDependency from '../ContainerEntryDependency';\nimport FederationRuntimeDependency from './FederationRuntimeDependency';\n\nconst { RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nconst PLUGIN_NAME = 'EmbedFederationRuntimePlugin';\n\nconst federationGlobal = getFederationGlobalScope(RuntimeGlobals);\n\ninterface EmbedFederationRuntimePluginOptions {\n /**\n * Whether to enable runtime module embedding for all chunks.\n * If false, only chunks that explicitly require it will be embedded.\n */\n enableForAllChunks?: boolean;\n}\n\n/**\n * Plugin that embeds Module Federation runtime code into chunks.\n * It ensures proper initialization of federated modules and manages runtime requirements.\n */\nclass EmbedFederationRuntimePlugin {\n private readonly options: EmbedFederationRuntimePluginOptions;\n private readonly processedChunks = new WeakMap<Chunk, boolean>();\n\n constructor(options: EmbedFederationRuntimePluginOptions = {}) {\n this.options = {\n enableForAllChunks: false,\n ...options,\n };\n }\n\n /**\n * Determines if runtime embedding should be enabled for a given chunk.\n */\n private isEnabledForChunk(chunk: Chunk): boolean {\n // Disable for our special \"build time chunk\"\n if (chunk.id === 'build time chunk') return false;\n return this.options.enableForAllChunks || chunk.hasRuntime();\n }\n\n /**\n * Checks if a hook has already been tapped by this plugin.\n */\n private isHookAlreadyTapped(\n taps: Array<{ name: string }>,\n hookName: string,\n ): boolean {\n return taps.some((tap) => tap.name === hookName);\n }\n\n apply(compiler: Compiler): void {\n // Prevent double application of the plugin.\n const compilationTaps = compiler.hooks.thisCompilation.taps || [];\n if (this.isHookAlreadyTapped(compilationTaps, PLUGIN_NAME)) {\n return;\n }\n\n // Tap into the compilation to modify renderStartup and runtime requirements.\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: Compilation) => {\n // --- Part 1: Modify renderStartup to append a startup call when none is added automatically ---\n const { renderStartup } =\n compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(\n compilation,\n );\n\n renderStartup.tap(\n PLUGIN_NAME,\n (startupSource, _lastInlinedModule, renderContext) => {\n const { chunk, chunkGraph } = renderContext;\n\n if (!this.isEnabledForChunk(chunk)) {\n return startupSource;\n }\n\n const runtimeRequirements =\n chunkGraph.getTreeRuntimeRequirements(chunk);\n const entryModuleCount = chunkGraph.getNumberOfEntryModules(chunk);\n\n // The default renderBootstrap automatically pushes a startup call when either:\n // - There is at least one entry module, OR\n // - runtimeRequirements.has(RuntimeGlobals.startupNoDefault) is true.\n if (\n entryModuleCount > 0 ||\n runtimeRequirements.has(RuntimeGlobals.startupNoDefault)\n ) {\n return startupSource;\n }\n\n // Otherwise, append a startup call.\n return new compiler.webpack.sources.ConcatSource(\n startupSource,\n '\\n// Custom hook: appended startup call because none was added automatically\\n',\n `${RuntimeGlobals.startup}();\\n`,\n );\n },\n );\n\n // --- Part 2: Embed Federation Runtime Module and adjust runtime requirements ---\n const federationHooks =\n FederationModulesPlugin.getCompilationHooks(compilation);\n const containerEntrySet: Set<\n ContainerEntryDependency | FederationRuntimeDependency\n > = new Set();\n\n // Proactively add startupOnlyBefore target chunks.\n compilation.hooks.additionalChunkRuntimeRequirements.tap(\n PLUGIN_NAME,\n (chunk: Chunk, runtimeRequirements: Set<string>) => {\n if (!this.isEnabledForChunk(chunk)) {\n return;\n }\n runtimeRequirements.add(RuntimeGlobals.startupOnlyBefore);\n },\n );\n\n // Collect federation runtime dependencies.\n federationHooks.addFederationRuntimeDependency.tap(\n PLUGIN_NAME,\n (dependency: FederationRuntimeDependency) => {\n containerEntrySet.add(dependency);\n },\n );\n\n // Handle additional runtime requirements when federation is enabled.\n const handleRuntimeRequirements = (\n chunk: Chunk,\n runtimeRequirements: Set<string>,\n ) => {\n if (!this.isEnabledForChunk(chunk)) {\n return;\n }\n // Skip if already processed or if not a federation chunk.\n if (runtimeRequirements.has('embeddedFederationRuntime')) return;\n if (!runtimeRequirements.has(federationGlobal)) {\n return;\n }\n\n // Mark as embedded and add the runtime module.\n runtimeRequirements.add('embeddedFederationRuntime');\n const runtimeModule = new EmbedFederationRuntimeModule(\n containerEntrySet,\n );\n compilation.addRuntimeModule(chunk, runtimeModule);\n };\n\n compilation.hooks.runtimeRequirementInTree\n .for(federationGlobal)\n .tap(PLUGIN_NAME, handleRuntimeRequirements);\n },\n );\n }\n}\n\nexport default EmbedFederationRuntimePlugin;\n"],"mappings":";;;;;;;;oFAEgE;AAMhE,MAAM,EAAE,mBAAmB,gFACJ,UAAU,CAChC;AAED,MAAM,cAAc;AAEpB,MAAM,mBAAmBA,6DAAyB,eAAe;;;;;AAcjE,IAAM,+BAAN,MAAmC;CAIjC,YAAY,UAA+C,EAAE,EAAE;yCAF5B,IAAI,SAAyB;AAG9D,OAAK,UAAU;GACb,oBAAoB;GACpB,GAAG;GACJ;;;;;CAMH,AAAQ,kBAAkB,OAAuB;AAE/C,MAAI,MAAM,OAAO,mBAAoB,QAAO;AAC5C,SAAO,KAAK,QAAQ,sBAAsB,MAAM,YAAY;;;;;CAM9D,AAAQ,oBACN,MACA,UACS;AACT,SAAO,KAAK,MAAM,QAAQ,IAAI,SAAS,SAAS;;CAGlD,MAAM,UAA0B;EAE9B,MAAM,kBAAkB,SAAS,MAAM,gBAAgB,QAAQ,EAAE;AACjE,MAAI,KAAK,oBAAoB,iBAAiB,YAAY,CACxD;AAIF,WAAS,MAAM,gBAAgB,IAC7B,cACC,gBAA6B;GAE5B,MAAM,EAAE,kBACN,SAAS,QAAQ,WAAW,wBAAwB,oBAClD,YACD;AAEH,iBAAc,IACZ,cACC,eAAe,oBAAoB,kBAAkB;IACpD,MAAM,EAAE,OAAO,eAAe;AAE9B,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC,QAAO;IAGT,MAAM,sBACJ,WAAW,2BAA2B,MAAM;AAM9C,QALyB,WAAW,wBAAwB,MAAM,GAM7C,KACnB,oBAAoB,IAAI,eAAe,iBAAiB,CAExD,QAAO;AAIT,WAAO,IAAI,SAAS,QAAQ,QAAQ,aAClC,eACA,kFACA,GAAG,eAAe,QAAQ,OAC3B;KAEJ;GAGD,MAAM,kBACJC,8DAAwB,oBAAoB,YAAY;GAC1D,MAAM,oCAEF,IAAI,KAAK;AAGb,eAAY,MAAM,mCAAmC,IACnD,cACC,OAAc,wBAAqC;AAClD,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC;AAEF,wBAAoB,IAAI,eAAe,kBAAkB;KAE5D;AAGD,mBAAgB,+BAA+B,IAC7C,cACC,eAA4C;AAC3C,sBAAkB,IAAI,WAAW;KAEpC;GAGD,MAAM,6BACJ,OACA,wBACG;AACH,QAAI,CAAC,KAAK,kBAAkB,MAAM,CAChC;AAGF,QAAI,oBAAoB,IAAI,4BAA4B,CAAE;AAC1D,QAAI,CAAC,oBAAoB,IAAI,iBAAiB,CAC5C;AAIF,wBAAoB,IAAI,4BAA4B;IACpD,MAAM,gBAAgB,IAAIC,mEACxB,kBACD;AACD,gBAAY,iBAAiB,OAAO,cAAc;;AAGpD,eAAY,MAAM,yBACf,IAAI,iBAAiB,CACrB,IAAI,aAAa,0BAA0B;IAEjD"}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import ContainerEntryDependency from "../ContainerEntryDependency.js";
|
|
2
|
+
import FederationRuntimeDependency from "./FederationRuntimeDependency.js";
|
|
3
|
+
import { Compilation, Compiler } from "webpack";
|
|
4
|
+
import { SyncHook } from "tapable";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/container/runtime/FederationModulesPlugin.d.ts
|
|
5
7
|
/** @typedef {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} Bootstrap */
|
|
6
8
|
type CompilationHooks = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
addContainerEntryDependency: SyncHook<[ContainerEntryDependency], void>;
|
|
10
|
+
addFederationRuntimeDependency: SyncHook<[FederationRuntimeDependency], void>;
|
|
11
|
+
addRemoteDependency: SyncHook<[any], void>;
|
|
10
12
|
};
|
|
11
13
|
declare class FederationModulesPlugin {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
options: any;
|
|
15
|
+
/**
|
|
16
|
+
* @param {Compilation} compilation the compilation
|
|
17
|
+
* @returns {CompilationHooks} the attached hooks
|
|
18
|
+
*/
|
|
19
|
+
static getCompilationHooks(compilation: Compilation): CompilationHooks;
|
|
20
|
+
constructor(options?: {});
|
|
21
|
+
apply(compiler: Compiler): void;
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
export { FederationModulesPlugin as default };
|
|
25
|
+
//# sourceMappingURL=FederationModulesPlugin.d.ts.map
|
|
@@ -1,49 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
4
|
+
let tapable = require("tapable");
|
|
5
|
+
|
|
6
|
+
//#region src/lib/container/runtime/FederationModulesPlugin.ts
|
|
7
|
+
var FederationModulesPlugin_exports = /* @__PURE__ */ require_runtime.__exportAll({ default: () => FederationModulesPlugin });
|
|
8
|
+
var compilationHooksMap, PLUGIN_NAME, FederationModulesPlugin;
|
|
9
|
+
var init_FederationModulesPlugin = require_runtime.__esmMin((() => {
|
|
10
|
+
require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/Compilation"));
|
|
11
|
+
compilationHooksMap = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
PLUGIN_NAME = "FederationModulesPlugin";
|
|
13
|
+
FederationModulesPlugin = class FederationModulesPlugin {
|
|
14
|
+
/**
|
|
15
|
+
* @param {Compilation} compilation the compilation
|
|
16
|
+
* @returns {CompilationHooks} the attached hooks
|
|
17
|
+
*/
|
|
18
|
+
static getCompilationHooks(compilation) {
|
|
19
|
+
if (!(compilation && typeof compilation === "object" && typeof compilation.hooks === "object" && typeof compilation.hooks.processAssets?.tap === "function")) throw new TypeError("Invalid 'compilation' argument: expected a Webpack Compilation-like object");
|
|
20
|
+
let hooks = compilationHooksMap.get(compilation);
|
|
21
|
+
if (hooks === void 0) {
|
|
22
|
+
hooks = {
|
|
23
|
+
addContainerEntryDependency: new tapable.SyncHook(["dependency"]),
|
|
24
|
+
addFederationRuntimeDependency: new tapable.SyncHook(["dependency"]),
|
|
25
|
+
addRemoteDependency: new tapable.SyncHook(["dependency"])
|
|
26
|
+
};
|
|
27
|
+
compilationHooksMap.set(compilation, hooks);
|
|
28
|
+
}
|
|
29
|
+
return hooks;
|
|
30
|
+
}
|
|
31
|
+
constructor(options = {}) {
|
|
32
|
+
this.options = options;
|
|
33
|
+
}
|
|
34
|
+
apply(compiler) {
|
|
35
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation, { normalModuleFactory }) => {
|
|
36
|
+
FederationModulesPlugin.getCompilationHooks(compilation);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
init_FederationModulesPlugin();
|
|
44
|
+
Object.defineProperty(exports, 'FederationModulesPlugin_exports', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return FederationModulesPlugin_exports;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
48
50
|
exports.default = FederationModulesPlugin;
|
|
51
|
+
Object.defineProperty(exports, 'init_FederationModulesPlugin', {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return init_FederationModulesPlugin;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
49
57
|
//# sourceMappingURL=FederationModulesPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederationModulesPlugin.js","
|
|
1
|
+
{"version":3,"file":"FederationModulesPlugin.js","names":["SyncHook"],"sources":["../../../../../src/lib/container/runtime/FederationModulesPlugin.ts"],"sourcesContent":["import type { Compiler, Compilation as CompilationType } from 'webpack';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst Compilation = require(\n normalizeWebpackPath('webpack/lib/Compilation'),\n) as typeof import('webpack/lib/Compilation');\nimport { SyncHook } from 'tapable';\nimport ContainerEntryDependency from '../ContainerEntryDependency';\nimport FederationRuntimeDependency from './FederationRuntimeDependency';\n\n/** @type {WeakMap<import(\"webpack\").Compilation, CompilationHooks>} */\nconst compilationHooksMap = new WeakMap<CompilationType, CompilationHooks>();\n\nconst PLUGIN_NAME = 'FederationModulesPlugin';\n\n/** @typedef {{ header: string[], beforeStartup: string[], startup: string[], afterStartup: string[], allowInlineStartup: boolean }} Bootstrap */\n\ntype CompilationHooks = {\n addContainerEntryDependency: SyncHook<[ContainerEntryDependency], void>;\n addFederationRuntimeDependency: SyncHook<[FederationRuntimeDependency], void>;\n addRemoteDependency: SyncHook<[any], void>;\n};\n\nclass FederationModulesPlugin {\n options: any;\n\n /**\n * @param {Compilation} compilation the compilation\n * @returns {CompilationHooks} the attached hooks\n */\n static getCompilationHooks(compilation: CompilationType): CompilationHooks {\n // Avoid cross-realm instanceof checks (e.g., Jest VM modules) by using\n // a duck-typed verification of a Webpack Compilation-like object.\n const isLikelyCompilation =\n compilation &&\n typeof compilation === 'object' &&\n // @ts-ignore\n typeof (compilation as any).hooks === 'object' &&\n // A couple of well-known hooks available on Webpack 5 compilations\n // @ts-ignore\n typeof (compilation as any).hooks.processAssets?.tap === 'function';\n\n if (!isLikelyCompilation) {\n throw new TypeError(\n \"Invalid 'compilation' argument: expected a Webpack Compilation-like object\",\n );\n }\n let hooks = compilationHooksMap.get(compilation);\n if (hooks === undefined) {\n hooks = {\n addContainerEntryDependency: new SyncHook(['dependency']),\n addFederationRuntimeDependency: new SyncHook(['dependency']),\n addRemoteDependency: new SyncHook(['dependency']),\n };\n compilationHooksMap.set(compilation, hooks);\n }\n return hooks;\n }\n\n constructor(options = {}) {\n this.options = options;\n }\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(\n PLUGIN_NAME,\n (compilation: CompilationType, { normalModuleFactory }) => {\n //@ts-ignore\n const hooks = FederationModulesPlugin.getCompilationHooks(compilation);\n },\n );\n }\n}\n\nexport default FederationModulesPlugin;\n"],"mappings":";;;;;;;;;AAGoB,iFACG,0BAA0B,CAChD;CAMK,sCAAsB,IAAI,SAA4C;CAEtE,cAAc;CAUd,0BAAN,MAAM,wBAAwB;;;;;EAO5B,OAAO,oBAAoB,aAAgD;AAYzE,OAAI,EARF,eACA,OAAO,gBAAgB,YAEvB,OAAQ,YAAoB,UAAU,YAGtC,OAAQ,YAAoB,MAAM,eAAe,QAAQ,YAGzD,OAAM,IAAI,UACR,6EACD;GAEH,IAAI,QAAQ,oBAAoB,IAAI,YAAY;AAChD,OAAI,UAAU,QAAW;AACvB,YAAQ;KACN,6BAA6B,IAAIA,iBAAS,CAAC,aAAa,CAAC;KACzD,gCAAgC,IAAIA,iBAAS,CAAC,aAAa,CAAC;KAC5D,qBAAqB,IAAIA,iBAAS,CAAC,aAAa,CAAC;KAClD;AACD,wBAAoB,IAAI,aAAa,MAAM;;AAE7C,UAAO;;EAGT,YAAY,UAAU,EAAE,EAAE;AACxB,QAAK,UAAU;;EAGjB,MAAM,UAAoB;AACxB,YAAS,MAAM,YAAY,IACzB,cACC,aAA8B,EAAE,0BAA0B;AAE3C,4BAAwB,oBAAoB,YAAY;KAEzE"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as webpack_lib_dependencies_ModuleDependency0 from "webpack/lib/dependencies/ModuleDependency";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/container/runtime/FederationRuntimeDependency.d.ts
|
|
4
|
+
declare const ModuleDependency: typeof webpack_lib_dependencies_ModuleDependency0;
|
|
2
5
|
declare class FederationRuntimeDependency extends ModuleDependency {
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
constructor(request: string);
|
|
7
|
+
get type(): string;
|
|
5
8
|
}
|
|
6
|
-
|
|
9
|
+
//#endregion
|
|
10
|
+
export { FederationRuntimeDependency as default };
|
|
11
|
+
//# sourceMappingURL=FederationRuntimeDependency.d.ts.map
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
4
|
+
|
|
5
|
+
//#region src/lib/container/runtime/FederationRuntimeDependency.ts
|
|
6
|
+
const ModuleDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/ModuleDependency"));
|
|
7
|
+
var FederationRuntimeDependency = class extends ModuleDependency {
|
|
8
|
+
constructor(request) {
|
|
9
|
+
super(request);
|
|
10
|
+
}
|
|
11
|
+
get type() {
|
|
12
|
+
return "federation runtime dependency";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
13
17
|
exports.default = FederationRuntimeDependency;
|
|
14
18
|
//# sourceMappingURL=FederationRuntimeDependency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederationRuntimeDependency.js","
|
|
1
|
+
{"version":3,"file":"FederationRuntimeDependency.js","names":[],"sources":["../../../../../src/lib/container/runtime/FederationRuntimeDependency.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst ModuleDependency = require(\n normalizeWebpackPath('webpack/lib/dependencies/ModuleDependency'),\n) as typeof import('webpack/lib/dependencies/ModuleDependency');\n\nclass FederationRuntimeDependency extends ModuleDependency {\n constructor(request: string) {\n super(request);\n }\n\n override get type() {\n return 'federation runtime dependency';\n }\n}\n\nexport default FederationRuntimeDependency;\n"],"mappings":";;;;;AAEA,MAAM,mBAAmB,gFACF,4CAA4C,CAClE;AAED,IAAM,8BAAN,cAA0C,iBAAiB;CACzD,YAAY,SAAiB;AAC3B,QAAM,QAAQ;;CAGhB,IAAa,OAAO;AAClB,SAAO"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { NormalizedRuntimeInitOptionsWithOutShared } from
|
|
2
|
-
|
|
1
|
+
import { NormalizedRuntimeInitOptionsWithOutShared } from "./utils.js";
|
|
2
|
+
import * as webpack$1 from "webpack";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/container/runtime/FederationRuntimeModule.d.ts
|
|
5
|
+
declare const RuntimeModule: typeof webpack$1.RuntimeModule;
|
|
3
6
|
declare class FederationRuntimeModule extends RuntimeModule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
runtimeRequirements: ReadonlySet<string>;
|
|
8
|
+
containerName: string;
|
|
9
|
+
initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;
|
|
10
|
+
constructor(runtimeRequirements: ReadonlySet<string>, containerName: string, initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared);
|
|
11
|
+
/**
|
|
12
|
+
* @returns {string | null} runtime code
|
|
13
|
+
*/
|
|
14
|
+
generate(): string;
|
|
12
15
|
}
|
|
13
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
export { FederationRuntimeModule as default };
|
|
18
|
+
//# sourceMappingURL=FederationRuntimeModule.d.ts.map
|
|
@@ -1,49 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
|
|
3
|
+
const require_lib_container_runtime_getFederationGlobal = require('./getFederationGlobal.js');
|
|
4
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
5
|
+
|
|
6
|
+
//#region src/lib/container/runtime/FederationRuntimeModule.ts
|
|
7
|
+
const compileBooleanMatcher = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/compileBooleanMatcher"));
|
|
8
|
+
const { getUndoPath } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/identifier"));
|
|
9
|
+
const { RuntimeModule, RuntimeGlobals, Template } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
10
|
+
var FederationRuntimeModule = class extends RuntimeModule {
|
|
11
|
+
constructor(runtimeRequirements, containerName, initOptionsWithoutShared) {
|
|
12
|
+
super("federation runtime", RuntimeModule.STAGE_NORMAL - 1);
|
|
13
|
+
this.runtimeRequirements = runtimeRequirements;
|
|
14
|
+
this.containerName = containerName;
|
|
15
|
+
this.initOptionsWithoutShared = initOptionsWithoutShared;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @returns {string | null} runtime code
|
|
19
|
+
*/
|
|
20
|
+
generate() {
|
|
21
|
+
let matcher = false;
|
|
22
|
+
let rootOutputDir;
|
|
23
|
+
if (this.compilation && this.chunk) {
|
|
24
|
+
const jsModulePlugin = this.compilation.compiler.webpack?.javascript?.JavascriptModulesPlugin || require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/javascript/JavascriptModulesPlugin"));
|
|
25
|
+
const { chunkHasJs } = jsModulePlugin;
|
|
26
|
+
if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {
|
|
27
|
+
const hasJsMatcher = compileBooleanMatcher(this.compilation.chunkGraph.getChunkConditionMap(this.chunk, chunkHasJs));
|
|
28
|
+
if (typeof hasJsMatcher === "boolean") matcher = hasJsMatcher;
|
|
29
|
+
else matcher = hasJsMatcher("chunkId");
|
|
30
|
+
rootOutputDir = getUndoPath(this.compilation.getPath(jsModulePlugin.getChunkFilenameTemplate(this.chunk, this.compilation.outputOptions), {
|
|
31
|
+
chunk: this.chunk,
|
|
32
|
+
contentHashType: "javascript"
|
|
33
|
+
}), this.compilation.outputOptions.path || "", false);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return Template.asString([require_lib_container_runtime_getFederationGlobal.default(Template, RuntimeGlobals, matcher, rootOutputDir, this.initOptionsWithoutShared)]);
|
|
37
|
+
}
|
|
4
38
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const compileBooleanMatcher = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/compileBooleanMatcher'));
|
|
8
|
-
const { getUndoPath } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/identifier'));
|
|
9
|
-
// inspired by react-refresh-webpack-plugin
|
|
10
|
-
const getFederationGlobal_1 = __importDefault(require("./getFederationGlobal"));
|
|
11
|
-
const { RuntimeModule, RuntimeGlobals, Template } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
12
|
-
class FederationRuntimeModule extends RuntimeModule {
|
|
13
|
-
constructor(runtimeRequirements, containerName, initOptionsWithoutShared) {
|
|
14
|
-
super('federation runtime', RuntimeModule.STAGE_NORMAL - 1);
|
|
15
|
-
this.runtimeRequirements = runtimeRequirements;
|
|
16
|
-
this.containerName = containerName;
|
|
17
|
-
this.initOptionsWithoutShared = initOptionsWithoutShared;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @returns {string | null} runtime code
|
|
21
|
-
*/
|
|
22
|
-
generate() {
|
|
23
|
-
let matcher = false;
|
|
24
|
-
let rootOutputDir;
|
|
25
|
-
if (this.compilation && this.chunk) {
|
|
26
|
-
const jsModulePlugin = this.compilation.compiler.webpack?.javascript
|
|
27
|
-
?.JavascriptModulesPlugin ||
|
|
28
|
-
require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/javascript/JavascriptModulesPlugin'));
|
|
29
|
-
const { chunkHasJs } = jsModulePlugin;
|
|
30
|
-
if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {
|
|
31
|
-
const conditionMap = this.compilation.chunkGraph.getChunkConditionMap(this.chunk, chunkHasJs);
|
|
32
|
-
const hasJsMatcher = compileBooleanMatcher(conditionMap);
|
|
33
|
-
if (typeof hasJsMatcher === 'boolean') {
|
|
34
|
-
matcher = hasJsMatcher;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
matcher = hasJsMatcher('chunkId');
|
|
38
|
-
}
|
|
39
|
-
const outputName = this.compilation.getPath(jsModulePlugin.getChunkFilenameTemplate(this.chunk, this.compilation.outputOptions), { chunk: this.chunk, contentHashType: 'javascript' });
|
|
40
|
-
rootOutputDir = getUndoPath(outputName, this.compilation.outputOptions.path || '', false);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return Template.asString([
|
|
44
|
-
(0, getFederationGlobal_1.default)(Template, RuntimeGlobals, matcher, rootOutputDir, this.initOptionsWithoutShared),
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
48
41
|
exports.default = FederationRuntimeModule;
|
|
49
42
|
//# sourceMappingURL=FederationRuntimeModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederationRuntimeModule.js","
|
|
1
|
+
{"version":3,"file":"FederationRuntimeModule.js","names":["getFederationGlobal"],"sources":["../../../../../src/lib/container/runtime/FederationRuntimeModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nconst compileBooleanMatcher = require(\n normalizeWebpackPath('webpack/lib/util/compileBooleanMatcher'),\n) as typeof import('webpack/lib/util/compileBooleanMatcher');\nconst { getUndoPath } = require(\n normalizeWebpackPath('webpack/lib/util/identifier'),\n) as typeof import('webpack/lib/util/identifier');\n// inspired by react-refresh-webpack-plugin\nimport getFederationGlobal from './getFederationGlobal';\nimport type { NormalizedRuntimeInitOptionsWithOutShared } from './utils';\n\nconst { RuntimeModule, RuntimeGlobals, Template } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nclass FederationRuntimeModule extends RuntimeModule {\n runtimeRequirements: ReadonlySet<string>;\n containerName: string;\n initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared;\n\n constructor(\n runtimeRequirements: ReadonlySet<string>,\n containerName: string,\n initOptionsWithoutShared: NormalizedRuntimeInitOptionsWithOutShared,\n ) {\n super('federation runtime', RuntimeModule.STAGE_NORMAL - 1);\n this.runtimeRequirements = runtimeRequirements;\n this.containerName = containerName;\n this.initOptionsWithoutShared = initOptionsWithoutShared;\n }\n\n /**\n * @returns {string | null} runtime code\n */\n override generate() {\n let matcher: string | boolean = false;\n let rootOutputDir: string | undefined;\n if (this.compilation && this.chunk) {\n const jsModulePlugin =\n this.compilation.compiler.webpack?.javascript\n ?.JavascriptModulesPlugin ||\n require(\n normalizeWebpackPath(\n 'webpack/lib/javascript/JavascriptModulesPlugin',\n ),\n );\n const { chunkHasJs } = jsModulePlugin;\n if (this.runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)) {\n const conditionMap = this.compilation.chunkGraph.getChunkConditionMap(\n this.chunk,\n chunkHasJs,\n );\n const hasJsMatcher = compileBooleanMatcher(conditionMap);\n if (typeof hasJsMatcher === 'boolean') {\n matcher = hasJsMatcher;\n } else {\n matcher = hasJsMatcher('chunkId');\n }\n const outputName = this.compilation.getPath(\n jsModulePlugin.getChunkFilenameTemplate(\n this.chunk,\n this.compilation.outputOptions,\n ),\n { chunk: this.chunk, contentHashType: 'javascript' },\n );\n rootOutputDir = getUndoPath(\n outputName,\n this.compilation.outputOptions.path || '',\n false,\n );\n }\n }\n\n return Template.asString([\n getFederationGlobal(\n Template,\n RuntimeGlobals,\n matcher,\n rootOutputDir,\n this.initOptionsWithoutShared,\n ),\n ]);\n }\n}\nexport default FederationRuntimeModule;\n"],"mappings":";;;;;;AACA,MAAM,wBAAwB,gFACP,yCAAyC,CAC/D;AACD,MAAM,EAAE,gBAAgB,gFACD,8BAA8B,CACpD;AAKD,MAAM,EAAE,eAAe,gBAAgB,aAAa,gFAC7B,UAAU,CAChC;AAED,IAAM,0BAAN,cAAsC,cAAc;CAKlD,YACE,qBACA,eACA,0BACA;AACA,QAAM,sBAAsB,cAAc,eAAe,EAAE;AAC3D,OAAK,sBAAsB;AAC3B,OAAK,gBAAgB;AACrB,OAAK,2BAA2B;;;;;CAMlC,AAAS,WAAW;EAClB,IAAI,UAA4B;EAChC,IAAI;AACJ,MAAI,KAAK,eAAe,KAAK,OAAO;GAClC,MAAM,iBACJ,KAAK,YAAY,SAAS,SAAS,YAC/B,2BACJ,gFAEI,iDACD,CACF;GACH,MAAM,EAAE,eAAe;AACvB,OAAI,KAAK,oBAAoB,IAAI,eAAe,oBAAoB,EAAE;IAKpE,MAAM,eAAe,sBAJA,KAAK,YAAY,WAAW,qBAC/C,KAAK,OACL,WACD,CACuD;AACxD,QAAI,OAAO,iBAAiB,UAC1B,WAAU;QAEV,WAAU,aAAa,UAAU;AASnC,oBAAgB,YAPG,KAAK,YAAY,QAClC,eAAe,yBACb,KAAK,OACL,KAAK,YAAY,cAClB,EACD;KAAE,OAAO,KAAK;KAAO,iBAAiB;KAAc,CACrD,EAGC,KAAK,YAAY,cAAc,QAAQ,IACvC,MACD;;;AAIL,SAAO,SAAS,SAAS,CACvBA,0DACE,UACA,gBACA,SACA,eACA,KAAK,yBACN,CACF,CAAC"}
|