@module-federation/node 0.0.0-feat-node-support-1702694175665
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/jest.config.d.ts +11 -0
- package/jest.config.js +19 -0
- package/jest.config.js.map +1 -0
- package/package.json +66 -0
- package/src/filesystem/stratagies.d.ts +18 -0
- package/src/filesystem/stratagies.js +124 -0
- package/src/filesystem/stratagies.js.map +1 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +17 -0
- package/src/index.js.map +1 -0
- package/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -0
- package/src/plugins/AutomaticPublicPathPlugin.js +38 -0
- package/src/plugins/AutomaticPublicPathPlugin.js.map +1 -0
- package/src/plugins/ChunkCorrelationPlugin.d.ts +61 -0
- package/src/plugins/ChunkCorrelationPlugin.js +442 -0
- package/src/plugins/ChunkCorrelationPlugin.js.map +1 -0
- package/src/plugins/CommonJsChunkLoadingPlugin.d.ts +17 -0
- package/src/plugins/CommonJsChunkLoadingPlugin.js +121 -0
- package/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -0
- package/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +39 -0
- package/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +119 -0
- package/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -0
- package/src/plugins/NodeFederationPlugin.d.ts +46 -0
- package/src/plugins/NodeFederationPlugin.js +76 -0
- package/src/plugins/NodeFederationPlugin.js.map +1 -0
- package/src/plugins/RemotePublicPathRuntimeModule.d.ts +10 -0
- package/src/plugins/RemotePublicPathRuntimeModule.js +109 -0
- package/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -0
- package/src/plugins/StreamingTargetPlugin.d.ts +28 -0
- package/src/plugins/StreamingTargetPlugin.js +59 -0
- package/src/plugins/StreamingTargetPlugin.js.map +1 -0
- package/src/plugins/UniversalFederationPlugin.d.ts +43 -0
- package/src/plugins/UniversalFederationPlugin.js +53 -0
- package/src/plugins/UniversalFederationPlugin.js.map +1 -0
- package/src/plugins/webpackChunkUtilities.d.ts +50 -0
- package/src/plugins/webpackChunkUtilities.js +321 -0
- package/src/plugins/webpackChunkUtilities.js.map +1 -0
- package/src/types/index.d.ts +3 -0
- package/src/types/index.js +3 -0
- package/src/types/index.js.map +1 -0
- package/src/utils/flush-chunks.d.ts +10 -0
- package/src/utils/flush-chunks.js +162 -0
- package/src/utils/flush-chunks.js.map +1 -0
- package/src/utils/hot-reload.d.ts +7 -0
- package/src/utils/hot-reload.js +142 -0
- package/src/utils/hot-reload.js.map +1 -0
- package/src/utils/index.d.ts +2 -0
- package/src/utils/index.js +19 -0
- package/src/utils/index.js.map +1 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateExternalInstallChunkCode = exports.generateInstallChunk = exports.generateLoadScript = exports.handleOnChunkLoad = exports.generateHmrManifestCode = exports.generateLoadingCode = exports.getInitialChunkIds = exports.generateHmrCode = void 0;
|
|
4
|
+
const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
|
|
5
|
+
const { RuntimeGlobals, Template } = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack'));
|
|
6
|
+
/**
|
|
7
|
+
* Generates the hot module replacement (HMR) code.
|
|
8
|
+
* @param {boolean} withHmr - Flag indicating whether HMR is enabled.
|
|
9
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
10
|
+
* @returns {string} - The generated HMR code.
|
|
11
|
+
*/
|
|
12
|
+
function generateHmrCode(withHmr, rootOutputDir) {
|
|
13
|
+
if (!withHmr) {
|
|
14
|
+
return '// no HMR';
|
|
15
|
+
}
|
|
16
|
+
return Template.asString([
|
|
17
|
+
// Function to load updated chunk
|
|
18
|
+
'function loadUpdateChunk(chunkId, updatedModulesList) {',
|
|
19
|
+
Template.indent([
|
|
20
|
+
'return new Promise(function(resolve, reject) {',
|
|
21
|
+
Template.indent([
|
|
22
|
+
// Construct filename for the updated chunk
|
|
23
|
+
`var filename = require('path').join(__dirname, ${JSON.stringify(rootOutputDir)} + ${RuntimeGlobals.getChunkUpdateScriptFilename}(chunkId));`,
|
|
24
|
+
// Read the updated chunk file
|
|
25
|
+
"require('fs').readFile(filename, 'utf-8', function(err, content) {",
|
|
26
|
+
Template.indent([
|
|
27
|
+
'if(err) return reject(err);',
|
|
28
|
+
'var update = {};',
|
|
29
|
+
// Execute the updated chunk in the current context
|
|
30
|
+
"require('vm').runInThisContext('(function(exports, require, __dirname, __filename) {' + content + '\\n})', filename)" +
|
|
31
|
+
"(update, require, require('path').dirname(filename), filename);",
|
|
32
|
+
'var updatedModules = update.modules;',
|
|
33
|
+
'var runtime = update.runtime;',
|
|
34
|
+
// Iterate over the updated modules
|
|
35
|
+
'for(var moduleId in updatedModules) {',
|
|
36
|
+
Template.indent([
|
|
37
|
+
`if(${RuntimeGlobals.hasOwnProperty}(updatedModules, moduleId)) {`,
|
|
38
|
+
Template.indent([
|
|
39
|
+
`currentUpdate[moduleId] = updatedModules[moduleId];`,
|
|
40
|
+
'if(updatedModulesList) updatedModulesList.push(moduleId);',
|
|
41
|
+
]),
|
|
42
|
+
'}',
|
|
43
|
+
]),
|
|
44
|
+
'}',
|
|
45
|
+
'if(runtime) currentUpdateRuntime.push(runtime);',
|
|
46
|
+
'resolve();',
|
|
47
|
+
]),
|
|
48
|
+
'});',
|
|
49
|
+
]),
|
|
50
|
+
'});',
|
|
51
|
+
]),
|
|
52
|
+
'}',
|
|
53
|
+
'',
|
|
54
|
+
// Replace placeholders in the HMR runtime code
|
|
55
|
+
Template.getFunctionContent(
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
57
|
+
require('webpack/lib/hmr/JavascriptHotModuleReplacement.runtime.js'))
|
|
58
|
+
.replace(/\$key\$/g, 'readFileVm')
|
|
59
|
+
.replace(/\$installedChunks\$/g, 'installedChunks')
|
|
60
|
+
.replace(/\$loadUpdateChunk\$/g, 'loadUpdateChunk')
|
|
61
|
+
.replace(/\$moduleCache\$/g, RuntimeGlobals.moduleCache)
|
|
62
|
+
.replace(/\$moduleFactories\$/g, RuntimeGlobals.moduleFactories)
|
|
63
|
+
.replace(/\$ensureChunkHandlers\$/g, RuntimeGlobals.ensureChunkHandlers)
|
|
64
|
+
.replace(/\$hasOwnProperty\$/g, RuntimeGlobals.hasOwnProperty)
|
|
65
|
+
.replace(/\$hmrModuleData\$/g, RuntimeGlobals.hmrModuleData)
|
|
66
|
+
.replace(/\$hmrDownloadUpdateHandlers\$/g, RuntimeGlobals.hmrDownloadUpdateHandlers)
|
|
67
|
+
.replace(/\$hmrInvalidateModuleHandlers\$/g, RuntimeGlobals.hmrInvalidateModuleHandlers),
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
exports.generateHmrCode = generateHmrCode;
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves the initial chunk IDs.
|
|
73
|
+
* @param {Chunk} chunk - The chunk object.
|
|
74
|
+
* @param {ChunkGraph} chunkGraph - The chunk graph object.
|
|
75
|
+
* @param {any} chunkHasJs - Function to check if a chunk has JavaScript.
|
|
76
|
+
* @returns {Set} - The set of initial chunk IDs.
|
|
77
|
+
*/
|
|
78
|
+
function getInitialChunkIds(chunk, chunkGraph, chunkHasJs) {
|
|
79
|
+
const initialChunkIds = new Set(chunk.ids);
|
|
80
|
+
for (const c of chunk.getAllInitialChunks()) {
|
|
81
|
+
if (c === chunk || chunkHasJs(c, chunkGraph))
|
|
82
|
+
continue;
|
|
83
|
+
if (c.ids) {
|
|
84
|
+
for (const id of c.ids)
|
|
85
|
+
initialChunkIds.add(id);
|
|
86
|
+
}
|
|
87
|
+
for (const c of chunk.getAllAsyncChunks()) {
|
|
88
|
+
if (c === chunk || chunkHasJs(c, chunkGraph))
|
|
89
|
+
continue;
|
|
90
|
+
if (c.ids) {
|
|
91
|
+
for (const id of c.ids)
|
|
92
|
+
initialChunkIds.add(id);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return initialChunkIds;
|
|
97
|
+
}
|
|
98
|
+
exports.getInitialChunkIds = getInitialChunkIds;
|
|
99
|
+
/**
|
|
100
|
+
* Generates the loading code for chunks.
|
|
101
|
+
* @param {boolean} withLoading - Flag indicating whether chunk loading is enabled.
|
|
102
|
+
* @param {string} fn - The function name.
|
|
103
|
+
* @param {any} hasJsMatcher - Function to check if a chunk has JavaScript.
|
|
104
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
105
|
+
* @param {Record<string, string>} remotes - The remotes object.
|
|
106
|
+
* @param {string | undefined} name - The name of the chunk.
|
|
107
|
+
* @returns {string} - The generated loading code.
|
|
108
|
+
*/
|
|
109
|
+
function generateLoadingCode(withLoading, fn, hasJsMatcher, rootOutputDir, remotes, name) {
|
|
110
|
+
if (!withLoading) {
|
|
111
|
+
return '// no chunk loading';
|
|
112
|
+
}
|
|
113
|
+
return Template.asString([
|
|
114
|
+
'// Dynamic filesystem chunk loading for javascript',
|
|
115
|
+
`${fn}.readFileVm = function(chunkId, promises) {`,
|
|
116
|
+
hasJsMatcher !== false
|
|
117
|
+
? Template.indent([
|
|
118
|
+
'var installedChunkData = installedChunks[chunkId];',
|
|
119
|
+
'if(installedChunkData !== 0) { // 0 means "already installed".',
|
|
120
|
+
Template.indent([
|
|
121
|
+
'// array of [resolve, reject, promise] means "currently loading"',
|
|
122
|
+
'if(installedChunkData) {',
|
|
123
|
+
Template.indent(['promises.push(installedChunkData[2]);']),
|
|
124
|
+
'} else {',
|
|
125
|
+
Template.indent([
|
|
126
|
+
hasJsMatcher === true
|
|
127
|
+
? 'if(true) { // all chunks have JS'
|
|
128
|
+
: `if(${hasJsMatcher('chunkId')}) {`,
|
|
129
|
+
Template.indent([
|
|
130
|
+
'// load the chunk and return promise to it',
|
|
131
|
+
'var promise = new Promise(async function(resolve, reject) {',
|
|
132
|
+
Template.indent([
|
|
133
|
+
'installedChunkData = installedChunks[chunkId] = [resolve, reject];',
|
|
134
|
+
'function installChunkCallback(error,chunk){',
|
|
135
|
+
Template.indent([
|
|
136
|
+
'if(error) return reject(error);',
|
|
137
|
+
'installChunk(chunk);',
|
|
138
|
+
]),
|
|
139
|
+
'}',
|
|
140
|
+
'var fs = typeof process !== "undefined" ? require(\'fs\') : false;',
|
|
141
|
+
`var filename = typeof process !== "undefined" ? require('path').join(__dirname, ${JSON.stringify(rootOutputDir)} + ${RuntimeGlobals.getChunkScriptFilename}(chunkId)) : false;`,
|
|
142
|
+
'if(fs && fs.existsSync(filename)) {',
|
|
143
|
+
Template.indent([
|
|
144
|
+
`loadChunkStrategy('filesystem', chunkId, ${JSON.stringify(rootOutputDir)}, remotes, installChunkCallback);`,
|
|
145
|
+
]),
|
|
146
|
+
'} else { ',
|
|
147
|
+
Template.indent([
|
|
148
|
+
`var remotes = ${JSON.stringify(Object.values(remotes).reduce((acc, remote) => {
|
|
149
|
+
const [global, url] = remote.split('@');
|
|
150
|
+
acc[global] = url;
|
|
151
|
+
return acc;
|
|
152
|
+
}, {}))};`,
|
|
153
|
+
`var chunkName = ${RuntimeGlobals.getChunkScriptFilename}(chunkId);`,
|
|
154
|
+
"const loadingStrategy = typeof process !== 'undefined' ? 'http-vm' : 'http-eval';",
|
|
155
|
+
`loadChunkStrategy(loadingStrategy, chunkName,${RuntimeGlobals.require}.federation.initOptions.name, ${RuntimeGlobals.require}.federation.initOptions.remotes, installChunkCallback);`,
|
|
156
|
+
]),
|
|
157
|
+
'}',
|
|
158
|
+
]),
|
|
159
|
+
'});',
|
|
160
|
+
'promises.push(installedChunkData[2] = promise);',
|
|
161
|
+
]),
|
|
162
|
+
'} else installedChunks[chunkId] = 0;',
|
|
163
|
+
]),
|
|
164
|
+
'}',
|
|
165
|
+
]),
|
|
166
|
+
'}',
|
|
167
|
+
])
|
|
168
|
+
: Template.indent(['installedChunks[chunkId] = 0;']),
|
|
169
|
+
'};',
|
|
170
|
+
]);
|
|
171
|
+
}
|
|
172
|
+
exports.generateLoadingCode = generateLoadingCode;
|
|
173
|
+
/**
|
|
174
|
+
* Generates the HMR manifest code.
|
|
175
|
+
* @param {boolean} withHmrManifest - Flag indicating whether HMR manifest is enabled.
|
|
176
|
+
* @param {string} rootOutputDir - The root output directory.
|
|
177
|
+
* @returns {string} - The generated HMR manifest code.
|
|
178
|
+
*/
|
|
179
|
+
function generateHmrManifestCode(withHmrManifest, rootOutputDir) {
|
|
180
|
+
if (!withHmrManifest) {
|
|
181
|
+
return '// no HMR manifest';
|
|
182
|
+
}
|
|
183
|
+
return Template.asString([
|
|
184
|
+
`${RuntimeGlobals.hmrDownloadManifest} = function() {`,
|
|
185
|
+
Template.indent([
|
|
186
|
+
'return new Promise(function(resolve, reject) {',
|
|
187
|
+
Template.indent([
|
|
188
|
+
`var filename = require('path').join(__dirname, ${JSON.stringify(rootOutputDir)} + ${RuntimeGlobals.getUpdateManifestFilename}());`,
|
|
189
|
+
"require('fs').readFile(filename, 'utf-8', function(err, content) {",
|
|
190
|
+
Template.indent([
|
|
191
|
+
'if(err) {',
|
|
192
|
+
Template.indent([
|
|
193
|
+
'if(err.code === "ENOENT") return resolve();',
|
|
194
|
+
'return reject(err);',
|
|
195
|
+
]),
|
|
196
|
+
'}',
|
|
197
|
+
'try { resolve(JSON.parse(content)); }',
|
|
198
|
+
'catch(e) { reject(e); }',
|
|
199
|
+
]),
|
|
200
|
+
'});',
|
|
201
|
+
]),
|
|
202
|
+
'});',
|
|
203
|
+
]),
|
|
204
|
+
'}',
|
|
205
|
+
]);
|
|
206
|
+
}
|
|
207
|
+
exports.generateHmrManifestCode = generateHmrManifestCode;
|
|
208
|
+
/**
|
|
209
|
+
* Handles the on chunk load event.
|
|
210
|
+
* @param {boolean} withOnChunkLoad - Flag indicating whether on chunk load event is enabled.
|
|
211
|
+
* @param {any} runtimeTemplate - The runtime template.
|
|
212
|
+
* @returns {string} - The generated on chunk load event handler.
|
|
213
|
+
*/
|
|
214
|
+
function handleOnChunkLoad(withOnChunkLoad, runtimeTemplate) {
|
|
215
|
+
if (withOnChunkLoad) {
|
|
216
|
+
return `${RuntimeGlobals.onChunksLoaded}.readFileVm = ${runtimeTemplate.returningFunction('installedChunks[chunkId] === 0', 'chunkId')};`;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return '// no on chunks loaded';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.handleOnChunkLoad = handleOnChunkLoad;
|
|
223
|
+
/**
|
|
224
|
+
* Generates the load script for server-side execution. This function creates a script that loads a remote module
|
|
225
|
+
* and executes it in the current context. It supports both browser and Node.js environments.
|
|
226
|
+
* @param {any} runtimeTemplate - The runtime template used to generate the load script.
|
|
227
|
+
* @returns {string} - The generated load script.
|
|
228
|
+
*/
|
|
229
|
+
function generateLoadScript(runtimeTemplate) {
|
|
230
|
+
return Template.asString([
|
|
231
|
+
'// load script equivalent for server side',
|
|
232
|
+
`${RuntimeGlobals.loadScript} = ${runtimeTemplate.basicFunction('url,callback,chunkId', [
|
|
233
|
+
Template.indent([
|
|
234
|
+
`async function executeLoad(url, callback, name) {
|
|
235
|
+
if (!name) {
|
|
236
|
+
throw new Error('__webpack_require__.l name is required for ' + url);
|
|
237
|
+
}
|
|
238
|
+
var remoteName = name;
|
|
239
|
+
if(name.includes('__remote_scope__')) {
|
|
240
|
+
remoteName = name.split('__remote_scope__.')[1]
|
|
241
|
+
}
|
|
242
|
+
if (typeof globalThis.__remote_scope__[remoteName] !== 'undefined') return callback(globalThis.__remote_scope__[remoteName]);
|
|
243
|
+
globalThis.__remote_scope__._config[remoteName] = url;
|
|
244
|
+
try {
|
|
245
|
+
const scriptContent = await (globalThis.webpackChunkLoad || globalThis.fetch || require("node-fetch"))(url).then(res => res.text());
|
|
246
|
+
let remote;
|
|
247
|
+
if (typeof process !== 'undefined') {
|
|
248
|
+
const vm = require('vm');
|
|
249
|
+
const m = require('module');
|
|
250
|
+
const remoteCapsule = vm.runInThisContext(m.wrap(scriptContent), 'node-federation-loader-' + name + '.vm')
|
|
251
|
+
const exp = {};
|
|
252
|
+
remote = {exports:{}};
|
|
253
|
+
remoteCapsule(exp,require,remote,'node-federation-loader-' + name + '.vm',__dirname);
|
|
254
|
+
remote = remote.exports || remote;
|
|
255
|
+
} else {
|
|
256
|
+
remote = eval('let module = {};' + scriptContent + '\\nmodule.exports')
|
|
257
|
+
}
|
|
258
|
+
globalThis.__remote_scope__[remoteName] = remote[remoteName] || remote;
|
|
259
|
+
globalThis.__remote_scope__._config[remoteName] = url;
|
|
260
|
+
callback(globalThis.__remote_scope__[remoteName])
|
|
261
|
+
} catch (e) {
|
|
262
|
+
e.target = {src: url};
|
|
263
|
+
globalThis.__remote_scope__[remoteName] = {
|
|
264
|
+
get: function() {
|
|
265
|
+
return function() {
|
|
266
|
+
return ()=>null
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
init: function() {},
|
|
270
|
+
fake: true
|
|
271
|
+
}
|
|
272
|
+
console.log(e);
|
|
273
|
+
callback(e);
|
|
274
|
+
}
|
|
275
|
+
}`,
|
|
276
|
+
`executeLoad(url,callback,chunkId)`,
|
|
277
|
+
]),
|
|
278
|
+
])}`,
|
|
279
|
+
]);
|
|
280
|
+
}
|
|
281
|
+
exports.generateLoadScript = generateLoadScript;
|
|
282
|
+
function generateInstallChunk(runtimeTemplate, withOnChunkLoad) {
|
|
283
|
+
return `var installChunk = ${runtimeTemplate.basicFunction('chunk', [
|
|
284
|
+
'var moreModules = chunk.modules, chunkIds = chunk.ids, runtime = chunk.runtime;',
|
|
285
|
+
'for(var moduleId in moreModules) {',
|
|
286
|
+
Template.indent([
|
|
287
|
+
`if(${RuntimeGlobals.hasOwnProperty}(moreModules, moduleId)) {`,
|
|
288
|
+
Template.indent([
|
|
289
|
+
`${RuntimeGlobals.moduleFactories}[moduleId] = moreModules[moduleId];`,
|
|
290
|
+
]),
|
|
291
|
+
'}',
|
|
292
|
+
]),
|
|
293
|
+
'}',
|
|
294
|
+
'if(runtime) runtime(__webpack_require__);',
|
|
295
|
+
'for(var i = 0; i < chunkIds.length; i++) {',
|
|
296
|
+
Template.indent([
|
|
297
|
+
'if(installedChunks[chunkIds[i]]) {',
|
|
298
|
+
Template.indent(['installedChunks[chunkIds[i]][0]();']),
|
|
299
|
+
'}',
|
|
300
|
+
'installedChunks[chunkIds[i]] = 0;',
|
|
301
|
+
]),
|
|
302
|
+
'}',
|
|
303
|
+
withOnChunkLoad ? `${RuntimeGlobals.onChunksLoaded}();` : '',
|
|
304
|
+
])};`;
|
|
305
|
+
}
|
|
306
|
+
exports.generateInstallChunk = generateInstallChunk;
|
|
307
|
+
function generateExternalInstallChunkCode(withExternalInstallChunk, debug) {
|
|
308
|
+
if (!withExternalInstallChunk) {
|
|
309
|
+
return '// no external install chunk';
|
|
310
|
+
}
|
|
311
|
+
return Template.asString([
|
|
312
|
+
'module.exports = __webpack_require__;',
|
|
313
|
+
`${RuntimeGlobals.externalInstallChunk} = function(){`,
|
|
314
|
+
debug
|
|
315
|
+
? `console.debug('node: webpack installing to install chunk id:', arguments['0'].id);`
|
|
316
|
+
: '',
|
|
317
|
+
`return installChunk.apply(this, arguments)};`,
|
|
318
|
+
]);
|
|
319
|
+
}
|
|
320
|
+
exports.generateExternalInstallChunkCode = generateExternalInstallChunkCode;
|
|
321
|
+
//# sourceMappingURL=webpackChunkUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpackChunkUtilities.js","sourceRoot":"","sources":["../../../../../packages/node/src/plugins/webpackChunkUtilities.ts"],"names":[],"mappings":";;;AAAA,0FAAqF;AACrF,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,CAC1C,IAAA,6CAAoB,EAAC,SAAS,CAAC,CACJ,CAAC;AAG9B;;;;;GAKG;AACH,SAAgB,eAAe,CAC7B,OAAgB,EAChB,aAAqB;IAErB,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,WAAW,CAAC;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AC,oBAAoB,gBAAgB;QACtD,KAAK;YACH,CAAC,CAAC,oFAAoF;YACtF,CAAC,CAAC,EAAE;QACN,8CAA8C;KAC/C,CAAC,CAAC;AACL,CAAC;AAhBD,4EAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/node/src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize usedChunks and share it globally.
|
|
3
|
+
* @type {Set}
|
|
4
|
+
*/
|
|
5
|
+
export declare const usedChunks: Set<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Flush the chunks and return a deduplicated array of chunks.
|
|
8
|
+
* @returns {Promise<Array>} A promise that resolves to an array of deduplicated chunks.
|
|
9
|
+
*/
|
|
10
|
+
export declare const flushChunks: () => Promise<unknown[]>;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.flushChunks = exports.usedChunks = void 0;
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
if (!globalThis.usedChunks) {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
globalThis.usedChunks = new Set();
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Initialize usedChunks and share it globally.
|
|
12
|
+
* @type {Set}
|
|
13
|
+
*/
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
exports.usedChunks = globalThis.usedChunks;
|
|
16
|
+
/**
|
|
17
|
+
* Load hostStats from the JSON file.
|
|
18
|
+
* @returns {object} hostStats - An object containing host stats data.
|
|
19
|
+
*/
|
|
20
|
+
const loadHostStats = () => {
|
|
21
|
+
try {
|
|
22
|
+
return __non_webpack_require__('../federated-stats.json');
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Create a shareMap based on the loaded modules.
|
|
30
|
+
* @returns {object} shareMap - An object containing the shareMap data.
|
|
31
|
+
*/
|
|
32
|
+
const createShareMap = () => {
|
|
33
|
+
// Check if __webpack_share_scopes__ is defined and has a default property
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
if (__webpack_share_scopes__?.default) {
|
|
36
|
+
// Reduce the keys of the default property to create the share map
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
return Object.keys(__webpack_share_scopes__.default).reduce((acc, key) => {
|
|
39
|
+
// Get the loaded modules for the current key
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
const loadedModules = Object.values(__webpack_share_scopes__.default[key])
|
|
42
|
+
// Filter out the modules that are not loaded
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
.filter((sharedModule) => sharedModule.loaded)
|
|
45
|
+
// Map the filtered modules to their 'from' properties
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
.map((sharedModule) => sharedModule.from);
|
|
48
|
+
// If there are any loaded modules, add them to the accumulator object
|
|
49
|
+
if (loadedModules.length > 0) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
acc[key] = loadedModules;
|
|
52
|
+
}
|
|
53
|
+
// Return the accumulator object for the next iteration
|
|
54
|
+
return acc;
|
|
55
|
+
}, {});
|
|
56
|
+
}
|
|
57
|
+
// If __webpack_share_scopes__ is not defined or doesn't have a default property, return an empty object
|
|
58
|
+
return {};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Process a single chunk and return an array of updated chunks.
|
|
62
|
+
* @param {string} chunk - A chunk string containing remote and request data.
|
|
63
|
+
* @param {object} shareMap - An object containing the shareMap data.
|
|
64
|
+
* @param {object} hostStats - An object containing host stats data.
|
|
65
|
+
* @returns {Promise<Array>} A promise that resolves to an array of updated chunks.
|
|
66
|
+
*/
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
const processChunk = async (chunk, shareMap, hostStats) => {
|
|
69
|
+
// Create a set to store the chunks
|
|
70
|
+
const chunks = new Set();
|
|
71
|
+
// Split the chunk string into remote and request
|
|
72
|
+
const [remote, request] = chunk.split('->');
|
|
73
|
+
// If the remote is not defined in the global config, return
|
|
74
|
+
if (!globalThis.__remote_scope__._config[remote]) {
|
|
75
|
+
console.error(`flush chunks:`, `Remote ${remote} is not defined in the global config`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
// Extract the remote name from the URL
|
|
80
|
+
//@ts-ignore
|
|
81
|
+
const remoteName = new URL(globalThis.__remote_scope__._config[remote]).pathname
|
|
82
|
+
.split('/')
|
|
83
|
+
.pop();
|
|
84
|
+
// Construct the stats file URL from the remote config
|
|
85
|
+
const statsFile = globalThis.__remote_scope__._config[remote]
|
|
86
|
+
.replace(remoteName, 'federated-stats.json')
|
|
87
|
+
.replace('ssr', 'chunks');
|
|
88
|
+
let stats = {};
|
|
89
|
+
try {
|
|
90
|
+
// Fetch the remote config and stats file
|
|
91
|
+
stats = await fetch(statsFile).then((res) => res.json());
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
console.error('flush error', e);
|
|
95
|
+
}
|
|
96
|
+
// Add the main chunk to the chunks set
|
|
97
|
+
//TODO: ensure host doesnt embed its own remote in ssr, this causes crash
|
|
98
|
+
// chunks.add(
|
|
99
|
+
// global.__remote_scope__._config[remote].replace('ssr', 'chunks')
|
|
100
|
+
// );
|
|
101
|
+
// Extract the prefix from the remote config
|
|
102
|
+
const [prefix] = globalThis.__remote_scope__._config[remote].split('static/');
|
|
103
|
+
// Process federated modules from the stats object
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
if (stats.federatedModules) {
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
stats.federatedModules.forEach((modules) => {
|
|
108
|
+
// Process exposed modules
|
|
109
|
+
if (modules.exposes?.[request]) {
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
modules.exposes[request].forEach((chunk) => {
|
|
112
|
+
chunks.add([prefix, chunk].join(''));
|
|
113
|
+
//TODO: reimplement this
|
|
114
|
+
Object.values(chunk).forEach((chunk) => {
|
|
115
|
+
// Add files to the chunks set
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
if (chunk.files) {
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
chunk.files.forEach((file) => {
|
|
120
|
+
chunks.add(prefix + file);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// Process required modules
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
if (chunk.requiredModules) {
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
chunk.requiredModules.forEach((module) => {
|
|
128
|
+
// Check if the module is in the shareMap
|
|
129
|
+
if (shareMap[module]) {
|
|
130
|
+
// If the module is from the host, log the host stats
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Return the array of chunks
|
|
140
|
+
return Array.from(chunks);
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
console.error('flush error:', e);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Flush the chunks and return a deduplicated array of chunks.
|
|
148
|
+
* @returns {Promise<Array>} A promise that resolves to an array of deduplicated chunks.
|
|
149
|
+
*/
|
|
150
|
+
const flushChunks = async () => {
|
|
151
|
+
const hostStats = loadHostStats();
|
|
152
|
+
const shareMap = createShareMap();
|
|
153
|
+
const allFlushed = await Promise.all(Array.from(exports.usedChunks).map(async (chunk) => processChunk(chunk, shareMap, hostStats)));
|
|
154
|
+
// Deduplicate the chunks array
|
|
155
|
+
const dedupe = Array.from(new Set([...allFlushed.flat()]));
|
|
156
|
+
// Clear usedChunks
|
|
157
|
+
exports.usedChunks.clear();
|
|
158
|
+
// Filter out any undefined or null values
|
|
159
|
+
return dedupe.filter(Boolean);
|
|
160
|
+
};
|
|
161
|
+
exports.flushChunks = flushChunks;
|
|
162
|
+
//# sourceMappingURL=flush-chunks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush-chunks.js","sourceRoot":"","sources":["../../../../../packages/node/src/utils/flush-chunks.ts"],"names":[],"mappings":";AAAA,6BAA6B;;;AAE7B,aAAa;AACb,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;IAC1B,aAAa;IACb,UAAU,CAAC,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;CACnC;AACD;;;GAGG;AACH,aAAa;AACE,kBAAU,GAAK,UAAU,YAAC;AACzC;;;GAGG;AACH,MAAM,aAAa,GAAG,GAAG,EAAE;IACzB,IAAI;QACF,OAAO,uBAAuB,CAAC,yBAAyB,CAAC,CAAC;KAC3D;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,EAAE,CAAC;KACX;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,0EAA0E;IAC1E,aAAa;IACb,IAAI,wBAAwB,EAAE,OAAO,EAAE;QACrC,kEAAkE;QAClE,aAAa;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACvE,6CAA6C;YAC7C,aAAa;YACb,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACxE,6CAA6C;gBAC7C,aAAa;iBACZ,MAAM,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC;gBAC9C,sDAAsD;gBACtD,aAAa;iBACZ,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAE5C,sEAAsE;YACtE,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC5B,a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I,QAAQ,CAAC,MAAM,CAAC,EAAE;wCACpB,qDAAqD;qCACtD;gCACH,CAAC,CAAC,CAAC;6BACJ;wBACH,CAAC,CAAC,CAAC;oBACL,CAAC,CAAC,CAAC;iBACJ;YACH,CAAC,CAAC,CAAC;SACJ;QAED,6BAA6B;QAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC3B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;KAClC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IACpC,MAAM,SAAS,GAAG,aAAa,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;IAElC,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,GAAG,CAClC,KAAK,CAAC,IAAI,CAAC,kBAAU,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACzC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CACzC,CACF,CAAC;IAEF,+BAA+B;IAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE3D,mBAAmB;IACnB,kBAAU,CAAC,KAAK,EAAE,CAAC;IACnB,0CAA0C;IAC1C,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC,CAAC;AAjBW,QAAA,WAAW,eAiBtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const performReload: (shouldReload: any) => boolean;
|
|
2
|
+
export declare const checkUnreachableRemote: (remoteScope: any) => boolean;
|
|
3
|
+
export declare const checkMedusaConfigChange: (remoteScope: any, fetchModule: any) => boolean;
|
|
4
|
+
export declare const checkFakeRemote: (remoteScope: any) => boolean;
|
|
5
|
+
export declare const fetchRemote: (remoteScope: any, fetchModule: any) => Promise<any[]>;
|
|
6
|
+
export declare const revalidate: (remoteScope?: any, fetchModule?: any) => Promise<boolean>;
|
|
7
|
+
export declare function getFetchModule(): any;
|