@module-federation/runtime-core 0.0.0-chore-bump-node-22-20260710161714

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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +13 -0
  3. package/dist/LICENSE +21 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +19 -0
  5. package/dist/_virtual/_rolldown/runtime.js +18 -0
  6. package/dist/constant.cjs +9 -0
  7. package/dist/constant.cjs.map +1 -0
  8. package/dist/constant.js +7 -0
  9. package/dist/constant.js.map +1 -0
  10. package/dist/core.cjs +161 -0
  11. package/dist/core.cjs.map +1 -0
  12. package/dist/core.d.ts +197 -0
  13. package/dist/core.js +161 -0
  14. package/dist/core.js.map +1 -0
  15. package/dist/global.cjs +160 -0
  16. package/dist/global.cjs.map +1 -0
  17. package/dist/global.d.ts +45 -0
  18. package/dist/global.js +142 -0
  19. package/dist/global.js.map +1 -0
  20. package/dist/helpers.cjs +44 -0
  21. package/dist/helpers.cjs.map +1 -0
  22. package/dist/helpers.d.ts +30 -0
  23. package/dist/helpers.js +44 -0
  24. package/dist/helpers.js.map +1 -0
  25. package/dist/index.cjs +60 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.ts +29 -0
  28. package/dist/index.js +20 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/module/index.cjs +266 -0
  31. package/dist/module/index.cjs.map +1 -0
  32. package/dist/module/index.d.ts +32 -0
  33. package/dist/module/index.js +266 -0
  34. package/dist/module/index.js.map +1 -0
  35. package/dist/plugins/generate-preload-assets.cjs +182 -0
  36. package/dist/plugins/generate-preload-assets.cjs.map +1 -0
  37. package/dist/plugins/generate-preload-assets.js +182 -0
  38. package/dist/plugins/generate-preload-assets.js.map +1 -0
  39. package/dist/plugins/snapshot/SnapshotHandler.cjs +215 -0
  40. package/dist/plugins/snapshot/SnapshotHandler.cjs.map +1 -0
  41. package/dist/plugins/snapshot/SnapshotHandler.d.ts +69 -0
  42. package/dist/plugins/snapshot/SnapshotHandler.js +214 -0
  43. package/dist/plugins/snapshot/SnapshotHandler.js.map +1 -0
  44. package/dist/plugins/snapshot/index.cjs +67 -0
  45. package/dist/plugins/snapshot/index.cjs.map +1 -0
  46. package/dist/plugins/snapshot/index.js +66 -0
  47. package/dist/plugins/snapshot/index.js.map +1 -0
  48. package/dist/remote/index.cjs +445 -0
  49. package/dist/remote/index.cjs.map +1 -0
  50. package/dist/remote/index.d.ts +145 -0
  51. package/dist/remote/index.js +445 -0
  52. package/dist/remote/index.js.map +1 -0
  53. package/dist/shared/index.cjs +418 -0
  54. package/dist/shared/index.cjs.map +1 -0
  55. package/dist/shared/index.d.ts +104 -0
  56. package/dist/shared/index.js +418 -0
  57. package/dist/shared/index.js.map +1 -0
  58. package/dist/type/config.d.ts +130 -0
  59. package/dist/type/index.cjs +13 -0
  60. package/dist/type/index.cjs.map +1 -0
  61. package/dist/type/index.d.ts +11 -0
  62. package/dist/type/index.js +8 -0
  63. package/dist/type/index.js.map +1 -0
  64. package/dist/type/plugin.d.ts +27 -0
  65. package/dist/type/preload.d.ts +54 -0
  66. package/dist/types.cjs +0 -0
  67. package/dist/types.d.ts +4 -0
  68. package/dist/types.js +1 -0
  69. package/dist/utils/context.cjs +45 -0
  70. package/dist/utils/context.cjs.map +1 -0
  71. package/dist/utils/context.d.ts +1 -0
  72. package/dist/utils/context.js +44 -0
  73. package/dist/utils/context.js.map +1 -0
  74. package/dist/utils/env.cjs +10 -0
  75. package/dist/utils/env.cjs.map +1 -0
  76. package/dist/utils/env.d.ts +1 -0
  77. package/dist/utils/env.js +10 -0
  78. package/dist/utils/env.js.map +1 -0
  79. package/dist/utils/hooks/asyncHook.cjs +26 -0
  80. package/dist/utils/hooks/asyncHook.cjs.map +1 -0
  81. package/dist/utils/hooks/asyncHook.d.ts +10 -0
  82. package/dist/utils/hooks/asyncHook.js +26 -0
  83. package/dist/utils/hooks/asyncHook.js.map +1 -0
  84. package/dist/utils/hooks/asyncWaterfallHooks.cjs +44 -0
  85. package/dist/utils/hooks/asyncWaterfallHooks.cjs.map +1 -0
  86. package/dist/utils/hooks/asyncWaterfallHooks.d.ts +12 -0
  87. package/dist/utils/hooks/asyncWaterfallHooks.js +44 -0
  88. package/dist/utils/hooks/asyncWaterfallHooks.js.map +1 -0
  89. package/dist/utils/hooks/index.cjs +5 -0
  90. package/dist/utils/hooks/index.d.ts +5 -0
  91. package/dist/utils/hooks/index.js +7 -0
  92. package/dist/utils/hooks/pluginSystem.cjs +37 -0
  93. package/dist/utils/hooks/pluginSystem.cjs.map +1 -0
  94. package/dist/utils/hooks/pluginSystem.d.ts +19 -0
  95. package/dist/utils/hooks/pluginSystem.js +37 -0
  96. package/dist/utils/hooks/pluginSystem.js.map +1 -0
  97. package/dist/utils/hooks/syncHook.cjs +37 -0
  98. package/dist/utils/hooks/syncHook.cjs.map +1 -0
  99. package/dist/utils/hooks/syncHook.d.ts +16 -0
  100. package/dist/utils/hooks/syncHook.js +36 -0
  101. package/dist/utils/hooks/syncHook.js.map +1 -0
  102. package/dist/utils/hooks/syncWaterfallHook.cjs +40 -0
  103. package/dist/utils/hooks/syncWaterfallHook.cjs.map +1 -0
  104. package/dist/utils/hooks/syncWaterfallHook.d.ts +11 -0
  105. package/dist/utils/hooks/syncWaterfallHook.js +39 -0
  106. package/dist/utils/hooks/syncWaterfallHook.js.map +1 -0
  107. package/dist/utils/index.cjs +8 -0
  108. package/dist/utils/index.d.ts +4 -0
  109. package/dist/utils/index.js +9 -0
  110. package/dist/utils/load.cjs +214 -0
  111. package/dist/utils/load.cjs.map +1 -0
  112. package/dist/utils/load.d.ts +16 -0
  113. package/dist/utils/load.js +212 -0
  114. package/dist/utils/load.js.map +1 -0
  115. package/dist/utils/logger.cjs +34 -0
  116. package/dist/utils/logger.cjs.map +1 -0
  117. package/dist/utils/logger.d.ts +10 -0
  118. package/dist/utils/logger.js +31 -0
  119. package/dist/utils/logger.js.map +1 -0
  120. package/dist/utils/manifest.cjs +56 -0
  121. package/dist/utils/manifest.cjs.map +1 -0
  122. package/dist/utils/manifest.d.ts +10 -0
  123. package/dist/utils/manifest.js +53 -0
  124. package/dist/utils/manifest.js.map +1 -0
  125. package/dist/utils/plugin.cjs +27 -0
  126. package/dist/utils/plugin.cjs.map +1 -0
  127. package/dist/utils/plugin.d.ts +1 -0
  128. package/dist/utils/plugin.js +27 -0
  129. package/dist/utils/plugin.js.map +1 -0
  130. package/dist/utils/preload.cjs +212 -0
  131. package/dist/utils/preload.cjs.map +1 -0
  132. package/dist/utils/preload.d.ts +8 -0
  133. package/dist/utils/preload.js +209 -0
  134. package/dist/utils/preload.js.map +1 -0
  135. package/dist/utils/semver/compare.cjs +48 -0
  136. package/dist/utils/semver/compare.cjs.map +1 -0
  137. package/dist/utils/semver/compare.js +47 -0
  138. package/dist/utils/semver/compare.js.map +1 -0
  139. package/dist/utils/semver/constants.cjs +41 -0
  140. package/dist/utils/semver/constants.cjs.map +1 -0
  141. package/dist/utils/semver/constants.js +31 -0
  142. package/dist/utils/semver/constants.js.map +1 -0
  143. package/dist/utils/semver/index.cjs +68 -0
  144. package/dist/utils/semver/index.cjs.map +1 -0
  145. package/dist/utils/semver/index.d.ts +5 -0
  146. package/dist/utils/semver/index.js +68 -0
  147. package/dist/utils/semver/index.js.map +1 -0
  148. package/dist/utils/semver/parser.cjs +104 -0
  149. package/dist/utils/semver/parser.cjs.map +1 -0
  150. package/dist/utils/semver/parser.js +96 -0
  151. package/dist/utils/semver/parser.js.map +1 -0
  152. package/dist/utils/semver/utils.cjs +28 -0
  153. package/dist/utils/semver/utils.cjs.map +1 -0
  154. package/dist/utils/semver/utils.js +24 -0
  155. package/dist/utils/semver/utils.js.map +1 -0
  156. package/dist/utils/share.cjs +284 -0
  157. package/dist/utils/share.cjs.map +1 -0
  158. package/dist/utils/share.d.ts +23 -0
  159. package/dist/utils/share.js +278 -0
  160. package/dist/utils/share.js.map +1 -0
  161. package/dist/utils/tool.cjs +82 -0
  162. package/dist/utils/tool.cjs.map +1 -0
  163. package/dist/utils/tool.d.ts +8 -0
  164. package/dist/utils/tool.js +71 -0
  165. package/dist/utils/tool.js.map +1 -0
  166. package/package.json +65 -0
@@ -0,0 +1,266 @@
1
+ import { assert, error } from "../utils/logger.js";
2
+ import { processModuleAlias } from "../utils/tool.js";
3
+ import { composeRemoteRequestId } from "../utils/manifest.js";
4
+ import { getRemoteEntry } from "../utils/load.js";
5
+ import { optionsToMFContext } from "../utils/context.js";
6
+ import "../utils/index.js";
7
+ import { safeToString } from "@module-federation/sdk";
8
+ import { RUNTIME_002, RUNTIME_014, RUNTIME_015, runtimeDescMap } from "@module-federation/error-codes";
9
+
10
+ //#region src/module/index.ts
11
+ function getAvailableExposeNames(remoteSnapshot) {
12
+ if (!remoteSnapshot || !("modules" in remoteSnapshot) || !Array.isArray(remoteSnapshot.modules)) return;
13
+ const exposes = remoteSnapshot.modules.map((module) => module.moduleName).filter(Boolean);
14
+ return exposes.length ? exposes.join(",") : void 0;
15
+ }
16
+ function createRemoteEntryInitOptions(remoteInfo, hostShareScopeMap, rawInitScope) {
17
+ const localShareScopeMap = hostShareScopeMap;
18
+ const shareScopeKeys = Array.isArray(remoteInfo.shareScope) ? remoteInfo.shareScope : [remoteInfo.shareScope];
19
+ if (!shareScopeKeys.length) shareScopeKeys.push("default");
20
+ shareScopeKeys.forEach((shareScopeKey) => {
21
+ if (!localShareScopeMap[shareScopeKey]) localShareScopeMap[shareScopeKey] = {};
22
+ });
23
+ const remoteEntryInitOptions = {
24
+ version: remoteInfo.version || "",
25
+ shareScopeKeys: Array.isArray(remoteInfo.shareScope) ? shareScopeKeys : remoteInfo.shareScope || "default"
26
+ };
27
+ Object.defineProperty(remoteEntryInitOptions, "shareScopeMap", {
28
+ value: localShareScopeMap,
29
+ enumerable: false
30
+ });
31
+ return {
32
+ remoteEntryInitOptions,
33
+ shareScope: localShareScopeMap[shareScopeKeys[0]],
34
+ initScope: rawInitScope ?? []
35
+ };
36
+ }
37
+ var Module$1 = class {
38
+ constructor({ remoteInfo, host }) {
39
+ this.inited = false;
40
+ this.initing = false;
41
+ this.lib = void 0;
42
+ this.remoteInfo = remoteInfo;
43
+ this.host = host;
44
+ }
45
+ async getEntry(expose) {
46
+ if (this.remoteEntryExports) return this.remoteEntryExports;
47
+ const remoteEntryExports = await getRemoteEntry({
48
+ origin: this.host,
49
+ remoteInfo: this.remoteInfo,
50
+ remoteEntryExports: this.remoteEntryExports,
51
+ resourceContext: {
52
+ initiator: "loadRemote",
53
+ id: composeRemoteRequestId(this.remoteInfo.name, expose),
54
+ resourceType: "remoteEntry"
55
+ }
56
+ });
57
+ assert(remoteEntryExports, `remoteEntryExports is undefined \n ${safeToString(this.remoteInfo)}`);
58
+ this.remoteEntryExports = remoteEntryExports;
59
+ return this.remoteEntryExports;
60
+ }
61
+ async init(id, remoteSnapshot, rawInitScope, expose) {
62
+ const remoteEntryExports = await this.getEntry(expose);
63
+ if (this.inited) {
64
+ await this.host.loaderHook.lifecycle.afterInitRemote.emit({
65
+ id,
66
+ remoteInfo: this.remoteInfo,
67
+ remoteSnapshot,
68
+ remoteEntryExports,
69
+ cached: true,
70
+ origin: this.host
71
+ });
72
+ return remoteEntryExports;
73
+ }
74
+ if (this.initPromise) {
75
+ try {
76
+ await this.initPromise;
77
+ await this.host.loaderHook.lifecycle.afterInitRemote.emit({
78
+ id,
79
+ remoteInfo: this.remoteInfo,
80
+ remoteSnapshot,
81
+ remoteEntryExports,
82
+ cached: true,
83
+ origin: this.host
84
+ });
85
+ } catch (initError) {
86
+ await this.host.loaderHook.lifecycle.afterInitRemote.emit({
87
+ id,
88
+ remoteInfo: this.remoteInfo,
89
+ remoteSnapshot,
90
+ remoteEntryExports,
91
+ error: initError,
92
+ cached: true,
93
+ origin: this.host
94
+ });
95
+ throw initError;
96
+ }
97
+ return remoteEntryExports;
98
+ }
99
+ this.initing = true;
100
+ this.initPromise = (async () => {
101
+ await this.host.loaderHook.lifecycle.beforeInitRemote.emit({
102
+ id,
103
+ remoteInfo: this.remoteInfo,
104
+ remoteSnapshot,
105
+ origin: this.host
106
+ });
107
+ const { remoteEntryInitOptions, shareScope, initScope } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap, rawInitScope);
108
+ const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
109
+ shareScope,
110
+ remoteEntryInitOptions,
111
+ initScope,
112
+ remoteInfo: this.remoteInfo,
113
+ origin: this.host
114
+ });
115
+ if (typeof remoteEntryExports?.init === "undefined") error(RUNTIME_002, runtimeDescMap, {
116
+ hostName: this.host.name,
117
+ remoteName: this.remoteInfo.name,
118
+ remoteEntryUrl: this.remoteInfo.entry,
119
+ remoteEntryKey: this.remoteInfo.entryGlobalName
120
+ }, void 0, optionsToMFContext(this.host.options));
121
+ try {
122
+ await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
123
+ } catch (initError) {
124
+ error(RUNTIME_015, runtimeDescMap, {
125
+ hostName: this.host.name,
126
+ remoteName: this.remoteInfo.name,
127
+ remoteEntryUrl: this.remoteInfo.entry,
128
+ remoteEntryKey: this.remoteInfo.entryGlobalName,
129
+ shareScope: this.remoteInfo.shareScope
130
+ }, `${initError}`, optionsToMFContext(this.host.options));
131
+ }
132
+ await this.host.hooks.lifecycle.initContainer.emit({
133
+ ...initContainerOptions,
134
+ id,
135
+ remoteSnapshot,
136
+ remoteEntryExports
137
+ });
138
+ this.inited = true;
139
+ })();
140
+ try {
141
+ await this.initPromise;
142
+ await this.host.loaderHook.lifecycle.afterInitRemote.emit({
143
+ id,
144
+ remoteInfo: this.remoteInfo,
145
+ remoteSnapshot,
146
+ remoteEntryExports,
147
+ origin: this.host
148
+ });
149
+ } catch (initError) {
150
+ await this.host.loaderHook.lifecycle.afterInitRemote.emit({
151
+ id,
152
+ remoteInfo: this.remoteInfo,
153
+ remoteSnapshot,
154
+ remoteEntryExports,
155
+ error: initError,
156
+ origin: this.host
157
+ });
158
+ throw initError;
159
+ } finally {
160
+ this.initing = false;
161
+ this.initPromise = void 0;
162
+ }
163
+ return remoteEntryExports;
164
+ }
165
+ async get(id, expose, options, remoteSnapshot) {
166
+ const { loadFactory = true } = options || { loadFactory: true };
167
+ const remoteEntryExports = await this.init(id, remoteSnapshot, void 0, expose);
168
+ this.lib = remoteEntryExports;
169
+ await this.host.loaderHook.lifecycle.beforeGetExpose.emit({
170
+ id,
171
+ expose,
172
+ moduleInfo: this.remoteInfo,
173
+ remoteEntryExports,
174
+ origin: this.host
175
+ });
176
+ let moduleFactory;
177
+ try {
178
+ const hookModuleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
179
+ remoteEntryExports,
180
+ expose,
181
+ moduleInfo: this.remoteInfo
182
+ });
183
+ moduleFactory = typeof hookModuleFactory === "function" ? hookModuleFactory : void 0;
184
+ if (!moduleFactory) moduleFactory = await remoteEntryExports.get(expose);
185
+ if (!moduleFactory) error(RUNTIME_014, runtimeDescMap, {
186
+ hostName: this.host.name,
187
+ remoteName: this.remoteInfo.name,
188
+ remoteEntryUrl: this.remoteInfo.entry,
189
+ expose,
190
+ requestId: id,
191
+ availableExposes: getAvailableExposeNames(remoteSnapshot)
192
+ }, void 0, optionsToMFContext(this.host.options));
193
+ await this.host.loaderHook.lifecycle.afterGetExpose.emit({
194
+ id,
195
+ expose,
196
+ moduleInfo: this.remoteInfo,
197
+ remoteEntryExports,
198
+ moduleFactory,
199
+ origin: this.host
200
+ });
201
+ } catch (getExposeError) {
202
+ await this.host.loaderHook.lifecycle.afterGetExpose.emit({
203
+ id,
204
+ expose,
205
+ moduleInfo: this.remoteInfo,
206
+ remoteEntryExports,
207
+ error: getExposeError,
208
+ origin: this.host
209
+ });
210
+ throw getExposeError;
211
+ }
212
+ const symbolName = processModuleAlias(this.remoteInfo.name, expose);
213
+ const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
214
+ if (!loadFactory) return wrapModuleFactory;
215
+ await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({
216
+ id,
217
+ expose,
218
+ moduleInfo: this.remoteInfo,
219
+ loadFactory,
220
+ origin: this.host
221
+ });
222
+ try {
223
+ const exposeContent = await wrapModuleFactory();
224
+ await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
225
+ id,
226
+ expose,
227
+ moduleInfo: this.remoteInfo,
228
+ loadFactory,
229
+ exposeModule: exposeContent,
230
+ origin: this.host
231
+ });
232
+ return exposeContent;
233
+ } catch (executeFactoryError) {
234
+ await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
235
+ id,
236
+ expose,
237
+ moduleInfo: this.remoteInfo,
238
+ loadFactory,
239
+ error: executeFactoryError,
240
+ origin: this.host
241
+ });
242
+ throw executeFactoryError;
243
+ }
244
+ }
245
+ wraperFactory(moduleFactory, id) {
246
+ function defineModuleId(res, id) {
247
+ if (res && typeof res === "object" && Object.isExtensible(res) && !Object.getOwnPropertyDescriptor(res, Symbol.for("mf_module_id"))) Object.defineProperty(res, Symbol.for("mf_module_id"), {
248
+ value: id,
249
+ enumerable: false
250
+ });
251
+ }
252
+ return () => {
253
+ const res = moduleFactory();
254
+ if (res instanceof Promise) return res.then((asyncRes) => {
255
+ defineModuleId(asyncRes, id);
256
+ return asyncRes;
257
+ });
258
+ defineModuleId(res, id);
259
+ return res;
260
+ };
261
+ }
262
+ };
263
+
264
+ //#endregion
265
+ export { Module$1 as Module };
266
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Module"],"sources":["../../src/module/index.ts"],"sourcesContent":["import {\n assert,\n error,\n processModuleAlias,\n optionsToMFContext,\n composeRemoteRequestId,\n} from '../utils';\nimport { safeToString, ModuleInfo } from '@module-federation/sdk';\nimport {\n RUNTIME_002,\n RUNTIME_014,\n RUNTIME_015,\n runtimeDescMap,\n} from '@module-federation/error-codes';\nimport { getRemoteEntry } from '../utils/load';\nimport { ModuleFederation } from '../core';\nimport {\n RemoteEntryExports,\n RemoteInfo,\n InitScope,\n ShareScopeMap,\n} from '../type';\n\nexport type ModuleOptions = ConstructorParameters<typeof Module>[0];\nexport type RemoteModuleFactory = () => unknown | Promise<unknown>;\n\nfunction getAvailableExposeNames(\n remoteSnapshot?: ModuleInfo,\n): string | undefined {\n if (\n !remoteSnapshot ||\n !('modules' in remoteSnapshot) ||\n !Array.isArray(remoteSnapshot.modules)\n ) {\n return undefined;\n }\n\n const exposes = remoteSnapshot.modules\n .map((module) => module.moduleName)\n .filter(Boolean);\n\n return exposes.length ? exposes.join(',') : undefined;\n}\n\nexport function createRemoteEntryInitOptions(\n remoteInfo: RemoteInfo,\n hostShareScopeMap: ShareScopeMap,\n rawInitScope?: InitScope,\n): Record<string, any> {\n const localShareScopeMap = hostShareScopeMap;\n\n const shareScopeKeys = Array.isArray(remoteInfo.shareScope)\n ? remoteInfo.shareScope\n : [remoteInfo.shareScope];\n\n if (!shareScopeKeys.length) {\n shareScopeKeys.push('default');\n }\n shareScopeKeys.forEach((shareScopeKey) => {\n if (!localShareScopeMap[shareScopeKey]) {\n localShareScopeMap[shareScopeKey] = {};\n }\n });\n\n const remoteEntryInitOptions = {\n version: remoteInfo.version || '',\n shareScopeKeys: Array.isArray(remoteInfo.shareScope)\n ? shareScopeKeys\n : remoteInfo.shareScope || 'default',\n };\n\n // Help to find host instance\n Object.defineProperty(remoteEntryInitOptions, 'shareScopeMap', {\n value: localShareScopeMap,\n // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed\n enumerable: false,\n });\n\n // TODO: compate legacy init params, should use shareScopeMap if exist\n const shareScope = localShareScopeMap[shareScopeKeys[0]];\n const initScope: InitScope = rawInitScope ?? [];\n\n return {\n remoteEntryInitOptions,\n shareScope,\n initScope,\n };\n}\n\nclass Module {\n remoteInfo: RemoteInfo;\n inited = false;\n initing = false;\n initPromise?: Promise<void>;\n remoteEntryExports?: RemoteEntryExports;\n lib: RemoteEntryExports | undefined = undefined;\n host: ModuleFederation;\n\n constructor({\n remoteInfo,\n host,\n }: {\n remoteInfo: RemoteInfo;\n host: ModuleFederation;\n }) {\n this.remoteInfo = remoteInfo;\n this.host = host;\n }\n\n async getEntry(expose?: string): Promise<RemoteEntryExports> {\n if (this.remoteEntryExports) {\n return this.remoteEntryExports;\n }\n\n const remoteEntryExports = await getRemoteEntry({\n origin: this.host,\n remoteInfo: this.remoteInfo,\n remoteEntryExports: this.remoteEntryExports,\n resourceContext: {\n initiator: 'loadRemote',\n id: composeRemoteRequestId(this.remoteInfo.name, expose),\n resourceType: 'remoteEntry',\n },\n });\n\n assert(\n remoteEntryExports,\n `remoteEntryExports is undefined \\n ${safeToString(this.remoteInfo)}`,\n );\n\n this.remoteEntryExports = remoteEntryExports;\n return this.remoteEntryExports;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n\n async init(\n id?: string,\n remoteSnapshot?: ModuleInfo,\n rawInitScope?: InitScope,\n expose?: string,\n ) {\n // Get remoteEntry.js\n const remoteEntryExports = await this.getEntry(expose);\n\n if (this.inited) {\n await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n remoteEntryExports,\n cached: true,\n origin: this.host,\n });\n return remoteEntryExports;\n }\n\n if (this.initPromise) {\n try {\n await this.initPromise;\n await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n remoteEntryExports,\n cached: true,\n origin: this.host,\n });\n } catch (initError) {\n await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n remoteEntryExports,\n error: initError,\n cached: true,\n origin: this.host,\n });\n throw initError;\n }\n return remoteEntryExports;\n }\n\n this.initing = true;\n this.initPromise = (async () => {\n await this.host.loaderHook.lifecycle.beforeInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n origin: this.host,\n });\n\n const { remoteEntryInitOptions, shareScope, initScope } =\n createRemoteEntryInitOptions(\n this.remoteInfo,\n this.host.shareScopeMap,\n rawInitScope,\n );\n\n const initContainerOptions =\n await this.host.hooks.lifecycle.beforeInitContainer.emit({\n shareScope,\n // @ts-ignore shareScopeMap will be set by Object.defineProperty\n remoteEntryInitOptions,\n initScope,\n remoteInfo: this.remoteInfo,\n origin: this.host,\n });\n\n if (typeof remoteEntryExports?.init === 'undefined') {\n error(\n RUNTIME_002,\n runtimeDescMap,\n {\n hostName: this.host.name,\n remoteName: this.remoteInfo.name,\n remoteEntryUrl: this.remoteInfo.entry,\n remoteEntryKey: this.remoteInfo.entryGlobalName,\n },\n undefined,\n optionsToMFContext(this.host.options),\n );\n }\n\n try {\n await remoteEntryExports.init(\n initContainerOptions.shareScope,\n initContainerOptions.initScope,\n initContainerOptions.remoteEntryInitOptions,\n );\n } catch (initError) {\n error(\n RUNTIME_015,\n runtimeDescMap,\n {\n hostName: this.host.name,\n remoteName: this.remoteInfo.name,\n remoteEntryUrl: this.remoteInfo.entry,\n remoteEntryKey: this.remoteInfo.entryGlobalName,\n shareScope: this.remoteInfo.shareScope,\n },\n `${initError}`,\n optionsToMFContext(this.host.options),\n );\n }\n\n await this.host.hooks.lifecycle.initContainer.emit({\n ...initContainerOptions,\n id,\n remoteSnapshot,\n remoteEntryExports,\n });\n this.inited = true;\n })();\n\n try {\n await this.initPromise;\n await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n remoteEntryExports,\n origin: this.host,\n });\n } catch (initError) {\n await this.host.loaderHook.lifecycle.afterInitRemote.emit({\n id,\n remoteInfo: this.remoteInfo,\n remoteSnapshot,\n remoteEntryExports,\n error: initError,\n origin: this.host,\n });\n throw initError;\n } finally {\n this.initing = false;\n this.initPromise = undefined;\n }\n\n return remoteEntryExports;\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n async get(\n id: string,\n expose: string,\n options?: { loadFactory?: boolean },\n remoteSnapshot?: ModuleInfo,\n ) {\n const { loadFactory = true } = options || { loadFactory: true };\n\n const remoteEntryExports = await this.init(\n id,\n remoteSnapshot,\n undefined,\n expose,\n );\n this.lib = remoteEntryExports;\n\n await this.host.loaderHook.lifecycle.beforeGetExpose.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n remoteEntryExports,\n origin: this.host,\n });\n\n let moduleFactory: RemoteModuleFactory | undefined;\n try {\n const hookModuleFactory =\n await this.host.loaderHook.lifecycle.getModuleFactory.emit({\n remoteEntryExports,\n expose,\n moduleInfo: this.remoteInfo,\n });\n moduleFactory =\n typeof hookModuleFactory === 'function' ? hookModuleFactory : undefined;\n\n // get exposeGetter\n if (!moduleFactory) {\n moduleFactory = await remoteEntryExports.get(expose);\n }\n\n if (!moduleFactory) {\n error(\n RUNTIME_014,\n runtimeDescMap,\n {\n hostName: this.host.name,\n remoteName: this.remoteInfo.name,\n remoteEntryUrl: this.remoteInfo.entry,\n expose,\n requestId: id,\n availableExposes: getAvailableExposeNames(remoteSnapshot),\n },\n undefined,\n optionsToMFContext(this.host.options),\n );\n }\n\n await this.host.loaderHook.lifecycle.afterGetExpose.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n remoteEntryExports,\n moduleFactory,\n origin: this.host,\n });\n } catch (getExposeError) {\n await this.host.loaderHook.lifecycle.afterGetExpose.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n remoteEntryExports,\n error: getExposeError,\n origin: this.host,\n });\n throw getExposeError;\n }\n\n // keep symbol for module name always one format\n const symbolName = processModuleAlias(this.remoteInfo.name, expose);\n const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);\n\n if (!loadFactory) {\n return wrapModuleFactory;\n }\n\n await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n loadFactory,\n origin: this.host,\n });\n\n try {\n const exposeContent = await wrapModuleFactory();\n\n await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n loadFactory,\n exposeModule: exposeContent,\n origin: this.host,\n });\n\n return exposeContent;\n } catch (executeFactoryError) {\n await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({\n id,\n expose,\n moduleInfo: this.remoteInfo,\n loadFactory,\n error: executeFactoryError,\n origin: this.host,\n });\n throw executeFactoryError;\n }\n }\n\n private wraperFactory(moduleFactory: RemoteModuleFactory, id: string) {\n function defineModuleId(res: unknown, id: string) {\n if (\n res &&\n typeof res === 'object' &&\n Object.isExtensible(res) &&\n !Object.getOwnPropertyDescriptor(res, Symbol.for('mf_module_id'))\n ) {\n Object.defineProperty(res, Symbol.for('mf_module_id'), {\n value: id,\n enumerable: false,\n });\n }\n }\n\n return () => {\n const res = moduleFactory();\n\n if (res instanceof Promise) {\n return res.then((asyncRes) => {\n // This parameter is used for bridge debugging\n defineModuleId(asyncRes, id);\n return asyncRes;\n });\n }\n\n // This parameter is used for bridge debugging\n defineModuleId(res, id);\n return res;\n };\n }\n}\n\nexport { Module };\n"],"mappings":";;;;;;;;;;AA0BA,SAAS,wBACP,gBACoB;AACpB,KACE,CAAC,kBACD,EAAE,aAAa,mBACf,CAAC,MAAM,QAAQ,eAAe,QAAQ,CAEtC;CAGF,MAAM,UAAU,eAAe,QAC5B,KAAK,WAAW,OAAO,WAAW,CAClC,OAAO,QAAQ;AAElB,QAAO,QAAQ,SAAS,QAAQ,KAAK,IAAI,GAAG;;AAG9C,SAAgB,6BACd,YACA,mBACA,cACqB;CACrB,MAAM,qBAAqB;CAE3B,MAAM,iBAAiB,MAAM,QAAQ,WAAW,WAAW,GACvD,WAAW,aACX,CAAC,WAAW,WAAW;AAE3B,KAAI,CAAC,eAAe,OAClB,gBAAe,KAAK,UAAU;AAEhC,gBAAe,SAAS,kBAAkB;AACxC,MAAI,CAAC,mBAAmB,eACtB,oBAAmB,iBAAiB,EAAE;GAExC;CAEF,MAAM,yBAAyB;EAC7B,SAAS,WAAW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,KAAK,KAAK,WAAW,UAAU,qBAAqB,KAAK;GAC7D;GACA;GACA,YAAY,KAAK;GACjB;GACA,QAAQ,KAAK;GACd,CAAC;AAEF,MAAI;GACF,MAAM,gBAAgB,MAAM,mBAAmB;AAE/C,SAAM,KAAK,KAAK,WAAW,UAAU,oBAAoB,KAAK;IAC5D;IACA;IACA,YAAY,KAAK;IACjB;IACA,cAAc;IACd,QAAQ,KAAK;IACd,CAAC;AAEF,UAAO;WACA,qBAAqB;AAC5B,SAAM,KAAK,KAAK,WAAW,UAAU,oBAAoB,KAAK;IAC5D;IACA;IACA,YAAY,KAAK;IACjB;IACA,OAAO;IACP,QAAQ,KAAK;IACd,CAAC;AACF,SAAM;;;CAIV,AAAQ,cAAc,eAAoC,IAAY;EACpE,SAAS,eAAe,KAAc,IAAY;AAChD,OACE,OACA,OAAO,QAAQ,YACf,OAAO,aAAa,IAAI,IACxB,CAAC,OAAO,yBAAyB,KAAK,OAAO,IAAI,eAAe,CAAC,CAEjE,QAAO,eAAe,KAAK,OAAO,IAAI,eAAe,EAAE;IACrD,OAAO;IACP,YAAY;IACb,CAAC;;AAIN,eAAa;GACX,MAAM,MAAM,eAAe;AAE3B,OAAI,eAAe,QACjB,QAAO,IAAI,MAAM,aAAa;AAE5B,mBAAe,UAAU,GAAG;AAC5B,WAAO;KACP;AAIJ,kBAAe,KAAK,GAAG;AACvB,UAAO"}
@@ -0,0 +1,182 @@
1
+ const require_tool = require('../utils/tool.cjs');
2
+ const require_global = require('../global.cjs');
3
+ const require_share = require('../utils/share.cjs');
4
+ require('../utils/index.cjs');
5
+ const require_preload = require('../utils/preload.cjs');
6
+ const require_index$1 = require('./snapshot/index.cjs');
7
+ let _module_federation_sdk = require("@module-federation/sdk");
8
+
9
+ //#region src/plugins/generate-preload-assets.ts
10
+ function splitId(id) {
11
+ const splitInfo = id.split(":");
12
+ if (splitInfo.length === 1) return {
13
+ name: splitInfo[0],
14
+ version: void 0
15
+ };
16
+ else if (splitInfo.length === 2) return {
17
+ name: splitInfo[0],
18
+ version: splitInfo[1]
19
+ };
20
+ else return {
21
+ name: splitInfo[1],
22
+ version: splitInfo[2]
23
+ };
24
+ }
25
+ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, remoteSnapshot) {
26
+ const { value: snapshotValue } = require_global.getInfoWithoutType(globalSnapshot, require_tool.getFMId(remoteInfo));
27
+ const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;
28
+ if (effectiveRemoteSnapshot && !(0, _module_federation_sdk.isManifestProvider)(effectiveRemoteSnapshot)) {
29
+ traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
30
+ if (effectiveRemoteSnapshot.remotesInfo) {
31
+ const remoteKeys = Object.keys(effectiveRemoteSnapshot.remotesInfo);
32
+ for (const key of remoteKeys) {
33
+ if (memo[key]) continue;
34
+ memo[key] = true;
35
+ const subRemoteInfo = splitId(key);
36
+ const remoteValue = effectiveRemoteSnapshot.remotesInfo[key];
37
+ traverseModuleInfo(globalSnapshot, {
38
+ name: subRemoteInfo.name,
39
+ version: remoteValue.matchedVersion
40
+ }, traverse, false, memo, void 0);
41
+ }
42
+ }
43
+ }
44
+ }
45
+ const isExisted = (type, url) => {
46
+ return document.querySelector(`${type}[${type === "link" ? "href" : "src"}="${url}"]`);
47
+ };
48
+ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, remoteSnapshot) {
49
+ const cssAssets = [];
50
+ const jsAssets = [];
51
+ const entryAssets = [];
52
+ const loadedSharedJsAssets = /* @__PURE__ */ new Set();
53
+ const loadedSharedCssAssets = /* @__PURE__ */ new Set();
54
+ const { options } = origin;
55
+ const { preloadConfig: rootPreloadConfig } = preloadOptions;
56
+ const { depsRemote } = rootPreloadConfig;
57
+ traverseModuleInfo(globalSnapshot, remote, (moduleInfoSnapshot, remoteInfo, isRoot) => {
58
+ let preloadConfig;
59
+ if (isRoot) preloadConfig = rootPreloadConfig;
60
+ else if (Array.isArray(depsRemote)) {
61
+ const findPreloadConfig = depsRemote.find((remoteConfig) => {
62
+ if (remoteConfig.nameOrAlias === remoteInfo.name || remoteConfig.nameOrAlias === remoteInfo.alias) return true;
63
+ return false;
64
+ });
65
+ if (!findPreloadConfig) return;
66
+ preloadConfig = require_preload.defaultPreloadArgs(findPreloadConfig);
67
+ } else if (depsRemote === true) preloadConfig = rootPreloadConfig;
68
+ else return;
69
+ const remoteEntryUrl = (0, _module_federation_sdk.getResourceUrl)(moduleInfoSnapshot, require_tool.getRemoteEntryInfoFromSnapshot(moduleInfoSnapshot).url);
70
+ if (remoteEntryUrl) entryAssets.push({
71
+ name: remoteInfo.name,
72
+ moduleInfo: {
73
+ name: remoteInfo.name,
74
+ entry: remoteEntryUrl,
75
+ type: "remoteEntryType" in moduleInfoSnapshot ? moduleInfoSnapshot.remoteEntryType : "global",
76
+ entryGlobalName: "globalName" in moduleInfoSnapshot ? moduleInfoSnapshot.globalName : remoteInfo.name,
77
+ shareScope: "",
78
+ version: "version" in moduleInfoSnapshot ? moduleInfoSnapshot.version : void 0
79
+ },
80
+ url: remoteEntryUrl
81
+ });
82
+ let moduleAssetsInfo = "modules" in moduleInfoSnapshot ? moduleInfoSnapshot.modules : [];
83
+ const normalizedPreloadExposes = require_preload.normalizePreloadExposes(preloadConfig.exposes);
84
+ if (normalizedPreloadExposes.length && "modules" in moduleInfoSnapshot) moduleAssetsInfo = moduleInfoSnapshot?.modules?.reduce((assets, moduleAssetInfo) => {
85
+ if (normalizedPreloadExposes?.indexOf(moduleAssetInfo.moduleName) !== -1) assets.push(moduleAssetInfo);
86
+ return assets;
87
+ }, []);
88
+ function handleAssets(assets) {
89
+ const assetsRes = assets.map((asset) => (0, _module_federation_sdk.getResourceUrl)(moduleInfoSnapshot, asset));
90
+ if (preloadConfig.filter) return assetsRes.filter(preloadConfig.filter);
91
+ return assetsRes;
92
+ }
93
+ if (moduleAssetsInfo) {
94
+ const assetsLength = moduleAssetsInfo.length;
95
+ for (let index = 0; index < assetsLength; index++) {
96
+ const assetsInfo = moduleAssetsInfo[index];
97
+ const exposeFullPath = `${remoteInfo.name}/${assetsInfo.moduleName}`;
98
+ origin.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
99
+ id: assetsInfo.moduleName === "." ? remoteInfo.name : exposeFullPath,
100
+ name: remoteInfo.name,
101
+ remoteSnapshot: moduleInfoSnapshot,
102
+ preloadConfig,
103
+ remote: remoteInfo,
104
+ origin
105
+ });
106
+ if (require_global.getPreloaded(exposeFullPath)) continue;
107
+ if (preloadConfig.resourceCategory === "all") {
108
+ cssAssets.push(...handleAssets(assetsInfo.assets.css.async));
109
+ cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));
110
+ jsAssets.push(...handleAssets(assetsInfo.assets.js.async));
111
+ jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));
112
+ } else if (preloadConfig.resourceCategory === "sync") {
113
+ cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));
114
+ jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));
115
+ }
116
+ require_global.setPreloaded(exposeFullPath);
117
+ }
118
+ }
119
+ }, true, {}, remoteSnapshot);
120
+ if (remoteSnapshot.shared && remoteSnapshot.shared.length > 0) {
121
+ const collectSharedAssets = (shareInfo, snapshotShared) => {
122
+ const { shared: registeredShared } = require_share.getRegisteredShare(origin.shareScopeMap, snapshotShared.sharedName, shareInfo, origin.sharedHandler.hooks.lifecycle.resolveShare) || {};
123
+ if (registeredShared && typeof registeredShared.lib === "function") {
124
+ snapshotShared.assets.js.sync.forEach((asset) => {
125
+ loadedSharedJsAssets.add(asset);
126
+ });
127
+ snapshotShared.assets.css.sync.forEach((asset) => {
128
+ loadedSharedCssAssets.add(asset);
129
+ });
130
+ }
131
+ };
132
+ remoteSnapshot.shared.forEach((shared) => {
133
+ const shareInfos = options.shared?.[shared.sharedName];
134
+ if (!shareInfos) return;
135
+ const sharedOptions = shared.version ? shareInfos.find((s) => s.version === shared.version) : shareInfos;
136
+ if (!sharedOptions) return;
137
+ require_tool.arrayOptions(sharedOptions).forEach((s) => {
138
+ collectSharedAssets(s, shared);
139
+ });
140
+ });
141
+ }
142
+ const needPreloadJsAssets = jsAssets.filter((asset) => !loadedSharedJsAssets.has(asset) && !isExisted("script", asset));
143
+ return {
144
+ cssAssets: cssAssets.filter((asset) => !loadedSharedCssAssets.has(asset) && !isExisted("link", asset)),
145
+ jsAssetsWithoutEntry: needPreloadJsAssets,
146
+ entryAssets: entryAssets.filter((entry) => !isExisted("script", entry.url))
147
+ };
148
+ }
149
+ const generatePreloadAssetsPlugin = function() {
150
+ return {
151
+ name: "generate-preload-assets-plugin",
152
+ async generatePreloadAssets(args) {
153
+ const { origin, preloadOptions, remoteInfo, remote, globalSnapshot, remoteSnapshot } = args;
154
+ if (!_module_federation_sdk.isBrowserEnvValue) return {
155
+ cssAssets: [],
156
+ jsAssetsWithoutEntry: [],
157
+ entryAssets: []
158
+ };
159
+ if (require_tool.isRemoteInfoWithEntry(remote) && require_tool.isPureRemoteEntry(remote)) return {
160
+ cssAssets: [],
161
+ jsAssetsWithoutEntry: [],
162
+ entryAssets: [{
163
+ name: remote.name,
164
+ url: remote.entry,
165
+ moduleInfo: {
166
+ name: remoteInfo.name,
167
+ entry: remote.entry,
168
+ type: remoteInfo.type || "global",
169
+ entryGlobalName: "",
170
+ shareScope: ""
171
+ }
172
+ }]
173
+ };
174
+ require_index$1.assignRemoteInfo(remoteInfo, remoteSnapshot);
175
+ return generatePreloadAssets(origin, preloadOptions, remoteInfo, globalSnapshot, remoteSnapshot);
176
+ }
177
+ };
178
+ };
179
+
180
+ //#endregion
181
+ exports.generatePreloadAssetsPlugin = generatePreloadAssetsPlugin;
182
+ //# sourceMappingURL=generate-preload-assets.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-preload-assets.cjs","names":["getInfoWithoutType","getFMId","defaultPreloadArgs","getRemoteEntryInfoFromSnapshot","normalizePreloadExposes","getPreloaded","getRegisteredShare","arrayOptions","isBrowserEnvValue","isRemoteInfoWithEntry","isPureRemoteEntry"],"sources":["../../src/plugins/generate-preload-assets.ts"],"sourcesContent":["import {\n GlobalModuleInfo,\n ModuleInfo,\n ProviderModuleInfo,\n isManifestProvider,\n getResourceUrl,\n isBrowserEnvValue,\n} from '@module-federation/sdk';\nimport {\n EntryAssets,\n ModuleFederationRuntimePlugin,\n PreloadAssets,\n PreloadConfig,\n PreloadOptions,\n RemoteInfoOptionalVersion,\n Shared,\n Remote,\n} from '../type';\nimport { assignRemoteInfo } from './snapshot';\nimport { getInfoWithoutType, getPreloaded, setPreloaded } from '../global';\nimport { ModuleFederation } from '../core';\nimport { defaultPreloadArgs, normalizePreloadExposes } from '../utils/preload';\nimport { getRegisteredShare } from '../utils/share';\nimport {\n arrayOptions,\n getFMId,\n getRemoteEntryInfoFromSnapshot,\n isPureRemoteEntry,\n isRemoteInfoWithEntry,\n} from '../utils';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var __INIT_VMOK_DEPLOY_GLOBAL_DATA__: boolean | undefined;\n}\n\n// name\n// name:version\nfunction splitId(id: string): {\n name: string;\n version: string | undefined;\n} {\n const splitInfo = id.split(':');\n if (splitInfo.length === 1) {\n return {\n name: splitInfo[0],\n version: undefined,\n };\n } else if (splitInfo.length === 2) {\n return {\n name: splitInfo[0],\n version: splitInfo[1],\n };\n } else {\n return {\n name: splitInfo[1],\n version: splitInfo[2],\n };\n }\n}\n\n// Traverse all nodes in moduleInfo and traverse the entire snapshot\nfunction traverseModuleInfo(\n globalSnapshot: GlobalModuleInfo,\n remoteInfo: RemoteInfoOptionalVersion,\n traverse: (\n snapshotInfo: ModuleInfo,\n remoteInfo: RemoteInfoOptionalVersion,\n isRoot: boolean,\n ) => void,\n isRoot: boolean,\n memo: Record<string, boolean> = {},\n remoteSnapshot?: ModuleInfo,\n): void {\n const id = getFMId(remoteInfo);\n const { value: snapshotValue } = getInfoWithoutType(globalSnapshot, id);\n const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;\n if (effectiveRemoteSnapshot && !isManifestProvider(effectiveRemoteSnapshot)) {\n traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);\n if (effectiveRemoteSnapshot.remotesInfo) {\n const remoteKeys = Object.keys(effectiveRemoteSnapshot.remotesInfo);\n for (const key of remoteKeys) {\n if (memo[key]) {\n continue;\n }\n memo[key] = true;\n const subRemoteInfo = splitId(key);\n const remoteValue = effectiveRemoteSnapshot.remotesInfo[key];\n traverseModuleInfo(\n globalSnapshot,\n {\n name: subRemoteInfo.name,\n version: remoteValue.matchedVersion,\n },\n traverse,\n false,\n memo,\n undefined,\n );\n }\n }\n }\n}\n\nconst isExisted = (type: 'link' | 'script', url: string) => {\n return document.querySelector(\n `${type}[${type === 'link' ? 'href' : 'src'}=\"${url}\"]`,\n );\n};\n\n// eslint-disable-next-line max-lines-per-function\nexport function generatePreloadAssets(\n origin: ModuleFederation,\n preloadOptions: PreloadOptions[number],\n remote: RemoteInfoOptionalVersion,\n globalSnapshot: GlobalModuleInfo,\n remoteSnapshot: ModuleInfo,\n): PreloadAssets {\n const cssAssets: Array<string> = [];\n const jsAssets: Array<string> = [];\n const entryAssets: Array<EntryAssets> = [];\n const loadedSharedJsAssets = new Set();\n const loadedSharedCssAssets = new Set();\n const { options } = origin;\n\n const { preloadConfig: rootPreloadConfig } = preloadOptions;\n const { depsRemote } = rootPreloadConfig;\n const memo = {};\n traverseModuleInfo(\n globalSnapshot,\n remote,\n (moduleInfoSnapshot: ModuleInfo, remoteInfo, isRoot) => {\n let preloadConfig: PreloadConfig;\n if (isRoot) {\n preloadConfig = rootPreloadConfig;\n } else {\n if (Array.isArray(depsRemote)) {\n // eslint-disable-next-line array-callback-return\n const findPreloadConfig = depsRemote.find((remoteConfig) => {\n if (\n remoteConfig.nameOrAlias === remoteInfo.name ||\n remoteConfig.nameOrAlias === remoteInfo.alias\n ) {\n return true;\n }\n return false;\n });\n if (!findPreloadConfig) {\n return;\n }\n preloadConfig = defaultPreloadArgs(findPreloadConfig);\n } else if (depsRemote === true) {\n preloadConfig = rootPreloadConfig;\n } else {\n return;\n }\n }\n\n const remoteEntryUrl = getResourceUrl(\n moduleInfoSnapshot,\n getRemoteEntryInfoFromSnapshot(moduleInfoSnapshot).url,\n );\n\n if (remoteEntryUrl) {\n entryAssets.push({\n name: remoteInfo.name,\n moduleInfo: {\n name: remoteInfo.name,\n entry: remoteEntryUrl,\n type:\n 'remoteEntryType' in moduleInfoSnapshot\n ? moduleInfoSnapshot.remoteEntryType\n : 'global',\n entryGlobalName:\n 'globalName' in moduleInfoSnapshot\n ? moduleInfoSnapshot.globalName\n : remoteInfo.name,\n shareScope: '',\n version:\n 'version' in moduleInfoSnapshot\n ? moduleInfoSnapshot.version\n : undefined,\n },\n url: remoteEntryUrl,\n });\n }\n\n let moduleAssetsInfo: NonNullable<ProviderModuleInfo['modules']> =\n 'modules' in moduleInfoSnapshot ? moduleInfoSnapshot.modules : [];\n const normalizedPreloadExposes = normalizePreloadExposes(\n preloadConfig.exposes,\n );\n if (normalizedPreloadExposes.length && 'modules' in moduleInfoSnapshot) {\n moduleAssetsInfo = moduleInfoSnapshot?.modules?.reduce(\n (assets, moduleAssetInfo) => {\n if (\n normalizedPreloadExposes?.indexOf(moduleAssetInfo.moduleName) !==\n -1\n ) {\n assets.push(moduleAssetInfo);\n }\n return assets;\n },\n [] as NonNullable<(typeof moduleInfoSnapshot)['modules']>,\n );\n }\n\n function handleAssets(assets: string[]): string[] {\n const assetsRes = assets.map((asset) =>\n getResourceUrl(moduleInfoSnapshot, asset),\n );\n if (preloadConfig.filter) {\n return assetsRes.filter(preloadConfig.filter);\n }\n return assetsRes;\n }\n\n if (moduleAssetsInfo) {\n const assetsLength = moduleAssetsInfo.length;\n for (let index = 0; index < assetsLength; index++) {\n const assetsInfo = moduleAssetsInfo[index];\n const exposeFullPath = `${remoteInfo.name}/${assetsInfo.moduleName}`;\n origin.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({\n id:\n assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,\n name: remoteInfo.name,\n remoteSnapshot: moduleInfoSnapshot,\n preloadConfig,\n remote: remoteInfo as Remote,\n origin,\n });\n const preloaded = getPreloaded(exposeFullPath);\n if (preloaded) {\n continue;\n }\n\n if (preloadConfig.resourceCategory === 'all') {\n cssAssets.push(...handleAssets(assetsInfo.assets.css.async));\n cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));\n jsAssets.push(...handleAssets(assetsInfo.assets.js.async));\n jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));\n } else if (preloadConfig.resourceCategory === 'sync') {\n cssAssets.push(...handleAssets(assetsInfo.assets.css.sync));\n jsAssets.push(...handleAssets(assetsInfo.assets.js.sync));\n }\n\n setPreloaded(exposeFullPath);\n }\n }\n },\n true,\n memo,\n remoteSnapshot,\n );\n\n if (remoteSnapshot.shared && remoteSnapshot.shared.length > 0) {\n const collectSharedAssets = (\n shareInfo: Shared,\n snapshotShared: ModuleInfo['shared'][0],\n ) => {\n const { shared: registeredShared } =\n getRegisteredShare(\n origin.shareScopeMap,\n snapshotShared.sharedName,\n shareInfo,\n origin.sharedHandler.hooks.lifecycle.resolveShare,\n ) || {};\n // If the global share does not exist, or the lib function does not exist, it means that the shared has not been loaded yet and can be preloaded.\n\n if (registeredShared && typeof registeredShared.lib === 'function') {\n snapshotShared.assets.js.sync.forEach((asset) => {\n loadedSharedJsAssets.add(asset);\n });\n snapshotShared.assets.css.sync.forEach((asset) => {\n loadedSharedCssAssets.add(asset);\n });\n }\n };\n remoteSnapshot.shared.forEach((shared) => {\n const shareInfos = options.shared?.[shared.sharedName];\n if (!shareInfos) {\n return;\n }\n // if no version, preload all shared\n const sharedOptions = shared.version\n ? shareInfos.find((s) => s.version === shared.version)\n : shareInfos;\n\n if (!sharedOptions) {\n return;\n }\n const arrayShareInfo = arrayOptions(sharedOptions);\n arrayShareInfo.forEach((s) => {\n collectSharedAssets(s, shared);\n });\n });\n }\n\n const needPreloadJsAssets = jsAssets.filter(\n (asset) => !loadedSharedJsAssets.has(asset) && !isExisted('script', asset),\n );\n const needPreloadCssAssets = cssAssets.filter(\n (asset) => !loadedSharedCssAssets.has(asset) && !isExisted('link', asset),\n );\n\n return {\n cssAssets: needPreloadCssAssets,\n jsAssetsWithoutEntry: needPreloadJsAssets,\n entryAssets: entryAssets.filter((entry) => !isExisted('script', entry.url)),\n };\n}\n\nexport const generatePreloadAssetsPlugin: () => ModuleFederationRuntimePlugin =\n function () {\n return {\n name: 'generate-preload-assets-plugin',\n async generatePreloadAssets(args) {\n const {\n origin,\n preloadOptions,\n remoteInfo,\n remote,\n globalSnapshot,\n remoteSnapshot,\n } = args;\n if (!isBrowserEnvValue) {\n return {\n cssAssets: [],\n jsAssetsWithoutEntry: [],\n entryAssets: [],\n };\n }\n\n if (isRemoteInfoWithEntry(remote) && isPureRemoteEntry(remote)) {\n return {\n cssAssets: [],\n jsAssetsWithoutEntry: [],\n entryAssets: [\n {\n name: remote.name,\n url: remote.entry,\n moduleInfo: {\n name: remoteInfo.name,\n entry: remote.entry,\n type: remoteInfo.type || 'global',\n entryGlobalName: '',\n shareScope: '',\n },\n },\n ],\n };\n }\n\n assignRemoteInfo(remoteInfo, remoteSnapshot);\n\n const assets = generatePreloadAssets(\n origin,\n preloadOptions,\n remoteInfo,\n globalSnapshot,\n remoteSnapshot,\n );\n\n return assets;\n },\n };\n };\n"],"mappings":";;;;;;;;;AAsCA,SAAS,QAAQ,IAGf;CACA,MAAM,YAAY,GAAG,MAAM,IAAI;AAC/B,KAAI,UAAU,WAAW,EACvB,QAAO;EACL,MAAM,UAAU;EAChB,SAAS;EACV;UACQ,UAAU,WAAW,EAC9B,QAAO;EACL,MAAM,UAAU;EAChB,SAAS,UAAU;EACpB;KAED,QAAO;EACL,MAAM,UAAU;EAChB,SAAS,UAAU;EACpB;;AAKL,SAAS,mBACP,gBACA,YACA,UAKA,QACA,OAAgC,EAAE,EAClC,gBACM;CAEN,MAAM,EAAE,OAAO,kBAAkBA,kCAAmB,gB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