@module-federation/node 0.0.0-perf-devtools-20260107043700 → 0.0.0-perf-website-code-usage-20260914033703

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 (128) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +31 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +8 -0
  3. package/dist/node_modules/.pnpm/webpack@5.104.1_@swc_core@1.7.26_@swc_helpers@0.5.13__esbuild@0.28.1_webpack-cli@5.1.4/node_modules/webpack/types.d.mts +1 -0
  4. package/dist/node_modules/.pnpm/webpack@5.104.1_@swc_core@1.7.26_@swc_helpers@0.5.13__esbuild@0.28.1_webpack-cli@5.1.4/node_modules/webpack/types.d.ts +1 -0
  5. package/dist/plugins/ChunkCorrelationPlugin.js +308 -0
  6. package/dist/plugins/ChunkCorrelationPlugin.js.map +1 -0
  7. package/dist/plugins/ChunkCorrelationPlugin.mjs +305 -0
  8. package/dist/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  9. package/dist/plugins/createBundlerLogger.js +9 -0
  10. package/dist/plugins/createBundlerLogger.js.map +1 -0
  11. package/dist/plugins/createBundlerLogger.mjs +8 -0
  12. package/dist/plugins/createBundlerLogger.mjs.map +1 -0
  13. package/dist/src/filesystem/stratagies.d.mts +21 -0
  14. package/dist/src/filesystem/stratagies.d.ts +10 -7
  15. package/dist/src/filesystem/stratagies.js +97 -116
  16. package/dist/src/filesystem/stratagies.js.map +1 -1
  17. package/dist/src/filesystem/stratagies.mjs +103 -0
  18. package/dist/src/filesystem/stratagies.mjs.map +1 -0
  19. package/dist/src/index.d.mts +8 -0
  20. package/dist/src/index.d.ts +8 -7
  21. package/dist/src/index.js +16 -22
  22. package/dist/src/index.mjs +9 -0
  23. package/dist/src/plugins/AutomaticPublicPathPlugin.d.mts +12 -0
  24. package/dist/src/plugins/AutomaticPublicPathPlugin.d.ts +9 -7
  25. package/dist/src/plugins/AutomaticPublicPathPlugin.js +26 -35
  26. package/dist/src/plugins/AutomaticPublicPathPlugin.js.map +1 -1
  27. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs +28 -0
  28. package/dist/src/plugins/AutomaticPublicPathPlugin.mjs.map +1 -0
  29. package/dist/src/plugins/ChunkCorrelationPlugin.d.mts +5 -0
  30. package/dist/src/plugins/ChunkCorrelationPlugin.d.ts +4 -61
  31. package/dist/src/plugins/ChunkCorrelationPlugin.js +8 -440
  32. package/dist/src/plugins/ChunkCorrelationPlugin.js.map +1 -1
  33. package/dist/src/plugins/ChunkCorrelationPlugin.mjs +8 -0
  34. package/dist/src/plugins/ChunkCorrelationPlugin.mjs.map +1 -0
  35. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.mts +21 -0
  36. package/dist/src/plugins/CommonJsChunkLoadingPlugin.d.ts +16 -13
  37. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js +68 -118
  38. package/dist/src/plugins/CommonJsChunkLoadingPlugin.js.map +1 -1
  39. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs +70 -0
  40. package/dist/src/plugins/CommonJsChunkLoadingPlugin.mjs.map +1 -0
  41. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.mts +44 -0
  42. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.d.ts +37 -34
  43. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js +109 -126
  44. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.js.map +1 -1
  45. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs +110 -0
  46. package/dist/src/plugins/DynamicFilesystemChunkLoadingRuntimeModule.mjs.map +1 -0
  47. package/dist/src/plugins/EntryChunkTrackerPlugin.d.mts +17 -0
  48. package/dist/src/plugins/EntryChunkTrackerPlugin.d.ts +14 -10
  49. package/dist/src/plugins/EntryChunkTrackerPlugin.js +30 -32
  50. package/dist/src/plugins/EntryChunkTrackerPlugin.js.map +1 -1
  51. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs +38 -0
  52. package/dist/src/plugins/EntryChunkTrackerPlugin.mjs.map +1 -0
  53. package/dist/src/plugins/NodeFederationPlugin.d.mts +54 -0
  54. package/dist/src/plugins/NodeFederationPlugin.d.ts +33 -26
  55. package/dist/src/plugins/NodeFederationPlugin.js +72 -84
  56. package/dist/src/plugins/NodeFederationPlugin.js.map +1 -1
  57. package/dist/src/plugins/NodeFederationPlugin.mjs +73 -0
  58. package/dist/src/plugins/NodeFederationPlugin.mjs.map +1 -0
  59. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.mts +13 -0
  60. package/dist/src/plugins/RemotePublicPathRuntimeModule.d.ts +10 -8
  61. package/dist/src/plugins/RemotePublicPathRuntimeModule.js +34 -35
  62. package/dist/src/plugins/RemotePublicPathRuntimeModule.js.map +1 -1
  63. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs +132 -0
  64. package/dist/src/plugins/RemotePublicPathRuntimeModule.mjs.map +1 -0
  65. package/dist/src/plugins/StreamingTargetPlugin.d.mts +32 -0
  66. package/dist/src/plugins/StreamingTargetPlugin.d.ts +19 -16
  67. package/dist/src/plugins/StreamingTargetPlugin.js +43 -56
  68. package/dist/src/plugins/StreamingTargetPlugin.js.map +1 -1
  69. package/dist/src/plugins/StreamingTargetPlugin.mjs +46 -0
  70. package/dist/src/plugins/StreamingTargetPlugin.mjs.map +1 -0
  71. package/dist/src/plugins/UniversalFederationPlugin.d.mts +49 -0
  72. package/dist/src/plugins/UniversalFederationPlugin.d.ts +26 -23
  73. package/dist/src/plugins/UniversalFederationPlugin.js +62 -81
  74. package/dist/src/plugins/UniversalFederationPlugin.js.map +1 -1
  75. package/dist/src/plugins/UniversalFederationPlugin.mjs +65 -0
  76. package/dist/src/plugins/UniversalFederationPlugin.mjs.map +1 -0
  77. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.mts +9 -0
  78. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.d.ts +6 -3
  79. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js +14 -17
  80. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.js.map +1 -1
  81. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs +23 -0
  82. package/dist/src/plugins/UniverseEntryChunkTrackerPlugin.mjs.map +1 -0
  83. package/dist/src/plugins/webpackChunkUtilities.d.mts +55 -0
  84. package/dist/src/plugins/webpackChunkUtilities.d.ts +14 -9
  85. package/dist/src/plugins/webpackChunkUtilities.js +195 -257
  86. package/dist/src/plugins/webpackChunkUtilities.js.map +1 -1
  87. package/dist/src/plugins/webpackChunkUtilities.mjs +234 -0
  88. package/dist/src/plugins/webpackChunkUtilities.mjs.map +1 -0
  89. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.mts +7 -0
  90. package/dist/src/recordDynamicRemoteEntryHashPlugin.d.ts +5 -2
  91. package/dist/src/recordDynamicRemoteEntryHashPlugin.js +24 -61
  92. package/dist/src/recordDynamicRemoteEntryHashPlugin.js.map +1 -1
  93. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs +26 -0
  94. package/dist/src/recordDynamicRemoteEntryHashPlugin.mjs.map +1 -0
  95. package/dist/src/runtimePlugin.d.mts +27 -0
  96. package/dist/src/runtimePlugin.d.ts +24 -19
  97. package/dist/src/runtimePlugin.js +214 -252
  98. package/dist/src/runtimePlugin.js.map +1 -1
  99. package/dist/src/runtimePlugin.mjs +226 -0
  100. package/dist/src/runtimePlugin.mjs.map +1 -0
  101. package/dist/src/types/index.d.mts +8 -0
  102. package/dist/src/types/index.d.ts +8 -3
  103. package/dist/src/types/index.js +1 -3
  104. package/dist/src/types/index.mjs +1 -0
  105. package/dist/src/utils/flush-chunks.d.mts +17 -0
  106. package/dist/src/utils/flush-chunks.d.ts +9 -3
  107. package/dist/src/utils/flush-chunks.js +138 -167
  108. package/dist/src/utils/flush-chunks.js.map +1 -1
  109. package/dist/src/utils/flush-chunks.mjs +144 -0
  110. package/dist/src/utils/flush-chunks.mjs.map +1 -0
  111. package/dist/src/utils/hot-reload.d.mts +16 -0
  112. package/dist/src/utils/hot-reload.d.ts +14 -10
  113. package/dist/src/utils/hot-reload.js +178 -264
  114. package/dist/src/utils/hot-reload.js.map +1 -1
  115. package/dist/src/utils/hot-reload.mjs +195 -0
  116. package/dist/src/utils/hot-reload.mjs.map +1 -0
  117. package/dist/src/utils/index.d.mts +3 -0
  118. package/dist/src/utils/index.d.ts +3 -2
  119. package/dist/src/utils/index.js +15 -19
  120. package/dist/src/utils/index.mjs +4 -0
  121. package/package.json +71 -26
  122. package/dist/jest.config.d.ts +0 -11
  123. package/dist/jest.config.js +0 -19
  124. package/dist/jest.config.js.map +0 -1
  125. package/dist/package.json +0 -90
  126. package/dist/src/index.js.map +0 -1
  127. package/dist/src/types/index.js.map +0 -1
  128. package/dist/src/utils/index.js.map +0 -1
@@ -1,280 +1,242 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setupWebpackRequirePatching = exports.setupChunkHandler = exports.setupScriptLoader = exports.deleteChunk = exports.installChunk = exports.loadChunk = exports.resolveUrl = exports.fetchAndRun = exports.loadFromFs = exports.returnFromGlobalInstances = exports.returnFromCache = exports.resolveFile = exports.nodeRuntimeImportCache = void 0;
4
- exports.importNodeModule = importNodeModule;
5
- exports.default = default_1;
6
- exports.nodeRuntimeImportCache = new Map();
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+
3
+ //#region src/runtimePlugin.ts
4
+ const nodeRuntimeImportCache = /* @__PURE__ */ new Map();
5
+ const CHUNK_PREVIEW_LENGTH = 240;
6
+ const getChunkPreview = (content) => content.slice(0, CHUNK_PREVIEW_LENGTH).replace(/\s+/g, " ").trim();
7
+ const enrichChunkExecutionError = (error, options) => {
8
+ const normalizedError = error instanceof Error ? error : new Error(String(error));
9
+ const preview = getChunkPreview(options.content);
10
+ const details = [
11
+ `Federated chunk execution failed.`,
12
+ `chunk: ${options.chunkName}`,
13
+ `source: ${options.source}`,
14
+ `location: ${options.location}`
15
+ ];
16
+ if (options.hostName) details.push(`host: ${options.hostName}`);
17
+ if (options.resolution) {
18
+ details.push(`resolved-from: ${options.resolution.resolvedFrom}`);
19
+ if (options.resolution.remoteName) details.push(`remote: ${options.resolution.remoteName}`);
20
+ if (options.resolution.publicPath) details.push(`public-path: ${options.resolution.publicPath}`);
21
+ if (options.resolution.rootOutputDir) details.push(`root-output-dir: ${options.resolution.rootOutputDir}`);
22
+ if (options.resolution.remoteEntryUrl) details.push(`remote-entry: ${options.resolution.remoteEntryUrl}`);
23
+ }
24
+ if (preview) details.push(`preview: ${preview}`);
25
+ normalizedError.message = `${normalizedError.message}\n${details.join("\n")}`;
26
+ Object.assign(normalizedError, {
27
+ chunkName: options.chunkName,
28
+ chunkLocation: options.location,
29
+ chunkSource: options.source,
30
+ chunkPreview: preview,
31
+ chunkHostName: options.hostName,
32
+ chunkResolution: options.resolution
33
+ });
34
+ return normalizedError;
35
+ };
7
36
  function importNodeModule(name) {
8
- if (!name) {
9
- throw new Error('import specifier is required');
10
- }
11
- // Check cache to prevent infinite recursion
12
- if (exports.nodeRuntimeImportCache.has(name)) {
13
- return exports.nodeRuntimeImportCache.get(name);
14
- }
15
- const importModule = new Function('name', `return import(name)`);
16
- const promise = importModule(name)
17
- .then((res) => res.default)
18
- .catch((error) => {
19
- console.error(`Error importing module ${name}:`, error);
20
- // Remove from cache on error so it can be retried
21
- exports.nodeRuntimeImportCache.delete(name);
22
- throw error;
23
- });
24
- // Cache the promise to prevent recursive calls
25
- exports.nodeRuntimeImportCache.set(name, promise);
26
- return promise;
37
+ if (!name) throw new Error("import specifier is required");
38
+ if (nodeRuntimeImportCache.has(name)) return nodeRuntimeImportCache.get(name);
39
+ const promise = new Function("name", `return import(name)`)(name).then((res) => res.default).catch((error) => {
40
+ console.error(`Error importing module ${name}:`, error);
41
+ nodeRuntimeImportCache.delete(name);
42
+ throw error;
43
+ });
44
+ nodeRuntimeImportCache.set(name, promise);
45
+ return promise;
27
46
  }
28
- // Hoisted utility function to resolve file paths for chunks
29
47
  const resolveFile = (rootOutputDir, chunkId) => {
30
- const path = __non_webpack_require__('path');
31
- return path.join(__dirname, rootOutputDir + __webpack_require__.u(chunkId));
48
+ return __non_webpack_require__("path").join(__dirname, rootOutputDir + __webpack_require__.u(chunkId));
32
49
  };
33
- exports.resolveFile = resolveFile;
34
- // Hoisted utility function to get remote entry from cache
35
50
  const returnFromCache = (remoteName) => {
36
- const globalThisVal = new Function('return globalThis')();
37
- const federationInstances = globalThisVal['__FEDERATION__']['__INSTANCES__'];
38
- for (const instance of federationInstances) {
39
- const moduleContainer = instance.moduleCache.get(remoteName);
40
- if (moduleContainer?.remoteInfo)
41
- return moduleContainer.remoteInfo.entry;
42
- }
43
- return null;
51
+ const federationInstances = new Function("return globalThis")()["__FEDERATION__"]["__INSTANCES__"];
52
+ for (const instance of federationInstances) {
53
+ const moduleContainer = instance.moduleCache.get(remoteName);
54
+ if (moduleContainer?.remoteInfo) return moduleContainer.remoteInfo.entry;
55
+ }
56
+ return null;
44
57
  };
45
- exports.returnFromCache = returnFromCache;
46
- // Hoisted utility function to get remote entry from global instances
47
58
  const returnFromGlobalInstances = (remoteName) => {
48
- const globalThisVal = new Function('return globalThis')();
49
- const federationInstances = globalThisVal['__FEDERATION__']['__INSTANCES__'];
50
- for (const instance of federationInstances) {
51
- for (const remote of instance.options.remotes) {
52
- if (remote.name === remoteName || remote.alias === remoteName) {
53
- console.log('Backup remote entry found:', remote.entry);
54
- return remote.entry;
55
- }
56
- }
57
- }
58
- return null;
59
+ const federationInstances = new Function("return globalThis")()["__FEDERATION__"]["__INSTANCES__"];
60
+ for (const instance of federationInstances) for (const remote of instance.options.remotes) if (remote.name === remoteName || remote.alias === remoteName) {
61
+ console.log("Backup remote entry found:", remote.entry);
62
+ return remote.entry;
63
+ }
64
+ return null;
59
65
  };
60
- exports.returnFromGlobalInstances = returnFromGlobalInstances;
61
- // Hoisted utility function to load chunks from filesystem
62
66
  const loadFromFs = (filename, callback) => {
63
- const fs = __non_webpack_require__('fs');
64
- const path = __non_webpack_require__('path');
65
- const vm = __non_webpack_require__('vm');
66
- if (fs.existsSync(filename)) {
67
- fs.readFile(filename, 'utf-8', (err, content) => {
68
- if (err)
69
- return callback(err, null);
70
- const chunk = {};
71
- try {
72
- const script = new vm.Script(`(function(exports, require, __dirname, __filename) {${content}\n})`, {
73
- filename,
74
- importModuleDynamically:
75
- //@ts-ignore
76
- vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule,
77
- });
78
- script.runInThisContext()(chunk, __non_webpack_require__, path.dirname(filename), filename);
79
- callback(null, chunk);
80
- }
81
- catch (e) {
82
- console.log("'runInThisContext threw'", e);
83
- callback(e, null);
84
- }
85
- });
86
- }
87
- else {
88
- callback(new Error(`File ${filename} does not exist`), null);
89
- }
67
+ const fs = __non_webpack_require__("fs");
68
+ const path = __non_webpack_require__("path");
69
+ const vm = __non_webpack_require__("vm");
70
+ if (fs.existsSync(filename)) fs.readFile(filename, "utf-8", (err, content) => {
71
+ if (err) return callback(err, null);
72
+ const chunk = {};
73
+ try {
74
+ new vm.Script(`(function(exports, require, __dirname, __filename) {${content}\n})`, {
75
+ filename,
76
+ importModuleDynamically: vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule
77
+ }).runInThisContext()(chunk, __non_webpack_require__, path.dirname(filename), filename);
78
+ callback(null, chunk);
79
+ } catch (e) {
80
+ callback(enrichChunkExecutionError(e, {
81
+ chunkName: path.basename(filename),
82
+ location: filename,
83
+ source: "filesystem",
84
+ content
85
+ }), null);
86
+ }
87
+ });
88
+ else callback(/* @__PURE__ */ new Error(`File ${filename} does not exist`), null);
90
89
  };
91
- exports.loadFromFs = loadFromFs;
92
- // Hoisted utility function to fetch and execute chunks from remote URLs
93
90
  const fetchAndRun = (url, chunkName, callback, args) => {
94
- (typeof fetch === 'undefined'
95
- ? importNodeModule('node-fetch').then((mod) => mod.default)
96
- : Promise.resolve(fetch))
97
- .then((fetchFunction) => {
98
- return args.origin.loaderHook.lifecycle.fetch
99
- .emit(url.href, {})
100
- .then((res) => {
101
- if (!res || !(res instanceof Response)) {
102
- return fetchFunction(url.href).then((response) => response.text());
103
- }
104
- return res.text();
105
- });
106
- })
107
- .then((data) => {
108
- const chunk = {};
109
- try {
110
- eval(`(function(exports, require, __dirname, __filename) {${data}\n})`)(chunk, __non_webpack_require__, url.pathname.split('/').slice(0, -1).join('/'), chunkName);
111
- callback(null, chunk);
112
- }
113
- catch (e) {
114
- callback(e, null);
115
- }
116
- })
117
- .catch((err) => callback(err, null));
91
+ (typeof fetch === "undefined" ? importNodeModule("node-fetch").then((mod) => mod.default) : Promise.resolve(fetch)).then((fetchFunction) => {
92
+ return args.origin.loaderHook.lifecycle.fetch.emit(url.href, {}).then((res) => {
93
+ if (!res || !(res instanceof Response)) return fetchFunction(url.href).then((response) => response.text());
94
+ return res.text();
95
+ });
96
+ }).then((data) => {
97
+ const chunk = {};
98
+ const hostName = args?.origin?.options?.name || args?.origin?.name;
99
+ const resolution = url.mfMetadata;
100
+ try {
101
+ eval(`(function(exports, require, __dirname, __filename) {${data}\n})`)(chunk, __non_webpack_require__, url.pathname.split("/").slice(0, -1).join("/"), chunkName);
102
+ callback(null, chunk);
103
+ } catch (e) {
104
+ callback(enrichChunkExecutionError(e, {
105
+ chunkName,
106
+ location: url.href,
107
+ source: "remote-url",
108
+ content: data,
109
+ hostName,
110
+ resolution
111
+ }), null);
112
+ }
113
+ }).catch((err) => callback(err, null));
118
114
  };
119
- exports.fetchAndRun = fetchAndRun;
120
- // Hoisted utility function to resolve URLs for chunks
121
115
  const resolveUrl = (remoteName, chunkName) => {
122
- try {
123
- return new URL(chunkName, __webpack_require__.p);
124
- }
125
- catch {
126
- const entryUrl = (0, exports.returnFromCache)(remoteName) || (0, exports.returnFromGlobalInstances)(remoteName);
127
- if (!entryUrl)
128
- return null;
129
- const url = new URL(entryUrl);
130
- const path = __non_webpack_require__('path');
131
- // Extract the directory path from the remote entry URL
132
- // e.g., from "http://url/static/js/remoteEntry.js" to "/static/js/"
133
- const urlPath = url.pathname;
134
- const lastSlashIndex = urlPath.lastIndexOf('/');
135
- const directoryPath = lastSlashIndex >= 0 ? urlPath.substring(0, lastSlashIndex + 1) : '/';
136
- // Get rootDir from webpack configuration
137
- const rootDir = __webpack_require__.federation.rootOutputDir || '';
138
- // Use path.join to combine the paths properly while handling slashes
139
- // Convert Windows-style paths to URL-style paths
140
- const combinedPath = path
141
- .join(directoryPath, rootDir, chunkName)
142
- .replace(/\\/g, '/');
143
- // Create the final URL
144
- return new URL(combinedPath, url.origin);
145
- }
116
+ try {
117
+ return Object.assign(new URL(chunkName, __webpack_require__.p), { mfMetadata: {
118
+ chunkName,
119
+ publicPath: __webpack_require__.p,
120
+ remoteName,
121
+ rootOutputDir: __webpack_require__.federation.rootOutputDir || "",
122
+ resolvedFrom: "public-path"
123
+ } });
124
+ } catch {
125
+ const entryUrl = returnFromCache(remoteName) || returnFromGlobalInstances(remoteName);
126
+ if (!entryUrl) return null;
127
+ const url = new URL(entryUrl);
128
+ const path = __non_webpack_require__("path");
129
+ const urlPath = url.pathname;
130
+ const lastSlashIndex = urlPath.lastIndexOf("/");
131
+ const directoryPath = lastSlashIndex >= 0 ? urlPath.substring(0, lastSlashIndex + 1) : "/";
132
+ const rootDir = __webpack_require__.federation.rootOutputDir || "";
133
+ const combinedPath = path.join(directoryPath, rootDir, chunkName).replace(/\\/g, "/");
134
+ return Object.assign(new URL(combinedPath, url.origin), { mfMetadata: {
135
+ chunkName,
136
+ publicPath: __webpack_require__.p,
137
+ remoteName,
138
+ rootOutputDir: rootDir,
139
+ resolvedFrom: "remote-entry-fallback",
140
+ remoteEntryUrl: entryUrl
141
+ } });
142
+ }
146
143
  };
147
- exports.resolveUrl = resolveUrl;
148
- // Hoisted utility function to load chunks based on different strategies
149
144
  const loadChunk = (strategy, chunkId, rootOutputDir, callback, args) => {
150
- if (strategy === 'filesystem') {
151
- return (0, exports.loadFromFs)((0, exports.resolveFile)(rootOutputDir, chunkId), callback);
152
- }
153
- const url = (0, exports.resolveUrl)(rootOutputDir, chunkId);
154
- if (!url)
155
- return callback(null, { modules: {}, ids: [], runtime: null });
156
- // Using fetchAndRun directly with args
157
- (0, exports.fetchAndRun)(url, chunkId, callback, args);
145
+ if (strategy === "filesystem") return loadFromFs(resolveFile(rootOutputDir, chunkId), callback);
146
+ const url = resolveUrl(rootOutputDir, chunkId);
147
+ if (!url) return callback(null, {
148
+ modules: {},
149
+ ids: [],
150
+ runtime: null
151
+ });
152
+ fetchAndRun(url, chunkId, callback, args);
158
153
  };
159
- exports.loadChunk = loadChunk;
160
- // Hoisted utility function to install a chunk into webpack
161
154
  const installChunk = (chunk, installedChunks) => {
162
- for (const moduleId in chunk.modules) {
163
- __webpack_require__.m[moduleId] = chunk.modules[moduleId];
164
- }
165
- if (chunk.runtime)
166
- chunk.runtime(__webpack_require__);
167
- for (const chunkId of chunk.ids) {
168
- if (installedChunks[chunkId])
169
- installedChunks[chunkId][0]();
170
- installedChunks[chunkId] = 0;
171
- }
155
+ for (const moduleId in chunk.modules) __webpack_require__.m[moduleId] = chunk.modules[moduleId];
156
+ if (chunk.runtime) chunk.runtime(__webpack_require__);
157
+ for (const chunkId of chunk.ids) {
158
+ if (installedChunks[chunkId]) installedChunks[chunkId][0]();
159
+ installedChunks[chunkId] = 0;
160
+ }
172
161
  };
173
- exports.installChunk = installChunk;
174
- // Hoisted utility function to remove a chunk on fail
175
162
  const deleteChunk = (chunkId, installedChunks) => {
176
- delete installedChunks[chunkId];
177
- return true;
163
+ delete installedChunks[chunkId];
164
+ return true;
178
165
  };
179
- exports.deleteChunk = deleteChunk;
180
- // Hoisted function to set up webpack script loader
181
166
  const setupScriptLoader = () => {
182
- __webpack_require__.l = (url, done, key, chunkId) => {
183
- if (!key || chunkId)
184
- throw new Error(`__webpack_require__.l name is required for ${url}`);
185
- __webpack_require__.federation.runtime
186
- .loadScriptNode(url, { attrs: { globalName: key } })
187
- .then((res) => {
188
- const enhancedRemote = __webpack_require__.federation.instance.initRawContainer(key, url, res);
189
- new Function('return globalThis')()[key] = enhancedRemote;
190
- done(enhancedRemote);
191
- })
192
- .catch(done);
193
- };
167
+ __webpack_require__.l = (url, done, key, chunkId) => {
168
+ if (!key || chunkId) throw new Error(`__webpack_require__.l name is required for ${url}`);
169
+ __webpack_require__.federation.runtime.loadScriptNode(url, { attrs: { globalName: key } }).then((res) => {
170
+ const enhancedRemote = __webpack_require__.federation.instance.initRawContainer(key, url, res);
171
+ new Function("return globalThis")()[key] = enhancedRemote;
172
+ done(enhancedRemote);
173
+ }).catch(done);
174
+ };
194
175
  };
195
- exports.setupScriptLoader = setupScriptLoader;
196
- // Hoisted function to set up chunk handler
197
176
  const setupChunkHandler = (installedChunks, args) => {
198
- return (chunkId, promises) => {
199
- let installedChunkData = installedChunks[chunkId];
200
- if (installedChunkData !== 0) {
201
- if (installedChunkData) {
202
- promises.push(installedChunkData[2]);
203
- }
204
- else {
205
- const matcher = __webpack_require__.federation.chunkMatcher
206
- ? __webpack_require__.federation.chunkMatcher(chunkId)
207
- : true;
208
- if (matcher) {
209
- const promise = new Promise((resolve, reject) => {
210
- installedChunkData = installedChunks[chunkId] = [resolve, reject];
211
- const fs = typeof process !== 'undefined'
212
- ? __non_webpack_require__('fs')
213
- : false;
214
- const filename = typeof process !== 'undefined'
215
- ? (0, exports.resolveFile)(__webpack_require__.federation.rootOutputDir || '', chunkId)
216
- : false;
217
- if (fs && fs.existsSync(filename)) {
218
- (0, exports.loadChunk)('filesystem', chunkId, __webpack_require__.federation.rootOutputDir || '', (err, chunk) => {
219
- if (err)
220
- return (0, exports.deleteChunk)(chunkId, installedChunks) && reject(err);
221
- if (chunk)
222
- (0, exports.installChunk)(chunk, installedChunks);
223
- resolve(chunk);
224
- }, args);
225
- }
226
- else {
227
- const chunkName = __webpack_require__.u(chunkId);
228
- const loadingStrategy = typeof process === 'undefined' ? 'http-eval' : 'http-vm';
229
- (0, exports.loadChunk)(loadingStrategy, chunkName, __webpack_require__.federation.initOptions.name, (err, chunk) => {
230
- if (err)
231
- return (0, exports.deleteChunk)(chunkId, installedChunks) && reject(err);
232
- if (chunk)
233
- (0, exports.installChunk)(chunk, installedChunks);
234
- resolve(chunk);
235
- }, args);
236
- }
237
- });
238
- promises.push((installedChunkData[2] = promise));
239
- }
240
- else {
241
- installedChunks[chunkId] = 0;
242
- }
243
- }
244
- }
245
- };
177
+ return (chunkId, promises) => {
178
+ let installedChunkData = installedChunks[chunkId];
179
+ if (installedChunkData !== 0) if (installedChunkData) promises.push(installedChunkData[2]);
180
+ else if (__webpack_require__.federation.chunkMatcher ? __webpack_require__.federation.chunkMatcher(chunkId) : true) {
181
+ const promise = new Promise((resolve, reject) => {
182
+ installedChunkData = installedChunks[chunkId] = [resolve, reject];
183
+ const fs = typeof process !== "undefined" ? __non_webpack_require__("fs") : false;
184
+ const filename = typeof process !== "undefined" ? resolveFile(__webpack_require__.federation.rootOutputDir || "", chunkId) : false;
185
+ if (fs && fs.existsSync(filename)) loadChunk("filesystem", chunkId, __webpack_require__.federation.rootOutputDir || "", (err, chunk) => {
186
+ if (err) return deleteChunk(chunkId, installedChunks) && reject(err);
187
+ if (chunk) installChunk(chunk, installedChunks);
188
+ resolve(chunk);
189
+ }, args);
190
+ else {
191
+ const chunkName = __webpack_require__.u(chunkId);
192
+ loadChunk(typeof process === "undefined" ? "http-eval" : "http-vm", chunkName, __webpack_require__.federation.initOptions.name, (err, chunk) => {
193
+ if (err) return deleteChunk(chunkId, installedChunks) && reject(err);
194
+ if (chunk) installChunk(chunk, installedChunks);
195
+ resolve(chunk);
196
+ }, args);
197
+ }
198
+ });
199
+ promises.push(installedChunkData[2] = promise);
200
+ } else installedChunks[chunkId] = 0;
201
+ };
246
202
  };
247
- exports.setupChunkHandler = setupChunkHandler;
248
- // Hoisted function to set up webpack require patching
249
203
  const setupWebpackRequirePatching = (handle) => {
250
- if (__webpack_require__.f) {
251
- if (__webpack_require__.f.require) {
252
- console.warn('\x1b[33m%s\x1b[0m', 'CAUTION: build target is not set to "async-node", attempting to patch additional chunk handlers. This may not work');
253
- __webpack_require__.f.require = handle;
254
- }
255
- if (__webpack_require__.f.readFileVm) {
256
- __webpack_require__.f.readFileVm = handle;
257
- }
258
- }
204
+ if (__webpack_require__.f) {
205
+ if (__webpack_require__.f.require) {
206
+ console.warn("\x1B[33m%s\x1B[0m", "CAUTION: build target is not set to \"async-node\", attempting to patch additional chunk handlers. This may not work");
207
+ __webpack_require__.f.require = handle;
208
+ }
209
+ if (__webpack_require__.f.readFileVm) __webpack_require__.f.readFileVm = handle;
210
+ }
259
211
  };
260
- exports.setupWebpackRequirePatching = setupWebpackRequirePatching;
261
- function default_1() {
262
- return {
263
- name: 'node-federation-plugin',
264
- beforeInit(args) {
265
- // Patch webpack chunk loading handlers
266
- (() => {
267
- // Create the chunk tracking object
268
- const installedChunks = {};
269
- // Set up webpack script loader
270
- (0, exports.setupScriptLoader)();
271
- // Create and set up the chunk handler
272
- const handle = (0, exports.setupChunkHandler)(installedChunks, args);
273
- // Patch webpack require
274
- (0, exports.setupWebpackRequirePatching)(handle);
275
- })();
276
- return args;
277
- },
278
- };
212
+ function runtimePlugin_default() {
213
+ return {
214
+ name: "node-federation-plugin",
215
+ beforeInit(args) {
216
+ (() => {
217
+ const installedChunks = {};
218
+ setupScriptLoader();
219
+ setupWebpackRequirePatching(setupChunkHandler(installedChunks, args));
220
+ })();
221
+ return args;
222
+ }
223
+ };
279
224
  }
225
+
226
+ //#endregion
227
+ exports.default = runtimePlugin_default;
228
+ exports.deleteChunk = deleteChunk;
229
+ exports.fetchAndRun = fetchAndRun;
230
+ exports.importNodeModule = importNodeModule;
231
+ exports.installChunk = installChunk;
232
+ exports.loadChunk = loadChunk;
233
+ exports.loadFromFs = loadFromFs;
234
+ exports.nodeRuntimeImportCache = nodeRuntimeImportCache;
235
+ exports.resolveFile = resolveFile;
236
+ exports.resolveUrl = resolveUrl;
237
+ exports.returnFromCache = returnFromCache;
238
+ exports.returnFromGlobalInstances = returnFromGlobalInstances;
239
+ exports.setupChunkHandler = setupChunkHandler;
240
+ exports.setupScriptLoader = setupScriptLoader;
241
+ exports.setupWebpackRequirePatching = setupWebpackRequirePatching;
280
242
  //# sourceMappingURL=runtimePlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtimePlugin.js","sourceRoot":"","sources":["../../src/runtimePlugin.ts"],"names":[],"mappings":";;;AA2CA,4CAuBC;AAsTD,4BAsBC;AArWY,QAAA,sBAAsB,GAAG,IAAI,GAAG,EAAwB,CAAC;AAEtE,SAAgB,gBAAgB,CAAI,IAAY;IAC9C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,4CAA4C;IAC5C,IAAI,8BAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,OAAO,8BAAsB,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;IAC3C,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACjE,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC;SAC/B,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,OAAY,CAAC;SACpC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,0BAA0B,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;QACxD,kDAAkD;QAClD,8BAAsB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IAEL,+CAA+C;IAC/C,8BAAsB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,OAAO,OAAO,CAAC;AACj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AAC;AACJ,CAAC,CAAC;AAnEW,QAAA,iBAAiB,qBAmE5B;AAEF,sDAAsD;AAC/C,MAAM,2BAA2B,GAAG,CACzC,MAAkD,EAC5C,EAAE;IACR,IAAI,mBAAmB,CAAC,CAAC,EAAE,CAAC;QAC1B,IAAI,mBAAmB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CACV,mBAAmB,EACnB,oHAAoH,CACrH,CAAC;YACF,mBAAmB,CAAC,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC;QACzC,CAAC;QAED,IAAI,mBAAmB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;YACrC,mBAAmB,CAAC,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC;QAC5C,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAhBW,QAAA,2BAA2B,+BAgBtC;AAEF;IACE,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,UAAU,CAAC,IAAI;YACb,uCAAuC;YACvC,CAAC,GAAG,EAAE;gBACJ,mCAAmC;gBACnC,MAAM,eAAe,GAA2B,EAAE,CAAC;gBAEnD,+BAA+B;gBAC/B,IAAA,yBAAiB,GAAE,CAAC;gBAEpB,sCAAsC;gBACtC,MAAM,MAAM,GAAG,IAAA,yBAAiB,EAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBAExD,wBAAwB;gBACxB,IAAA,mCAA2B,EAAC,MAAM,CAAC,CAAC;YACtC,CAAC,CAAC,EAAE,CAAC;YAEL,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"runtimePlugin.js","names":[],"sources":["../../src/runtimePlugin.ts"],"sourcesContent":["import type {\n ModuleFederationRuntimePlugin,\n ModuleFederation,\n} from '@module-federation/runtime';\ntype WebpackRequire = {\n (id: string): any;\n u: (chunkId: string) => string;\n p: string;\n m: { [key: string]: any };\n o: (obj: any, prop: string) => boolean;\n C?: (chunk: any) => void;\n l: (\n url: string,\n done: (res: any) => void,\n key: string,\n chunkId: string,\n ) => void;\n federation: {\n runtime: {\n loadScriptNode: (\n url: string,\n options: { attrs: { globalName: string } },\n ) => Promise<any>;\n };\n instance: ModuleFederation;\n chunkMatcher?: (chunkId: string) => boolean;\n rootOutputDir?: string;\n initOptions: {\n name: string;\n remotes: any;\n };\n };\n f?: {\n require?: (chunkId: string, promises: any[]) => void;\n readFileVm?: (chunkId: string, promises: any[]) => void;\n };\n};\n\ndeclare const __webpack_require__: WebpackRequire;\ndeclare const __non_webpack_require__: (id: string) => any;\n\nexport const nodeRuntimeImportCache = new Map<string, Promise<any>>();\nconst CHUNK_PREVIEW_LENGTH = 240;\ntype ChunkResolutionSource = 'public-path' | 'remote-entry-fallback';\ntype ChunkLocationSource = 'filesystem' | 'remote-url';\ntype ChunkUrlMetadata = {\n chunkName: string;\n publicPath?: string;\n remoteName?: string;\n rootOutputDir?: string;\n resolvedFrom: ChunkResolutionSource;\n remoteEntryUrl?: string;\n};\n\nconst getChunkPreview = (content: string): string =>\n content.slice(0, CHUNK_PREVIEW_LENGTH).replace(/\\s+/g, ' ').trim();\n\nconst enrichChunkExecutionError = (\n error: unknown,\n options: {\n chunkName: string;\n location: string;\n source: ChunkLocationSource;\n content: string;\n hostName?: string;\n resolution?: ChunkUrlMetadata;\n },\n): Error => {\n const normalizedError =\n error instanceof Error ? error : new Error(String(error));\n const preview = getChunkPreview(options.content);\n const details = [\n `Federated chunk execution failed.`,\n `chunk: ${options.chunkName}`,\n `source: ${options.source}`,\n `location: ${options.location}`,\n ];\n\n if (options.hostName) {\n details.push(`host: ${options.hostName}`);\n }\n\n if (options.resolution) {\n details.push(`resolved-from: ${options.resolution.resolvedFrom}`);\n\n if (options.resolution.remoteName) {\n details.push(`remote: ${options.resolution.remoteName}`);\n }\n\n if (options.resolution.publicPath) {\n details.push(`public-path: ${options.resolution.publicPath}`);\n }\n\n if (options.resolution.rootOutputDir) {\n details.push(`root-output-dir: ${options.resolution.rootOutputDir}`);\n }\n\n if (options.resolution.remoteEntryUrl) {\n details.push(`remote-entry: ${options.resolution.remoteEntryUrl}`);\n }\n }\n\n if (preview) {\n details.push(`preview: ${preview}`);\n }\n\n normalizedError.message = `${normalizedError.message}\\n${details.join('\\n')}`;\n\n Object.assign(normalizedError, {\n chunkName: options.chunkName,\n chunkLocation: options.location,\n chunkSource: options.source,\n chunkPreview: preview,\n chunkHostName: options.hostName,\n chunkResolution: options.resolution,\n });\n\n return normalizedError;\n};\n\nexport function importNodeModule<T>(name: string): Promise<T> {\n if (!name) {\n throw new Error('import specifier is required');\n }\n\n // Check cache to prevent infinite recursion\n if (nodeRuntimeImportCache.has(name)) {\n return nodeRuntimeImportCache.get(name)!;\n }\n\n const importModule = new Function('name', `return import(name)`);\n const promise = importModule(name)\n .then((res: any) => res.default as T)\n .catch((error: any) => {\n console.error(`Error importing module ${name}:`, error);\n // Remove from cache on error so it can be retried\n nodeRuntimeImportCache.delete(name);\n throw error;\n });\n\n // Cache the promise to prevent recursive calls\n nodeRuntimeImportCache.set(name, promise);\n return promise;\n}\n\n// Hoisted utility function to resolve file paths for chunks\nexport const resolveFile = (rootOutputDir: string, chunkId: string): string => {\n const path = __non_webpack_require__('path');\n return path.join(__dirname, rootOutputDir + __webpack_require__.u(chunkId));\n};\n\n// Hoisted utility function to get remote entry from cache\nexport const returnFromCache = (remoteName: string): string | null => {\n const globalThisVal = new Function('return globalThis')();\n const federationInstances = globalThisVal['__FEDERATION__']['__INSTANCES__'];\n for (const instance of federationInstances) {\n const moduleContainer = instance.moduleCache.get(remoteName);\n if (moduleContainer?.remoteInfo) return moduleContainer.remoteInfo.entry;\n }\n return null;\n};\n\n// Hoisted utility function to get remote entry from global instances\nexport const returnFromGlobalInstances = (\n remoteName: string,\n): string | null => {\n const globalThisVal = new Function('return globalThis')();\n const federationInstances = globalThisVal['__FEDERATION__']['__INSTANCES__'];\n for (const instance of federationInstances) {\n for (const remote of instance.options.remotes) {\n if (remote.name === remoteName || remote.alias === remoteName) {\n console.log('Backup remote entry found:', remote.entry);\n return remote.entry;\n }\n }\n }\n return null;\n};\n\n// Hoisted utility function to load chunks from filesystem\nexport const loadFromFs = (\n filename: string,\n callback: (err: Error | null, chunk: any) => void,\n): void => {\n const fs = __non_webpack_require__('fs') as typeof import('fs');\n const path = __non_webpack_require__('path') as typeof import('path');\n const vm = __non_webpack_require__('vm') as typeof import('vm');\n\n if (fs.existsSync(filename)) {\n fs.readFile(filename, 'utf-8', (err, content) => {\n if (err) return callback(err, null);\n const chunk = {};\n try {\n const script = new vm.Script(\n `(function(exports, require, __dirname, __filename) {${content}\\n})`,\n {\n filename,\n importModuleDynamically:\n //@ts-ignore\n vm.constants?.USE_MAIN_CONTEXT_DEFAULT_LOADER ?? importNodeModule,\n },\n );\n script.runInThisContext()(\n chunk,\n __non_webpack_require__,\n path.dirname(filename),\n filename,\n );\n callback(null, chunk);\n } catch (e) {\n callback(\n enrichChunkExecutionError(e, {\n chunkName: path.basename(filename),\n location: filename,\n source: 'filesystem',\n content,\n }),\n null,\n );\n }\n });\n } else {\n callback(new Error(`File ${filename} does not exist`), null);\n }\n};\n\n// Hoisted utility function to fetch and execute chunks from remote URLs\nexport const fetchAndRun = (\n url: URL,\n chunkName: string,\n callback: (err: Error | null, chunk: any) => void,\n args: any,\n): void => {\n (typeof fetch === 'undefined'\n ? importNodeModule<typeof import('node-fetch')>('node-fetch').then(\n (mod) => mod.default,\n )\n : Promise.resolve(fetch)\n )\n .then((fetchFunction) => {\n return args.origin.loaderHook.lifecycle.fetch\n .emit(url.href, {})\n .then((res: Response | null) => {\n if (!res || !(res instanceof Response)) {\n return fetchFunction(url.href).then((response) => response.text());\n }\n return res.text();\n });\n })\n .then((data) => {\n const chunk = {};\n const hostName = args?.origin?.options?.name || args?.origin?.name;\n const resolution = (url as URL & { mfMetadata?: ChunkUrlMetadata })\n .mfMetadata;\n try {\n eval(`(function(exports, require, __dirname, __filename) {${data}\\n})`)(\n chunk,\n __non_webpack_require__,\n url.pathname.split('/').slice(0, -1).join('/'),\n chunkName,\n );\n callback(null, chunk);\n } catch (e) {\n callback(\n enrichChunkExecutionError(e, {\n chunkName,\n location: url.href,\n source: 'remote-url',\n content: data,\n hostName,\n resolution,\n }),\n null,\n );\n }\n })\n .catch((err: Error) => callback(err, null));\n};\n\n// Hoisted utility function to resolve URLs for chunks\nexport const resolveUrl = (\n remoteName: string,\n chunkName: string,\n): URL | null => {\n try {\n return Object.assign(new URL(chunkName, __webpack_require__.p), {\n mfMetadata: {\n chunkName,\n publicPath: __webpack_require__.p,\n remoteName,\n rootOutputDir: __webpack_require__.federation.rootOutputDir || '',\n resolvedFrom: 'public-path' as const,\n },\n });\n } catch {\n const entryUrl =\n returnFromCache(remoteName) || returnFromGlobalInstances(remoteName);\n\n if (!entryUrl) return null;\n\n const url = new URL(entryUrl);\n const path = __non_webpack_require__('path');\n\n // Extract the directory path from the remote entry URL\n // e.g., from \"http://url/static/js/remoteEntry.js\" to \"/static/js/\"\n const urlPath = url.pathname;\n const lastSlashIndex = urlPath.lastIndexOf('/');\n const directoryPath =\n lastSlashIndex >= 0 ? urlPath.substring(0, lastSlashIndex + 1) : '/';\n\n // Get rootDir from webpack configuration\n const rootDir = __webpack_require__.federation.rootOutputDir || '';\n\n // Use path.join to combine the paths properly while handling slashes\n // Convert Windows-style paths to URL-style paths\n const combinedPath = path\n .join(directoryPath, rootDir, chunkName)\n .replace(/\\\\/g, '/');\n // Create the final URL\n return Object.assign(new URL(combinedPath, url.origin), {\n mfMetadata: {\n chunkName,\n publicPath: __webpack_require__.p,\n remoteName,\n rootOutputDir: rootDir,\n resolvedFrom: 'remote-entry-fallback' as const,\n remoteEntryUrl: entryUrl,\n },\n });\n }\n};\n\n// Hoisted utility function to load chunks based on different strategies\nexport const loadChunk = (\n strategy: string,\n chunkId: string,\n rootOutputDir: string,\n callback: (err: Error | null, chunk: any) => void,\n args: any,\n): void => {\n if (strategy === 'filesystem') {\n return loadFromFs(resolveFile(rootOutputDir, chunkId), callback);\n }\n\n const url = resolveUrl(rootOutputDir, chunkId);\n if (!url) return callback(null, { modules: {}, ids: [], runtime: null });\n\n // Using fetchAndRun directly with args\n fetchAndRun(url, chunkId, callback, args);\n};\n\n// Hoisted utility function to install a chunk into webpack\nexport const installChunk = (\n chunk: any,\n installedChunks: { [key: string]: any },\n): void => {\n for (const moduleId in chunk.modules) {\n __webpack_require__.m[moduleId] = chunk.modules[moduleId];\n }\n if (chunk.runtime) chunk.runtime(__webpack_require__);\n for (const chunkId of chunk.ids) {\n if (installedChunks[chunkId]) installedChunks[chunkId][0]();\n installedChunks[chunkId] = 0;\n }\n};\n\n// Hoisted utility function to remove a chunk on fail\nexport const deleteChunk = (\n chunkId: string,\n installedChunks: { [key: string]: any },\n): boolean => {\n delete installedChunks[chunkId];\n return true;\n};\n\n// Hoisted function to set up webpack script loader\nexport const setupScriptLoader = (): void => {\n __webpack_require__.l = (\n url: string,\n done: (res: any) => void,\n key: string,\n chunkId: string,\n ): void => {\n if (!key || chunkId)\n throw new Error(`__webpack_require__.l name is required for ${url}`);\n __webpack_require__.federation.runtime\n .loadScriptNode(url, { attrs: { globalName: key } })\n .then((res) => {\n const enhancedRemote =\n __webpack_require__.federation.instance.initRawContainer(\n key,\n url,\n res,\n );\n new Function('return globalThis')()[key] = enhancedRemote;\n done(enhancedRemote);\n })\n .catch(done);\n };\n};\n\n// Hoisted function to set up chunk handler\nexport const setupChunkHandler = (\n installedChunks: { [key: string]: any },\n args: any,\n): ((chunkId: string, promises: any[]) => void) => {\n return (chunkId: string, promises: any[]): void => {\n let installedChunkData = installedChunks[chunkId];\n if (installedChunkData !== 0) {\n if (installedChunkData) {\n promises.push(installedChunkData[2]);\n } else {\n const matcher = __webpack_require__.federation.chunkMatcher\n ? __webpack_require__.federation.chunkMatcher(chunkId)\n : true;\n\n if (matcher) {\n const promise = new Promise((resolve, reject) => {\n installedChunkData = installedChunks[chunkId] = [resolve, reject];\n const fs =\n typeof process !== 'undefined'\n ? __non_webpack_require__('fs')\n : false;\n const filename =\n typeof process !== 'undefined'\n ? resolveFile(\n __webpack_require__.federation.rootOutputDir || '',\n chunkId,\n )\n : false;\n\n if (fs && fs.existsSync(filename)) {\n loadChunk(\n 'filesystem',\n chunkId,\n __webpack_require__.federation.rootOutputDir || '',\n (err, chunk) => {\n if (err)\n return deleteChunk(chunkId, installedChunks) && reject(err);\n if (chunk) installChunk(chunk, installedChunks);\n resolve(chunk);\n },\n args,\n );\n } else {\n const chunkName = __webpack_require__.u(chunkId);\n const loadingStrategy =\n typeof process === 'undefined' ? 'http-eval' : 'http-vm';\n loadChunk(\n loadingStrategy,\n chunkName,\n __webpack_require__.federation.initOptions.name,\n (err, chunk) => {\n if (err)\n return deleteChunk(chunkId, installedChunks) && reject(err);\n if (chunk) installChunk(chunk, installedChunks);\n resolve(chunk);\n },\n args,\n );\n }\n });\n promises.push((installedChunkData[2] = promise));\n } else {\n installedChunks[chunkId] = 0;\n }\n }\n }\n };\n};\n\n// Hoisted function to set up webpack require patching\nexport const setupWebpackRequirePatching = (\n handle: (chunkId: string, promises: any[]) => void,\n): void => {\n if (__webpack_require__.f) {\n if (__webpack_require__.f.require) {\n console.warn(\n '\\x1b[33m%s\\x1b[0m',\n 'CAUTION: build target is not set to \"async-node\", attempting to patch additional chunk handlers. This may not work',\n );\n __webpack_require__.f.require = handle;\n }\n\n if (__webpack_require__.f.readFileVm) {\n __webpack_require__.f.readFileVm = handle;\n }\n }\n};\n\nexport default function (): ModuleFederationRuntimePlugin {\n return {\n name: 'node-federation-plugin',\n beforeInit(args) {\n // Patch webpack chunk loading handlers\n (() => {\n // Create the chunk tracking object\n const installedChunks: { [key: string]: any } = {};\n\n // Set up webpack script loader\n setupScriptLoader();\n\n // Create and set up the chunk handler\n const handle = setupChunkHandler(installedChunks, args);\n\n // Patch webpack require\n setupWebpackRequirePatching(handle);\n })();\n\n return args;\n },\n };\n}\n"],"mappings":";;;AAyCA,MAAa,yCAAyB,IAAI,KAA2B;AACr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