@module-federation/enhanced 2.0.1 → 2.2.0
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 +2357 -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 -196
- 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 -180
- 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 -120
- 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 -18
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +266 -345
- 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 -125
- 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 -100
- 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 -322
- 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 +21 -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 -219
- 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,86 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { containerPlugin } from "@module-federation/sdk";
|
|
2
|
+
import * as webpack$1 from "webpack";
|
|
3
|
+
import { Compilation } from "webpack";
|
|
4
|
+
import { InputFileSystem, LibIdentOptions, NeedBuildContext, ObjectDeserializerContext, ObjectSerializerContext, RequestShortener, ResolverWithOptions, WebpackOptions } from "webpack/lib/Module";
|
|
5
|
+
import WebpackError$1 from "webpack/lib/WebpackError";
|
|
6
|
+
|
|
7
|
+
//#region src/lib/container/ContainerEntryModule.d.ts
|
|
8
|
+
declare const Module$1: typeof webpack$1.Module;
|
|
9
|
+
type ExposeOptions = {
|
|
10
|
+
/**
|
|
11
|
+
* requests to exposed modules (last one is exported)
|
|
12
|
+
*/
|
|
13
|
+
import: string[];
|
|
14
|
+
/**
|
|
15
|
+
* custom chunk name for the exposed module
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
15
18
|
};
|
|
16
|
-
declare class ContainerEntryModule extends Module {
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
19
|
+
declare class ContainerEntryModule extends Module$1 {
|
|
20
|
+
private _name;
|
|
21
|
+
private _exposes;
|
|
22
|
+
private _shareScope;
|
|
23
|
+
private _injectRuntimeEntry;
|
|
24
|
+
private _dataPrefetch;
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} name container entry name
|
|
27
|
+
* @param {[string, ExposeOptions][]} exposes list of exposed modules
|
|
28
|
+
* @param {string|string[]} shareScope name of the share scope
|
|
29
|
+
* @param {string} injectRuntimeEntry the path of injectRuntime file.
|
|
30
|
+
* @param {containerPlugin.ContainerPluginOptions['dataPrefetch']} dataPrefetch whether enable dataPrefetch
|
|
31
|
+
*/
|
|
32
|
+
constructor(name: string, exposes: [string, ExposeOptions][], shareScope: string | string[], injectRuntimeEntry: string, dataPrefetch: containerPlugin.ContainerPluginOptions['dataPrefetch']);
|
|
33
|
+
/**
|
|
34
|
+
* @param {ObjectDeserializerContext} context context
|
|
35
|
+
* @returns {ContainerEntryModule} deserialized container entry module
|
|
36
|
+
*/
|
|
37
|
+
static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
|
|
38
|
+
/**
|
|
39
|
+
* @returns {Set<string>} types available (do not mutate)
|
|
40
|
+
*/
|
|
41
|
+
getSourceTypes(): Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* @returns {string} a unique identifier of the module
|
|
44
|
+
*/
|
|
45
|
+
identifier(): string;
|
|
46
|
+
/**
|
|
47
|
+
* @param {RequestShortener} requestShortener the request shortener
|
|
48
|
+
* @returns {string} a user readable identifier of the module
|
|
49
|
+
*/
|
|
50
|
+
readableIdentifier(requestShortener: RequestShortener): string;
|
|
51
|
+
/**
|
|
52
|
+
* @param {LibIdentOptions} options options
|
|
53
|
+
* @returns {string | null} an identifier for library inclusion
|
|
54
|
+
*/
|
|
55
|
+
libIdent(options: LibIdentOptions): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* @param {NeedBuildContext} context context info
|
|
58
|
+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError$1 | null) | undefined, arg1: boolean | undefined) => void): void;
|
|
62
|
+
/**
|
|
63
|
+
* @param {WebpackOptions} options webpack options
|
|
64
|
+
* @param {Compilation} compilation the compilation
|
|
65
|
+
* @param {ResolverWithOptions} resolver the resolver
|
|
66
|
+
* @param {InputFileSystem} fs the file system
|
|
67
|
+
* @param {function(WebpackError): void} callback callback function
|
|
68
|
+
* @returns {void}
|
|
69
|
+
*/
|
|
70
|
+
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError$1) => void): void;
|
|
71
|
+
/**
|
|
72
|
+
* @param {CodeGenerationContext} context context for code generation
|
|
73
|
+
* @returns {CodeGenerationResult} result
|
|
74
|
+
*/
|
|
75
|
+
codeGeneration({
|
|
76
|
+
moduleGraph,
|
|
77
|
+
chunkGraph,
|
|
78
|
+
runtimeTemplate
|
|
79
|
+
}: any): {
|
|
80
|
+
sources: Map<any, any>;
|
|
81
|
+
runtimeRequirements: Set<"__webpack_require__.d" | "__webpack_require__.o" | "__webpack_exports__">;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* @param {string=} type the source type for which the size should be estimated
|
|
85
|
+
* @returns {number} the estimated size of the module (must be non-zero)
|
|
86
|
+
*/
|
|
87
|
+
size(type?: string): number;
|
|
88
|
+
/**
|
|
89
|
+
* @param {ObjectSerializerContext} context context
|
|
90
|
+
*/
|
|
91
|
+
serialize(context: ObjectSerializerContext): void;
|
|
85
92
|
}
|
|
86
|
-
|
|
93
|
+
//#endregion
|
|
94
|
+
export { ExposeOptions, ContainerEntryModule as default };
|
|
95
|
+
//# sourceMappingURL=ContainerEntryModule.d.ts.map
|
|
@@ -1,238 +1,223 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
|
|
4
|
-
*/
|
|
5
1
|
'use strict';
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
5
|
+
const require_lib_Constants = require('../Constants.js');
|
|
6
|
+
const require_lib_container_ContainerExposedDependency = require('./ContainerExposedDependency.js');
|
|
7
|
+
const require_lib_container_runtime_utils = require('./runtime/utils.js');
|
|
8
|
+
let _module_federation_sdk = require("@module-federation/sdk");
|
|
9
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
10
|
+
let _module_federation_error_codes = require("@module-federation/error-codes");
|
|
11
|
+
let _module_federation_error_codes_node = require("@module-federation/error-codes/node");
|
|
12
|
+
let _module_federation_data_prefetch_cli = require("@module-federation/data-prefetch/cli");
|
|
13
|
+
|
|
14
|
+
//#region src/lib/container/ContainerEntryModule.ts
|
|
15
|
+
const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
|
|
16
|
+
const { sources: webpackSources, AsyncDependenciesBlock, Template, Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
17
|
+
const StaticExportsDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/StaticExportsDependency"));
|
|
18
|
+
const EntryDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/EntryDependency"));
|
|
19
|
+
const SOURCE_TYPES = new Set(["javascript"]);
|
|
20
|
+
var ContainerEntryModule = class ContainerEntryModule extends Module {
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} name container entry name
|
|
23
|
+
* @param {[string, ExposeOptions][]} exposes list of exposed modules
|
|
24
|
+
* @param {string|string[]} shareScope name of the share scope
|
|
25
|
+
* @param {string} injectRuntimeEntry the path of injectRuntime file.
|
|
26
|
+
* @param {containerPlugin.ContainerPluginOptions['dataPrefetch']} dataPrefetch whether enable dataPrefetch
|
|
27
|
+
*/
|
|
28
|
+
constructor(name, exposes, shareScope, injectRuntimeEntry, dataPrefetch) {
|
|
29
|
+
super(require_lib_Constants.JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
|
|
30
|
+
this._name = name;
|
|
31
|
+
this._exposes = exposes;
|
|
32
|
+
this._shareScope = shareScope;
|
|
33
|
+
this._injectRuntimeEntry = injectRuntimeEntry;
|
|
34
|
+
this._dataPrefetch = dataPrefetch;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param {ObjectDeserializerContext} context context
|
|
38
|
+
* @returns {ContainerEntryModule} deserialized container entry module
|
|
39
|
+
*/
|
|
40
|
+
static deserialize(context) {
|
|
41
|
+
const { read } = context;
|
|
42
|
+
const obj = new ContainerEntryModule(read(), read(), read(), read(), read());
|
|
43
|
+
obj.deserialize(context);
|
|
44
|
+
return obj;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @returns {Set<string>} types available (do not mutate)
|
|
48
|
+
*/
|
|
49
|
+
getSourceTypes() {
|
|
50
|
+
return SOURCE_TYPES;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @returns {string} a unique identifier of the module
|
|
54
|
+
*/
|
|
55
|
+
identifier() {
|
|
56
|
+
return `container entry (${Array.isArray(this._shareScope) ? this._shareScope.join("|") : this._shareScope}) ${JSON.stringify(this._exposes)} ${this._injectRuntimeEntry} ${JSON.stringify(this._dataPrefetch)}`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @param {RequestShortener} requestShortener the request shortener
|
|
60
|
+
* @returns {string} a user readable identifier of the module
|
|
61
|
+
*/
|
|
62
|
+
readableIdentifier(requestShortener) {
|
|
63
|
+
return "container entry";
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @param {LibIdentOptions} options options
|
|
67
|
+
* @returns {string | null} an identifier for library inclusion
|
|
68
|
+
*/
|
|
69
|
+
libIdent(options) {
|
|
70
|
+
return `${this.layer ? `(${this.layer})/` : ""}webpack/container/entry/${this._name}`;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {NeedBuildContext} context context info
|
|
74
|
+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
75
|
+
* @returns {void}
|
|
76
|
+
*/
|
|
77
|
+
needBuild(context, callback) {
|
|
78
|
+
callback(null, !this.buildMeta);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* @param {WebpackOptions} options webpack options
|
|
82
|
+
* @param {Compilation} compilation the compilation
|
|
83
|
+
* @param {ResolverWithOptions} resolver the resolver
|
|
84
|
+
* @param {InputFileSystem} fs the file system
|
|
85
|
+
* @param {function(WebpackError): void} callback callback function
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
build(options, compilation, resolver, fs, callback) {
|
|
89
|
+
this.buildMeta = {};
|
|
90
|
+
this.buildInfo = {
|
|
91
|
+
strict: true,
|
|
92
|
+
topLevelDeclarations: new Set([
|
|
93
|
+
"moduleMap",
|
|
94
|
+
"get",
|
|
95
|
+
"init"
|
|
96
|
+
])
|
|
97
|
+
};
|
|
98
|
+
this.buildMeta.exportsType = "namespace";
|
|
99
|
+
this.clearDependenciesAndBlocks();
|
|
100
|
+
for (const [name, options] of this._exposes) {
|
|
101
|
+
const block = new AsyncDependenciesBlock({ name: options.name }, { name }, options.import[options.import.length - 1]);
|
|
102
|
+
let idx = 0;
|
|
103
|
+
for (const request of options.import) {
|
|
104
|
+
const dep = new require_lib_container_ContainerExposedDependency.default(name, request);
|
|
105
|
+
dep.loc = {
|
|
106
|
+
name,
|
|
107
|
+
index: idx++
|
|
108
|
+
};
|
|
109
|
+
block.addDependency(dep);
|
|
110
|
+
}
|
|
111
|
+
this.addBlock(block);
|
|
112
|
+
}
|
|
113
|
+
this.addDependency(new StaticExportsDependency(["get", "init"], false));
|
|
114
|
+
this.addDependency(new EntryDependency(this._injectRuntimeEntry));
|
|
115
|
+
callback();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @param {CodeGenerationContext} context context for code generation
|
|
119
|
+
* @returns {CodeGenerationResult} result
|
|
120
|
+
*/
|
|
121
|
+
codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {
|
|
122
|
+
const sources = /* @__PURE__ */ new Map();
|
|
123
|
+
const runtimeRequirements = new Set([
|
|
124
|
+
RuntimeGlobals.definePropertyGetters,
|
|
125
|
+
RuntimeGlobals.hasOwnProperty,
|
|
126
|
+
RuntimeGlobals.exports
|
|
127
|
+
]);
|
|
128
|
+
const getters = [];
|
|
129
|
+
for (const block of this.blocks) {
|
|
130
|
+
const { dependencies } = block;
|
|
131
|
+
const modules = dependencies.map((dependency) => {
|
|
132
|
+
const dep = dependency;
|
|
133
|
+
return {
|
|
134
|
+
name: dep.exposedName,
|
|
135
|
+
module: moduleGraph.getModule(dep),
|
|
136
|
+
request: dep.userRequest
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
let str;
|
|
140
|
+
if (modules.some((m) => !m.module)) {
|
|
141
|
+
(0, _module_federation_error_codes_node.logAndReport)(_module_federation_error_codes.BUILD_001, _module_federation_error_codes.buildDescMap, {
|
|
142
|
+
exposeModules: modules.filter((m) => !m.module),
|
|
143
|
+
FEDERATION_WEBPACK_PATH: process.env["FEDERATION_WEBPACK_PATH"]
|
|
144
|
+
}, _module_federation_sdk.infrastructureLogger.error.bind(_module_federation_sdk.infrastructureLogger), void 0, {
|
|
145
|
+
bundler: { name: "webpack" },
|
|
146
|
+
mfConfig: {
|
|
147
|
+
name: this._name,
|
|
148
|
+
exposes: Object.fromEntries(this._exposes.map(([key, opts]) => [key, opts.import[opts.import.length - 1]]))
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
process.exit(1);
|
|
152
|
+
} else str = `return ${runtimeTemplate.blockPromise({
|
|
153
|
+
block,
|
|
154
|
+
message: "",
|
|
155
|
+
chunkGraph,
|
|
156
|
+
runtimeRequirements
|
|
157
|
+
})}.then(${runtimeTemplate.returningFunction(runtimeTemplate.returningFunction(`(${modules.map(({ module, request }) => runtimeTemplate.moduleRaw({
|
|
158
|
+
module,
|
|
159
|
+
chunkGraph,
|
|
160
|
+
request,
|
|
161
|
+
weak: false,
|
|
162
|
+
runtimeRequirements
|
|
163
|
+
})).join(", ")})`))});`;
|
|
164
|
+
getters.push(`${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction("", str)}`);
|
|
165
|
+
}
|
|
166
|
+
const federationGlobal = require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals || {});
|
|
167
|
+
const source = Template.asString([
|
|
168
|
+
`var moduleMap = {`,
|
|
169
|
+
Template.indent(getters.join(",\n")),
|
|
170
|
+
"};",
|
|
171
|
+
`var get = ${runtimeTemplate.basicFunction("module, getScope", [
|
|
172
|
+
`${RuntimeGlobals.currentRemoteGetScope} = getScope;`,
|
|
173
|
+
"getScope = (",
|
|
174
|
+
Template.indent([`${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`, Template.indent(["? moduleMap[module]()", `: Promise.resolve().then(${runtimeTemplate.basicFunction("", "throw new Error('Module \"' + module + '\" does not exist in container.');")})`])]),
|
|
175
|
+
");",
|
|
176
|
+
`${RuntimeGlobals.currentRemoteGetScope} = undefined;`,
|
|
177
|
+
"return getScope;"
|
|
178
|
+
])};`,
|
|
179
|
+
`var init = ${runtimeTemplate.basicFunction("shareScope, initScope, remoteEntryInitOptions", [`return ${federationGlobal}.bundlerRuntime.initContainerEntry({${Template.indent([
|
|
180
|
+
`webpackRequire: ${RuntimeGlobals.require},`,
|
|
181
|
+
`shareScope: shareScope,`,
|
|
182
|
+
`initScope: initScope,`,
|
|
183
|
+
`remoteEntryInitOptions: remoteEntryInitOptions,`,
|
|
184
|
+
`shareScopeKey: ${JSON.stringify(this._shareScope)}`
|
|
185
|
+
])}`, "})"])};`,
|
|
186
|
+
this._dataPrefetch ? _module_federation_data_prefetch_cli.PrefetchPlugin.setRemoteIdentifier() : "",
|
|
187
|
+
this._dataPrefetch ? _module_federation_data_prefetch_cli.PrefetchPlugin.removeRemoteIdentifier() : "",
|
|
188
|
+
"// This exports getters to disallow modifications",
|
|
189
|
+
`${RuntimeGlobals.definePropertyGetters}(exports, {`,
|
|
190
|
+
Template.indent([`get: ${runtimeTemplate.returningFunction("get")},`, `init: ${runtimeTemplate.returningFunction("init")}`]),
|
|
191
|
+
"});"
|
|
192
|
+
]);
|
|
193
|
+
sources.set("javascript", this.useSourceMap || this.useSimpleSourceMap ? new webpackSources.OriginalSource(source, "webpack/container-entry") : new webpackSources.RawSource(source));
|
|
194
|
+
return {
|
|
195
|
+
sources,
|
|
196
|
+
runtimeRequirements
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @param {string=} type the source type for which the size should be estimated
|
|
201
|
+
* @returns {number} the estimated size of the module (must be non-zero)
|
|
202
|
+
*/
|
|
203
|
+
size(type) {
|
|
204
|
+
return 42;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* @param {ObjectSerializerContext} context context
|
|
208
|
+
*/
|
|
209
|
+
serialize(context) {
|
|
210
|
+
const { write } = context;
|
|
211
|
+
write(this._name);
|
|
212
|
+
write(this._exposes);
|
|
213
|
+
write(this._shareScope);
|
|
214
|
+
write(this._injectRuntimeEntry);
|
|
215
|
+
write(this._dataPrefetch);
|
|
216
|
+
super.serialize(context);
|
|
217
|
+
}
|
|
8
218
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const error_codes_1 = require("@module-federation/error-codes");
|
|
13
|
-
const cli_1 = require("@module-federation/data-prefetch/cli");
|
|
14
|
-
const Constants_1 = require("../Constants");
|
|
15
|
-
const ContainerExposedDependency_1 = __importDefault(require("./ContainerExposedDependency"));
|
|
16
|
-
const utils_1 = require("./runtime/utils");
|
|
17
|
-
const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
|
|
18
|
-
const { sources: webpackSources, AsyncDependenciesBlock, Template, Module, RuntimeGlobals, } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
19
|
-
const StaticExportsDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/StaticExportsDependency'));
|
|
20
|
-
const EntryDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/EntryDependency'));
|
|
21
|
-
const SOURCE_TYPES = new Set(['javascript']);
|
|
22
|
-
class ContainerEntryModule extends Module {
|
|
23
|
-
/**
|
|
24
|
-
* @param {string} name container entry name
|
|
25
|
-
* @param {[string, ExposeOptions][]} exposes list of exposed modules
|
|
26
|
-
* @param {string|string[]} shareScope name of the share scope
|
|
27
|
-
* @param {string} injectRuntimeEntry the path of injectRuntime file.
|
|
28
|
-
* @param {containerPlugin.ContainerPluginOptions['dataPrefetch']} dataPrefetch whether enable dataPrefetch
|
|
29
|
-
*/
|
|
30
|
-
constructor(name, exposes, shareScope, injectRuntimeEntry, dataPrefetch) {
|
|
31
|
-
super(Constants_1.JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
|
|
32
|
-
this._name = name;
|
|
33
|
-
this._exposes = exposes;
|
|
34
|
-
this._shareScope = shareScope;
|
|
35
|
-
this._injectRuntimeEntry = injectRuntimeEntry;
|
|
36
|
-
this._dataPrefetch = dataPrefetch;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* @param {ObjectDeserializerContext} context context
|
|
40
|
-
* @returns {ContainerEntryModule} deserialized container entry module
|
|
41
|
-
*/
|
|
42
|
-
static deserialize(context) {
|
|
43
|
-
const { read } = context;
|
|
44
|
-
const obj = new ContainerEntryModule(read(), read(), read(), read(), read());
|
|
45
|
-
obj.deserialize(context);
|
|
46
|
-
return obj;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @returns {Set<string>} types available (do not mutate)
|
|
50
|
-
*/
|
|
51
|
-
getSourceTypes() {
|
|
52
|
-
return SOURCE_TYPES;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @returns {string} a unique identifier of the module
|
|
56
|
-
*/
|
|
57
|
-
identifier() {
|
|
58
|
-
const scopeStr = Array.isArray(this._shareScope)
|
|
59
|
-
? this._shareScope.join('|')
|
|
60
|
-
: this._shareScope;
|
|
61
|
-
return `container entry (${scopeStr}) ${JSON.stringify(this._exposes)} ${this._injectRuntimeEntry} ${JSON.stringify(this._dataPrefetch)}`;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @param {RequestShortener} requestShortener the request shortener
|
|
65
|
-
* @returns {string} a user readable identifier of the module
|
|
66
|
-
*/
|
|
67
|
-
readableIdentifier(requestShortener) {
|
|
68
|
-
return 'container entry';
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @param {LibIdentOptions} options options
|
|
72
|
-
* @returns {string | null} an identifier for library inclusion
|
|
73
|
-
*/
|
|
74
|
-
libIdent(options) {
|
|
75
|
-
return `${this.layer ? `(${this.layer})/` : ''}webpack/container/entry/${this._name}`;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* @param {NeedBuildContext} context context info
|
|
79
|
-
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
80
|
-
* @returns {void}
|
|
81
|
-
*/
|
|
82
|
-
needBuild(context, callback) {
|
|
83
|
-
callback(null, !this.buildMeta);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @param {WebpackOptions} options webpack options
|
|
87
|
-
* @param {Compilation} compilation the compilation
|
|
88
|
-
* @param {ResolverWithOptions} resolver the resolver
|
|
89
|
-
* @param {InputFileSystem} fs the file system
|
|
90
|
-
* @param {function(WebpackError): void} callback callback function
|
|
91
|
-
* @returns {void}
|
|
92
|
-
*/
|
|
93
|
-
build(options, compilation, resolver, fs, callback) {
|
|
94
|
-
this.buildMeta = {};
|
|
95
|
-
this.buildInfo = {
|
|
96
|
-
strict: true,
|
|
97
|
-
topLevelDeclarations: new Set(['moduleMap', 'get', 'init']),
|
|
98
|
-
};
|
|
99
|
-
this.buildMeta.exportsType = 'namespace';
|
|
100
|
-
this.clearDependenciesAndBlocks();
|
|
101
|
-
for (const [name, options] of this._exposes) {
|
|
102
|
-
const block = new AsyncDependenciesBlock({
|
|
103
|
-
name: options.name,
|
|
104
|
-
}, { name }, options.import[options.import.length - 1]);
|
|
105
|
-
let idx = 0;
|
|
106
|
-
for (const request of options.import) {
|
|
107
|
-
const dep = new ContainerExposedDependency_1.default(name, request);
|
|
108
|
-
dep.loc = {
|
|
109
|
-
name,
|
|
110
|
-
index: idx++,
|
|
111
|
-
};
|
|
112
|
-
block.addDependency(dep);
|
|
113
|
-
}
|
|
114
|
-
this.addBlock(block);
|
|
115
|
-
}
|
|
116
|
-
this.addDependency(new StaticExportsDependency(['get', 'init'], false));
|
|
117
|
-
this.addDependency(new EntryDependency(this._injectRuntimeEntry));
|
|
118
|
-
callback();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @param {CodeGenerationContext} context context for code generation
|
|
122
|
-
* @returns {CodeGenerationResult} result
|
|
123
|
-
*/
|
|
124
|
-
codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {
|
|
125
|
-
const sources = new Map();
|
|
126
|
-
const runtimeRequirements = new Set([
|
|
127
|
-
RuntimeGlobals.definePropertyGetters,
|
|
128
|
-
RuntimeGlobals.hasOwnProperty,
|
|
129
|
-
RuntimeGlobals.exports,
|
|
130
|
-
]);
|
|
131
|
-
const getters = [];
|
|
132
|
-
for (const block of this.blocks) {
|
|
133
|
-
const { dependencies } = block;
|
|
134
|
-
const modules = dependencies.map((dependency) => {
|
|
135
|
-
const dep = dependency;
|
|
136
|
-
return {
|
|
137
|
-
name: dep.exposedName,
|
|
138
|
-
module: moduleGraph.getModule(dep),
|
|
139
|
-
request: dep.userRequest,
|
|
140
|
-
};
|
|
141
|
-
});
|
|
142
|
-
let str;
|
|
143
|
-
if (modules.some((m) => !m.module)) {
|
|
144
|
-
sdk_1.infrastructureLogger.error((0, error_codes_1.getShortErrorMsg)(error_codes_1.BUILD_001, error_codes_1.buildDescMap, {
|
|
145
|
-
exposeModules: modules.filter((m) => !m.module),
|
|
146
|
-
FEDERATION_WEBPACK_PATH: process.env['FEDERATION_WEBPACK_PATH'],
|
|
147
|
-
}));
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
str = `return ${runtimeTemplate.blockPromise({
|
|
152
|
-
block,
|
|
153
|
-
message: '',
|
|
154
|
-
chunkGraph,
|
|
155
|
-
runtimeRequirements,
|
|
156
|
-
})}.then(${runtimeTemplate.returningFunction(runtimeTemplate.returningFunction(`(${modules
|
|
157
|
-
.map(({ module, request }) => runtimeTemplate.moduleRaw({
|
|
158
|
-
module,
|
|
159
|
-
chunkGraph,
|
|
160
|
-
request,
|
|
161
|
-
weak: false,
|
|
162
|
-
runtimeRequirements,
|
|
163
|
-
}))
|
|
164
|
-
.join(', ')})`))});`;
|
|
165
|
-
}
|
|
166
|
-
getters.push(`${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction('', str)}`);
|
|
167
|
-
}
|
|
168
|
-
const federationGlobal = (0, utils_1.getFederationGlobalScope)(RuntimeGlobals || {});
|
|
169
|
-
const source = Template.asString([
|
|
170
|
-
`var moduleMap = {`,
|
|
171
|
-
Template.indent(getters.join(',\n')),
|
|
172
|
-
'};',
|
|
173
|
-
`var get = ${runtimeTemplate.basicFunction('module, getScope', [
|
|
174
|
-
`${RuntimeGlobals.currentRemoteGetScope} = getScope;`,
|
|
175
|
-
// reusing the getScope variable to avoid creating a new var (and module is also used later)
|
|
176
|
-
'getScope = (',
|
|
177
|
-
Template.indent([
|
|
178
|
-
`${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`,
|
|
179
|
-
Template.indent([
|
|
180
|
-
'? moduleMap[module]()',
|
|
181
|
-
`: Promise.resolve().then(${runtimeTemplate.basicFunction('', "throw new Error('Module \"' + module + '\" does not exist in container.');")})`,
|
|
182
|
-
]),
|
|
183
|
-
]),
|
|
184
|
-
');',
|
|
185
|
-
`${RuntimeGlobals.currentRemoteGetScope} = undefined;`,
|
|
186
|
-
'return getScope;',
|
|
187
|
-
])};`,
|
|
188
|
-
`var init = ${runtimeTemplate.basicFunction('shareScope, initScope, remoteEntryInitOptions', [
|
|
189
|
-
`return ${federationGlobal}.bundlerRuntime.initContainerEntry({${Template.indent([
|
|
190
|
-
`webpackRequire: ${RuntimeGlobals.require},`,
|
|
191
|
-
`shareScope: shareScope,`,
|
|
192
|
-
`initScope: initScope,`,
|
|
193
|
-
`remoteEntryInitOptions: remoteEntryInitOptions,`,
|
|
194
|
-
`shareScopeKey: ${JSON.stringify(this._shareScope)}`,
|
|
195
|
-
])}`,
|
|
196
|
-
'})',
|
|
197
|
-
])};`,
|
|
198
|
-
this._dataPrefetch ? cli_1.PrefetchPlugin.setRemoteIdentifier() : '',
|
|
199
|
-
this._dataPrefetch ? cli_1.PrefetchPlugin.removeRemoteIdentifier() : '',
|
|
200
|
-
'// This exports getters to disallow modifications',
|
|
201
|
-
`${RuntimeGlobals.definePropertyGetters}(exports, {`,
|
|
202
|
-
Template.indent([
|
|
203
|
-
`get: ${runtimeTemplate.returningFunction('get')},`,
|
|
204
|
-
`init: ${runtimeTemplate.returningFunction('init')}`,
|
|
205
|
-
]),
|
|
206
|
-
'});',
|
|
207
|
-
]);
|
|
208
|
-
sources.set('javascript', this.useSourceMap || this.useSimpleSourceMap
|
|
209
|
-
? new webpackSources.OriginalSource(source, 'webpack/container-entry')
|
|
210
|
-
: new webpackSources.RawSource(source));
|
|
211
|
-
return {
|
|
212
|
-
sources,
|
|
213
|
-
runtimeRequirements,
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* @param {string=} type the source type for which the size should be estimated
|
|
218
|
-
* @returns {number} the estimated size of the module (must be non-zero)
|
|
219
|
-
*/
|
|
220
|
-
size(type) {
|
|
221
|
-
return 42;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @param {ObjectSerializerContext} context context
|
|
225
|
-
*/
|
|
226
|
-
serialize(context) {
|
|
227
|
-
const { write } = context;
|
|
228
|
-
write(this._name);
|
|
229
|
-
write(this._exposes);
|
|
230
|
-
write(this._shareScope);
|
|
231
|
-
write(this._injectRuntimeEntry);
|
|
232
|
-
write(this._dataPrefetch);
|
|
233
|
-
super.serialize(context);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
makeSerializable(ContainerEntryModule, 'enhanced/lib/container/ContainerEntryModule');
|
|
219
|
+
makeSerializable(ContainerEntryModule, "enhanced/lib/container/ContainerEntryModule");
|
|
220
|
+
|
|
221
|
+
//#endregion
|
|
237
222
|
exports.default = ContainerEntryModule;
|
|
238
223
|
//# sourceMappingURL=ContainerEntryModule.js.map
|