@module-federation/nextjs-mf 6.5.0 → 6.5.2-beta.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +280 -0
  2. package/README.md +3 -2
  3. package/package.json +5 -6
  4. package/src/default-delegate.d.ts +2 -0
  5. package/src/default-delegate.js +17 -0
  6. package/src/default-delegate.js.map +1 -0
  7. package/src/delegate-hoist-container.js +2 -0
  8. package/src/delegate-hoist-container.js.map +1 -0
  9. package/src/federation-noop.d.ts +1 -0
  10. package/src/federation-noop.js +3 -0
  11. package/src/federation-noop.js.map +1 -0
  12. package/src/index.d.ts +1 -1
  13. package/src/index.js +6 -5
  14. package/src/index.js.map +1 -1
  15. package/src/internal-delegate-hoist.js +1 -0
  16. package/src/internal-delegate-hoist.js.map +1 -1
  17. package/src/internal.d.ts +38 -9
  18. package/src/internal.js +164 -251
  19. package/src/internal.js.map +1 -1
  20. package/src/loaders/delegateLoader.js +2 -4
  21. package/src/loaders/delegateLoader.js.map +1 -1
  22. package/src/loaders/inject-hoist.d.ts +3 -0
  23. package/src/loaders/inject-hoist.js +8 -0
  24. package/src/loaders/inject-hoist.js.map +1 -0
  25. package/src/loaders/nextPageMapLoader.js +0 -2
  26. package/src/loaders/nextPageMapLoader.js.map +1 -1
  27. package/src/loaders/patchDefaultSharedLoader.d.ts +0 -5
  28. package/src/loaders/patchDefaultSharedLoader.js +20 -16
  29. package/src/loaders/patchDefaultSharedLoader.js.map +1 -1
  30. package/src/plugins/CopyFederationPlugin.d.ts +7 -0
  31. package/src/plugins/CopyFederationPlugin.js +48 -0
  32. package/src/plugins/CopyFederationPlugin.js.map +1 -0
  33. package/src/plugins/JsonpChunkLoading.d.ts +7 -0
  34. package/src/plugins/JsonpChunkLoading.js +41 -0
  35. package/src/plugins/JsonpChunkLoading.js.map +1 -0
  36. package/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +24 -0
  37. package/src/plugins/NextFederationPlugin/apply-client-plugins.js +78 -0
  38. package/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -0
  39. package/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +53 -0
  40. package/src/plugins/NextFederationPlugin/apply-server-plugins.js +159 -0
  41. package/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -0
  42. package/src/plugins/NextFederationPlugin/index.d.ts +18 -0
  43. package/src/plugins/NextFederationPlugin/index.js +136 -0
  44. package/src/plugins/NextFederationPlugin/index.js.map +1 -0
  45. package/src/plugins/NextFederationPlugin/next-fragments.d.ts +33 -0
  46. package/src/plugins/NextFederationPlugin/next-fragments.js +79 -0
  47. package/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -0
  48. package/src/plugins/NextFederationPlugin/regex-equal.d.ts +14 -0
  49. package/src/plugins/NextFederationPlugin/regex-equal.js +25 -0
  50. package/src/plugins/NextFederationPlugin/regex-equal.js.map +1 -0
  51. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +1 -0
  52. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +20 -0
  53. package/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +1 -0
  54. package/src/plugins/NextFederationPlugin/set-options.d.ts +20 -0
  55. package/src/plugins/NextFederationPlugin/set-options.js +33 -0
  56. package/src/plugins/NextFederationPlugin/set-options.js.map +1 -0
  57. package/src/plugins/NextFederationPlugin/validate-options.d.ts +26 -0
  58. package/src/plugins/NextFederationPlugin/validate-options.js +46 -0
  59. package/src/plugins/NextFederationPlugin/validate-options.js.map +1 -0
  60. package/src/plugins/container/InvertedContainerPlugin.d.ts +30 -0
  61. package/src/plugins/container/InvertedContainerPlugin.js +167 -0
  62. package/src/plugins/container/InvertedContainerPlugin.js.map +1 -0
  63. package/src/plugins/container/InvertedContainerRuntimeModule.d.ts +45 -0
  64. package/src/plugins/container/InvertedContainerRuntimeModule.js +521 -0
  65. package/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -0
  66. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +17 -0
  67. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +91 -0
  68. package/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +1 -0
  69. package/src/plugins/container/custom-jsonp.d.ts +2 -0
  70. package/src/plugins/container/custom-jsonp.js +122 -0
  71. package/src/plugins/container/custom-jsonp.js.map +1 -0
  72. package/src/plugins/container/types.d.ts +2 -0
  73. package/src/plugins/container/types.js +3 -0
  74. package/src/plugins/container/types.js.map +1 -0
  75. package/utils/Template.d.ts +1 -1
  76. package/utils/Template.js +1 -1
  77. package/utils/Template.js.map +1 -1
  78. package/utils/build-utils.d.ts +0 -8
  79. package/utils/build-utils.js +1 -228
  80. package/utils/build-utils.js.map +1 -1
  81. package/utils/flushedChunks.d.ts +7 -0
  82. package/utils/flushedChunks.js +37 -0
  83. package/utils/flushedChunks.js.map +1 -0
  84. package/utils/index.d.ts +4 -12
  85. package/utils/index.js +7 -35
  86. package/utils/index.js.map +1 -1
  87. package/src/include-defaults.js +0 -16
  88. package/src/include-defaults.js.map +0 -1
  89. package/src/loaders/async-boundary-loader.d.ts +0 -2
  90. package/src/loaders/async-boundary-loader.js +0 -69
  91. package/src/loaders/async-boundary-loader.js.map +0 -1
  92. package/src/plugins/ChildFederationPlugin.d.ts +0 -11
  93. package/src/plugins/ChildFederationPlugin.js +0 -299
  94. package/src/plugins/ChildFederationPlugin.js.map +0 -1
  95. package/src/plugins/ModuleFederationPlugin.d.ts +0 -7
  96. package/src/plugins/ModuleFederationPlugin.js +0 -50
  97. package/src/plugins/ModuleFederationPlugin.js.map +0 -1
  98. package/src/plugins/NextFederationPlugin.d.ts +0 -9
  99. package/src/plugins/NextFederationPlugin.js +0 -234
  100. package/src/plugins/NextFederationPlugin.js.map +0 -1
  101. package/src/plugins/RemoveRRRuntimePlugin.d.ts +0 -5
  102. package/src/plugins/RemoveRRRuntimePlugin.js +0 -40
  103. package/src/plugins/RemoveRRRuntimePlugin.js.map +0 -1
  104. /package/src/{include-defaults.d.ts → delegate-hoist-container.d.ts} +0 -0
@@ -0,0 +1,521 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /*
3
+ MIT License http://www.opensource.org/licenses/mit-license.php
4
+ */
5
+ 'use strict';
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ const webpack_1 = require("webpack");
8
+ const semver_1 = require("webpack/lib/util/semver");
9
+ /**
10
+ * InvertedContainerRuntimeModule is a Webpack runtime module that generates
11
+ * the runtime code needed for loading federated modules in an inverted container.
12
+ */
13
+ class InvertedContainerRuntimeModule extends webpack_1.RuntimeModule {
14
+ /**
15
+ * Constructor for the InvertedContainerRuntimeModule.
16
+ * @param {Set<string>} runtimeRequirements - A set of runtime requirement strings.
17
+ * @param {InvertedContainerRuntimeModuleOptions} options - Runtime module options.
18
+ * @param {ChunkLoadingContext} chunkLoadingContext - Chunk loading context.
19
+ */
20
+ constructor(runtimeRequirements, options, chunkLoadingContext) {
21
+ super('inverted container startup', webpack_1.RuntimeModule.STAGE_ATTACH);
22
+ this.runtimeRequirements = runtimeRequirements;
23
+ this.options = options;
24
+ this.chunkLoadingContext = chunkLoadingContext;
25
+ }
26
+ resolveContainerModule() {
27
+ const container = this.compilation.entrypoints
28
+ .get(this.options.container)
29
+ ?.getRuntimeChunk?.();
30
+ if (!container)
31
+ return;
32
+ const entryModules = this.compilation.chunkGraph.getChunkEntryModulesIterable(container);
33
+ let entryModule;
34
+ for (const module of entryModules) {
35
+ entryModule = module;
36
+ break;
37
+ }
38
+ return entryModule;
39
+ }
40
+ mapShared() {
41
+ const { runtimeTemplate, chunkGraph, codeGenerationResults, entrypoints, compiler, } = this.compilation;
42
+ const { RuntimeGlobals, Template } = compiler.webpack;
43
+ const chunkToModuleMapping = {};
44
+ /** @type {Map<string | number, Source>} */
45
+ const moduleIdToSourceMapping = new Map();
46
+ const moduleIdToSourceChunkID = new Map();
47
+ // @ts-ignore
48
+ const initialConsumes = [];
49
+ /**
50
+ *
51
+ * @param {Iterable<Module>} modules modules
52
+ * @param {Chunk} chunk the chunk
53
+ * @param {(string | number)[]} list list of ids
54
+ */
55
+ //@ts-ignore
56
+ const addShared = (modules, chunk, list) => {
57
+ for (const m of modules) {
58
+ const module = /** @type {ConsumeSharedModule} */ m;
59
+ const id = chunkGraph.getModuleId(module);
60
+ list.push(id);
61
+ moduleIdToSourceMapping.set(id, codeGenerationResults.getSource(module, chunk.runtime, 'consume-shared'));
62
+ }
63
+ };
64
+ // @ts-ignore
65
+ const addModules = (modules, chunk, list) => {
66
+ for (const m of modules) {
67
+ const module = /** @type {ConsumeSharedModule} */ m;
68
+ const id = chunkGraph.getModuleId(module);
69
+ list.push(id);
70
+ const moduleOrigin = module.options.importResolved;
71
+ const filter = chunkGraph.getChunkModuleIdMap(chunk, (module) => {
72
+ // @ts-ignore
73
+ return module?.resource === moduleOrigin;
74
+ }, true);
75
+ moduleIdToSourceChunkID.set(id, filter);
76
+ }
77
+ };
78
+ for (const entrypointModule of entrypoints.values()) {
79
+ const entrypoint = entrypointModule.getEntrypointChunk();
80
+ if (entrypoint.hasRuntime())
81
+ continue;
82
+ // for (const entryChunks of entrypoint.getAllInitialChunks()) {}
83
+ // @ts-ignore
84
+ for (const chunk of entrypoint.getAllAsyncChunks()) {
85
+ //if(chunk.hasEntryModule()) continue
86
+ const modules = chunkGraph.getChunkModulesIterableBySourceType(chunk, 'consume-shared');
87
+ if (!modules)
88
+ continue;
89
+ //@ts-ignore
90
+ // addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = []));
91
+ }
92
+ // @ts-ignore
93
+ for (const chunk of entrypoint.getAllInitialChunks()) {
94
+ // if(chunk.hasEntryModule()) continue
95
+ const modules = chunkGraph.getChunkModulesIterableBySourceType(chunk, 'consume-shared');
96
+ if (!modules)
97
+ continue;
98
+ // @ts-ignore
99
+ addModules(modules, chunk, (chunkToModuleMapping[chunk.id] = []));
100
+ //@ts-ignore
101
+ addShared(modules, chunk, initialConsumes);
102
+ }
103
+ }
104
+ if (moduleIdToSourceMapping.size === 0 ||
105
+ moduleIdToSourceChunkID.size === 0) {
106
+ return '';
107
+ }
108
+ return Template.asString([
109
+ (0, semver_1.parseVersionRuntimeCode)(runtimeTemplate),
110
+ (0, semver_1.versionLtRuntimeCode)(runtimeTemplate),
111
+ (0, semver_1.rangeToStringRuntimeCode)(runtimeTemplate),
112
+ (0, semver_1.satisfyRuntimeCode)(runtimeTemplate),
113
+ `var ensureExistence = ${runtimeTemplate.basicFunction('scopeName, key', [
114
+ `var scope = ${RuntimeGlobals.shareScopeMap}[scopeName];`,
115
+ `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) throw new Error("Shared module " + key + " doesn't exist in shared scope " + scopeName);`,
116
+ 'return scope;',
117
+ ])};`,
118
+ `var findVersion = ${runtimeTemplate.basicFunction('scope, key', [
119
+ 'var versions = scope[key];',
120
+ `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction('a, b', ['return !a || versionLt(a, b) ? b : a;'])}, 0);`,
121
+ 'return key && versions[key]',
122
+ ])};`,
123
+ `var findSingletonVersionKey = ${runtimeTemplate.basicFunction('scope, key', [
124
+ 'var versions = scope[key];',
125
+ `return Object.keys(versions).reduce(${runtimeTemplate.basicFunction('a, b', ['return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;'])}, 0);`,
126
+ ])};`,
127
+ `var getInvalidSingletonVersionMessage = ${runtimeTemplate.basicFunction('scope, key, version, requiredVersion', [
128
+ `return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"`,
129
+ ])};`,
130
+ `var getSingleton = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
131
+ 'var version = findSingletonVersionKey(scope, key);',
132
+ 'return get(scope[key][version]);',
133
+ ])};`,
134
+ `var getSingletonVersion = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
135
+ 'var version = findSingletonVersionKey(scope, key);',
136
+ 'if (!satisfy(requiredVersion, version)) ' +
137
+ 'typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));',
138
+ 'return get(scope[key][version]);',
139
+ ])};`,
140
+ `var getStrictSingletonVersion = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
141
+ 'var version = findSingletonVersionKey(scope, key);',
142
+ 'if (!satisfy(requiredVersion, version)) ' +
143
+ 'throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));',
144
+ 'return get(scope[key][version]);',
145
+ ])};`,
146
+ `var findValidVersion = ${runtimeTemplate.basicFunction('scope, key, requiredVersion', [
147
+ 'var versions = scope[key];',
148
+ `var key = Object.keys(versions).reduce(${runtimeTemplate.basicFunction('a, b', [
149
+ 'if (!satisfy(requiredVersion, b)) return a;',
150
+ 'return !a || versionLt(a, b) ? b : a;',
151
+ ])}, 0);`,
152
+ 'return key && versions[key]',
153
+ ])};`,
154
+ `var getInvalidVersionMessage = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
155
+ 'var versions = scope[key];',
156
+ 'return "No satisfying version (" + rangeToString(requiredVersion) + ") of shared module " + key + " found in shared scope " + scopeName + ".\\n" +',
157
+ `"Available versions: " + Object.keys(versions).map(${runtimeTemplate.basicFunction('key', ['return key + " from " + versions[key].from;'])}).join(", ");`,
158
+ ])};`,
159
+ `var getValidVersion = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
160
+ 'var entry = findValidVersion(scope, key, requiredVersion);',
161
+ 'if(entry) return get(entry);',
162
+ 'throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));',
163
+ ])};`,
164
+ `var warnInvalidVersion = ${runtimeTemplate.basicFunction('scope, scopeName, key, requiredVersion', [
165
+ 'typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));',
166
+ ])};`,
167
+ `var get = ${runtimeTemplate.basicFunction('entry', [
168
+ 'entry.loaded = 1;',
169
+ 'return entry.get()',
170
+ ])};`,
171
+ `var init = ${runtimeTemplate.returningFunction(Template.asString([
172
+ 'function(scopeName, a, b, c) {',
173
+ Template.indent([
174
+ `var promise = ${RuntimeGlobals.initializeSharing}(scopeName);`,
175
+ `if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c));`,
176
+ `return fn(scopeName, ${RuntimeGlobals.shareScopeMap}[scopeName], a, b, c);`,
177
+ ]),
178
+ '}',
179
+ ]), 'fn')};`,
180
+ '',
181
+ `var load = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key', [
182
+ 'ensureExistence(scopeName, key);',
183
+ 'return get(findVersion(scope, key));',
184
+ ])});`,
185
+ `var loadFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, fallback', [
186
+ `return scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) ? get(findVersion(scope, key)) : fallback();`,
187
+ ])});`,
188
+ `var loadVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version', [
189
+ 'ensureExistence(scopeName, key);',
190
+ 'return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));',
191
+ ])});`,
192
+ `var loadSingleton = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key', [
193
+ 'ensureExistence(scopeName, key);',
194
+ 'return getSingleton(scope, scopeName, key);',
195
+ ])});`,
196
+ `var loadSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version', [
197
+ 'ensureExistence(scopeName, key);',
198
+ 'return getSingletonVersion(scope, scopeName, key, version);',
199
+ ])});`,
200
+ `var loadStrictVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version', [
201
+ 'ensureExistence(scopeName, key);',
202
+ 'return getValidVersion(scope, scopeName, key, version);',
203
+ ])});`,
204
+ `var loadStrictSingletonVersionCheck = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version', [
205
+ 'ensureExistence(scopeName, key);',
206
+ 'return getStrictSingletonVersion(scope, scopeName, key, version);',
207
+ ])});`,
208
+ `var loadVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version, fallback', [
209
+ `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`,
210
+ 'return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));',
211
+ ])});`,
212
+ `var loadSingletonFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, fallback', [
213
+ `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`,
214
+ 'return getSingleton(scope, scopeName, key);',
215
+ ])});`,
216
+ `var loadSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version, fallback', [
217
+ `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`,
218
+ 'return getSingletonVersion(scope, scopeName, key, version);',
219
+ ])});`,
220
+ `var loadStrictVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version, fallback', [
221
+ `var entry = scope && ${RuntimeGlobals.hasOwnProperty}(scope, key) && findValidVersion(scope, key, version);`,
222
+ `return entry ? get(entry) : fallback();`,
223
+ ])});`,
224
+ `var loadStrictSingletonVersionCheckFallback = /*#__PURE__*/ init(${runtimeTemplate.basicFunction('scopeName, scope, key, version, fallback', [
225
+ `if(!scope || !${RuntimeGlobals.hasOwnProperty}(scope, key)) return fallback();`,
226
+ 'return getStrictSingletonVersion(scope, scopeName, key, version);',
227
+ ])});`,
228
+ 'var installedModules = __webpack_require__.installedModules',
229
+ 'var moduleToHandlerMapping = {',
230
+ Template.indent(Array.from(moduleIdToSourceMapping, ([key, source]) => `${JSON.stringify(key)}: ${source.source()}`).join(',\n')),
231
+ '};',
232
+ 'var listOfInitialIds = {',
233
+ Template.indent(Array.from(moduleIdToSourceChunkID, ([key, chunkIds]) => {
234
+ return `${JSON.stringify(key)}: ${JSON.stringify(Object.keys(chunkIds))}`;
235
+ }).join(',\n')),
236
+ '};',
237
+ initialConsumes.length > 0
238
+ ? Template.asString([
239
+ //@ts-ignore
240
+ `var initialConsumes = ${JSON.stringify(initialConsumes)};`,
241
+ // `initialConsumes.forEach(${runtimeTemplate.basicFunction('id', [
242
+ // `${
243
+ // RuntimeGlobals.moduleFactories
244
+ // }[id] = ${runtimeTemplate.basicFunction('module', [
245
+ // '// Handle case when module is used sync',
246
+ // 'installedModules[id] = 0;',
247
+ // `delete ${RuntimeGlobals.moduleCache}[id];`,
248
+ // 'var factory = moduleToHandlerMapping[id]();',
249
+ // 'if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);',
250
+ // `module.exports = factory();`,
251
+ // ])}`,
252
+ // ])});`,
253
+ ])
254
+ : '// no consumes in initial chunks',
255
+ // this._runtimeRequirements.has(RuntimeGlobals.ensureChunkHandlers)
256
+ Template.asString([
257
+ `var chunkMapping = ${JSON.stringify(chunkToModuleMapping, null, '')};`,
258
+ `__webpack_require__.getEagerSharedForChunkId = ${runtimeTemplate.basicFunction('chunkId, promises', [
259
+ `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`,
260
+ Template.indent([
261
+ `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction('id', [
262
+ `if(${RuntimeGlobals.hasOwnProperty}(installedModules, id)) return promises.push(installedModules[id]);`,
263
+ `if(typeof ${RuntimeGlobals.moduleCache}[id] === 'object') {
264
+ ${RuntimeGlobals.moduleCache}[id].hot.removeDisposeHandler()
265
+ ${RuntimeGlobals.moduleCache}[id].hot.addDisposeHandler(function (args){
266
+
267
+ delete ${RuntimeGlobals.moduleCache}[id]
268
+
269
+
270
+ ${RuntimeGlobals.moduleFactories}[id] = function(module) {
271
+ return module.exports = globalThis.factoryTracker[id]
272
+ }
273
+ })
274
+
275
+ }`,
276
+ `var onFactory = ${runtimeTemplate.basicFunction('factory', [
277
+ 'installedModules[id] = 0;',
278
+ `${RuntimeGlobals.moduleFactories}[id] = ${runtimeTemplate.basicFunction('module', [
279
+ `delete ${RuntimeGlobals.moduleCache}[id];`,
280
+ 'globalThis.factoryTracker[id] = module.exports = factory();',
281
+ ])}`,
282
+ ])};`,
283
+ `var onError = ${runtimeTemplate.basicFunction('error', [
284
+ 'delete installedModules[id];',
285
+ this.options.debug
286
+ ? "console.error('on error',id, error)"
287
+ : '',
288
+ `${RuntimeGlobals.moduleFactories}[id] = ${runtimeTemplate.basicFunction('module', [
289
+ `delete ${RuntimeGlobals.moduleCache}[id];`,
290
+ 'throw error;',
291
+ ])}`,
292
+ ])};`,
293
+ 'try {',
294
+ Template.indent([
295
+ 'var promise = moduleToHandlerMapping[id]();',
296
+ 'if(promise.then) {',
297
+ Template.indent("promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));"),
298
+ '} else onFactory(promise);',
299
+ ]),
300
+ '} catch(e) { onError(e); }',
301
+ ])});`,
302
+ ]),
303
+ '}',
304
+ ])}`,
305
+ ]),
306
+ ]);
307
+ }
308
+ //@ts-ignore
309
+ mapChunks() {
310
+ // @ts-ignore
311
+ const { chunkGraph, compilation } = this;
312
+ const { runtimeTemplate, moduleGraph, entrypoints, compiler } = compilation;
313
+ const { RuntimeGlobals, Template } = compiler.webpack;
314
+ const chunkToRemotesMapping = {};
315
+ const idToExternalAndNameMapping = {};
316
+ //@ts-ignore
317
+ for (const entrypointModule of entrypoints.values()) {
318
+ const entrypoint = entrypointModule.getEntrypointChunk();
319
+ if (entrypoint.hasRuntime())
320
+ continue;
321
+ for (const chunk of entrypoint.getAllInitialChunks()) {
322
+ const modules = chunkGraph.getChunkModulesIterableBySourceType(chunk, 'remote');
323
+ if (!modules)
324
+ continue;
325
+ const remotes = (chunkToRemotesMapping[chunk.id || chunk.name] = []);
326
+ //@ts-ignore
327
+ for (const m of modules) {
328
+ const module = m;
329
+ //@ts-ignore
330
+ const name = module.internalRequest;
331
+ const id = chunkGraph.getModuleId(module);
332
+ //@ts-ignore
333
+ const shareScope = module.shareScope;
334
+ const dep = module.dependencies[0];
335
+ const externalModule = moduleGraph.getModule(dep);
336
+ const externalModuleId = externalModule && chunkGraph.getModuleId(externalModule);
337
+ remotes.push(id);
338
+ //@ts-ignore
339
+ idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId];
340
+ }
341
+ }
342
+ }
343
+ return Template.asString([
344
+ `var remoteMapping = Object.assign(__webpack_require__.rMap,${JSON.stringify(chunkToRemotesMapping, null, '')});`,
345
+ `var idToExternalAndNameMapping = Object.assign(__webpack_require__.reMap, ${JSON.stringify(idToExternalAndNameMapping, null, '')});`,
346
+ 'globalThis.factoryTracker = globalThis.factoryTracker || {}',
347
+ `__webpack_require__.getEagerRemotesForChunkId = ${runtimeTemplate.basicFunction('chunkId, promises', [
348
+ `
349
+ if(${RuntimeGlobals.hasOwnProperty}(remoteMapping, chunkId)) {`,
350
+ Template.indent([
351
+ `remoteMapping[chunkId].forEach(${runtimeTemplate.basicFunction('id', [
352
+ `if(typeof ${RuntimeGlobals.moduleCache}[id] === 'object') {
353
+ ${RuntimeGlobals.moduleCache}[id].hot.removeDisposeHandler()
354
+ ${RuntimeGlobals.moduleCache}[id].hot.addDisposeHandler(function (args){
355
+
356
+ ${RuntimeGlobals.moduleCache}[id] = globalThis.factoryTracker[id];
357
+ ${RuntimeGlobals.moduleFactories}[id] = function(module) {
358
+ return module.exports = globalThis.factoryTracker[id]
359
+ }
360
+ })
361
+
362
+ }`,
363
+ `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`,
364
+ 'if(!getScope) getScope = [];',
365
+ 'var data = idToExternalAndNameMapping[id];',
366
+ 'if(getScope.indexOf(data) >= 0) return;',
367
+ 'getScope.push(data);',
368
+ `if(data.p) return promises.push(data.p);`,
369
+ `var onError = ${runtimeTemplate.basicFunction('error', [
370
+ 'if(!error) error = new Error("Container missing");',
371
+ 'if(typeof error.message === "string")',
372
+ Template.indent(`error.message += '\\nwhile loading "' + data[1] + '" from ' + data[2];`),
373
+ `${RuntimeGlobals.moduleFactories}[id] = ${runtimeTemplate.basicFunction('', [
374
+ 'throw error;',
375
+ ])}`,
376
+ 'data.p = 0;',
377
+ ])};`,
378
+ `var handleFunction = ${runtimeTemplate.basicFunction('fn, arg1, arg2, d, next, first', [
379
+ 'try {',
380
+ Template.indent([
381
+ 'var promise = fn(arg1, arg2);',
382
+ 'if(promise && promise.then) {',
383
+ Template.indent([
384
+ `var p = promise.then(${runtimeTemplate.returningFunction('next(result, d)', 'result')}, onError);`,
385
+ `if(first) promises.push(data.p = p); else return p;`,
386
+ ]),
387
+ '} else {',
388
+ Template.indent(['return next(promise, d, first);']),
389
+ '}',
390
+ ]),
391
+ '} catch(error) {',
392
+ Template.indent(['onError(error);']),
393
+ '}',
394
+ ])}`,
395
+ `var onExternal = ${runtimeTemplate.basicFunction(['external', '_', 'first'], `
396
+ return external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`)};`,
397
+ `var onInitialized = ${runtimeTemplate.returningFunction(`handleFunction(external.get, data[1], getScope, 0, onFactory, first)`, '_, external, first')};`,
398
+ `var onFactory = ${runtimeTemplate.basicFunction('factory', [
399
+ 'data.p = 1;',
400
+ `${RuntimeGlobals.moduleFactories}[id] = ${runtimeTemplate.basicFunction('module', [
401
+ 'globalThis.factoryTracker[id] = module.exports = (globalThis.factoryTracker[id] || factory());',
402
+ ])}`,
403
+ ])};`,
404
+ 'handleFunction(__webpack_require__, data[2], 0, 0, onExternal, 1);',
405
+ ])});`,
406
+ ]),
407
+ '}',
408
+ ])}`,
409
+ ]);
410
+ }
411
+ /**
412
+ * Generate method for the runtime module, producing the runtime code.
413
+ * @returns {string} runtime code
414
+ */
415
+ generate() {
416
+ const { name } = this.options;
417
+ const { chunkGraph, compilation, chunk } = this;
418
+ const { runtimeTemplate, moduleGraph, entrypoints, compiler } = compilation;
419
+ const { RuntimeGlobals, Template, javascript } = compiler.webpack || {};
420
+ const chunkHasJs = (javascript && javascript.JavascriptModulesPlugin.chunkHasJs) ||
421
+ require('webpack/lib/javascript/JavascriptModulesPlugin').chunkHasJs;
422
+ const containerEntryModule = this.resolveContainerModule();
423
+ //server runtime is always called webpack-runtime
424
+ const isServer = chunk.name === 'webpack-runtime';
425
+ const conditionMap = chunkGraph.getChunkConditionMap(chunk, chunkHasJs);
426
+ // const hasJsMatcher = compileBooleanMatcher(conditionMap);
427
+ // find the main webpack runtime, skip all other chunks
428
+ if (chunk.name !== 'webpack-runtime' && chunk.name !== 'webpack') {
429
+ return Template.asString('');
430
+ }
431
+ const containerEntry = [containerEntryModule].map((module) => {
432
+ //@ts-ignore
433
+ const containerName = module?._name || name;
434
+ const containerModuleId = module?.id || module?.debugId;
435
+ if (!(containerName && containerName)) {
436
+ return '';
437
+ }
438
+ // const globalRef = this.compilation.options.output?.globalObject;
439
+ //@ts-ignore
440
+ const nodeGlobal = this.compilation.options?.node?.global;
441
+ const globalObject = nodeGlobal
442
+ ? RuntimeGlobals.global || 'global'
443
+ : 'global';
444
+ const containerScope = isServer
445
+ ? [globalObject, "['__remote_scope__']"].join('')
446
+ : 'window';
447
+ const serverContainerKickstart = Template.asString([
448
+ '__webpack_require__.own_remote = new Promise(function(resolve,reject){',
449
+ Template.indent([
450
+ // attachOnMount,
451
+ `__webpack_require__.O(0, ["webpack-runtime"], function() {`,
452
+ // attachOnMount,
453
+ `if(!__webpack_require__.m[${JSON.stringify(containerModuleId)}]) {`,
454
+ `console.error('container does not exist in host runtime graph', ${JSON.stringify(containerModuleId)});`,
455
+ `} else { console.debug('SHOULD ATTACH CONTAINER'); attachRemote(resolve) } `,
456
+ '},0)',
457
+ ]),
458
+ '})',
459
+ ]);
460
+ const checkForAsyncChunkRequirements = Template.asString([
461
+ `__webpack_require__.checkAsyncReqs = function() {`,
462
+ Template.indent([
463
+ `self[${JSON.stringify(this.compilation.outputOptions.chunkLoadingGlobal)}].forEach(function(chunkId) {`,
464
+ `__webpack_require__.getEagerSharedForChunkId(chunkId[0],__webpack_require__.initConsumes)
465
+ __webpack_require__.getEagerRemotesForChunkId(chunkId[0],__webpack_require__.initRemotes)`,
466
+ '});',
467
+ ]),
468
+ '}',
469
+ ]);
470
+ const browserContainerKickstart = Template.asString([
471
+ '__webpack_require__.own_remote = new Promise(function(resolve,reject){',
472
+ 'console.debug("O keys",Object.keys(__webpack_require__.O))',
473
+ "__webpack_require__.O(0, ['webpack'], function() {",
474
+ "console.debug('runtime loaded');",
475
+ "console.debug('replaying all installed chunk requirements');",
476
+ '__webpack_require__.checkAsyncReqs();',
477
+ 'attachRemote(resolve)',
478
+ '},0)',
479
+ '})',
480
+ ]);
481
+ // __webpack_require__.O(0, ["webpack-runtime"], function() {
482
+ return Template.asString([
483
+ 'globalThis.usedChunks = globalThis.usedChunks || new Set();',
484
+ 'globalThis.backupScope = globalThis.backupScope || {};',
485
+ '__webpack_require__.S = globalThis.backupScope;',
486
+ '__webpack_require__.initConsumes = __webpack_require__.initConsumes || [];',
487
+ '__webpack_require__.initRemotes = __webpack_require__.initRemotes || [];',
488
+ '__webpack_require__.rMap = __webpack_require__.rMap || {};',
489
+ '__webpack_require__.reMap = __webpack_require__.reMap || {};',
490
+ '__webpack_require__.installedModules = {};',
491
+ "console.debug('share scope', __webpack_require__.S);",
492
+ `if(${containerScope} === undefined) {
493
+ console.debug('container scope is empty, initializing');
494
+ ${containerScope} = {_config: {}}
495
+ };`,
496
+ checkForAsyncChunkRequirements,
497
+ Template.asString([
498
+ 'function attachRemote (resolve) {',
499
+ Template.indent([
500
+ `const innerRemote = __webpack_require__(${JSON.stringify(containerModuleId)});`,
501
+ `${containerScope}[${JSON.stringify(containerName)}] = innerRemote;`,
502
+ "__webpack_require__.I('default',[globalThis.backupScope]);",
503
+ "console.log('remote attached', innerRemote);",
504
+ 'if(resolve) resolve(innerRemote)',
505
+ ]),
506
+ '}',
507
+ ]),
508
+ 'try {',
509
+ isServer ? serverContainerKickstart : browserContainerKickstart,
510
+ '} catch (e) {',
511
+ "console.error('host runtime was unable to initialize its own remote', e);",
512
+ '}',
513
+ this.mapChunks(),
514
+ this.mapShared(),
515
+ ]);
516
+ });
517
+ return Template.asString(containerEntry);
518
+ }
519
+ }
520
+ exports.default = InvertedContainerRuntimeModule;
521
+ //# sourceMappingURL=InvertedContainerRuntimeModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvertedContainerRuntimeModule.js","sourceRoot":"","sources":["../../../../../../packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;EAEE;AAEF,YAAY,CAAC;;AAGb,qCAAwC;AACxC,oDAMiC;AAqBjC;;;GAGG;AACH,MAAM,8BAA+B,SAAQ,uBAAa;IAKxD;;;;;OAKG;IACH,YACE,mBAAgC,EAChC,OAA8C,EAC9C,mBAAwC;QAExC,KAAK,CAAC,4BAA4B,EAAE,uBAAa,CAAC,YAAY,CAAC,CAAC;QAChE,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;QAE/C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,CAAC;IAED,sBAAsB;QACpB,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW;aAC3C,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAmB,CAAC;YACtC,EAAE,eAAe,EAAE,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS;YAAE,OAAO;QACvB,MAAM,YAAY,GAChB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC;QAEtE,IAAI,WAAW,CAAC;QAChB,KAAK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AC,yBAAyB;gBAC/D,eAAe;gBACf,2EAA2E;gBAC3E,GAAG;gBACH,IAAI,CAAC,SAAS,EAAE;gBAChB,IAAI,CAAC,SAAS,EAAE;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,kBAAe,8BAA8B,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Compiler } from 'webpack';
2
+ declare class RemoveEagerModulesFromRuntimePlugin {
3
+ private container;
4
+ private debug;
5
+ private dependentModules;
6
+ private visitedModules;
7
+ constructor(options: {
8
+ container?: string;
9
+ debug?: boolean;
10
+ });
11
+ apply(compiler: Compiler): void;
12
+ private traverseModuleGraph;
13
+ private getEagerModulesInRemote;
14
+ private processModules;
15
+ private removeDependentModules;
16
+ }
17
+ export default RemoveEagerModulesFromRuntimePlugin;