@module-federation/enhanced 2.1.0 → 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 -200
- package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryDependency.d.ts +28 -23
- package/dist/src/lib/container/ContainerEntryDependency.js +39 -39
- package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModule.d.ts +93 -84
- package/dist/src/lib/container/ContainerEntryModule.js +219 -234
- package/dist/src/lib/container/ContainerEntryModule.js.map +1 -1
- package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +15 -10
- package/dist/src/lib/container/ContainerEntryModuleFactory.js +21 -25
- package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
- package/dist/src/lib/container/ContainerExposedDependency.d.ts +29 -24
- package/dist/src/lib/container/ContainerExposedDependency.js +47 -47
- package/dist/src/lib/container/ContainerExposedDependency.js.map +1 -1
- package/dist/src/lib/container/ContainerPlugin.d.ts +12 -8
- package/dist/src/lib/container/ContainerPlugin.js +147 -211
- package/dist/src/lib/container/ContainerPlugin.js.map +1 -1
- package/dist/src/lib/container/ContainerReferencePlugin.d.ts +16 -12
- package/dist/src/lib/container/ContainerReferencePlugin.js +74 -102
- package/dist/src/lib/container/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/lib/container/FallbackDependency.d.ts +24 -19
- package/dist/src/lib/container/FallbackDependency.js +46 -44
- package/dist/src/lib/container/FallbackDependency.js.map +1 -1
- package/dist/src/lib/container/FallbackItemDependency.d.ts +13 -8
- package/dist/src/lib/container/FallbackItemDependency.js +24 -24
- package/dist/src/lib/container/FallbackItemDependency.js.map +1 -1
- package/dist/src/lib/container/FallbackModule.d.ts +82 -71
- package/dist/src/lib/container/FallbackModule.js +133 -145
- package/dist/src/lib/container/FallbackModule.js.map +1 -1
- package/dist/src/lib/container/FallbackModuleFactory.d.ts +15 -10
- package/dist/src/lib/container/FallbackModuleFactory.js +20 -24
- package/dist/src/lib/container/FallbackModuleFactory.js.map +1 -1
- package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +11 -7
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js +125 -188
- package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -1
- package/dist/src/lib/container/ModuleFederationPlugin.d.ts +20 -16
- package/dist/src/lib/container/ModuleFederationPlugin.js +143 -181
- package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/lib/container/RemoteModule.d.ts +79 -74
- package/dist/src/lib/container/RemoteModule.js +143 -153
- package/dist/src/lib/container/RemoteModule.js.map +1 -1
- package/dist/src/lib/container/RemoteRuntimeModule.d.ts +12 -7
- package/dist/src/lib/container/RemoteRuntimeModule.js +86 -132
- package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/RemoteToExternalDependency.d.ts +13 -8
- package/dist/src/lib/container/RemoteToExternalDependency.js +25 -23
- package/dist/src/lib/container/RemoteToExternalDependency.js.map +1 -1
- package/dist/src/lib/container/constant.d.ts +3 -0
- package/dist/src/lib/container/constant.js +11 -14
- package/dist/src/lib/container/constant.js.map +1 -1
- package/dist/src/lib/container/options.d.ts +7 -3
- package/dist/src/lib/container/options.js +51 -69
- package/dist/src/lib/container/options.js.map +1 -1
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.d.ts +14 -9
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js +56 -64
- package/dist/src/lib/container/runtime/EmbedFederationRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.d.ts +23 -19
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js +71 -101
- package/dist/src/lib/container/runtime/EmbedFederationRuntimePlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationModulesPlugin.d.ts +20 -16
- package/dist/src/lib/container/runtime/FederationModulesPlugin.js +55 -47
- package/dist/src/lib/container/runtime/FederationModulesPlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.d.ts +9 -4
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.js +16 -12
- package/dist/src/lib/container/runtime/FederationRuntimeDependency.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +16 -11
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js +39 -46
- package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -1
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +31 -20
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +265 -358
- package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -1
- package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +9 -4
- package/dist/src/lib/container/runtime/getFederationGlobal.js +43 -41
- package/dist/src/lib/container/runtime/getFederationGlobal.js.map +1 -1
- package/dist/src/lib/container/runtime/utils.d.ts +24 -13
- package/dist/src/lib/container/runtime/utils.js +83 -101
- package/dist/src/lib/container/runtime/utils.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +15 -10
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +27 -25
- package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +77 -68
- package/dist/src/lib/sharing/ConsumeSharedModule.js +186 -214
- package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +13 -9
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js +308 -475
- package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +16 -11
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +107 -137
- package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +14 -9
- package/dist/src/lib/sharing/ProvideForSharedDependency.js +25 -25
- package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +44 -39
- package/dist/src/lib/sharing/ProvideSharedDependency.js +72 -76
- package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModule.d.ts +91 -82
- package/dist/src/lib/sharing/ProvideSharedModule.js +177 -184
- package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +14 -9
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +19 -25
- package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
- package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +27 -21
- package/dist/src/lib/sharing/ProvideSharedPlugin.js +341 -550
- package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/SharePlugin.d.ts +53 -49
- package/dist/src/lib/sharing/SharePlugin.js +86 -100
- package/dist/src/lib/sharing/SharePlugin.js.map +1 -1
- package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +12 -7
- package/dist/src/lib/sharing/ShareRuntimeModule.js +81 -103
- package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +11 -7
- package/dist/src/lib/sharing/resolveMatchedConfigs.js +58 -71
- package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.d.ts +18 -14
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js +74 -128
- package/dist/src/lib/sharing/tree-shaking/CollectSharedEntryPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.d.ts +39 -34
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js +234 -328
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.d.ts +16 -11
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js +30 -28
- package/dist/src/lib/sharing/tree-shaking/IndependentSharedRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.d.ts +28 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js +91 -95
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedContainerPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.d.ts +29 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js +47 -43
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedDependency.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.d.ts +20 -15
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js +33 -29
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryDependency.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.d.ts +85 -77
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js +141 -153
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.d.ts +15 -10
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js +20 -24
- package/dist/src/lib/sharing/tree-shaking/SharedContainerPlugin/SharedEntryModuleFactory.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.d.ts +21 -16
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js +157 -231
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerPlugin.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.d.ts +14 -9
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js +26 -27
- package/dist/src/lib/sharing/tree-shaking/SharedUsedExportsOptimizerRuntimeModule.js.map +1 -1
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.d.ts +18 -13
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js +41 -49
- package/dist/src/lib/sharing/tree-shaking/TreeShakingSharedPlugin.js.map +1 -1
- package/dist/src/lib/sharing/utils.d.ts +27 -24
- package/dist/src/lib/sharing/utils.js +224 -367
- package/dist/src/lib/sharing/utils.js.map +1 -1
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.d.ts +11 -7
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js +56 -75
- package/dist/src/lib/startup/MfStartupChunkDependenciesPlugin.js.map +1 -1
- package/dist/src/lib/startup/StartupHelpers.d.ts +11 -6
- package/dist/src/lib/startup/StartupHelpers.js +128 -178
- package/dist/src/lib/startup/StartupHelpers.js.map +1 -1
- package/dist/src/prefetch.d.ts +3 -2
- package/dist/src/prefetch.js +17 -8
- package/dist/src/rspack.d.ts +3 -2
- package/dist/src/rspack.js +35 -11
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +8 -4
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -16
- package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -1
- package/dist/src/runtime.d.ts +1 -1
- package/dist/src/runtime.js +11 -18
- package/dist/src/schemas/container/ContainerPlugin.check.d.ts +13 -5
- package/dist/src/schemas/container/ContainerPlugin.check.js +958 -1218
- package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ContainerPlugin.d.ts +271 -268
- package/dist/src/schemas/container/ContainerPlugin.js +273 -361
- package/dist/src/schemas/container/ContainerPlugin.js.map +1 -1
- package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +13 -5
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js +335 -443
- package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +102 -99
- package/dist/src/schemas/container/ContainerReferencePlugin.js +122 -162
- package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/schemas/container/ExternalsType.check.d.ts +13 -5
- package/dist/src/schemas/container/ExternalsType.check.js +36 -62
- package/dist/src/schemas/container/ExternalsType.check.js.map +1 -1
- package/dist/src/schemas/container/ExternalsType.d.ts +5 -2
- package/dist/src/schemas/container/ExternalsType.js +8 -11
- package/dist/src/schemas/container/ExternalsType.js.map +1 -1
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js +3001 -4812
- package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -1
- package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +819 -814
- package/dist/src/schemas/container/ModuleFederationPlugin.js +780 -1053
- package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js +568 -768
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.d.ts +197 -194
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.js +212 -238
- package/dist/src/schemas/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js +598 -804
- package/dist/src/schemas/sharing/ProvideSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ProvideSharedPlugin.d.ts +184 -181
- package/dist/src/schemas/sharing/ProvideSharedPlugin.js +196 -229
- package/dist/src/schemas/sharing/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +12 -4
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +285 -482
- package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +103 -100
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js +104 -126
- package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -1
- package/dist/src/schemas/sharing/SharePlugin.check.d.ts +13 -5
- package/dist/src/schemas/sharing/SharePlugin.check.js +749 -965
- package/dist/src/schemas/sharing/SharePlugin.check.js.map +1 -1
- package/dist/src/schemas/sharing/SharePlugin.d.ts +245 -242
- package/dist/src/schemas/sharing/SharePlugin.js +256 -293
- package/dist/src/schemas/sharing/SharePlugin.js.map +1 -1
- package/dist/src/utils.d.ts +3 -0
- package/dist/src/utils.js +35 -26
- package/dist/src/utils.js.map +1 -1
- package/dist/src/webpack.d.ts +2 -2
- package/dist/src/webpack.js +6 -40
- package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +9 -4
- package/dist/src/wrapper/AsyncBoundaryPlugin.js +12 -11
- package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -1
- package/dist/src/wrapper/BaseWrapperPlugin.d.ts +18 -13
- package/dist/src/wrapper/BaseWrapperPlugin.js +39 -39
- package/dist/src/wrapper/BaseWrapperPlugin.js.map +1 -1
- package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +10 -4
- package/dist/src/wrapper/ConsumeSharedPlugin.js +12 -11
- package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -1
- package/dist/src/wrapper/ContainerPlugin.d.ts +9 -4
- package/dist/src/wrapper/ContainerPlugin.js +12 -11
- package/dist/src/wrapper/ContainerPlugin.js.map +1 -1
- package/dist/src/wrapper/ContainerReferencePlugin.d.ts +9 -4
- package/dist/src/wrapper/ContainerReferencePlugin.js +12 -11
- package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -1
- package/dist/src/wrapper/FederationModulesPlugin.d.ts +18 -10
- package/dist/src/wrapper/FederationModulesPlugin.js +19 -19
- package/dist/src/wrapper/FederationModulesPlugin.js.map +1 -1
- package/dist/src/wrapper/FederationRuntimePlugin.d.ts +11 -6
- package/dist/src/wrapper/FederationRuntimePlugin.js +18 -17
- package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -1
- package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +8 -3
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js +12 -11
- package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -1
- package/dist/src/wrapper/ModuleFederationPlugin.d.ts +12 -7
- package/dist/src/wrapper/ModuleFederationPlugin.js +73 -99
- package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -1
- package/dist/src/wrapper/ProvideSharedPlugin.d.ts +10 -4
- package/dist/src/wrapper/ProvideSharedPlugin.js +12 -11
- package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -1
- package/dist/src/wrapper/SharePlugin.d.ts +10 -4
- package/dist/src/wrapper/SharePlugin.js +12 -11
- package/dist/src/wrapper/SharePlugin.js.map +1 -1
- package/dist/src/wrapper/TreeShakingSharedPlugin.d.ts +9 -4
- package/dist/src/wrapper/TreeShakingSharedPlugin.js +12 -11
- package/dist/src/wrapper/TreeShakingSharedPlugin.js.map +1 -1
- package/package.json +20 -13
- package/dist/package.json +0 -110
- package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +0 -57
- package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +0 -33
- package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +0 -4
- package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +0 -28
- package/dist/src/declarations/plugins/container/Template.d.ts +0 -198
- package/dist/src/declarations/plugins/container/WebpackError.d.ts +0 -33
- package/dist/src/declarations/plugins/sharing/ConsumeSharedModule.d.ts +0 -86
- package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +0 -100
- package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +0 -102
- package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +0 -116
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.d.ts +0 -20
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js +0 -222
- package/dist/src/lib/container/runtime/ChildCompilationRuntimePlugin.js.map +0 -1
- package/dist/src/prefetch.js.map +0 -1
- package/dist/src/rspack.js.map +0 -1
- package/dist/src/runtime.js.map +0 -1
- package/dist/src/types/runtime.d.ts +0 -10
- package/dist/src/types/runtime.js +0 -3
- package/dist/src/types/runtime.js.map +0 -1
- package/dist/src/webpack.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/lib/sharing/utils.ts"],"names":[],"mappings":";AAAA;;;EAGE;;AA2UO,4CAAgB;AAoFhB,gDAAkB;AAO3B,sFAgCC;AAED,oEAwBC;AAED,8DAuBC;AAED,gDAwBC;AAED,8DAQC;AAED,kEAQC;AAriBD,gDAA2D;AAE3D,0FAAqF;AAIrF,MAAM,EAAE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SAAS,KAAK,cAAc,CAAC,EACjC,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,gCAAgC;IAChD,CAAC;IAED,IACE,cAAc;QACd,CAAC,cAAc,YAAY,MAAM;YAC/B,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;YAChC,CAAC,CAAC,SAAS,KAAK,cAAc,CAAC,EACjC,CAAC;QACD,OAAO,KAAK,CAAC,CAAC,0BAA0B;IAC1C,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,gCAAgC;AAC/C,CAAC;AAED,SAAgB,yBAAyB,CACvC,OAAe,EACf,KAAqB;IAErB,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,2BAA2B,CAAC,QAAgB;IAC1D,0CAA0C;IAC1C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACtC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,gBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC,8BAA8B;QACxF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../../src/lib/sharing/utils.ts"],"sourcesContent":["/*\n MIT License http://www.opensource.org/licenses/mit-license.php\n Author Tobias Koppers @sokra\n*/\n\nimport { isRequiredVersion } from '@module-federation/sdk';\nimport type { ConsumeOptions } from '@module-federation/sdk';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport type { InputFileSystem } from 'webpack/lib/util/fs';\nimport type { Compilation } from 'webpack';\n\nconst { join, dirname, readJson } = require(\n normalizeWebpackPath('webpack/lib/util/fs'),\n) as typeof import('webpack/lib/util/fs');\n\nconst { WebpackError } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\n\n// Extreme shorthand only for github. eg: foo/bar\nconst RE_URL_GITHUB_EXTREME_SHORT = /^[^/@:.\\s][^/@:\\s]*\\/[^@:\\s]*[^/@:\\s]#\\S+/;\n\n// Short url with specific protocol. eg: github:foo/bar\nconst RE_GIT_URL_SHORT = /^(github|gitlab|bitbucket|gist):\\/?[^/.]+\\/?/i;\n\n// Currently supported protocols\nconst RE_PROTOCOL =\n /^((git\\+)?(ssh|https?|file)|git|github|gitlab|bitbucket|gist):$/i;\n\n// Has custom protocol\nconst RE_CUSTOM_PROTOCOL = /^((git\\+)?(ssh|https?|file)|git):\\/\\//i;\n\n// Valid hash format for npm / yarn ...\nconst RE_URL_HASH_VERSION = /#(?:semver:)?(.+)/;\n\n// Simple hostname validate\nconst RE_HOSTNAME = /^(?:[^/.]+(\\.[^/]+)+|localhost)$/;\n\n// For hostname with colon. eg: ssh://user@github.com:foo/bar\nconst RE_HOSTNAME_WITH_COLON =\n /([^/@#:.]+(?:\\.[^/@#:.]+)+|localhost):([^#/0-9]+)/;\n\n// Reg for url without protocol\nconst RE_NO_PROTOCOL = /^([^/@#:.]+(?:\\.[^/@#:.]+)+)/;\n\n// Specific protocol for short url without normal hostname\nconst PROTOCOLS_FOR_SHORT = [\n 'github:',\n 'gitlab:',\n 'bitbucket:',\n 'gist:',\n 'file:',\n];\n\n// Default protocol for git url\nconst DEF_GIT_PROTOCOL = 'git+ssh://';\n\n// thanks to https://github.com/npm/hosted-git-info/blob/latest/git-host-info.js\nconst extractCommithashByDomain: {\n [key: string]: (pathname: string, hash: string) => string | undefined;\n} = {\n /**\n * @param {string} pathname pathname\n * @param {string} hash hash\n * @returns {string | undefined} hash\n */\n 'github.com': (pathname: string, hash: string) => {\n const [, user, project, type, commithash] = pathname.split('/', 5);\n if (type && type !== 'tree') {\n return;\n }\n\n let commithashResult = commithash;\n if (!type) {\n commithashResult = hash;\n } else {\n commithashResult = '#' + commithash;\n }\n\n let projectResult = project;\n if (project && project.endsWith('.git')) {\n projectResult = project.slice(0, -4);\n }\n\n if (!user || !projectResult) {\n return;\n }\n\n return commithashResult;\n },\n /**\n * @param {string} pathname pathname\n * @param {string} hash hash\n * @returns {string | undefined} hash\n */\n 'gitlab.com': (pathname: string, hash: string) => {\n const path = pathname.slice(1);\n if (path.includes('/-/') || path.includes('/archive.tar.gz')) {\n return;\n }\n\n const segments = path.split('/');\n let project = segments.pop();\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4);\n }\n\n const user = segments.join('/');\n if (!user || !project) {\n return;\n }\n\n return hash;\n },\n /**\n * @param {string} pathname pathname\n * @param {string} hash hash\n * @returns {string | undefined} hash\n */\n 'bitbucket.org': (pathname: string, hash: string) => {\n const [, user, project, aux] = pathname.split('/', 4);\n if (['get'].includes(aux)) {\n return;\n }\n\n let projectResult = project;\n if (project && project.endsWith('.git')) {\n projectResult = project.slice(0, -4);\n }\n\n if (!user || !projectResult) {\n return;\n }\n\n return hash;\n },\n /**\n * @param {string} pathname pathname\n * @param {string} hash hash\n * @returns {string | undefined} hash\n */\n 'gist.github.com': (pathname: string, hash: string) => {\n const [, user, project, aux] = pathname.split('/', 4);\n if (aux === 'raw') {\n return;\n }\n\n let projectResult = project;\n if (!projectResult) {\n if (!user) {\n return;\n }\n\n projectResult = user;\n }\n\n if (projectResult.endsWith('.git')) {\n projectResult = projectResult.slice(0, -4);\n }\n\n return hash;\n },\n};\n\n/**\n * extract commit hash from parsed url\n *\n * @inner\n * @param {URL} urlParsed parsed url\n * @returns {string} commithash\n */\nfunction getCommithash(urlParsed: URL): string {\n const { hostname, pathname, hash } = urlParsed;\n const hostnameResult = hostname.replace(/^www\\./, '');\n\n let hashResult = hash;\n try {\n hashResult = decodeURIComponent(hash);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n\n if (\n /** @type {keyof extractCommithashByDomain} */ extractCommithashByDomain[\n hostnameResult\n ]\n ) {\n return (\n extractCommithashByDomain\n /** @type {keyof extractCommithashByDomain} */ [hostnameResult](\n pathname,\n hashResult,\n ) || ''\n );\n }\n\n return hashResult;\n}\n\n/**\n * make url right for URL parse\n *\n * @inner\n * @param {string} gitUrl git url\n * @returns {string} fixed url\n */\nfunction correctUrl(gitUrl: string): string {\n // like:\n // proto://hostname.com:user/repo -> proto://hostname.com/user/repo\n return gitUrl.replace(RE_HOSTNAME_WITH_COLON, '$1/$2');\n}\n\n/**\n * make url protocol right for URL parse\n *\n * @inner\n * @param {string} gitUrl git url\n * @returns {string} fixed url\n */\nfunction correctProtocol(gitUrl: string): string {\n // eg: github:foo/bar#v1.0. Should not add double slash, in case of error parsed `pathname`\n if (RE_GIT_URL_SHORT.test(gitUrl)) {\n return gitUrl;\n }\n\n // eg: user@github.com:foo/bar\n if (!RE_CUSTOM_PROTOCOL.test(gitUrl)) {\n return `${DEF_GIT_PROTOCOL}${gitUrl}`;\n }\n\n return gitUrl;\n}\n\n/**\n * extract git dep version from hash\n *\n * @inner\n * @param {string} hash hash\n * @returns {string} git dep version\n */\nfunction getVersionFromHash(hash: string): string {\n const matched = hash.match(RE_URL_HASH_VERSION);\n\n return (matched && matched[1]) || '';\n}\n\n/**\n * if string can be decoded\n *\n * @inner\n * @param {string} str str to be checked\n * @returns {boolean} if can be decoded\n */\nfunction canBeDecoded(str: string): boolean {\n try {\n decodeURIComponent(str);\n } catch (e) {\n return false;\n }\n\n return true;\n}\n\n/**\n * get right dep version from git url\n *\n * @inner\n * @param {string} gitUrl git url\n * @returns {string} dep version\n */\nfunction getGitUrlVersion(gitUrl: string): string {\n const oriGitUrl = gitUrl;\n // github extreme shorthand\n if (RE_URL_GITHUB_EXTREME_SHORT.test(gitUrl)) {\n gitUrl = 'github:' + gitUrl;\n } else {\n gitUrl = correctProtocol(gitUrl);\n }\n\n gitUrl = correctUrl(gitUrl);\n\n let parsed;\n try {\n parsed = new URL(gitUrl);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n\n if (!parsed) {\n return '';\n }\n\n const { protocol, hostname, pathname, username, password } = parsed;\n if (!RE_PROTOCOL.test(protocol)) {\n return '';\n }\n\n // pathname shouldn't be empty or URL malformed\n if (!pathname || !canBeDecoded(pathname)) {\n return '';\n }\n\n // without protocol, there should have auth info\n if (RE_NO_PROTOCOL.test(oriGitUrl) && !username && !password) {\n return '';\n }\n\n if (!PROTOCOLS_FOR_SHORT.includes(protocol.toLowerCase())) {\n if (!RE_HOSTNAME.test(hostname)) {\n return '';\n }\n\n const commithash = getCommithash(parsed);\n return getVersionFromHash(commithash) || commithash;\n }\n\n // for protocol short\n return getVersionFromHash(gitUrl);\n}\n\n/**\n * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies\n * @param {string} versionDesc version to be normalized\n * @returns {string} normalized version\n */\nfunction normalizeVersion(versionDesc: string): string {\n versionDesc = (versionDesc && versionDesc.trim()) || '';\n\n if (isRequiredVersion(versionDesc)) {\n return versionDesc;\n }\n\n // add handle for URL Dependencies\n return getGitUrlVersion(versionDesc.toLowerCase());\n}\n\nexport { normalizeVersion };\n\n/** @typedef {{ data: Record<string, any>, path: string }} DescriptionFile */\n\ninterface DescriptionFile {\n data: Record<string, any>;\n path: string;\n}\n\n/**\n *\n * @param {InputFileSystem} fs file system\n * @param {string} directory directory to start looking into\n * @param {string[]} descriptionFiles possible description filenames\n * @param {function((Error | null)=, {data?: DescriptionFile, path?: string}=, (checkedDescriptionFilePaths: string[])=): void} callback callback\n * @param {function({data: DescriptionFile}=): boolean} satisfiesDescriptionFileData file data compliance check\n * @param {Set<string>} [checkedFilePaths] optional set to track checked file paths\n */\nfunction getDescriptionFile(\n fs: InputFileSystem,\n directory: string,\n descriptionFiles: string[],\n callback: (\n err: Error | null,\n data?: DescriptionFile,\n checkedDescriptionFilePaths?: string[],\n ) => void,\n satisfiesDescriptionFileData?: (data?: DescriptionFile) => boolean,\n checkedFilePaths: Set<string> = new Set<string>(), // Default to a new Set if not provided\n) {\n let i = 0;\n\n // Create an object to hold the function and the shared checkedFilePaths\n const satisfiesDescriptionFileDataInternal = {\n check: satisfiesDescriptionFileData,\n checkedFilePaths: checkedFilePaths, // Use the passed Set instance\n };\n\n const tryLoadCurrent = () => {\n if (i >= descriptionFiles.length) {\n const parentDirectory = dirname(fs, directory);\n if (!parentDirectory || parentDirectory === directory) {\n return callback(\n null,\n undefined,\n Array.from(satisfiesDescriptionFileDataInternal.checkedFilePaths),\n );\n }\n return getDescriptionFile(\n fs,\n parentDirectory,\n descriptionFiles,\n callback,\n satisfiesDescriptionFileDataInternal.check,\n satisfiesDescriptionFileDataInternal.checkedFilePaths, // Pass the same Set\n );\n }\n const filePath = join(fs, directory, descriptionFiles[i]);\n readJson(fs, filePath, (err, data?: Record<string, any>) => {\n if (err) {\n if ('code' in err && err.code === 'ENOENT') {\n i++;\n return tryLoadCurrent();\n }\n return callback(err);\n }\n if (!data || typeof data !== 'object' || Array.isArray(data)) {\n return callback(\n new Error(`Description file ${filePath} is not an object`),\n );\n }\n if (\n typeof satisfiesDescriptionFileDataInternal.check === 'function' &&\n !satisfiesDescriptionFileDataInternal.check({ data, path: filePath })\n ) {\n i++;\n satisfiesDescriptionFileDataInternal.checkedFilePaths.add(filePath);\n return tryLoadCurrent();\n }\n callback(null, { data, path: filePath });\n });\n };\n tryLoadCurrent();\n}\nexport { getDescriptionFile };\n/**\n * Get required version from description file\n * @param {Record<string, any>} data - The data object\n * @param {string} packageName - The package name\n * @returns {string | undefined} The normalized version\n */\nexport function getRequiredVersionFromDescriptionFile(\n data: Record<string, any>,\n packageName: string,\n): string | undefined | void {\n if (\n data['optionalDependencies'] &&\n typeof data['optionalDependencies'] === 'object' &&\n packageName in data['optionalDependencies']\n ) {\n return normalizeVersion(data['optionalDependencies'][packageName]);\n }\n if (\n data['dependencies'] &&\n typeof data['dependencies'] === 'object' &&\n packageName in data['dependencies']\n ) {\n return normalizeVersion(data['dependencies'][packageName]);\n }\n if (\n data['peerDependencies'] &&\n typeof data['peerDependencies'] === 'object' &&\n packageName in data['peerDependencies']\n ) {\n return normalizeVersion(data['peerDependencies'][packageName]);\n }\n if (\n data['devDependencies'] &&\n typeof data['devDependencies'] === 'object' &&\n packageName in data['devDependencies']\n ) {\n return normalizeVersion(data['devDependencies'][packageName]);\n }\n}\n\nexport function normalizeConsumeShareOptions(consumeOptions: ConsumeOptions) {\n const {\n requiredVersion = false,\n strictVersion,\n singleton = false,\n eager,\n shareKey,\n shareScope,\n layer,\n treeShakingMode,\n } = consumeOptions;\n return {\n shareConfig: {\n fixedDependencies: false,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n layer,\n },\n shareScope,\n shareKey,\n treeShakingMode,\n };\n}\n\nexport function addSingletonFilterWarning(\n compilation: Compilation,\n shareKey: string, // The shareKey or a relevant identifier for the shared module\n filterType: 'include' | 'exclude',\n filterProperty: 'request' | 'version',\n filterValue: string | RegExp,\n moduleRequest: string, // original request that led to this shared module\n moduleResource?: string, // resolved path of the module\n): void {\n if (typeof compilation.warnings.push !== 'function') {\n return;\n }\n const filterValueStr =\n filterValue instanceof RegExp ? filterValue.toString() : `\"${filterValue}\"`;\n const warningMessage = `\"singleton: true\" is used together with \"${filterType}.${filterProperty}: ${filterValueStr}\". This might lead to multiple instances of the shared module \"${shareKey}\" in the shared scope.`;\n const warning = new WebpackError(warningMessage);\n\n if (moduleResource) {\n warning.file = `shared module ${moduleRequest} -> ${moduleResource}`;\n } else {\n warning.file = `shared module ${moduleRequest}`; // Fallback if resource is not available\n }\n compilation.warnings.push(warning);\n}\n\nexport function testRequestFilters(\n remainder: string,\n includeRequest?: string | RegExp,\n excludeRequest?: string | RegExp,\n): boolean {\n if (\n includeRequest &&\n !(includeRequest instanceof RegExp\n ? includeRequest.test(remainder)\n : remainder === includeRequest)\n ) {\n return false; // Skip if include doesn't match\n }\n\n if (\n excludeRequest &&\n (excludeRequest instanceof RegExp\n ? excludeRequest.test(remainder)\n : remainder === excludeRequest)\n ) {\n return false; // Skip if exclude matches\n }\n\n return true; // Process if no filters skip it\n}\n\nexport function createLookupKeyForSharing(\n request: string,\n layer?: string | null,\n): string {\n if (layer) {\n return `(${layer})${request}`;\n }\n return request;\n}\n\nexport function extractPathAfterNodeModules(filePath: string): string | null {\n // Fast check for 'node_modules' substring\n if (~filePath.indexOf('node_modules')) {\n const nodeModulesIndex = filePath.lastIndexOf('node_modules');\n const result = filePath.substring(nodeModulesIndex + 13); // 13 = 'node_modules/'.length\n return result;\n }\n return null;\n}\n"],"mappings":";;;;;;AAWA,MAAM,EAAE,MAAM,SAAS,aAAa,gFACb,sBAAsB,CAC5C;AAED,MAAM,EAAE,iBAAiB,gFACF,UAAU,CAChC;AAGD,MAAM,8BAA8B;AAGpC,MAAM,mBAAmB;AAGzB,MAAM,cACJ;AAGF,MAAM,qBAAqB;AAG3B,MAAM,sBAAsB;AAG5B,MAAM,cAAc;AAGpB,MAAM,yBACJ;AAGF,MAAM,iBAAiB;AAGvB,MAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACD;AAGD,MAAM,mBAAmB;AAGzB,MAAM,4BAEF;CAMF,eAAe,UAAkB,SAAiB;EAChD,MAAM,GAAG,MAAM,SAAS,MAAM,cAAc,SAAS,MAAM,KAAK,EAAE;AAClE,MAAI,QAAQ,SAAS,OACnB;EAGF,IAAI,mBAAmB;AACvB,MAAI,CAAC,KACH,oBAAmB;MAEnB,oBAAmB,MAAM;EAG3B,IAAI,gBAAgB;AACpB,MAAI,WAAW,QAAQ,SAAS,OAAO,CACrC,iBAAgB,QAAQ,MAAM,GAAG,GAAG;AAGtC,MAAI,CAAC,QAAQ,CAAC,cACZ;AAGF,SAAO;;CAOT,eAAe,UAAkB,SAAiB;EAChD,MAAM,OAAO,SAAS,MAAM,EAAE;AAC9B,MAAI,KAAK,SAAS,MAAM,IAAI,KAAK,SAAS,kBAAkB,CAC1D;EAGF,MAAM,WAAW,KAAK,MAAM,IAAI;EAChC,IAAI,UAAU,SAAS,KAAK;AAC5B,MAA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,UACA,YACA,OACA,oBACE;AACJ,QAAO;EACL,aAAa;GACX,mBAAmB;GACnB;GACA;GACA;GACA;GACA;GACD;EACD;EACA;EACA;EACD;;AAGH,SAAgB,0BACd,aACA,UACA,YACA,gBACA,aACA,eACA,gBACM;AACN,KAAI,OAAO,YAAY,SAAS,SAAS,WACvC;CAKF,MAAM,UAAU,IAAI,aADG,4CAA4C,WAAW,GAAG,eAAe,IAD9F,uBAAuB,SAAS,YAAY,UAAU,GAAG,IAAI,YAAY,GACwC,iEAAiE,SAAS,wBAC7I;AAEhD,KAAI,eACF,SAAQ,OAAO,iBAAiB,cAAc,MAAM;KAEpD,SAAQ,OAAO,iBAAiB;AAElC,aAAY,SAAS,KAAK,QAAQ;;AAGpC,SAAgB,mBACd,WACA,gBACA,gBACS;AACT,KACE,kBACA,EAAE,0BAA0B,SACxB,eAAe,KAAK,UAAU,GAC9B,cAAc,gBAElB,QAAO;AAGT,KACE,mBACC,0BAA0B,SACvB,eAAe,KAAK,UAAU,GAC9B,cAAc,gBAElB,QAAO;AAGT,QAAO;;AAGT,SAAgB,0BACd,SACA,OACQ;AACR,KAAI,MACF,QAAO,IAAI,MAAM,GAAG;AAEtB,QAAO;;AAGT,SAAgB,4BAA4B,UAAiC;AAE3E,KAAI,CAAC,SAAS,QAAQ,eAAe,EAAE;EACrC,MAAM,mBAAmB,SAAS,YAAY,eAAe;AAE7D,SADe,SAAS,UAAU,mBAAmB,GAAG;;AAG1D,QAAO"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Compiler } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/startup/MfStartupChunkDependenciesPlugin.d.ts
|
|
2
4
|
interface Options {
|
|
3
|
-
|
|
5
|
+
asyncChunkLoading?: boolean;
|
|
4
6
|
}
|
|
5
7
|
declare class StartupChunkDependenciesPlugin {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
asyncChunkLoading: boolean;
|
|
9
|
+
constructor(options: Options);
|
|
10
|
+
private isEnabledForChunk;
|
|
11
|
+
apply(compiler: Compiler): void;
|
|
10
12
|
}
|
|
11
|
-
|
|
13
|
+
//#endregion
|
|
14
|
+
export { StartupChunkDependenciesPlugin as default };
|
|
15
|
+
//# sourceMappingURL=MfStartupChunkDependenciesPlugin.d.ts.map
|
|
@@ -1,79 +1,60 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
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_container_ContainerEntryModule = require('../container/ContainerEntryModule.js');
|
|
6
|
+
const require_lib_startup_StartupHelpers = require('./StartupHelpers.js');
|
|
7
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
8
|
+
|
|
9
|
+
//#region src/lib/startup/MfStartupChunkDependenciesPlugin.ts
|
|
10
|
+
const { RuntimeGlobals } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
11
|
+
const StartupEntrypointRuntimeModule = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/runtime/StartupEntrypointRuntimeModule"));
|
|
12
|
+
var StartupChunkDependenciesPlugin = class {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
this.asyncChunkLoading = options.asyncChunkLoading ?? true;
|
|
15
|
+
}
|
|
16
|
+
isEnabledForChunk(chunk, compilation) {
|
|
17
|
+
if (chunk.id === "build time chunk") return false;
|
|
18
|
+
const [finalEntry] = Array.from(compilation.chunkGraph.getChunkEntryModulesIterable(chunk)).reverse() || [];
|
|
19
|
+
return !(finalEntry instanceof require_lib_container_ContainerEntryModule.default);
|
|
20
|
+
}
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
compiler.hooks.thisCompilation.tap("MfStartupChunkDependenciesPlugin", (compilation) => {
|
|
23
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap("StartupChunkDependenciesPlugin", (chunk, set, { chunkGraph }) => {
|
|
24
|
+
if (!this.isEnabledForChunk(chunk, compilation)) return;
|
|
25
|
+
if (chunk.hasRuntime()) {
|
|
26
|
+
set.add(RuntimeGlobals.startupEntrypoint);
|
|
27
|
+
set.add(RuntimeGlobals.ensureChunk);
|
|
28
|
+
set.add(RuntimeGlobals.ensureChunkIncludeEntries);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
compilation.hooks.additionalChunkRuntimeRequirements.tap("MfStartupChunkDependenciesPlugin", (chunk, set, { chunkGraph }) => {
|
|
32
|
+
if (!this.isEnabledForChunk(chunk, compilation)) return;
|
|
33
|
+
if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return;
|
|
34
|
+
set.add(require_lib_startup_StartupHelpers.federationStartup);
|
|
35
|
+
});
|
|
36
|
+
compilation.hooks.runtimeRequirementInTree.for(RuntimeGlobals.startupEntrypoint).tap("StartupChunkDependenciesPlugin", (chunk, set, { chunkGraph }) => {
|
|
37
|
+
if (!this.isEnabledForChunk(chunk, compilation)) return;
|
|
38
|
+
set.add(RuntimeGlobals.require);
|
|
39
|
+
set.add(RuntimeGlobals.ensureChunk);
|
|
40
|
+
set.add(RuntimeGlobals.ensureChunkIncludeEntries);
|
|
41
|
+
compilation.addRuntimeModule(chunk, new StartupEntrypointRuntimeModule(this.asyncChunkLoading));
|
|
42
|
+
});
|
|
43
|
+
const { renderStartup } = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
44
|
+
renderStartup.tap("MfStartupChunkDependenciesPlugin", (startupSource, lastInlinedModule, renderContext) => {
|
|
45
|
+
const { chunk, chunkGraph, runtimeTemplate } = renderContext;
|
|
46
|
+
if (!this.isEnabledForChunk(chunk, compilation)) return startupSource;
|
|
47
|
+
if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return startupSource;
|
|
48
|
+
const treeRuntimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
|
|
49
|
+
if (!(chunkGraph.getChunkRuntimeRequirements(chunk).has(require_lib_startup_StartupHelpers.federationStartup) || treeRuntimeRequirements.has(require_lib_startup_StartupHelpers.federationStartup))) return startupSource;
|
|
50
|
+
const entryModules = Array.from(chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk));
|
|
51
|
+
const entryGeneration = runtimeTemplate.outputOptions.module ? require_lib_startup_StartupHelpers.generateESMEntryStartup : require_lib_startup_StartupHelpers.generateEntryStartup;
|
|
52
|
+
return new compiler.webpack.sources.ConcatSource(entryGeneration(compilation, chunkGraph, runtimeTemplate, entryModules, chunk, false));
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
4
56
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const StartupHelpers_1 = require("./StartupHelpers");
|
|
8
|
-
const ContainerEntryModule_1 = __importDefault(require("../container/ContainerEntryModule"));
|
|
9
|
-
const { RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
10
|
-
const StartupEntrypointRuntimeModule = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/runtime/StartupEntrypointRuntimeModule'));
|
|
11
|
-
class StartupChunkDependenciesPlugin {
|
|
12
|
-
constructor(options) {
|
|
13
|
-
this.asyncChunkLoading = options.asyncChunkLoading ?? true;
|
|
14
|
-
}
|
|
15
|
-
isEnabledForChunk(chunk, compilation) {
|
|
16
|
-
if (chunk.id === 'build time chunk')
|
|
17
|
-
return false;
|
|
18
|
-
const [finalEntry] = Array.from(compilation.chunkGraph.getChunkEntryModulesIterable(chunk)).reverse() || [];
|
|
19
|
-
return !(finalEntry instanceof ContainerEntryModule_1.default);
|
|
20
|
-
}
|
|
21
|
-
apply(compiler) {
|
|
22
|
-
compiler.hooks.thisCompilation.tap('MfStartupChunkDependenciesPlugin', (compilation) => {
|
|
23
|
-
// Add additional runtime requirements at the tree level.
|
|
24
|
-
compilation.hooks.additionalTreeRuntimeRequirements.tap('StartupChunkDependenciesPlugin', (chunk, set, { chunkGraph }) => {
|
|
25
|
-
if (!this.isEnabledForChunk(chunk, compilation))
|
|
26
|
-
return;
|
|
27
|
-
if (chunk.hasRuntime()) {
|
|
28
|
-
set.add(RuntimeGlobals.startupEntrypoint);
|
|
29
|
-
set.add(RuntimeGlobals.ensureChunk);
|
|
30
|
-
set.add(RuntimeGlobals.ensureChunkIncludeEntries);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
// Add additional runtime requirements at the chunk level if there are entry modules.
|
|
34
|
-
compilation.hooks.additionalChunkRuntimeRequirements.tap('MfStartupChunkDependenciesPlugin', (chunk, set, { chunkGraph }) => {
|
|
35
|
-
if (!this.isEnabledForChunk(chunk, compilation))
|
|
36
|
-
return;
|
|
37
|
-
if (chunkGraph.getNumberOfEntryModules(chunk) === 0)
|
|
38
|
-
return;
|
|
39
|
-
set.add(StartupHelpers_1.federationStartup);
|
|
40
|
-
});
|
|
41
|
-
// When the startupEntrypoint requirement is present, add extra keys and a runtime module.
|
|
42
|
-
compilation.hooks.runtimeRequirementInTree
|
|
43
|
-
.for(RuntimeGlobals.startupEntrypoint)
|
|
44
|
-
.tap('StartupChunkDependenciesPlugin', (chunk, set, { chunkGraph }) => {
|
|
45
|
-
if (!this.isEnabledForChunk(chunk, compilation))
|
|
46
|
-
return;
|
|
47
|
-
set.add(RuntimeGlobals.require);
|
|
48
|
-
set.add(RuntimeGlobals.ensureChunk);
|
|
49
|
-
set.add(RuntimeGlobals.ensureChunkIncludeEntries);
|
|
50
|
-
compilation.addRuntimeModule(chunk, new StartupEntrypointRuntimeModule(this.asyncChunkLoading));
|
|
51
|
-
});
|
|
52
|
-
// Replace the generated startup with a custom version if entry modules exist.
|
|
53
|
-
const { renderStartup } = compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);
|
|
54
|
-
renderStartup.tap('MfStartupChunkDependenciesPlugin', (startupSource, lastInlinedModule, renderContext) => {
|
|
55
|
-
const { chunk, chunkGraph, runtimeTemplate } = renderContext;
|
|
56
|
-
if (!this.isEnabledForChunk(chunk, compilation)) {
|
|
57
|
-
return startupSource;
|
|
58
|
-
}
|
|
59
|
-
if (chunkGraph.getNumberOfEntryModules(chunk) === 0) {
|
|
60
|
-
return startupSource;
|
|
61
|
-
}
|
|
62
|
-
const treeRuntimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
|
|
63
|
-
const chunkRuntimeRequirements = chunkGraph.getChunkRuntimeRequirements(chunk);
|
|
64
|
-
const federation = chunkRuntimeRequirements.has(StartupHelpers_1.federationStartup) ||
|
|
65
|
-
treeRuntimeRequirements.has(StartupHelpers_1.federationStartup);
|
|
66
|
-
if (!federation) {
|
|
67
|
-
return startupSource;
|
|
68
|
-
}
|
|
69
|
-
const entryModules = Array.from(chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk));
|
|
70
|
-
const entryGeneration = runtimeTemplate.outputOptions.module
|
|
71
|
-
? StartupHelpers_1.generateESMEntryStartup
|
|
72
|
-
: StartupHelpers_1.generateEntryStartup;
|
|
73
|
-
return new compiler.webpack.sources.ConcatSource(entryGeneration(compilation, chunkGraph, runtimeTemplate, entryModules, chunk, false));
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
78
59
|
exports.default = StartupChunkDependenciesPlugin;
|
|
79
60
|
//# sourceMappingURL=MfStartupChunkDependenciesPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MfStartupChunkDependenciesPlugin.js","
|
|
1
|
+
{"version":3,"file":"MfStartupChunkDependenciesPlugin.js","names":["ContainerEntryModule","federationStartup","generateESMEntryStartup","generateEntryStartup"],"sources":["../../../../src/lib/startup/MfStartupChunkDependenciesPlugin.ts"],"sourcesContent":["'use strict';\n\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport {\n federationStartup,\n generateEntryStartup,\n generateESMEntryStartup,\n} from './StartupHelpers';\nimport type { Compiler, Chunk } from 'webpack';\nimport ContainerEntryModule from '../container/ContainerEntryModule';\n\nconst { RuntimeGlobals } = require(\n normalizeWebpackPath('webpack'),\n) as typeof import('webpack');\nconst StartupEntrypointRuntimeModule = require(\n normalizeWebpackPath('webpack/lib/runtime/StartupEntrypointRuntimeModule'),\n) as typeof import('webpack/lib/runtime/StartupEntrypointRuntimeModule');\n\ninterface Options {\n asyncChunkLoading?: boolean;\n}\n\nclass StartupChunkDependenciesPlugin {\n asyncChunkLoading: boolean;\n\n constructor(options: Options) {\n this.asyncChunkLoading = options.asyncChunkLoading ?? true;\n }\n\n private isEnabledForChunk(chunk: Chunk, compilation: any): boolean {\n if (chunk.id === 'build time chunk') return false;\n\n const [finalEntry] =\n Array.from(\n compilation.chunkGraph.getChunkEntryModulesIterable(chunk),\n ).reverse() || [];\n\n return !(finalEntry instanceof ContainerEntryModule);\n }\n\n apply(compiler: Compiler): void {\n compiler.hooks.thisCompilation.tap(\n 'MfStartupChunkDependenciesPlugin',\n (compilation) => {\n // Add additional runtime requirements at the tree level.\n compilation.hooks.additionalTreeRuntimeRequirements.tap(\n 'StartupChunkDependenciesPlugin',\n (chunk, set, { chunkGraph }) => {\n if (!this.isEnabledForChunk(chunk, compilation)) return;\n if (chunk.hasRuntime()) {\n set.add(RuntimeGlobals.startupEntrypoint);\n set.add(RuntimeGlobals.ensureChunk);\n set.add(RuntimeGlobals.ensureChunkIncludeEntries);\n }\n },\n );\n\n // Add additional runtime requirements at the chunk level if there are entry modules.\n compilation.hooks.additionalChunkRuntimeRequirements.tap(\n 'MfStartupChunkDependenciesPlugin',\n (chunk, set, { chunkGraph }) => {\n if (!this.isEnabledForChunk(chunk, compilation)) return;\n if (chunkGraph.getNumberOfEntryModules(chunk) === 0) return;\n set.add(federationStartup);\n },\n );\n\n // When the startupEntrypoint requirement is present, add extra keys and a runtime module.\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.startupEntrypoint)\n .tap(\n 'StartupChunkDependenciesPlugin',\n (chunk, set, { chunkGraph }) => {\n if (!this.isEnabledForChunk(chunk, compilation)) return;\n set.add(RuntimeGlobals.require);\n set.add(RuntimeGlobals.ensureChunk);\n set.add(RuntimeGlobals.ensureChunkIncludeEntries);\n compilation.addRuntimeModule(\n chunk,\n new StartupEntrypointRuntimeModule(this.asyncChunkLoading),\n );\n },\n );\n\n // Replace the generated startup with a custom version if entry modules exist.\n const { renderStartup } =\n compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(\n compilation,\n );\n\n renderStartup.tap(\n 'MfStartupChunkDependenciesPlugin',\n (startupSource, lastInlinedModule, renderContext) => {\n const { chunk, chunkGraph, runtimeTemplate } = renderContext;\n\n if (!this.isEnabledForChunk(chunk, compilation)) {\n return startupSource;\n }\n\n if (chunkGraph.getNumberOfEntryModules(chunk) === 0) {\n return startupSource;\n }\n\n const treeRuntimeRequirements =\n chunkGraph.getTreeRuntimeRequirements(chunk);\n const chunkRuntimeRequirements =\n chunkGraph.getChunkRuntimeRequirements(chunk);\n\n const federation =\n chunkRuntimeRequirements.has(federationStartup) ||\n treeRuntimeRequirements.has(federationStartup);\n\n if (!federation) {\n return startupSource;\n }\n\n const entryModules = Array.from(\n chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk),\n );\n\n const entryGeneration = runtimeTemplate.outputOptions.module\n ? generateESMEntryStartup\n : generateEntryStartup;\n\n return new compiler.webpack.sources.ConcatSource(\n entryGeneration(\n compilation,\n chunkGraph,\n runtimeTemplate,\n entryModules,\n chunk,\n false,\n ),\n );\n },\n );\n },\n );\n }\n}\n\nexport default StartupChunkDependenciesPlugin;\n"],"mappings":";;;;;;;;;AAWA,MAAM,EAAE,mBAAmB,gFACJ,UAAU,CAChC;AACD,MAAM,iCAAiC,gFAChB,qDAAqD,CAC3E;AAMD,IAAM,iCAA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oB;AAE/C,QAAI,CAAC,KAAK,kBAAkB,OAAO,YAAY,CAC7C,QAAO;AAGT,QAAI,WAAW,wBAAwB,MAAM,KAAK,EAChD,QAAO;IAGT,MAAM,0BACJ,WAAW,2BAA2B,MAAM;AAQ9C,QAAI,EANF,WAAW,4BAA4B,MAAM,CAGpB,IAAIA,qDAAkB,IAC/C,wBAAwB,IAAIA,qDAAkB,EAG9C,QAAO;IAGT,MAAM,eAAe,MAAM,KACzB,WAAW,2CAA2C,MAAM,CAC7D;IAED,MAAM,kBAAkB,gBAAgB,cAAc,SAClDC,6DACAC;AAEJ,WAAO,IAAI,SAAS,QAAQ,QAAQ,aAClC,gBACE,aACA,YACA,iBACA,cACA,OACA,MACD,CACF;KAEJ;IAEJ"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Chunk, ChunkGraph, Compilation } from "webpack";
|
|
2
|
+
import { EntryModuleWithChunkGroup } from "webpack/lib/ChunkGraph";
|
|
3
|
+
import RuntimeTemplate from "webpack/lib/RuntimeTemplate";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/startup/StartupHelpers.d.ts
|
|
6
|
+
declare const federationStartup = "federation-entry-startup";
|
|
7
|
+
declare const generateEntryStartup: (compilation: Compilation, chunkGraph: ChunkGraph, runtimeTemplate: RuntimeTemplate, entries: EntryModuleWithChunkGroup[], chunk: Chunk, passive: boolean) => string;
|
|
8
|
+
declare const generateESMEntryStartup: (compilation: Compilation, chunkGraph: ChunkGraph, runtimeTemplate: RuntimeTemplate, entries: EntryModuleWithChunkGroup[], chunk: Chunk, passive: boolean) => string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { federationStartup, generateESMEntryStartup, generateEntryStartup };
|
|
11
|
+
//# sourceMappingURL=StartupHelpers.d.ts.map
|
|
@@ -1,186 +1,136 @@
|
|
|
1
|
-
/*
|
|
2
|
-
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
3
|
-
Author Tobias Koppers @sokra, Zack Jackson @ScriptedAlchemy
|
|
4
|
-
*/
|
|
5
1
|
'use strict';
|
|
6
|
-
|
|
7
|
-
exports
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const {
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.js');
|
|
5
|
+
let _module_federation_sdk_normalize_webpack_path = require("@module-federation/sdk/normalize-webpack-path");
|
|
6
|
+
|
|
7
|
+
//#region src/lib/startup/StartupHelpers.ts
|
|
8
|
+
const { RuntimeGlobals, Template } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack"));
|
|
9
|
+
const { isSubset } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/SetHelpers"));
|
|
10
|
+
const { getAllChunks } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/javascript/ChunkHelpers"));
|
|
11
|
+
const HotUpdateChunk = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/HotUpdateChunk"));
|
|
12
|
+
const { getUndoPath } = require((0, _module_federation_sdk_normalize_webpack_path.normalizeWebpackPath)("webpack/lib/util/identifier"));
|
|
14
13
|
const EXPORT_PREFIX = `var ${RuntimeGlobals.exports} = `;
|
|
15
|
-
|
|
16
|
-
// Abstracted from esm chunk format plugin in webpack, i only need the startup portion
|
|
17
|
-
// https://github.com/webpack/webpack/blob/c802a98f58e26dbfd727ee757ebad7c38b3c77aa/lib/esm/ModuleChunkFormatPlugin.js#L138
|
|
14
|
+
const federationStartup = "federation-entry-startup";
|
|
18
15
|
const generateEntryStartup = (compilation, chunkGraph, runtimeTemplate, entries, chunk, passive) => {
|
|
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
|
-
let currentModuleIds = undefined;
|
|
75
|
-
for (const [module, entrypoint] of entries) {
|
|
76
|
-
if (!entrypoint)
|
|
77
|
-
continue;
|
|
78
|
-
const runtimeChunk = entrypoint.getRuntimeChunk();
|
|
79
|
-
const moduleId = chunkGraph.getModuleId(module);
|
|
80
|
-
const chunks = getAllChunks(entrypoint, chunk, runtimeChunk);
|
|
81
|
-
if (currentChunks &&
|
|
82
|
-
currentChunks.size === chunks.size &&
|
|
83
|
-
isSubset(currentChunks, chunks)) {
|
|
84
|
-
currentModuleIds.push(moduleId);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
if (currentChunks) {
|
|
88
|
-
outputCombination(currentChunks, currentModuleIds);
|
|
89
|
-
}
|
|
90
|
-
currentChunks = chunks;
|
|
91
|
-
currentModuleIds = [moduleId];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// output current modules with export prefix
|
|
95
|
-
if (currentChunks) {
|
|
96
|
-
outputCombination(currentChunks, currentModuleIds, true);
|
|
97
|
-
}
|
|
98
|
-
runtime.push('');
|
|
99
|
-
return Template.asString(runtime);
|
|
16
|
+
/** @type {string[]} */
|
|
17
|
+
const runtime = [
|
|
18
|
+
`var __webpack_exec__ = ${runtimeTemplate.returningFunction(`${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, "moduleId")}`,
|
|
19
|
+
"",
|
|
20
|
+
"\n",
|
|
21
|
+
"var promises = [];",
|
|
22
|
+
"if (typeof __webpack_require__.x === \"function\") {",
|
|
23
|
+
" __webpack_require__.x();",
|
|
24
|
+
"} else {",
|
|
25
|
+
" console.warn(\"[Module Federation] __webpack_require__.x is not a function, skipping startup extension\");",
|
|
26
|
+
"}"
|
|
27
|
+
];
|
|
28
|
+
const treeRuntimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
|
|
29
|
+
const federation = chunkGraph.getChunkRuntimeRequirements(chunk).has(federationStartup) || treeRuntimeRequirements.has(federationStartup);
|
|
30
|
+
const runModule = (id) => {
|
|
31
|
+
return `__webpack_exec__(${JSON.stringify(id)})`;
|
|
32
|
+
};
|
|
33
|
+
const outputCombination = (chunks, moduleIds, final) => {
|
|
34
|
+
if (chunks.size === 0 && !federation) runtime.push(`${final ? EXPORT_PREFIX : ""}(${moduleIds.map(runModule).join(", ")});`);
|
|
35
|
+
else {
|
|
36
|
+
const fn = runtimeTemplate.returningFunction(moduleIds.map(runModule).join(", "));
|
|
37
|
+
if (federation) {
|
|
38
|
+
const chunkIds = Array.from(chunks, (c) => c.id);
|
|
39
|
+
const wrappedInit = (body) => Template.asString([
|
|
40
|
+
"Promise.all([",
|
|
41
|
+
Template.indent([`${RuntimeGlobals.ensureChunkHandlers}.consumes || function(chunkId, promises) {},`, `${RuntimeGlobals.ensureChunkHandlers}.remotes || function(chunkId, promises) {},`]),
|
|
42
|
+
`].reduce(${runtimeTemplate.returningFunction(`handler('${chunk.id}', p), p`, "p, handler")}, promises)`,
|
|
43
|
+
`).then(${runtimeTemplate.returningFunction(body)});`
|
|
44
|
+
]);
|
|
45
|
+
const wrap = wrappedInit(`${passive ? RuntimeGlobals.onChunksLoaded : RuntimeGlobals.startupEntrypoint}(0, ${JSON.stringify(chunkIds)}, ${fn})`);
|
|
46
|
+
runtime.push(`${final && !passive ? EXPORT_PREFIX : ""}${wrap}`);
|
|
47
|
+
} else {
|
|
48
|
+
const chunkIds = Array.from(chunks, (c) => c.id);
|
|
49
|
+
runtime.push(`${final && !passive ? EXPORT_PREFIX : ""}${passive ? RuntimeGlobals.onChunksLoaded : RuntimeGlobals.startupEntrypoint}(0, ${JSON.stringify(chunkIds)}, ${fn});`);
|
|
50
|
+
if (final && passive) runtime.push(`${EXPORT_PREFIX}${RuntimeGlobals.onChunksLoaded}();`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
let currentChunks = void 0;
|
|
55
|
+
let currentModuleIds = void 0;
|
|
56
|
+
for (const [module, entrypoint] of entries) {
|
|
57
|
+
if (!entrypoint) continue;
|
|
58
|
+
const runtimeChunk = entrypoint.getRuntimeChunk();
|
|
59
|
+
const moduleId = chunkGraph.getModuleId(module);
|
|
60
|
+
const chunks = getAllChunks(entrypoint, chunk, runtimeChunk);
|
|
61
|
+
if (currentChunks && currentChunks.size === chunks.size && isSubset(currentChunks, chunks)) currentModuleIds.push(moduleId);
|
|
62
|
+
else {
|
|
63
|
+
if (currentChunks) outputCombination(currentChunks, currentModuleIds);
|
|
64
|
+
currentChunks = chunks;
|
|
65
|
+
currentModuleIds = [moduleId];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (currentChunks) outputCombination(currentChunks, currentModuleIds, true);
|
|
69
|
+
runtime.push("");
|
|
70
|
+
return Template.asString(runtime);
|
|
100
71
|
};
|
|
101
|
-
exports.generateEntryStartup = generateEntryStartup;
|
|
102
72
|
const generateESMEntryStartup = (compilation, chunkGraph, runtimeTemplate, entries, chunk, passive) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const moduleId = chunkGraph.getModuleId(module);
|
|
161
|
-
const chunks = getAllChunks(entrypoint, runtimeChunk, undefined);
|
|
162
|
-
for (const chunk of chunks) {
|
|
163
|
-
if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph))
|
|
164
|
-
continue;
|
|
165
|
-
loadedChunks.add(chunk);
|
|
166
|
-
startupSource.add(`import * as __webpack_chunk_${index}__ from ${JSON.stringify(getRelativePath(chunk))};\n`);
|
|
167
|
-
startupSource.add(`${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n`);
|
|
168
|
-
index++;
|
|
169
|
-
}
|
|
170
|
-
// generateEntryStartup handles calling require and execution of the entry module.
|
|
171
|
-
if (!federation) {
|
|
172
|
-
startupSource.add(`${final ? EXPORT_PREFIX : ''}__webpack_exec__(${JSON.stringify(moduleId)});\n`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
if (federation) {
|
|
176
|
-
startupSource.add('\n');
|
|
177
|
-
// call original entry startup, which will template out the startup code now that the chunk installs are done
|
|
178
|
-
startupSource.add((0, exports.generateEntryStartup)(compilation, chunkGraph, runtimeTemplate, entries, chunk, passive));
|
|
179
|
-
}
|
|
180
|
-
return startupSource.source();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
return '';
|
|
73
|
+
const { chunkHasJs, getChunkFilenameTemplate } = compilation.compiler.webpack?.javascript?.JavascriptModulesPlugin || compilation.compiler.webpack.JavascriptModulesPlugin;
|
|
74
|
+
const { ConcatSource } = compilation.compiler.webpack.sources;
|
|
75
|
+
if (chunk instanceof HotUpdateChunk ? chunk : null) throw new Error("HMR is not implemented for module chunk format yet");
|
|
76
|
+
else {
|
|
77
|
+
const treeRuntimeRequirements = chunkGraph.getTreeRuntimeRequirements(chunk);
|
|
78
|
+
const federation = chunkGraph.getChunkRuntimeRequirements(chunk).has(federationStartup) || treeRuntimeRequirements.has(federationStartup);
|
|
79
|
+
if (entries.length > 0) {
|
|
80
|
+
const runtimeChunk = entries[0]?.[1]?.getRuntimeChunk?.();
|
|
81
|
+
if (!runtimeChunk) throw new Error("Runtime chunk is undefined");
|
|
82
|
+
const currentOutputName = compilation.getPath(getChunkFilenameTemplate(chunk, compilation.outputOptions), {
|
|
83
|
+
chunk,
|
|
84
|
+
contentHashType: "javascript"
|
|
85
|
+
}).replace(/^\/+/g, "").split("/");
|
|
86
|
+
/**
|
|
87
|
+
* @param {Chunk} chunk the chunk
|
|
88
|
+
* @returns {string} the relative path
|
|
89
|
+
*/
|
|
90
|
+
const getRelativePath = (chunk) => {
|
|
91
|
+
const baseOutputName = currentOutputName.slice();
|
|
92
|
+
const chunkOutputName = compilation.getPath(getChunkFilenameTemplate(chunk, compilation.outputOptions), {
|
|
93
|
+
chunk,
|
|
94
|
+
contentHashType: "javascript"
|
|
95
|
+
}).replace(/^\/+/g, "").split("/");
|
|
96
|
+
while (baseOutputName.length > 1 && chunkOutputName.length > 1 && baseOutputName[0] === chunkOutputName[0]) {
|
|
97
|
+
baseOutputName.shift();
|
|
98
|
+
chunkOutputName.shift();
|
|
99
|
+
}
|
|
100
|
+
const last = chunkOutputName.join("/");
|
|
101
|
+
return getUndoPath(baseOutputName.join("/"), last, true) + last;
|
|
102
|
+
};
|
|
103
|
+
const startupSource = new ConcatSource();
|
|
104
|
+
startupSource.add(`var __webpack_exec__ = ${runtimeTemplate.returningFunction(`${RuntimeGlobals.require}(${RuntimeGlobals.entryModuleId} = moduleId)`, "moduleId")}\n`);
|
|
105
|
+
const loadedChunks = /* @__PURE__ */ new Set();
|
|
106
|
+
let index = 0;
|
|
107
|
+
for (let i = 0; i < entries.length; i++) {
|
|
108
|
+
const [module, entrypoint] = entries[i];
|
|
109
|
+
if (!entrypoint) continue;
|
|
110
|
+
const final = i + 1 === entries.length;
|
|
111
|
+
const moduleId = chunkGraph.getModuleId(module);
|
|
112
|
+
const chunks = getAllChunks(entrypoint, runtimeChunk, void 0);
|
|
113
|
+
for (const chunk of chunks) {
|
|
114
|
+
if (loadedChunks.has(chunk) || !chunkHasJs(chunk, chunkGraph)) continue;
|
|
115
|
+
loadedChunks.add(chunk);
|
|
116
|
+
startupSource.add(`import * as __webpack_chunk_${index}__ from ${JSON.stringify(getRelativePath(chunk))};\n`);
|
|
117
|
+
startupSource.add(`${RuntimeGlobals.externalInstallChunk}(__webpack_chunk_${index}__);\n`);
|
|
118
|
+
index++;
|
|
119
|
+
}
|
|
120
|
+
if (!federation) startupSource.add(`${final ? EXPORT_PREFIX : ""}__webpack_exec__(${JSON.stringify(moduleId)});\n`);
|
|
121
|
+
}
|
|
122
|
+
if (federation) {
|
|
123
|
+
startupSource.add("\n");
|
|
124
|
+
startupSource.add(generateEntryStartup(compilation, chunkGraph, runtimeTemplate, entries, chunk, passive));
|
|
125
|
+
}
|
|
126
|
+
return startupSource.source();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return "";
|
|
184
130
|
};
|
|
131
|
+
|
|
132
|
+
//#endregion
|
|
133
|
+
exports.federationStartup = federationStartup;
|
|
185
134
|
exports.generateESMEntryStartup = generateESMEntryStartup;
|
|
135
|
+
exports.generateEntryStartup = generateEntryStartup;
|
|
186
136
|
//# sourceMappingURL=StartupHelpers.js.map
|