@module-federation/enhanced 0.1.5 → 0.1.7

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.
Files changed (194) hide show
  1. package/dist/package.json +67 -0
  2. package/dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts +57 -0
  3. package/dist/src/declarations/plugins/container/Dependency.d.ts +285 -0
  4. package/dist/src/declarations/plugins/container/Module.d.ts +138 -0
  5. package/dist/src/declarations/plugins/container/ModuleFactory.d.ts +33 -0
  6. package/dist/src/declarations/plugins/container/ObjectDeserializerContext.d.ts +4 -0
  7. package/dist/src/declarations/plugins/container/StaticExportsDependency.d.ts +28 -0
  8. package/dist/src/declarations/plugins/container/Template.d.ts +198 -0
  9. package/dist/src/declarations/plugins/container/WebpackError.d.ts +32 -0
  10. package/dist/src/declarations/plugins/container/WebpackOptions.d.ts +140 -0
  11. package/dist/src/declarations/plugins/sharing/ConsumeSharedPlugin.d.ts +74 -0
  12. package/dist/src/declarations/plugins/sharing/ProvideSharedPlugin.d.ts +67 -0
  13. package/dist/src/declarations/plugins/sharing/SharePlugin.d.ts +78 -0
  14. package/dist/src/index.d.ts +14 -0
  15. package/dist/src/index.js +37 -0
  16. package/dist/src/index.js.map +1 -0
  17. package/dist/src/lib/Constants.d.ts +117 -0
  18. package/dist/src/lib/Constants.js +125 -0
  19. package/dist/src/lib/Constants.js.map +1 -0
  20. package/dist/src/lib/RuntimeGlobals.d.ts +0 -0
  21. package/dist/src/lib/RuntimeGlobals.js +316 -0
  22. package/dist/src/lib/RuntimeGlobals.js.map +1 -0
  23. package/dist/src/lib/container/AsyncBoundaryPlugin.d.ts +20 -0
  24. package/dist/src/lib/container/AsyncBoundaryPlugin.js +183 -0
  25. package/dist/src/lib/container/AsyncBoundaryPlugin.js.map +1 -0
  26. package/dist/src/lib/container/ContainerEntryDependency.d.ts +24 -0
  27. package/dist/src/lib/container/ContainerEntryDependency.js +39 -0
  28. package/dist/src/lib/container/ContainerEntryDependency.js.map +1 -0
  29. package/dist/src/lib/container/ContainerEntryModule.d.ts +75 -0
  30. package/dist/src/lib/container/ContainerEntryModule.js +250 -0
  31. package/dist/src/lib/container/ContainerEntryModule.js.map +1 -0
  32. package/dist/src/lib/container/ContainerEntryModuleFactory.d.ts +15 -0
  33. package/dist/src/lib/container/ContainerEntryModuleFactory.js +30 -0
  34. package/dist/src/lib/container/ContainerEntryModuleFactory.js.map +1 -0
  35. package/dist/src/lib/container/ContainerExposedDependency.d.ts +19 -0
  36. package/dist/src/lib/container/ContainerExposedDependency.js +49 -0
  37. package/dist/src/lib/container/ContainerExposedDependency.js.map +1 -0
  38. package/dist/src/lib/container/ContainerPlugin.d.ts +13 -0
  39. package/dist/src/lib/container/ContainerPlugin.js +185 -0
  40. package/dist/src/lib/container/ContainerPlugin.js.map +1 -0
  41. package/dist/src/lib/container/ContainerReferencePlugin.d.ts +14 -0
  42. package/dist/src/lib/container/ContainerReferencePlugin.js +102 -0
  43. package/dist/src/lib/container/ContainerReferencePlugin.js.map +1 -0
  44. package/dist/src/lib/container/FallbackDependency.d.ts +15 -0
  45. package/dist/src/lib/container/FallbackDependency.js +47 -0
  46. package/dist/src/lib/container/FallbackDependency.js.map +1 -0
  47. package/dist/src/lib/container/FallbackItemDependency.d.ts +3 -0
  48. package/dist/src/lib/container/FallbackItemDependency.js +26 -0
  49. package/dist/src/lib/container/FallbackItemDependency.js.map +1 -0
  50. package/dist/src/lib/container/FallbackModule.d.ts +54 -0
  51. package/dist/src/lib/container/FallbackModule.js +152 -0
  52. package/dist/src/lib/container/FallbackModule.js.map +1 -0
  53. package/dist/src/lib/container/FallbackModuleFactory.d.ts +11 -0
  54. package/dist/src/lib/container/FallbackModuleFactory.js +28 -0
  55. package/dist/src/lib/container/FallbackModuleFactory.js.map +1 -0
  56. package/dist/src/lib/container/HoistContainerReferencesPlugin.d.ts +14 -0
  57. package/dist/src/lib/container/HoistContainerReferencesPlugin.js +61 -0
  58. package/dist/src/lib/container/HoistContainerReferencesPlugin.js.map +1 -0
  59. package/dist/src/lib/container/ModuleFederationPlugin.d.ts +16 -0
  60. package/dist/src/lib/container/ModuleFederationPlugin.js +122 -0
  61. package/dist/src/lib/container/ModuleFederationPlugin.js.map +1 -0
  62. package/dist/src/lib/container/RemoteModule.d.ts +90 -0
  63. package/dist/src/lib/container/RemoteModule.js +148 -0
  64. package/dist/src/lib/container/RemoteModule.js.map +1 -0
  65. package/dist/src/lib/container/RemoteRuntimeModule.d.ts +12 -0
  66. package/dist/src/lib/container/RemoteRuntimeModule.js +101 -0
  67. package/dist/src/lib/container/RemoteRuntimeModule.js.map +1 -0
  68. package/dist/src/lib/container/RemoteToExternalDependency.d.ts +4 -0
  69. package/dist/src/lib/container/RemoteToExternalDependency.js +26 -0
  70. package/dist/src/lib/container/RemoteToExternalDependency.js.map +1 -0
  71. package/dist/src/lib/container/constant.d.ts +3 -0
  72. package/dist/src/lib/container/constant.js +12 -0
  73. package/dist/src/lib/container/constant.js.map +1 -0
  74. package/dist/src/lib/container/options.d.ts +26 -0
  75. package/dist/src/lib/container/options.js +81 -0
  76. package/dist/src/lib/container/options.js.map +1 -0
  77. package/dist/src/lib/container/runtime/FederationRuntimeModule.d.ts +13 -0
  78. package/dist/src/lib/container/runtime/FederationRuntimeModule.js +27 -0
  79. package/dist/src/lib/container/runtime/FederationRuntimeModule.js.map +1 -0
  80. package/dist/src/lib/container/runtime/FederationRuntimePlugin.d.ts +17 -0
  81. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js +209 -0
  82. package/dist/src/lib/container/runtime/FederationRuntimePlugin.js.map +1 -0
  83. package/dist/src/lib/container/runtime/getFederationGlobal.d.ts +5 -0
  84. package/dist/src/lib/container/runtime/getFederationGlobal.js +24 -0
  85. package/dist/src/lib/container/runtime/getFederationGlobal.js.map +1 -0
  86. package/dist/src/lib/container/runtime/utils.d.ts +16 -0
  87. package/dist/src/lib/container/runtime/utils.js +83 -0
  88. package/dist/src/lib/container/runtime/utils.js.map +1 -0
  89. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.d.ts +3 -0
  90. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js +26 -0
  91. package/dist/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -0
  92. package/dist/src/lib/sharing/ConsumeSharedModule.d.ts +99 -0
  93. package/dist/src/lib/sharing/ConsumeSharedModule.js +206 -0
  94. package/dist/src/lib/sharing/ConsumeSharedModule.js.map +1 -0
  95. package/dist/src/lib/sharing/ConsumeSharedPlugin.d.ts +30 -0
  96. package/dist/src/lib/sharing/ConsumeSharedPlugin.js +245 -0
  97. package/dist/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -0
  98. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.d.ts +31 -0
  99. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js +124 -0
  100. package/dist/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -0
  101. package/dist/src/lib/sharing/ProvideForSharedDependency.d.ts +3 -0
  102. package/dist/src/lib/sharing/ProvideForSharedDependency.js +27 -0
  103. package/dist/src/lib/sharing/ProvideForSharedDependency.js.map +1 -0
  104. package/dist/src/lib/sharing/ProvideSharedDependency.d.ts +36 -0
  105. package/dist/src/lib/sharing/ProvideSharedDependency.js +70 -0
  106. package/dist/src/lib/sharing/ProvideSharedDependency.js.map +1 -0
  107. package/dist/src/lib/sharing/ProvideSharedModule.d.ts +67 -0
  108. package/dist/src/lib/sharing/ProvideSharedModule.js +186 -0
  109. package/dist/src/lib/sharing/ProvideSharedModule.js.map +1 -0
  110. package/dist/src/lib/sharing/ProvideSharedModuleFactory.d.ts +18 -0
  111. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js +30 -0
  112. package/dist/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -0
  113. package/dist/src/lib/sharing/ProvideSharedPlugin.d.ts +47 -0
  114. package/dist/src/lib/sharing/ProvideSharedPlugin.js +195 -0
  115. package/dist/src/lib/sharing/ProvideSharedPlugin.js.map +1 -0
  116. package/dist/src/lib/sharing/SharePlugin.d.ts +41 -0
  117. package/dist/src/lib/sharing/SharePlugin.js +79 -0
  118. package/dist/src/lib/sharing/SharePlugin.js.map +1 -0
  119. package/dist/src/lib/sharing/ShareRuntimeModule.d.ts +14 -0
  120. package/dist/src/lib/sharing/ShareRuntimeModule.js +102 -0
  121. package/dist/src/lib/sharing/ShareRuntimeModule.js.map +1 -0
  122. package/dist/src/lib/sharing/resolveMatchedConfigs.d.ts +12 -0
  123. package/dist/src/lib/sharing/resolveMatchedConfigs.js +66 -0
  124. package/dist/src/lib/sharing/resolveMatchedConfigs.js.map +1 -0
  125. package/dist/src/lib/sharing/utils.d.ts +37 -0
  126. package/dist/src/lib/sharing/utils.js +359 -0
  127. package/dist/src/lib/sharing/utils.js.map +1 -0
  128. package/dist/src/rspack.d.ts +1 -0
  129. package/dist/src/rspack.js +6 -0
  130. package/dist/src/rspack.js.map +1 -0
  131. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
  132. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +19 -0
  133. package/dist/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
  134. package/dist/src/runtime.d.ts +1 -0
  135. package/dist/src/runtime.js +18 -0
  136. package/dist/src/runtime.js.map +1 -0
  137. package/dist/src/schemas/container/ContainerPlugin.check.d.ts +7 -0
  138. package/dist/src/schemas/container/ContainerPlugin.check.js +2318 -0
  139. package/dist/src/schemas/container/ContainerPlugin.check.js.map +1 -0
  140. package/dist/src/schemas/container/ContainerPlugin.d.ts +289 -0
  141. package/dist/src/schemas/container/ContainerPlugin.js +326 -0
  142. package/dist/src/schemas/container/ContainerPlugin.js.map +1 -0
  143. package/dist/src/schemas/container/ContainerReferencePlugin.check.d.ts +7 -0
  144. package/dist/src/schemas/container/ContainerReferencePlugin.check.js +939 -0
  145. package/dist/src/schemas/container/ContainerReferencePlugin.check.js.map +1 -0
  146. package/dist/src/schemas/container/ContainerReferencePlugin.d.ts +87 -0
  147. package/dist/src/schemas/container/ContainerReferencePlugin.js +132 -0
  148. package/dist/src/schemas/container/ContainerReferencePlugin.js.map +1 -0
  149. package/dist/src/schemas/container/ModuleFederationPlugin.check.d.ts +9 -0
  150. package/dist/src/schemas/container/ModuleFederationPlugin.check.js +4001 -0
  151. package/dist/src/schemas/container/ModuleFederationPlugin.check.js.map +1 -0
  152. package/dist/src/schemas/container/ModuleFederationPlugin.d.ts +626 -0
  153. package/dist/src/schemas/container/ModuleFederationPlugin.js +720 -0
  154. package/dist/src/schemas/container/ModuleFederationPlugin.js.map +1 -0
  155. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.d.ts +7 -0
  156. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js +434 -0
  157. package/dist/src/schemas/sharing/ProviderSharedPlugin.check.js.map +1 -0
  158. package/dist/src/schemas/sharing/ProviderSharedPlugin.d.ts +104 -0
  159. package/dist/src/schemas/sharing/ProviderSharedPlugin.js +119 -0
  160. package/dist/src/schemas/sharing/ProviderSharedPlugin.js.map +1 -0
  161. package/dist/src/types/runtime.d.ts +7 -0
  162. package/dist/src/types/runtime.js +3 -0
  163. package/dist/src/types/runtime.js.map +1 -0
  164. package/dist/src/webpack.d.ts +1 -0
  165. package/dist/src/webpack.js +9 -0
  166. package/dist/src/webpack.js.map +1 -0
  167. package/dist/src/wrapper/AsyncBoundaryPlugin.d.ts +8 -0
  168. package/dist/src/wrapper/AsyncBoundaryPlugin.js +19 -0
  169. package/dist/src/wrapper/AsyncBoundaryPlugin.js.map +1 -0
  170. package/dist/src/wrapper/ConsumeSharedPlugin.d.ts +8 -0
  171. package/dist/src/wrapper/ConsumeSharedPlugin.js +19 -0
  172. package/dist/src/wrapper/ConsumeSharedPlugin.js.map +1 -0
  173. package/dist/src/wrapper/ContainerPlugin.d.ts +8 -0
  174. package/dist/src/wrapper/ContainerPlugin.js +19 -0
  175. package/dist/src/wrapper/ContainerPlugin.js.map +1 -0
  176. package/dist/src/wrapper/ContainerReferencePlugin.d.ts +8 -0
  177. package/dist/src/wrapper/ContainerReferencePlugin.js +19 -0
  178. package/dist/src/wrapper/ContainerReferencePlugin.js.map +1 -0
  179. package/dist/src/wrapper/FederationRuntimePlugin.d.ts +9 -0
  180. package/dist/src/wrapper/FederationRuntimePlugin.js +22 -0
  181. package/dist/src/wrapper/FederationRuntimePlugin.js.map +1 -0
  182. package/dist/src/wrapper/HoistContainerReferencesPlugin.d.ts +6 -0
  183. package/dist/src/wrapper/HoistContainerReferencesPlugin.js +18 -0
  184. package/dist/src/wrapper/HoistContainerReferencesPlugin.js.map +1 -0
  185. package/dist/src/wrapper/ModuleFederationPlugin.d.ts +8 -0
  186. package/dist/src/wrapper/ModuleFederationPlugin.js +24 -0
  187. package/dist/src/wrapper/ModuleFederationPlugin.js.map +1 -0
  188. package/dist/src/wrapper/ProvideSharedPlugin.d.ts +8 -0
  189. package/dist/src/wrapper/ProvideSharedPlugin.js +19 -0
  190. package/dist/src/wrapper/ProvideSharedPlugin.js.map +1 -0
  191. package/dist/src/wrapper/SharePlugin.d.ts +8 -0
  192. package/dist/src/wrapper/SharePlugin.js +19 -0
  193. package/dist/src/wrapper/SharePlugin.js.map +1 -0
  194. package/package.json +8 -8
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
4
+ const SortableSet = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/SortableSet'));
5
+ class AsyncEntryStartupPlugin {
6
+ constructor(options) {
7
+ this._runtimeChunks = new Map();
8
+ this._options = options || {};
9
+ }
10
+ apply(compiler) {
11
+ compiler.hooks.thisCompilation.tap('AsyncEntryStartupPlugin', (compilation) => {
12
+ this._collectRuntimeChunks(compilation);
13
+ this._handleRenderStartup(compiler, compilation);
14
+ });
15
+ }
16
+ _collectRuntimeChunks(compilation) {
17
+ compilation.hooks.beforeChunkAssets.tap('AsyncEntryStartupPlugin', () => {
18
+ for (const chunk of compilation.chunks) {
19
+ if (chunk.hasRuntime() && chunk.id !== null) {
20
+ this._runtimeChunks.set(chunk.id, chunk);
21
+ for (const dependentChunk of compilation.chunkGraph.getChunkEntryDependentChunksIterable(chunk)) {
22
+ if (dependentChunk.id !== null) {
23
+ this._runtimeChunks.set(dependentChunk.id, dependentChunk);
24
+ }
25
+ }
26
+ }
27
+ }
28
+ });
29
+ }
30
+ getChunkByName(compilation, dependOn) {
31
+ const byname = [];
32
+ for (const name of dependOn) {
33
+ const chunk = compilation.namedChunks.get(name);
34
+ if (chunk) {
35
+ byname.push(chunk.id || chunk.name);
36
+ }
37
+ }
38
+ return byname;
39
+ }
40
+ _handleRenderStartup(compiler, compilation) {
41
+ compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation).renderStartup.tap('AsyncEntryStartupPlugin', (source, _renderContext, upperContext) => {
42
+ const isSingleRuntime = compiler.options?.optimization?.runtimeChunk;
43
+ if (upperContext?.chunk.id && isSingleRuntime) {
44
+ if (upperContext?.chunk.hasRuntime()) {
45
+ this._runtimeChunks.set(upperContext.chunk.id, upperContext.chunk);
46
+ return source;
47
+ }
48
+ }
49
+ if (this._options.excludeChunk &&
50
+ this._options.excludeChunk(upperContext.chunk)) {
51
+ return source;
52
+ }
53
+ const runtime = this._getChunkRuntime(upperContext);
54
+ let remotes = '';
55
+ let shared = '';
56
+ for (const runtimeItem of runtime) {
57
+ if (!runtimeItem) {
58
+ continue;
59
+ }
60
+ const requirements = compilation.chunkGraph.getTreeRuntimeRequirements(runtimeItem);
61
+ const hasRemoteModules = compilation.chunkGraph.getChunkModulesIterableBySourceType(upperContext.chunk, 'remote');
62
+ const consumeShares = compilation.chunkGraph.getChunkModulesIterableBySourceType(upperContext.chunk, 'consume-shared');
63
+ const entryOptions = upperContext.chunk.getEntryOptions();
64
+ const initialChunks = Array.from(upperContext.chunk.getAllInitialChunks()).map((chunk) => chunk.id);
65
+ const dependOn = entryOptions?.dependOn || [];
66
+ const dependOnIDs = this.getChunkByName(compilation, dependOn);
67
+ const chunksToRef = [...dependOnIDs, ...initialChunks];
68
+ remotes = this._getRemotes(compiler.webpack.RuntimeGlobals, requirements, Boolean(hasRemoteModules), chunksToRef, remotes);
69
+ shared = this._getShared(compiler.webpack.RuntimeGlobals, requirements, Boolean(consumeShares), chunksToRef, shared);
70
+ }
71
+ if (!remotes && !shared) {
72
+ return source;
73
+ }
74
+ const initialEntryModules = this._getInitialEntryModules(compilation, upperContext);
75
+ const templateString = this._getTemplateString(compiler, initialEntryModules, shared, remotes, source);
76
+ return new compiler.webpack.sources.ConcatSource(templateString);
77
+ });
78
+ }
79
+ _getChunkRuntime(upperContext) {
80
+ const runtime = new Set();
81
+ const chunkRuntime = upperContext.chunk.runtime;
82
+ if (chunkRuntime) {
83
+ const runtimeItems = chunkRuntime instanceof SortableSet ? chunkRuntime : [chunkRuntime];
84
+ for (const runtimeItem of runtimeItems) {
85
+ const chunk = this._runtimeChunks.get(runtimeItem);
86
+ if (chunk) {
87
+ runtime.add(chunk);
88
+ }
89
+ }
90
+ }
91
+ if (runtime.size === 0) {
92
+ runtime.add(upperContext.chunk);
93
+ }
94
+ return runtime;
95
+ }
96
+ _getRemotes(runtimeGlobals, requirements, hasRemoteModules, chunksToRef, remotes) {
97
+ if (!requirements.has(runtimeGlobals.currentRemoteGetScope) &&
98
+ !hasRemoteModules &&
99
+ !requirements.has('__webpack_require__.vmok')) {
100
+ return remotes;
101
+ }
102
+ const remotesParts = remotes.startsWith('if(__webpack_require__.f && __webpack_require__.f.remotes) {')
103
+ ? [remotes]
104
+ : [
105
+ remotes,
106
+ 'if(__webpack_require__.f && __webpack_require__.f.remotes) {',
107
+ ];
108
+ for (const chunkId of chunksToRef) {
109
+ if (chunkId !== null && chunkId !== undefined) {
110
+ remotesParts.push(` __webpack_require__.f.remotes(${JSON.stringify(chunkId)}, promiseTrack);`);
111
+ }
112
+ }
113
+ remotesParts.push('}');
114
+ return remotesParts.join('');
115
+ }
116
+ _getShared(runtimeGlobals, requirements, consumeShares, chunksToRef, shared) {
117
+ if (!requirements.has(runtimeGlobals.shareScopeMap) &&
118
+ !consumeShares &&
119
+ !requirements.has(runtimeGlobals.initializeSharing)) {
120
+ return shared;
121
+ }
122
+ const sharedParts = shared.startsWith('if(__webpack_require__.f && __webpack_require__.f.consumes) {')
123
+ ? [shared]
124
+ : [
125
+ shared,
126
+ 'if(__webpack_require__.f && __webpack_require__.f.consumes) {',
127
+ ];
128
+ for (const chunkId of chunksToRef) {
129
+ if (chunkId !== null && chunkId !== undefined) {
130
+ sharedParts.push(` __webpack_require__.f.consumes(${JSON.stringify(chunkId)}, promiseTrack);`);
131
+ }
132
+ }
133
+ sharedParts.push('}');
134
+ return sharedParts.join('');
135
+ }
136
+ _getInitialEntryModules(compilation, upperContext) {
137
+ const entryModules = compilation.chunkGraph.getChunkEntryModulesIterable(upperContext.chunk);
138
+ const initialEntryModules = [];
139
+ for (const entryModule of entryModules) {
140
+ const entryModuleID = compilation.chunkGraph.getModuleId(entryModule);
141
+ if (entryModuleID) {
142
+ let shouldInclude = false;
143
+ if (typeof this._options.eager === 'function') {
144
+ shouldInclude = this._options.eager(entryModule);
145
+ }
146
+ else if (this._options.eager &&
147
+ this._options.eager.test(entryModule.identifier())) {
148
+ shouldInclude = true;
149
+ }
150
+ if (shouldInclude) {
151
+ initialEntryModules.push(`__webpack_require__(${JSON.stringify(entryModuleID)});`);
152
+ }
153
+ }
154
+ }
155
+ return initialEntryModules;
156
+ }
157
+ _getTemplateString(compiler, initialEntryModules, shared, remotes, source) {
158
+ const { Template } = compiler.webpack;
159
+ if (compiler.options?.experiments?.topLevelAwait &&
160
+ compiler.options?.experiments?.outputModule) {
161
+ return Template.asString([
162
+ 'var promiseTrack = [];',
163
+ Template.asString(initialEntryModules),
164
+ shared,
165
+ remotes,
166
+ 'await Promise.all(promiseTrack)',
167
+ Template.indent(source.source().toString()),
168
+ ]);
169
+ }
170
+ return Template.asString([
171
+ 'var promiseTrack = [];',
172
+ Template.asString(initialEntryModules),
173
+ shared,
174
+ remotes,
175
+ 'var __webpack_exports__ = Promise.all(promiseTrack).then(function() {',
176
+ Template.indent(source.source().toString()),
177
+ Template.indent('return __webpack_exports__'),
178
+ '});',
179
+ ]);
180
+ }
181
+ }
182
+ exports.default = AsyncEntryStartupPlugin;
183
+ //# sourceMappingURL=AsyncBoundaryPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncBoundaryPlugin.js","sourceRoot":"","sources":["../../../../src/lib/container/AsyncBoundaryPlugin.ts"],"names":[],"mappings":";;AAAA,0FAAqF;AAYrF,MAAM,WAAW,GAAG,OAAO,CACzB,IAAA,6CAAoB,EAAC,8BAA8B,CAAC,CACJ,CAAC;AAoBnD,MAAM,uBAAuB;IAI3B,YAAY,OAAiB;QAFrB,mBAAc,GAAG,IAAI,GAAG,EAAsC,CAAC;QAGrE,IAAI,CAAC,QAAQ,GAAG,OAAO,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,QAAkB;QACtB,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAChC,yBAAyB,EACzB,CAAC,WAAwB,EAAE,EAAE;YAC3B,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;YACxC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACnD,CAAC,CACF,CAAC;IACJ,CAAC;IAEO,qBAAqB,CAAC,WAAwB;QACpD,WAAW,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,EAAE;YACtE,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;gBACvC,IAAI,KAAK,CAAC,UAAU,EAAE,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;oBAC5C,IAAI,CAAC,cAAc,CA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IAAI,aAAa,EAAE,CAAC;oBAClB,mBAAmB,CAAC,IAAI,CACtB,uBAAuB,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CACzD,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAEO,kBAAkB,CACxB,QAAkB,EAClB,mBAA6B,EAC7B,MAAc,EACd,OAAe,EACf,MAAsB;QAEtB,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,OAAO,CAAC;QACtC,IACE,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,aAAa;YAC5C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAC3C,CAAC;YACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;gBACvB,wBAAwB;gBACxB,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBACtC,MAAM;gBACN,OAAO;gBACP,iCAAiC;gBACjC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;aAC5C,CAAC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC;YACvB,wBAAwB;YACxB,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YACtC,MAAM;YACN,OAAO;YACP,uEAAuE;YACvE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC;YAC3C,QAAQ,CAAC,MAAM,CAAC,4BAA4B,CAAC;YAC7C,KAAK;SACN,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,uBAAuB,CAAC"}
@@ -0,0 +1,24 @@
1
+ export = ContainerEntryDependency;
2
+ /** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */
3
+ declare class ContainerEntryDependency extends Dependency {
4
+ /**
5
+ * @param {string} name entry name
6
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
7
+ * @param {string} shareScope name of the share scope
8
+ * @param {string[]} runtimePlugins Runtime plugin file paths or package name.
9
+ */
10
+ constructor(
11
+ name: string,
12
+ exposes: [string, ExposeOptions][],
13
+ shareScope: string,
14
+ runtimePlugins: string[],
15
+ );
16
+ name: string;
17
+ exposes: [string, import('./ContainerEntryModule').ExposeOptions][];
18
+ shareScope: string;
19
+ runtimePlugins: string[];
20
+ }
21
+ declare namespace ContainerEntryDependency {
22
+ export { ExposeOptions };
23
+ }
24
+ type ExposeOptions = import('./ContainerEntryModule').ExposeOptions;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /*
3
+ MIT License http://www.opensource.org/licenses/mit-license.php
4
+ Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
8
+ const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
9
+ const { Dependency } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
10
+ class ContainerEntryDependency extends Dependency {
11
+ /**
12
+ * @param {string} name entry name
13
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
14
+ * @param {string} shareScope name of the share scope
15
+ * @param {string[]} injectRuntimeEntry the path of injectRuntime file.
16
+ */
17
+ constructor(name, exposes, shareScope, injectRuntimeEntry) {
18
+ super();
19
+ this.name = name;
20
+ this.exposes = exposes;
21
+ this.shareScope = shareScope;
22
+ this.injectRuntimeEntry = injectRuntimeEntry;
23
+ }
24
+ /**
25
+ * @returns {string | null} an identifier to merge equal requests
26
+ */
27
+ getResourceIdentifier() {
28
+ return `container-entry-${this.name}`;
29
+ }
30
+ get type() {
31
+ return 'container entry';
32
+ }
33
+ get category() {
34
+ return 'esm';
35
+ }
36
+ }
37
+ makeSerializable(ContainerEntryDependency, 'enhanced/lib/container/ContainerEntryDependency');
38
+ exports.default = ContainerEntryDependency;
39
+ //# sourceMappingURL=ContainerEntryDependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContainerEntryDependency.js","sourceRoot":"","sources":["../../../../src/lib/container/ContainerEntryDependency.ts"],"names":[],"mappings":";AAAA;;;EAGE;;AAGF,0FAAqF;AAErF,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CAC1D,CAAC;AACF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAC5B,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAE9B,MAAM,wBAAyB,SAAQ,UAAU;IAM/C;;;;;OAKG;IACH,YACE,IAAY,EACZ,OAAkC,EAClC,UAAkB,EAClB,kBAA0B;QAE1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;IAED;;OAEG;IACM,qBAAqB;QAC5B,OAAO,mBAAmB,IAAI,CAAC,IAAI,EAAE,CAAC;IACxC,CAAC;IAED,IAAa,IAAI;QACf,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,IAAa,QAAQ;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,gBAAgB,CACd,wBAAwB,EACxB,iDAAiD,CAClD,CAAC;AAEF,kBAAe,wBAAwB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import Module = require('webpack/lib/Module');
2
+ export type ExposeOptions = {
3
+ /**
4
+ * requests to exposed modules (last one is exported)
5
+ */
6
+ import: string[];
7
+ /**
8
+ * custom chunk name for the exposed module
9
+ */
10
+ name: string;
11
+ };
12
+ type ObjectDeserializerContext =
13
+ import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
14
+ type WebpackOptions = any;
15
+ type ChunkGraph = import('webpack/lib/ChunkGraph');
16
+ type ChunkGroup = import('webpack/lib/ChunkGroup');
17
+ type Compilation = import('webpack/lib/Compilation');
18
+ type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
19
+ type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
20
+ type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
21
+ type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
22
+ type RequestShortener = import('webpack/lib/RequestShortener');
23
+ type ResolverWithOptions =
24
+ import('webpack/lib/ResolverFactory').ResolverWithOptions;
25
+ type WebpackError = import('webpack/lib/WebpackError');
26
+ type ObjectSerializerContext =
27
+ import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
28
+ type Hash = import('webpack/lib/util/Hash');
29
+ type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
30
+ type ContainerEntryDependency = typeof import('./ContainerEntryDependency');
31
+
32
+ declare class ContainerEntryModule extends Module {
33
+ /**
34
+ * @param {ObjectDeserializerContext} context context
35
+ * @returns {ContainerEntryModule} deserialized container entry module
36
+ */
37
+ static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
38
+ /**
39
+ * @param {string} name container entry name
40
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
41
+ * @param {string} shareScope name of the share scope
42
+ * @param {string[]} runtimePlugins Runtime plugin file paths or package name.
43
+ */
44
+ constructor(
45
+ name: string,
46
+ exposes: [string, ExposeOptions][],
47
+ shareScope: string,
48
+ );
49
+ _name: string;
50
+ _exposes: [string, ExposeOptions][];
51
+ _shareScope: string;
52
+ runtimePlugins: string[];
53
+ }
54
+ declare namespace ContainerEntryModule {
55
+ export {
56
+ WebpackOptions,
57
+ ChunkGraph,
58
+ ChunkGroup,
59
+ Compilation,
60
+ CodeGenerationContext,
61
+ CodeGenerationResult,
62
+ LibIdentOptions,
63
+ NeedBuildContext,
64
+ RequestShortener,
65
+ ResolverWithOptions,
66
+ WebpackError,
67
+ ObjectDeserializerContext,
68
+ ObjectSerializerContext,
69
+ Hash,
70
+ InputFileSystem,
71
+ ContainerEntryDependency,
72
+ ExposeOptions,
73
+ };
74
+ }
75
+ export default ContainerEntryModule;
@@ -0,0 +1,250 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
4
+ */
5
+ 'use strict';
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
+ const ContainerExposedDependency_1 = __importDefault(require("./ContainerExposedDependency"));
12
+ const utils_1 = require("./runtime/utils");
13
+ const Constants_1 = require("../Constants");
14
+ const makeSerializable = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/makeSerializable'));
15
+ const { sources: webpackSources } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
16
+ const { AsyncDependenciesBlock, Template, Module, RuntimeGlobals } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
17
+ const StaticExportsDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/StaticExportsDependency'));
18
+ const EntryDependency = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/dependencies/EntryDependency'));
19
+ const SOURCE_TYPES = new Set(['javascript']);
20
+ class ContainerEntryModule extends Module {
21
+ /**
22
+ * @param {string} name container entry name
23
+ * @param {[string, ExposeOptions][]} exposes list of exposed modules
24
+ * @param {string} shareScope name of the share scope
25
+ */
26
+ constructor(name, exposes, shareScope, injectRuntimeEntry) {
27
+ super(Constants_1.JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);
28
+ this._name = name;
29
+ this._exposes = exposes;
30
+ this._shareScope = shareScope;
31
+ this._injectRuntimeEntry = injectRuntimeEntry;
32
+ }
33
+ /**
34
+ * @param {ObjectDeserializerContext} context context
35
+ * @returns {ContainerEntryModule} deserialized container entry module
36
+ */
37
+ static deserialize(context) {
38
+ const { read } = context;
39
+ const obj = new ContainerEntryModule(read(), read(), read(), read());
40
+ //@ts-ignore
41
+ obj.deserialize(context);
42
+ return obj;
43
+ }
44
+ /**
45
+ * @returns {Set<string>} types available (do not mutate)
46
+ */
47
+ getSourceTypes() {
48
+ return SOURCE_TYPES;
49
+ }
50
+ /**
51
+ * @returns {string} a unique identifier of the module
52
+ */
53
+ identifier() {
54
+ return `container entry (${this._shareScope}) ${JSON.stringify(this._exposes)}`;
55
+ }
56
+ /**
57
+ * @param {RequestShortener} requestShortener the request shortener
58
+ * @returns {string} a user readable identifier of the module
59
+ */
60
+ readableIdentifier(requestShortener) {
61
+ return 'container entry';
62
+ }
63
+ /**
64
+ * @param {LibIdentOptions} options options
65
+ * @returns {string | null} an identifier for library inclusion
66
+ */
67
+ libIdent(options) {
68
+ return `${this.layer ? `(${this.layer})/` : ''}webpack/container/entry/${this._name}`;
69
+ }
70
+ /**
71
+ * @param {NeedBuildContext} context context info
72
+ * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
73
+ * @returns {void}
74
+ */
75
+ // @ts-ignore typeof webpack/lib !== typeof webpack/types
76
+ needBuild(context, callback) {
77
+ const baseContext = context;
78
+ callback(null, !this.buildMeta);
79
+ }
80
+ /**
81
+ * @param {WebpackOptions} options webpack options
82
+ * @param {Compilation} compilation the compilation
83
+ * @param {ResolverWithOptions} resolver the resolver
84
+ * @param {InputFileSystem} fs the file system
85
+ * @param {function(WebpackError): void} callback callback function
86
+ * @returns {void}
87
+ */
88
+ // @ts-ignore typeof webpack/lib !== typeof webpack/types
89
+ build(options, compilation, resolver, fs, callback) {
90
+ this.buildMeta = {};
91
+ this.buildInfo = {
92
+ strict: true,
93
+ topLevelDeclarations: new Set(['moduleMap', 'get', 'init']),
94
+ };
95
+ this.buildMeta.exportsType = 'namespace';
96
+ //@ts-ignore
97
+ this.clearDependenciesAndBlocks();
98
+ for (const [name, options] of this._exposes) {
99
+ const block = new AsyncDependenciesBlock({
100
+ name: options.name,
101
+ }, { name }, options.import[options.import.length - 1]);
102
+ let idx = 0;
103
+ for (const request of options.import) {
104
+ const dep = new ContainerExposedDependency_1.default(name, request);
105
+ dep.loc = {
106
+ name,
107
+ index: idx++,
108
+ };
109
+ //@ts-ignore
110
+ block.addDependency(dep);
111
+ }
112
+ //@ts-ignore
113
+ this.addBlock(block);
114
+ }
115
+ //@ts-ignore
116
+ this.addDependency(
117
+ //@ts-ignore
118
+ new StaticExportsDependency(['get', 'init'], false));
119
+ this.addDependency(
120
+ // @ts-ignore
121
+ new EntryDependency(this._injectRuntimeEntry));
122
+ callback();
123
+ }
124
+ /**
125
+ * @param {CodeGenerationContext} context context for code generation
126
+ * @returns {CodeGenerationResult} result
127
+ */
128
+ //@ts-ignore
129
+ codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {
130
+ const sources = new Map();
131
+ const runtimeRequirements = new Set([
132
+ RuntimeGlobals.definePropertyGetters,
133
+ RuntimeGlobals.hasOwnProperty,
134
+ RuntimeGlobals.exports,
135
+ ]);
136
+ const getters = [];
137
+ for (const block of this.blocks) {
138
+ const { dependencies } = block;
139
+ const modules = dependencies.map((dependency) => {
140
+ const dep = dependency;
141
+ return {
142
+ name: dep.exposedName,
143
+ module: moduleGraph.getModule(dep),
144
+ request: dep.userRequest,
145
+ };
146
+ });
147
+ let str;
148
+ if (modules.some((m) => !m.module)) {
149
+ str = runtimeTemplate.throwMissingModuleErrorBlock({
150
+ request: modules.map((m) => m.request).join(', '),
151
+ });
152
+ }
153
+ else {
154
+ str = `return ${runtimeTemplate.blockPromise({
155
+ block,
156
+ message: '',
157
+ chunkGraph,
158
+ runtimeRequirements,
159
+ })}.then(${runtimeTemplate.returningFunction(runtimeTemplate.returningFunction(`(${modules
160
+ //@ts-ignore
161
+ .map(({ module, request }) => runtimeTemplate.moduleRaw({
162
+ module,
163
+ chunkGraph,
164
+ request,
165
+ weak: false,
166
+ runtimeRequirements,
167
+ }))
168
+ .join(', ')})`))});`;
169
+ }
170
+ getters.push(`${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction('', str)}`);
171
+ }
172
+ const initRuntimeDep = this.dependencies[1];
173
+ const initRuntimeModuleGetter = runtimeTemplate.moduleRaw({
174
+ module: moduleGraph.getModule(initRuntimeDep),
175
+ chunkGraph,
176
+ // @ts-expect-error
177
+ request: initRuntimeDep.userRequest,
178
+ weak: false,
179
+ runtimeRequirements,
180
+ });
181
+ const federationGlobal = (0, utils_1.getFederationGlobalScope)(RuntimeGlobals || {});
182
+ const source = Template.asString([
183
+ `var moduleMap = {`,
184
+ Template.indent(getters.join(',\n')),
185
+ '};',
186
+ `var get = ${runtimeTemplate.basicFunction('module, getScope', [
187
+ `${RuntimeGlobals.currentRemoteGetScope} = getScope;`,
188
+ // reusing the getScope variable to avoid creating a new var (and module is also used later)
189
+ 'getScope = (',
190
+ Template.indent([
191
+ `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`,
192
+ Template.indent([
193
+ '? moduleMap[module]()',
194
+ `: Promise.resolve().then(${runtimeTemplate.basicFunction('', "throw new Error('Module \"' + module + '\" does not exist in container.');")})`,
195
+ ]),
196
+ ]),
197
+ ');',
198
+ `${RuntimeGlobals.currentRemoteGetScope} = undefined;`,
199
+ 'return getScope;',
200
+ ])};`,
201
+ `var init = ${runtimeTemplate.basicFunction('shareScope, initScope, remoteEntryInitOptions', [
202
+ `return ${federationGlobal}.bundlerRuntime.initContainerEntry({${Template.indent([
203
+ `webpackRequire: ${RuntimeGlobals.require},`,
204
+ `shareScope: shareScope,`,
205
+ `initScope: initScope,`,
206
+ `remoteEntryInitOptions: remoteEntryInitOptions,`,
207
+ `shareScopeKey: ${JSON.stringify(this._shareScope)}`,
208
+ ])}`,
209
+ '})',
210
+ ])};`,
211
+ `${initRuntimeModuleGetter}`,
212
+ '',
213
+ '// This exports getters to disallow modifications',
214
+ `${RuntimeGlobals.definePropertyGetters}(exports, {`,
215
+ Template.indent([
216
+ `get: ${runtimeTemplate.returningFunction('get')},`,
217
+ `init: ${runtimeTemplate.returningFunction('init')}`,
218
+ ]),
219
+ '});',
220
+ ]);
221
+ sources.set('javascript', this.useSourceMap || this.useSimpleSourceMap
222
+ ? new webpackSources.OriginalSource(source, 'webpack/container-entry')
223
+ : new webpackSources.RawSource(source));
224
+ return {
225
+ sources,
226
+ runtimeRequirements,
227
+ };
228
+ }
229
+ /**
230
+ * @param {string=} type the source type for which the size should be estimated
231
+ * @returns {number} the estimated size of the module (must be non-zero)
232
+ */
233
+ size(type) {
234
+ return 42;
235
+ }
236
+ /**
237
+ * @param {ObjectSerializerContext} context context
238
+ */
239
+ serialize(context) {
240
+ const { write } = context;
241
+ write(this._name);
242
+ write(this._exposes);
243
+ write(this._shareScope);
244
+ write(this._injectRuntimeEntry);
245
+ super.serialize(context);
246
+ }
247
+ }
248
+ makeSerializable(ContainerEntryModule, 'enhanced/lib/container/ContainerEntryModule');
249
+ exports.default = ContainerEntryModule;
250
+ //# sourceMappingURL=ContainerEntryModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContainerEntryModule.js","sourceRoot":"","sources":["../../../../src/lib/container/ContainerEntryModule.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AACb,0FAAqF;AAErF,8FAAsE;AAYtE,2CAA2D;AAC3D,4CAA8D;AAE9D,MAAM,gBAAgB,GAAG,OAAO,CAC9B,IAAA,6CAAoB,EAAC,mCAAmC,CAAC,CACJ,CAAC;AACxD,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CACzC,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAC9B,MAAM,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,O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B,CAAC,MAAM,CAAC,EAAE;aACrD,CAAC;YACF,KAAK;SACN,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CACT,YAAY,EACZ,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,kBAAkB;YAC1C,CAAC,CAAC,IAAI,cAAc,CAAC,cAAc,CAAC,MAAM,EAAE,yBAAyB,CAAC;YACtE,CAAC,CAAC,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CACzC,CAAC;QAEF,OAAO;YACL,OAAO;YACP,mBAAmB;SACpB,CAAC;IACJ,CAAC;IAED;;;OAGG;IACM,IAAI,CAAC,IAAa;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD;;OAEG;IACM,SAAS,CAAC,OAAgC;QACjD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAChC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF;AACD,gBAAgB,CACd,oBAAoB,EACpB,6CAA6C,CAC9C,CAAC;AAEF,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,15 @@
1
+ export = ContainerEntryModuleFactory;
2
+ declare class ContainerEntryModuleFactory extends ModuleFactory {}
3
+ declare namespace ContainerEntryModuleFactory {
4
+ export {
5
+ ModuleFactoryCreateData,
6
+ ModuleFactoryResult,
7
+ ContainerEntryDependency,
8
+ };
9
+ }
10
+ import ModuleFactory = require('webpack/lib/ModuleFactory');
11
+ type ModuleFactoryCreateData =
12
+ import('webpack/lib/ModuleFactory').ModuleFactoryCreateData;
13
+ type ModuleFactoryResult =
14
+ import('webpack/lib/ModuleFactory').ModuleFactoryResult;
15
+ type ContainerEntryDependency = import('./ContainerEntryDependency');
@@ -0,0 +1,30 @@
1
+ /*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr
4
+ */
5
+ 'use strict';
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
11
+ const ContainerEntryModule_1 = __importDefault(require("./ContainerEntryModule"));
12
+ const ModuleFactory = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/ModuleFactory'));
13
+ class ContainerEntryModuleFactory extends ModuleFactory {
14
+ /**
15
+ * @param {ModuleFactoryCreateData} data data object
16
+ * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
17
+ * @returns {void}
18
+ */
19
+ create(data, callback) {
20
+ const { dependencies } = data;
21
+ const containerDependencies = dependencies;
22
+ const dep = containerDependencies[0];
23
+ callback(null, {
24
+ // @ts-ignore
25
+ module: new ContainerEntryModule_1.default(dep.name, dep.exposes, dep.shareScope, dep.injectRuntimeEntry),
26
+ });
27
+ }
28
+ }
29
+ exports.default = ContainerEntryModuleFactory;
30
+ //# sourceMappingURL=ContainerEntryModuleFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContainerEntryModuleFactory.js","sourceRoot":"","sources":["../../../../src/lib/container/ContainerEntryModuleFactory.ts"],"names":[],"mappings":"AAAA;;;EAGE;AAEF,YAAY,CAAC;;;;;AAEb,0FAAqF;AACrF,kFAA0D;AAG1D,MAAM,aAAa,GAAG,OAAO,CAC3B,IAAA,6CAAoB,EAAC,2BAA2B,CAAC,CACJ,CAAC;AAMhD,MAAqB,2BAA4B,SAAQ,aAAa;IACpE;;;;OAIG;IACM,MAAM,CACb,IAA6B,EAC7B,QAAoE;QAEpE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;QAC9B,MAAM,qBAAqB,GACzB,YAAqD,CAAC;QACxD,MAAM,GAAG,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAErC,QAAQ,CAAC,IAAI,EAAE;YACb,aAAa;YACb,MAAM,EAAE,IAAI,8BAAoB,CAC9B,GAAG,CAAC,IAAI,EACR,GAAG,CAAC,OAAO,EACX,GAAG,CAAC,UAAU,EACd,GAAG,CAAC,kBAAkB,CACvB;SACF,CAAC,CAAC;IACL,CAAC;CACF;AAzBD,8CAyBC"}