@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,31 +1,35 @@
|
|
|
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
|
-
|
|
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/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.ts
|
|
6
|
+
const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
|
|
7
|
+
const { Dependency } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
8
|
+
var SharedEntryDependency = class extends Dependency {
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} name entry name
|
|
11
|
+
* @param {string} request the request of the entry
|
|
12
|
+
*/
|
|
13
|
+
constructor(name, request) {
|
|
14
|
+
super();
|
|
15
|
+
this.name = name;
|
|
16
|
+
this.request = request;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @returns {string | null} an identifier to merge equal requests
|
|
20
|
+
*/
|
|
21
|
+
getResourceIdentifier() {
|
|
22
|
+
return `shared-entry-${this.name}`;
|
|
23
|
+
}
|
|
24
|
+
get type() {
|
|
25
|
+
return "shared entry";
|
|
26
|
+
}
|
|
27
|
+
get category() {
|
|
28
|
+
return "esm";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
makeSerializable(SharedEntryDependency, "enhanced/lib/container/SharedEntryDependency");
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
30
34
|
exports.default = SharedEntryDependency;
|
|
31
35
|
//# sourceMappingURL=SharedEntryDependency.js.map
|
package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedEntryDependency.js","
|
|
1
|
+
{"version":3,"file":"SharedEntryDependency.js","names":[],"sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\n\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n);\nconst { Dependency } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\nclass SharedEntryDependency extends Dependency {\n public name: string;\n public request: string;\n\n /**\n * @param {string} name entry name\n * @param {string} request the request of the entry\n */\n constructor(name: string, request: string) {\n super();\n this.name = name;\n this.request = request;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `shared-entry-${this.name}`;\n }\n\n override get type(): string {\n return 'shared entry';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n SharedEntryDependency,\n 'enhanced/lib/container/SharedEntryDependency',\n);\n\nexport default SharedEntryDependency;\n"],"mappings":";;;;;AAEA,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;AACD,MAAM,EAAE,eAAe,gFACA,UAAU,CAChC;AAED,IAAM,wBAAN,cAAoC,WAAW;;;;;CAQ7C,YAAY,MAAc,SAAiB;AACzC,SAAO;AACP,OAAK,OAAO;AACZ,OAAK,UAAU;;;;;CAMjB,AAAS,wBAAuC;AAC9C,SAAO,gBAAgB,KAAK;;CAG9B,IAAa,OAAe;AAC1B,SAAO;;CAGT,IAAa,WAAmB;AAC9B,SAAO;;;AAIX,iBACE,uBACA,+CACD"}
|
|
@@ -1,79 +1,87 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import * as webpack$1 from "webpack";
|
|
2
|
+
import { Compilation } from "webpack";
|
|
3
|
+
import { CodeGenerationResult, InputFileSystem, LibIdentOptions, NeedBuildContext, ObjectDeserializerContext, ObjectSerializerContext, RequestShortener, ResolverWithOptions, WebpackOptions } from "webpack/lib/Module";
|
|
4
|
+
import WebpackError$1 from "webpack/lib/WebpackError";
|
|
5
|
+
|
|
6
|
+
//#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts
|
|
7
|
+
declare const Module$1: typeof webpack$1.Module;
|
|
8
|
+
type ExposeOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* requests to exposed modules (last one is exported)
|
|
11
|
+
*/
|
|
12
|
+
import: string[];
|
|
13
|
+
/**
|
|
14
|
+
* custom chunk name for the exposed module
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
14
17
|
};
|
|
15
|
-
declare class SharedEntryModule extends Module {
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
18
|
+
declare class SharedEntryModule extends Module$1 {
|
|
19
|
+
private _name;
|
|
20
|
+
private _request;
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} name shared name
|
|
23
|
+
* @param {string} request request
|
|
24
|
+
*/
|
|
25
|
+
constructor(name: string, request: string);
|
|
26
|
+
/**
|
|
27
|
+
* @param {ObjectDeserializerContext} context context
|
|
28
|
+
* @returns {SharedEntryModule} deserialized container entry module
|
|
29
|
+
*/
|
|
30
|
+
static deserialize(context: ObjectDeserializerContext): SharedEntryModule;
|
|
31
|
+
/**
|
|
32
|
+
* @returns {Set<string>} types available (do not mutate)
|
|
33
|
+
*/
|
|
34
|
+
getSourceTypes(): Set<string>;
|
|
35
|
+
/**
|
|
36
|
+
* @returns {string} a unique identifier of the module
|
|
37
|
+
*/
|
|
38
|
+
identifier(): string;
|
|
39
|
+
/**
|
|
40
|
+
* @param {RequestShortener} requestShortener the request shortener
|
|
41
|
+
* @returns {string} a user readable identifier of the module
|
|
42
|
+
*/
|
|
43
|
+
readableIdentifier(requestShortener: RequestShortener): string;
|
|
44
|
+
/**
|
|
45
|
+
* @param {LibIdentOptions} options options
|
|
46
|
+
* @returns {string | null} an identifier for library inclusion
|
|
47
|
+
*/
|
|
48
|
+
libIdent(options: LibIdentOptions): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* @param {NeedBuildContext} context context info
|
|
51
|
+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError$1 | null) | undefined, arg1: boolean | undefined) => void): void;
|
|
55
|
+
/**
|
|
56
|
+
* @param {WebpackOptions} options webpack options
|
|
57
|
+
* @param {Compilation} compilation the compilation
|
|
58
|
+
* @param {ResolverWithOptions} resolver the resolver
|
|
59
|
+
* @param {InputFileSystem} fs the file system
|
|
60
|
+
* @param {function(WebpackError): void} callback callback function
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError$1) => void): void;
|
|
64
|
+
/**
|
|
65
|
+
* @param {CodeGenerationContext} context context for code generation
|
|
66
|
+
* @returns {CodeGenerationResult} result
|
|
67
|
+
*/
|
|
68
|
+
codeGeneration({
|
|
69
|
+
chunkGraph,
|
|
70
|
+
runtimeTemplate
|
|
71
|
+
}: CodeGenerationResult): {
|
|
72
|
+
sources: Map<any, any>;
|
|
73
|
+
runtimeRequirements: Set<"__webpack_require__.d" | "__webpack_require__.o" | "__webpack_exports__">;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* @param {string=} type the source type for which the size should be estimated
|
|
77
|
+
* @returns {number} the estimated size of the module (must be non-zero)
|
|
78
|
+
*/
|
|
79
|
+
size(type?: string): number;
|
|
80
|
+
/**
|
|
81
|
+
* @param {ObjectSerializerContext} context context
|
|
82
|
+
*/
|
|
83
|
+
serialize(context: ObjectSerializerContext): void;
|
|
78
84
|
}
|
|
79
|
-
|
|
85
|
+
//#endregion
|
|
86
|
+
export { ExposeOptions, SharedEntryModule as default };
|
|
87
|
+
//# sourceMappingURL=SharedEntryModule.d.ts.map
|
|
@@ -1,156 +1,144 @@
|
|
|
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_utils = require('../../../container/runtime/utils.js');
|
|
4
|
+
const require_lib_sharing_tree_shaking_SharedContainerPlugin_SharedDependency = require('./SharedDependency.js');
|
|
5
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
6
|
+
|
|
7
|
+
//#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.ts
|
|
8
|
+
const makeSerializable = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/makeSerializable"));
|
|
9
|
+
const { sources: webpackSources, Template, Module, RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
10
|
+
const StaticExportsDependency = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/dependencies/StaticExportsDependency"));
|
|
11
|
+
const SOURCE_TYPES = new Set(["javascript"]);
|
|
12
|
+
var SharedEntryModule = class SharedEntryModule extends Module {
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} name shared name
|
|
15
|
+
* @param {string} request request
|
|
16
|
+
*/
|
|
17
|
+
constructor(name, request) {
|
|
18
|
+
super("shared-entry-module", null);
|
|
19
|
+
this._name = name;
|
|
20
|
+
this._request = request;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @param {ObjectDeserializerContext} context context
|
|
24
|
+
* @returns {SharedEntryModule} deserialized container entry module
|
|
25
|
+
*/
|
|
26
|
+
static deserialize(context) {
|
|
27
|
+
const { read } = context;
|
|
28
|
+
const obj = new SharedEntryModule(read(), read());
|
|
29
|
+
obj.deserialize(context);
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @returns {Set<string>} types available (do not mutate)
|
|
34
|
+
*/
|
|
35
|
+
getSourceTypes() {
|
|
36
|
+
return SOURCE_TYPES;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @returns {string} a unique identifier of the module
|
|
40
|
+
*/
|
|
41
|
+
identifier() {
|
|
42
|
+
return `shared module ${this._name} ${this._request}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @param {RequestShortener} requestShortener the request shortener
|
|
46
|
+
* @returns {string} a user readable identifier of the module
|
|
47
|
+
*/
|
|
48
|
+
readableIdentifier(requestShortener) {
|
|
49
|
+
return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @param {LibIdentOptions} options options
|
|
53
|
+
* @returns {string | null} an identifier for library inclusion
|
|
54
|
+
*/
|
|
55
|
+
libIdent(options) {
|
|
56
|
+
return `shared module ${this._name}`;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @param {NeedBuildContext} context context info
|
|
60
|
+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
61
|
+
* @returns {void}
|
|
62
|
+
*/
|
|
63
|
+
needBuild(context, callback) {
|
|
64
|
+
callback(null, !this.buildMeta);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @param {WebpackOptions} options webpack options
|
|
68
|
+
* @param {Compilation} compilation the compilation
|
|
69
|
+
* @param {ResolverWithOptions} resolver the resolver
|
|
70
|
+
* @param {InputFileSystem} fs the file system
|
|
71
|
+
* @param {function(WebpackError): void} callback callback function
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
build(options, compilation, resolver, fs, callback) {
|
|
75
|
+
this.buildMeta = {};
|
|
76
|
+
this.buildInfo = {
|
|
77
|
+
strict: true,
|
|
78
|
+
topLevelDeclarations: new Set(["get", "init"])
|
|
79
|
+
};
|
|
80
|
+
this.buildMeta.exportsType = "namespace";
|
|
81
|
+
this.clearDependenciesAndBlocks();
|
|
82
|
+
this.addDependency(new StaticExportsDependency(["get", "init"], false));
|
|
83
|
+
this.addDependency(new require_lib_sharing_tree_shaking_SharedContainerPlugin_SharedDependency.default(this._name, this._request));
|
|
84
|
+
callback();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @param {CodeGenerationContext} context context for code generation
|
|
88
|
+
* @returns {CodeGenerationResult} result
|
|
89
|
+
*/
|
|
90
|
+
codeGeneration({ chunkGraph, runtimeTemplate }) {
|
|
91
|
+
const sources = /* @__PURE__ */ new Map();
|
|
92
|
+
const runtimeRequirements = new Set([
|
|
93
|
+
RuntimeGlobals.definePropertyGetters,
|
|
94
|
+
RuntimeGlobals.hasOwnProperty,
|
|
95
|
+
RuntimeGlobals.exports
|
|
96
|
+
]);
|
|
97
|
+
const moduleGetter = runtimeTemplate.syncModuleFactory({
|
|
98
|
+
dependency: this.dependencies[1],
|
|
99
|
+
chunkGraph,
|
|
100
|
+
request: this._request,
|
|
101
|
+
runtimeRequirements
|
|
102
|
+
});
|
|
103
|
+
const source = Template.asString([
|
|
104
|
+
`var moduleGetter = ${moduleGetter};`,
|
|
105
|
+
`var get = ${runtimeTemplate.basicFunction("module, getScope", ["return moduleGetter();"])};`,
|
|
106
|
+
`var init = ${runtimeTemplate.basicFunction("mfInstance, bundlerRuntime", [
|
|
107
|
+
`${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.instance = mfInstance;`,
|
|
108
|
+
`${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,
|
|
109
|
+
`if(!${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,
|
|
110
|
+
`return ${require_lib_container_runtime_utils.getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`
|
|
111
|
+
])};`,
|
|
112
|
+
"// This exports getters to disallow modifications",
|
|
113
|
+
`${RuntimeGlobals.definePropertyGetters}(exports, {`,
|
|
114
|
+
Template.indent([`get: ${runtimeTemplate.returningFunction("get")},`, `init: ${runtimeTemplate.returningFunction("init")}`]),
|
|
115
|
+
"});"
|
|
116
|
+
]);
|
|
117
|
+
sources.set("javascript", this.useSourceMap || this.useSimpleSourceMap ? new webpackSources.OriginalSource(source, "webpack/shared-entry") : new webpackSources.RawSource(source));
|
|
118
|
+
return {
|
|
119
|
+
sources,
|
|
120
|
+
runtimeRequirements
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @param {string=} type the source type for which the size should be estimated
|
|
125
|
+
* @returns {number} the estimated size of the module (must be non-zero)
|
|
126
|
+
*/
|
|
127
|
+
size(type) {
|
|
128
|
+
return 42;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @param {ObjectSerializerContext} context context
|
|
132
|
+
*/
|
|
133
|
+
serialize(context) {
|
|
134
|
+
const { write } = context;
|
|
135
|
+
write(this._name);
|
|
136
|
+
write(this._request);
|
|
137
|
+
super.serialize(context);
|
|
138
|
+
}
|
|
4
139
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const utils_1 = require("../../../container/runtime/utils");
|
|
9
|
-
const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
|
|
10
|
-
const { sources: webpackSources, Template, Module, RuntimeGlobals, } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
11
|
-
const StaticExportsDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/StaticExportsDependency'));
|
|
12
|
-
const SOURCE_TYPES = new Set(['javascript']);
|
|
13
|
-
class SharedEntryModule extends Module {
|
|
14
|
-
/**
|
|
15
|
-
* @param {string} name shared name
|
|
16
|
-
* @param {string} request request
|
|
17
|
-
*/
|
|
18
|
-
constructor(name, request) {
|
|
19
|
-
super('shared-entry-module', null);
|
|
20
|
-
// super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
|
|
21
|
-
this._name = name;
|
|
22
|
-
this._request = request;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @param {ObjectDeserializerContext} context context
|
|
26
|
-
* @returns {SharedEntryModule} deserialized container entry module
|
|
27
|
-
*/
|
|
28
|
-
static deserialize(context) {
|
|
29
|
-
const { read } = context;
|
|
30
|
-
const obj = new SharedEntryModule(read(), read());
|
|
31
|
-
obj.deserialize(context);
|
|
32
|
-
return obj;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @returns {Set<string>} types available (do not mutate)
|
|
36
|
-
*/
|
|
37
|
-
getSourceTypes() {
|
|
38
|
-
return SOURCE_TYPES;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @returns {string} a unique identifier of the module
|
|
42
|
-
*/
|
|
43
|
-
identifier() {
|
|
44
|
-
return `shared module ${this._name} ${this._request}`;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* @param {RequestShortener} requestShortener the request shortener
|
|
48
|
-
* @returns {string} a user readable identifier of the module
|
|
49
|
-
*/
|
|
50
|
-
readableIdentifier(requestShortener) {
|
|
51
|
-
return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @param {LibIdentOptions} options options
|
|
55
|
-
* @returns {string | null} an identifier for library inclusion
|
|
56
|
-
*/
|
|
57
|
-
libIdent(options) {
|
|
58
|
-
return `shared module ${this._name}`;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @param {NeedBuildContext} context context info
|
|
62
|
-
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
|
-
needBuild(context, callback) {
|
|
66
|
-
callback(null, !this.buildMeta);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @param {WebpackOptions} options webpack options
|
|
70
|
-
* @param {Compilation} compilation the compilation
|
|
71
|
-
* @param {ResolverWithOptions} resolver the resolver
|
|
72
|
-
* @param {InputFileSystem} fs the file system
|
|
73
|
-
* @param {function(WebpackError): void} callback callback function
|
|
74
|
-
* @returns {void}
|
|
75
|
-
*/
|
|
76
|
-
build(options, compilation, resolver, fs, callback) {
|
|
77
|
-
this.buildMeta = {};
|
|
78
|
-
this.buildInfo = {
|
|
79
|
-
strict: true,
|
|
80
|
-
topLevelDeclarations: new Set(['get', 'init']),
|
|
81
|
-
};
|
|
82
|
-
this.buildMeta.exportsType = 'namespace';
|
|
83
|
-
this.clearDependenciesAndBlocks();
|
|
84
|
-
this.addDependency(new StaticExportsDependency(['get', 'init'], false));
|
|
85
|
-
this.addDependency(new SharedDependency_1.default(this._name, this._request));
|
|
86
|
-
callback();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @param {CodeGenerationContext} context context for code generation
|
|
90
|
-
* @returns {CodeGenerationResult} result
|
|
91
|
-
*/
|
|
92
|
-
// @ts-ignore
|
|
93
|
-
codeGeneration({
|
|
94
|
-
// @ts-ignore
|
|
95
|
-
chunkGraph,
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
runtimeTemplate, }) {
|
|
98
|
-
const sources = new Map();
|
|
99
|
-
const runtimeRequirements = new Set([
|
|
100
|
-
RuntimeGlobals.definePropertyGetters,
|
|
101
|
-
RuntimeGlobals.hasOwnProperty,
|
|
102
|
-
RuntimeGlobals.exports,
|
|
103
|
-
]);
|
|
104
|
-
const moduleGetter = runtimeTemplate.syncModuleFactory({
|
|
105
|
-
dependency: this.dependencies[1],
|
|
106
|
-
chunkGraph,
|
|
107
|
-
request: this._request,
|
|
108
|
-
runtimeRequirements,
|
|
109
|
-
});
|
|
110
|
-
const source = Template.asString([
|
|
111
|
-
`var moduleGetter = ${moduleGetter};`,
|
|
112
|
-
`var get = ${runtimeTemplate.basicFunction('module, getScope', [
|
|
113
|
-
'return moduleGetter();',
|
|
114
|
-
])};`,
|
|
115
|
-
`var init = ${runtimeTemplate.basicFunction('mfInstance, bundlerRuntime', [
|
|
116
|
-
`${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.instance = mfInstance;`,
|
|
117
|
-
`${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,
|
|
118
|
-
`if(!${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,
|
|
119
|
-
`return ${(0, utils_1.getFederationGlobalScope)(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`,
|
|
120
|
-
])};`,
|
|
121
|
-
'// This exports getters to disallow modifications',
|
|
122
|
-
`${RuntimeGlobals.definePropertyGetters}(exports, {`,
|
|
123
|
-
Template.indent([
|
|
124
|
-
`get: ${runtimeTemplate.returningFunction('get')},`,
|
|
125
|
-
`init: ${runtimeTemplate.returningFunction('init')}`,
|
|
126
|
-
]),
|
|
127
|
-
'});',
|
|
128
|
-
]);
|
|
129
|
-
sources.set('javascript', this.useSourceMap || this.useSimpleSourceMap
|
|
130
|
-
? new webpackSources.OriginalSource(source, 'webpack/shared-entry')
|
|
131
|
-
: new webpackSources.RawSource(source));
|
|
132
|
-
return {
|
|
133
|
-
sources,
|
|
134
|
-
runtimeRequirements,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* @param {string=} type the source type for which the size should be estimated
|
|
139
|
-
* @returns {number} the estimated size of the module (must be non-zero)
|
|
140
|
-
*/
|
|
141
|
-
size(type) {
|
|
142
|
-
return 42;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* @param {ObjectSerializerContext} context context
|
|
146
|
-
*/
|
|
147
|
-
serialize(context) {
|
|
148
|
-
const { write } = context;
|
|
149
|
-
write(this._name);
|
|
150
|
-
write(this._request);
|
|
151
|
-
super.serialize(context);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
makeSerializable(SharedEntryModule, 'SharedEntryModule');
|
|
140
|
+
makeSerializable(SharedEntryModule, "SharedEntryModule");
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
155
143
|
exports.default = SharedEntryModule;
|
|
156
144
|
//# sourceMappingURL=SharedEntryModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedEntryModule.js","
|
|
1
|
+
{"version":3,"file":"SharedEntryModule.js","names":["SharedDependency","getFederationGlobalScope"],"sources":["../../../../../../src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.ts"],"sourcesContent":["import { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { Compilation, Dependency } from 'webpack';\nimport type {\n CodeGenerationResult,\n InputFileSystem,\n LibIdentOptions,\n NeedBuildContext,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackOptions,\n} from 'webpack/lib/Module';\nimport type WebpackError from 'webpack/lib/WebpackError';\nimport SharedDependency from './SharedDependency';\nimport { getFederationGlobalScope } from '../../../container/runtime/utils';\n\nconst makeSerializable = require(\n normalizeWebpackPath('webpack/lib/util/makeSerializable'),\n) as typeof import('webpack/lib/util/makeSerializable');\nconst {\n sources: webpackSources,\n Template,\n Module,\n RuntimeGlobals,\n} = require(normalizeWebpackPath('webpack')) as typeof import('webpack');\nconst StaticExportsDependency = require(\n normalizeWebpackPath('webpack/lib/dependencies/StaticExportsDependency'),\n) as typeof import('webpack/lib/dependencies/StaticExportsDependency');\n\nconst SOURCE_TYPES = new Set(['javascript']);\n\nexport type ExposeOptions = {\n /**\n * requests to exposed modules (last one is exported)\n */\n import: string[];\n /**\n * custom chunk name for the exposed module\n */\n name: string;\n};\n\nclass SharedEntryModule extends Module {\n private _name: string;\n private _request: string;\n\n /**\n * @param {string} name shared name\n * @param {string} request request\n */\n constructor(name: string, request: string) {\n super('shared-entry-module', null);\n // super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);\n this._name = name;\n this._request = request;\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {SharedEntryModule} deserialized container entry module\n */\n static deserialize(context: ObjectDeserializerContext): SharedEntryModule {\n const { read } = context;\n const obj = new SharedEntryModule(read(), read());\n obj.deserialize(context);\n return obj;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return SOURCE_TYPES;\n }\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return `shared module ${this._name} ${this._request}`;\n }\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return `shared module ${this._name} ${requestShortener.shorten(this._request)}`;\n }\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `shared module ${this._name}`;\n }\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (\n arg0: (WebpackError | null) | undefined,\n arg1: boolean | undefined,\n ) => void,\n ): void {\n callback(null, !this.buildMeta);\n }\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n topLevelDeclarations: new Set(['get', 'init']),\n };\n this.buildMeta.exportsType = 'namespace';\n this.clearDependenciesAndBlocks();\n\n this.addDependency(\n new StaticExportsDependency(\n ['get', 'init'],\n false,\n ) as unknown as Dependency,\n );\n\n this.addDependency(new SharedDependency(this._name, this._request));\n callback();\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n // @ts-ignore\n override codeGeneration({\n // @ts-ignore\n chunkGraph,\n // @ts-ignore\n runtimeTemplate,\n }: CodeGenerationResult) {\n const sources = new Map();\n const runtimeRequirements = new Set([\n RuntimeGlobals.definePropertyGetters,\n RuntimeGlobals.hasOwnProperty,\n RuntimeGlobals.exports,\n ]);\n const moduleGetter = runtimeTemplate.syncModuleFactory({\n dependency: this.dependencies[1],\n chunkGraph,\n request: this._request,\n runtimeRequirements,\n });\n const source = Template.asString([\n `var moduleGetter = ${moduleGetter};`,\n `var get = ${runtimeTemplate.basicFunction('module, getScope', [\n 'return moduleGetter();',\n ])};`,\n `var init = ${runtimeTemplate.basicFunction(\n 'mfInstance, bundlerRuntime',\n [\n `${getFederationGlobalScope(RuntimeGlobals)}.instance = mfInstance;`,\n `${getFederationGlobalScope(RuntimeGlobals)}.bundlerRuntime = bundlerRuntime;`,\n `if(!${getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes) { return Promise.resolve(); }`,\n `return ${getFederationGlobalScope(RuntimeGlobals)}.installInitialConsumes({ asyncLoad: true });`,\n ],\n )};`,\n '// This exports getters to disallow modifications',\n `${RuntimeGlobals.definePropertyGetters}(exports, {`,\n Template.indent([\n `get: ${runtimeTemplate.returningFunction('get')},`,\n `init: ${runtimeTemplate.returningFunction('init')}`,\n ]),\n\n '});',\n ]);\n\n sources.set(\n 'javascript',\n this.useSourceMap || this.useSimpleSourceMap\n ? new webpackSources.OriginalSource(source, 'webpack/shared-entry')\n : new webpackSources.RawSource(source),\n );\n\n return {\n sources,\n runtimeRequirements,\n };\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this._name);\n write(this._request);\n super.serialize(context);\n }\n}\n\nmakeSerializable(SharedEntryModule, 'SharedEntryModule');\n\nexport default SharedEntryModule;\n"],"mappings":";;;;;;;AAiBA,MAAM,mBAAmB,gFACF,oCAAoC,CAC1D;AACD,MAAM,EACJ,SAAS,gBACT,UACA,QACA,mBACE,gFAA6B,UAAU,CAAC;AAC5C,MAAM,0BAA0B,gFACT,mDAAmD,CACzE;AAED,MAAM,eAAe,IAAI,IAAI,CAAC,aAAa,CAAC;AAa5C,IAAM,oBAAN,MAAM,0BAA0B,OAAO;;;;;CAQrC,YAAY,MAAc,SAAiB;AACzC,QAAM,uBAAuB,KAAK;AAElC,OAAK,QAAQ;AACb,OAAK,WAAW;;;;;;CAOlB,OAAO,YAAY,SAAuD;EACxE,MAAM,EAAE,SAAS;EACjB,MAAM,MAAM,IAAI,kBAAkB,MAAM,EAAE,MAAM,CAAC;AACjD,MAAI,YAAY,QAAQ;AACxB,SAAO;;;;;CAMT,AAAS,iBAA8B;AACrC,SAAO;;;;;CAKT,AAAS,aAAqB;AAC5B,SAAO,iBAAiB,KAAK,MAAM,GAAG,KAAK;;;;;;CAM7C,AAAS,mBAAmB,kBAA4C;AACtE,SAAO,iBAAiB,KAAK,MAAM,GAAG,iBAAiB,QAAQ,KAAK,SAAS;;;;;;CAM/E,AAAS,SAAS,SAAyC;AACzD,SAAO,iBAAiB,KAAK;;;;;;;CAO/B,AAAS,UACP,SACA,UAIM;AACN,WAAS,MAAM,CAAC,KAAK,UAAU;;;;;;;;;;CAUjC,AAAS,MACP,SACA,aACA,UACA,IACA,UACM;AACN,OAAK,YAAY,EAAE;AACnB,OAAK,YAAY;GACf,QAAQ;GACR,sBAAsB,IAAI,IAAI,CAAC,OAAO,OAAO,CAAC;GAC/C;AACD,OAAK,UAAU,cAAc;AAC7B,OAAK,4BAA4B;AAEjC,OAAK,cACH,IAAI,wBACF,CAAC,OAAO,OAAO,EACf,MACD,CACF;AAED,OAAK,cAAc,IAAIA,gFAAiB,KAAK,OAAO,KAAK,SAAS,CAAC;AACnE,YAAU;;;;;;CAQZ,AAAS,eAAe,EAEtB,YAEA,mBACuB;EACvB,MAAM,0BAAU,IAAI,KAAK;EACzB,MAAM,sBAAsB,IAAI,IAAI;GAClC,eAAe;GACf,eAAe;GACf,eAAe;GAChB,CAAC;EACF,MAAM,eAAe,gBAAgB,kBAAkB;GACrD,YAAY,KAAK,aAAa;GAC9B;GACA,SAAS,KAAK;GACd;GACD,CAAC;EACF,MAAM,SAAS,SAAS,SAAS;GAC/B,sBAAsB,aAAa;GACnC,aAAa,gBAAgB,cAAc,oBAAoB,CAC7D,yBACD,CAAC,CAAC;GACH,cAAc,gBAAgB,cAC5B,8BACA;IACE,GAAGC,6DAAyB,eAAe,CAAC;IAC5C,GAAGA,6DAAyB,eAAe,CAAC;IAC5C,OAAOA,6DAAyB,eAAe,CAAC;IAChD,UAAUA,6DAAyB,eAAe,CAAC;IACpD,CACF,CAAC;GACF;GACA,GAAG,eAAe,sBAAsB;GACxC,SAAS,OAAO,CACd,QAAQ,gBAAgB,kBAAkB,MAAM,CAAC,IACjD,SAAS,gBAAgB,kBAAkB,OAAO,GACnD,CAAC;GAEF;GACD,CAAC;AAEF,UAAQ,IACN,cACA,KAAK,gBAAgB,KAAK,qBACtB,IAAI,eAAe,eAAe,QAAQ,uBAAuB,GACjE,IAAI,eAAe,UAAU,OAAO,CACzC;AAED,SAAO;GACL;GACA;GACD;;;;;;CAOH,AAAS,KAAK,MAAuB;AACnC,SAAO;;;;;CAKT,AAAS,UAAU,SAAwC;EACzD,MAAM,EAAE,UAAU;AAClB,QAAM,KAAK,MAAM;AACjB,QAAM,KAAK,SAAS;AACpB,QAAM,UAAU,QAAQ;;;AAI5B,iBAAiB,mBAAmB,oBAAoB"}
|
package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as webpack_lib_ModuleFactory0 from "webpack/lib/ModuleFactory";
|
|
2
|
+
import { ModuleFactoryCreateData, ModuleFactoryResult } from "webpack/lib/ModuleFactory";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts
|
|
5
|
+
declare const ModuleFactory: typeof webpack_lib_ModuleFactory0;
|
|
6
|
+
declare class SharedEntryModuleFactory extends ModuleFactory {
|
|
7
|
+
/**
|
|
8
|
+
* @param {ModuleFactoryCreateData} data data object
|
|
9
|
+
* @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
|
|
10
|
+
* @returns {void}
|
|
11
|
+
*/
|
|
12
|
+
create(data: ModuleFactoryCreateData, callback: (error: Error | null, result: ModuleFactoryResult) => void): void;
|
|
10
13
|
}
|
|
11
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SharedEntryModuleFactory as default };
|
|
16
|
+
//# sourceMappingURL=SharedEntryModuleFactory.d.ts.map
|