@module-federation/dts-plugin 0.0.0-perf-devtools-20260108034446 → 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 (56) hide show
  1. package/dist/Action-CzhPMw2i.js +153 -0
  2. package/dist/Broker-C-uWF8l5.js +802 -0
  3. package/dist/CHANGELOG.md +297 -6
  4. package/dist/DtsWorker-SBLpkK-D.d.ts +178 -0
  5. package/dist/constant-C0QI9ddQ.d.ts +42 -0
  6. package/dist/consumeTypes-DhrUgkUW.js +241 -0
  7. package/dist/core.d.ts +3 -68
  8. package/dist/core.js +26 -2380
  9. package/dist/dynamic-remote-type-hints-plugin.d.ts +819 -3
  10. package/dist/dynamic-remote-type-hints-plugin.js +65 -187
  11. package/dist/esm/Action-DNNg2YDh.mjs +47 -0
  12. package/dist/esm/Broker-BfFUcTHm.mjs +738 -0
  13. package/dist/esm/consumeTypes-WKYNaS9i.mjs +208 -0
  14. package/dist/esm/core.mjs +5 -0
  15. package/dist/esm/dynamic-remote-type-hints-plugin.mjs +73 -0
  16. package/dist/esm/expose-rpc-B0rqtOKP.mjs +1593 -0
  17. package/dist/esm/fork-dev-worker.mjs +113 -0
  18. package/dist/esm/fork-generate-dts.mjs +14 -0
  19. package/dist/esm/index.mjs +509 -0
  20. package/dist/esm/start-broker.mjs +22 -0
  21. package/dist/esm/utils-CkPvDGOy.mjs +13 -0
  22. package/dist/expose-rpc-jaGpsAVL.js +1701 -0
  23. package/dist/fork-dev-worker.d.ts +10 -9
  24. package/dist/fork-dev-worker.js +110 -2869
  25. package/dist/fork-generate-dts.d.ts +4 -8
  26. package/dist/fork-generate-dts.js +11 -2040
  27. package/dist/iife/launch-web-client.iife.js +117 -0
  28. package/dist/index.d.ts +46 -50
  29. package/dist/index.js +493 -2978
  30. package/dist/start-broker.d.ts +41 -39
  31. package/dist/start-broker.js +17 -952
  32. package/dist/utils-7KqCZHbb.js +19 -0
  33. package/package.json +50 -30
  34. package/dist/DTSManager-b15Gfat3.d.ts +0 -53
  35. package/dist/DTSManagerOptions-QVchWb0x.d.ts +0 -32
  36. package/dist/DtsWorker-BrHsGz8C.d.ts +0 -56
  37. package/dist/core.d.mts +0 -68
  38. package/dist/dynamic-remote-type-hints-plugin.d.mts +0 -5
  39. package/dist/esm/chunk-647HGGGS.js +0 -241
  40. package/dist/esm/chunk-G65LOFTY.js +0 -24
  41. package/dist/esm/chunk-N7GTIQUA.js +0 -282
  42. package/dist/esm/chunk-RWXNVNFM.js +0 -1579
  43. package/dist/esm/chunk-WWV5RWOP.js +0 -902
  44. package/dist/esm/core.js +0 -44
  45. package/dist/esm/dynamic-remote-type-hints-plugin.js +0 -73
  46. package/dist/esm/fork-dev-worker.js +0 -145
  47. package/dist/esm/fork-generate-dts.js +0 -27
  48. package/dist/esm/index.js +0 -644
  49. package/dist/esm/start-broker.js +0 -36
  50. package/dist/fork-dev-worker.d.mts +0 -15
  51. package/dist/fork-generate-dts.d.mts +0 -10
  52. package/dist/iife/launch-web-client.js +0 -152
  53. package/dist/index.d.mts +0 -56
  54. package/dist/package.json +0 -87
  55. package/dist/start-broker.d.mts +0 -42
  56. package/dist/utils-DxGrqb9N.d.ts +0 -15
@@ -1,5 +1,821 @@
1
- import { ModuleFederationRuntimePlugin } from '@module-federation/runtime/types';
1
+ import { CreateLinkHookReturnDom, CreateScriptHookReturn, GlobalModuleInfo, Manifest, Module, ModuleInfo, RemoteEntryType, RemoteWithEntry, RemoteWithVersion, TreeShakingStatus } from "@module-federation/sdk";
2
2
 
3
+ //#region ../runtime-core/dist/utils/hooks/syncHook.d.ts
4
+ //#region src/utils/hooks/syncHook.d.ts
5
+ type Callback<T, K> = (...args: ArgsType<T>) => K;
6
+ type ArgsType<T> = T extends Array<any> ? T : Array<any>;
7
+ declare class SyncHook<T, K> {
8
+ type: string;
9
+ listeners: Set<Callback<T, K>>;
10
+ constructor(type?: string);
11
+ on(fn: Callback<T, K>): void;
12
+ once(fn: Callback<T, K>): void;
13
+ emit(...data: ArgsType<T>): void | K | Promise<any>;
14
+ remove(fn: Callback<T, K>): void;
15
+ removeAll(): void;
16
+ } //#endregion
17
+ //#endregion
18
+ //#region ../runtime-core/dist/utils/hooks/asyncHook.d.ts
19
+ //#region src/utils/hooks/asyncHook.d.ts
20
+ type CallbackReturnType$1 = void | false | Promise<void | false>;
21
+ declare class AsyncHook<T, ExternalEmitReturnType = CallbackReturnType$1> extends SyncHook<T, ExternalEmitReturnType> {
22
+ emit(...data: ArgsType<T>): Promise<void | false | ExternalEmitReturnType>;
23
+ } //#endregion
24
+ //#endregion
25
+ //#region ../runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts
26
+ //#region src/utils/hooks/syncWaterfallHook.d.ts
27
+ declare class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<[T], T | void> {
28
+ onerror: (errMsg: string | Error | unknown) => void;
29
+ constructor(type: string);
30
+ emit(data: T): T;
31
+ } //#endregion
32
+ //#endregion
33
+ //#region ../runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts
34
+ //#region src/utils/hooks/asyncWaterfallHooks.d.ts
35
+ type CallbackReturnType<T> = T | void | Promise<T | void>;
36
+ declare class AsyncWaterfallHook<T extends object> extends SyncHook<[T], CallbackReturnType<T>> {
37
+ onerror: (errMsg: string | Error | unknown) => void;
38
+ constructor(type: string);
39
+ emit(data: T): Promise<T>;
40
+ } //#endregion
41
+ //#endregion
42
+ //#region ../runtime-core/dist/utils/hooks/pluginSystem.d.ts
43
+ //#region src/utils/hooks/pluginSystem.d.ts
44
+ type Plugin<T extends Record<string, any>> = { [k in keyof T]?: Parameters<T[k]['on']>[0] } & {
45
+ name: string;
46
+ version?: string;
47
+ };
48
+ declare class PluginSystem<T extends Record<string, any>> {
49
+ lifecycle: T;
50
+ lifecycleKeys: Array<keyof T>;
51
+ registerPlugins: Record<string, Plugin<T>>;
52
+ constructor(lifecycle: T);
53
+ applyPlugin(plugin: Plugin<T>): void;
54
+ removePlugin(pluginName: string): void;
55
+ } //#endregion
56
+ //#endregion
57
+ //#region ../runtime-core/dist/type/config.d.ts
58
+ //#region src/type/config.d.ts
59
+ type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
60
+ interface RemoteInfoCommon {
61
+ alias?: string;
62
+ shareScope?: string | string[];
63
+ type?: RemoteEntryType;
64
+ entryGlobalName?: string;
65
+ }
66
+ type Remote = (RemoteWithEntry | RemoteWithVersion) & RemoteInfoCommon;
67
+ type LoadShareExtraOptions = {
68
+ from?: CallFrom;
69
+ customShareInfo?: Partial<Shared>;
70
+ resolver?: (sharedOptions: ShareInfos[string]) => Shared;
71
+ context?: SharedLoadContext;
72
+ };
73
+ type SharedLoadTrigger = CallFrom | 'container-init';
74
+ interface SharedLoadContext {
75
+ trigger?: SharedLoadTrigger;
76
+ moduleId?: string | number;
77
+ chunkId?: string | number;
78
+ }
79
+ interface RemoteInfo {
80
+ alias?: string;
81
+ name: string;
82
+ version?: string;
83
+ buildVersion?: string;
84
+ entry: string;
85
+ type: RemoteEntryType;
86
+ entryGlobalName: string;
87
+ shareScope: string | string[];
88
+ }
89
+ interface SharedConfig {
90
+ singleton?: boolean;
91
+ requiredVersion: false | string;
92
+ eager?: boolean;
93
+ strictVersion?: boolean;
94
+ layer?: string | null;
95
+ }
96
+ type TreeShakingArgs = {
97
+ usedExports?: string[];
98
+ get?: SharedGetter;
99
+ lib?: () => Module;
100
+ status?: TreeShakingStatus;
101
+ mode?: 'server-calc' | 'runtime-infer';
102
+ loading?: null | Promise<any>;
103
+ loaded?: boolean;
104
+ useIn?: Array<string>;
105
+ };
106
+ type SharedBaseArgs = {
107
+ version?: string;
108
+ shareConfig?: SharedConfig;
109
+ scope?: string | Array<string>;
110
+ deps?: Array<string>;
111
+ strategy?: 'version-first' | 'loaded-first';
112
+ loaded?: boolean;
113
+ treeShaking?: TreeShakingArgs;
114
+ };
115
+ type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
116
+ type ShareArgs = (SharedBaseArgs & {
117
+ get: SharedGetter;
118
+ }) | (SharedBaseArgs & {
119
+ lib: () => Module;
120
+ }) | SharedBaseArgs;
121
+ type ShareStrategy = 'version-first' | 'loaded-first';
122
+ type Shared = {
123
+ version: string;
124
+ get: SharedGetter;
125
+ shareConfig: SharedConfig;
126
+ scope: Array<string>;
127
+ useIn: Array<string>;
128
+ from: string;
129
+ deps: Array<string>;
130
+ lib?: () => Module;
131
+ loaded?: boolean;
132
+ loading?: null | Promise<any>;
133
+ eager?: boolean;
134
+ /**
135
+ * @deprecated set in initOptions.shareStrategy instead
136
+ */
137
+ strategy: ShareStrategy;
138
+ treeShaking?: TreeShakingArgs;
139
+ };
140
+ type ShareScopeMap = {
141
+ [scope: string]: {
142
+ [pkgName: string]: {
143
+ [sharedVersion: string]: Shared;
144
+ };
145
+ };
146
+ };
147
+ type GlobalShareScopeMap = {
148
+ [instanceName: string]: ShareScopeMap;
149
+ };
150
+ type ShareInfos = {
151
+ [pkgName: string]: Shared[];
152
+ };
153
+ interface Options {
154
+ id?: string;
155
+ name: string;
156
+ version?: string;
157
+ remotes: Array<Remote>;
158
+ shared: ShareInfos;
159
+ plugins: Array<ModuleFederationRuntimePlugin>;
160
+ inBrowser: boolean;
161
+ shareStrategy?: ShareStrategy;
162
+ }
163
+ type UserOptions = Omit<Optional<Options, 'plugins'>, 'shared' | 'inBrowser'> & {
164
+ shared?: {
165
+ [pkgName: string]: ShareArgs | ShareArgs[];
166
+ };
167
+ };
168
+ type RemoteEntryInitOptions = {
169
+ version: string;
170
+ shareScopeMap?: ShareScopeMap;
171
+ shareScopeKeys: string | string[];
172
+ };
173
+ type InitTokens = Record<string, Record<string, any>>;
174
+ type InitScope = InitTokens[];
175
+ type CallFrom = 'build' | 'runtime';
176
+ type RemoteEntryExports = {
177
+ get: (id: string) => () => Promise<Module>;
178
+ init: (shareScope: ShareScopeMap[string], initScope?: InitScope, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void | Promise<void>;
179
+ }; //#endregion
180
+ //#endregion
181
+ //#region ../runtime-core/dist/type/preload.d.ts
182
+ //#region src/type/preload.d.ts
183
+ type depsPreloadArg = Omit<PreloadRemoteArgs, 'depsRemote'>;
184
+ interface PreloadRemoteArgs {
185
+ nameOrAlias: string;
186
+ exposes?: Array<string>;
187
+ resourceCategory?: 'all' | 'sync';
188
+ share?: boolean;
189
+ depsRemote?: boolean | Array<depsPreloadArg>;
190
+ filter?: (assetUrl: string) => boolean;
191
+ /**
192
+ * Record preloaded JS and CSS URLs to skip duplicate resource loading.
193
+ * @default true
194
+ */
195
+ recordPreloadedAssets?: boolean;
196
+ }
197
+ type PreloadConfig = PreloadRemoteArgs;
198
+ type PreloadOptions = Array<{
199
+ remote: Remote;
200
+ preloadConfig: PreloadConfig;
201
+ }>;
202
+ type ResourceLoadInitiator = 'loadRemote' | 'preloadRemote' | 'loadShare';
203
+ type ResourceLoadType = 'manifest' | 'remoteEntry' | 'js' | 'css';
204
+ interface ResourceLoadContext$1 {
205
+ initiator: ResourceLoadInitiator;
206
+ id: string;
207
+ resourceType: ResourceLoadType;
208
+ url?: string;
209
+ expose?: string;
210
+ }
211
+ type PreloadAssetStatus = 'success' | 'error' | 'timeout' | 'cached';
212
+ interface PreloadAssetResult {
213
+ url: string;
214
+ status: PreloadAssetStatus;
215
+ resourceType: ResourceLoadType;
216
+ initiator: ResourceLoadInitiator;
217
+ id: string;
218
+ error?: unknown;
219
+ }
220
+ interface PreloadRemoteResult {
221
+ remote: Remote;
222
+ remoteInfo: RemoteInfo;
223
+ preloadConfig: PreloadConfig;
224
+ id: string;
225
+ results: PreloadAssetResult[];
226
+ }
227
+ type EntryAssets = {
228
+ name: string;
229
+ url: string;
230
+ moduleInfo: RemoteInfo;
231
+ };
232
+ interface PreloadAssets {
233
+ cssAssets: Array<string>;
234
+ jsAssetsWithoutEntry: Array<string>;
235
+ entryAssets: Array<EntryAssets>;
236
+ } //#endregion
237
+ //#endregion
238
+ //#region ../runtime-core/dist/remote/index.d.ts
239
+ //#region src/remote/index.d.ts
240
+ interface LoadRemoteMatch {
241
+ id: string;
242
+ pkgNameOrAlias: string;
243
+ expose: string;
244
+ remote: Remote;
245
+ options: Options;
246
+ origin: ModuleFederation;
247
+ remoteInfo: RemoteInfo;
248
+ remoteSnapshot?: ModuleInfo;
249
+ }
250
+ declare class RemoteHandler {
251
+ host: ModuleFederation;
252
+ idToRemoteMap: Record<string, {
253
+ name: string;
254
+ expose: string;
255
+ }>;
256
+ hooks: PluginSystem<{
257
+ beforeRegisterRemote: SyncWaterfallHook<{
258
+ remote: Remote;
259
+ origin: ModuleFederation;
260
+ }>;
261
+ registerRemote: SyncWaterfallHook<{
262
+ remote: Remote;
263
+ origin: ModuleFederation;
264
+ }>;
265
+ beforeRequest: AsyncWaterfallHook<{
266
+ id: string;
267
+ options: Options;
268
+ origin: ModuleFederation;
269
+ }>;
270
+ afterMatchRemote: AsyncHook<[{
271
+ id: string;
272
+ options: Options;
273
+ remote?: Remote;
274
+ expose?: string;
275
+ remoteInfo?: RemoteInfo;
276
+ error?: unknown;
277
+ origin: ModuleFederation;
278
+ }], void>;
279
+ onLoad: AsyncHook<[{
280
+ id: string;
281
+ expose: string;
282
+ pkgNameOrAlias: string;
283
+ remote: Remote;
284
+ options: ModuleOptions;
285
+ origin: ModuleFederation;
286
+ exposeModule: any;
287
+ exposeModuleFactory: any;
288
+ moduleInstance: Module$1;
289
+ }], unknown>;
290
+ afterLoadRemote: AsyncHook<[{
291
+ id: string;
292
+ expose?: string;
293
+ remote?: RemoteInfo;
294
+ options?: {
295
+ loadFactory?: boolean;
296
+ from?: CallFrom;
297
+ };
298
+ error?: unknown;
299
+ recovered?: boolean;
300
+ origin: ModuleFederation;
301
+ }], void>;
302
+ handlePreloadModule: SyncHook<[{
303
+ id: string;
304
+ name: string;
305
+ remote: Remote;
306
+ remoteSnapshot: ModuleInfo;
307
+ preloadConfig: PreloadRemoteArgs;
308
+ origin: ModuleFederation;
309
+ }], void>;
310
+ errorLoadRemote: AsyncHook<[{
311
+ id: string;
312
+ error: unknown;
313
+ options?: any;
314
+ from: CallFrom;
315
+ lifecycle: "beforeRequest" | "beforeLoadShare" | "afterResolve" | "onLoad";
316
+ remote?: RemoteInfo;
317
+ expose?: string;
318
+ origin: ModuleFederation;
319
+ }], unknown>;
320
+ beforePreloadRemote: AsyncHook<[{
321
+ preloadOps: Array<PreloadRemoteArgs>;
322
+ options: Options;
323
+ origin: ModuleFederation;
324
+ }], false | void | Promise<false | void>>;
325
+ generatePreloadAssets: AsyncHook<[{
326
+ origin: ModuleFederation;
327
+ preloadOptions: PreloadOptions[number];
328
+ remote: Remote;
329
+ remoteInfo: RemoteInfo;
330
+ remoteSnapshot: ModuleInfo;
331
+ globalSnapshot: GlobalModuleInfo;
332
+ }], Promise<PreloadAssets>>;
333
+ afterPreloadRemote: AsyncHook<[{
334
+ preloadOps: Array<PreloadRemoteArgs>;
335
+ options: Options;
336
+ origin: ModuleFederation;
337
+ results: PreloadRemoteResult[];
338
+ error?: unknown;
339
+ }], false | void | Promise<false | void>>;
340
+ loadEntry: AsyncHook<[{
341
+ origin: ModuleFederation;
342
+ loaderHook: ModuleFederation["loaderHook"];
343
+ remoteInfo: RemoteInfo;
344
+ remoteEntryExports?: RemoteEntryExports;
345
+ resourceContext?: ResourceLoadContext;
346
+ }], void | RemoteEntryExports | Promise<void | RemoteEntryExports>>;
347
+ }>;
348
+ constructor(host: ModuleFederation);
349
+ formatAndRegisterRemote(globalOptions: Options, userOptions: UserOptions): Remote[];
350
+ setIdToRemoteMap(id: string, remoteMatchInfo: LoadRemoteMatch): void;
351
+ loadRemote<T>(id: string, options?: {
352
+ loadFactory?: boolean;
353
+ from: CallFrom;
354
+ }): Promise<T | null>;
355
+ preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
356
+ registerRemotes(remotes: Remote[], options?: {
357
+ force?: boolean;
358
+ }): void;
359
+ initRawContainer(name: string, url: string, container: RemoteEntryExports): Module$1;
360
+ getRemoteModuleAndOptions(options: {
361
+ id: string;
362
+ }): Promise<{
363
+ module: Module$1;
364
+ moduleOptions: ModuleOptions;
365
+ remoteMatchInfo: LoadRemoteMatch;
366
+ }>;
367
+ registerRemote(remote: Remote, targetRemotes: Remote[], options?: {
368
+ force?: boolean;
369
+ }): void;
370
+ private removeRemote;
371
+ } //#endregion
372
+ //#endregion
373
+ //#region ../runtime-core/dist/shared/index.d.ts
374
+ //#region src/shared/index.d.ts
375
+ declare class SharedHandler {
376
+ host: ModuleFederation;
377
+ shareScopeMap: ShareScopeMap;
378
+ hooks: PluginSystem<{
379
+ beforeRegisterShare: SyncWaterfallHook<{
380
+ pkgName: string;
381
+ shared: Shared;
382
+ origin: ModuleFederation;
383
+ }>;
384
+ afterRegisterShare: SyncHook<[{
385
+ pkgName: string;
386
+ scope: string;
387
+ shared: Shared;
388
+ previousShared?: Shared;
389
+ registeredShared?: Shared;
390
+ shareScopeMap: ShareScopeMap;
391
+ trigger: SharedLoadTrigger;
392
+ origin: ModuleFederation;
393
+ }], void>;
394
+ afterResolve: AsyncWaterfallHook<LoadRemoteMatch>;
395
+ beforeLoadShare: AsyncWaterfallHook<{
396
+ pkgName: string;
397
+ shareInfo?: Shared;
398
+ shared: Options["shared"];
399
+ origin: ModuleFederation;
400
+ loadContext?: SharedLoadContext;
401
+ }>;
402
+ loadShare: AsyncHook<[ModuleFederation, string, ShareInfos], false | void | Promise<false | void>>;
403
+ afterLoadShare: SyncHook<[{
404
+ pkgName: string;
405
+ shareInfo?: Partial<Shared>;
406
+ selectedShared?: Partial<Shared>;
407
+ shared: Options["shared"];
408
+ shareScopeMap: ShareScopeMap;
409
+ lifecycle: "loadShare" | "loadShareSync";
410
+ loadContext?: SharedLoadContext;
411
+ origin: ModuleFederation;
412
+ }], void>;
413
+ errorLoadShare: SyncHook<[{
414
+ pkgName: string;
415
+ shareInfo?: Partial<Shared>;
416
+ shared: Options["shared"];
417
+ shareScopeMap: ShareScopeMap;
418
+ lifecycle: "loadShare" | "loadShareSync";
419
+ origin: ModuleFederation;
420
+ error?: unknown;
421
+ recovered?: boolean;
422
+ loadContext?: SharedLoadContext;
423
+ }], void>;
424
+ resolveShare: SyncWaterfallHook<{
425
+ shareScopeMap: ShareScopeMap;
426
+ scope: string;
427
+ pkgName: string;
428
+ version: string;
429
+ shareInfo: Shared;
430
+ GlobalFederation: Federation;
431
+ resolver: () => {
432
+ shared: Shared;
433
+ useTreesShaking: boolean;
434
+ } | undefined;
435
+ loadContext?: SharedLoadContext;
436
+ }>;
437
+ initContainerShareScopeMap: SyncWaterfallHook<{
438
+ shareScope: ShareScopeMap[string];
439
+ options: Options;
440
+ origin: ModuleFederation;
441
+ scopeName: string;
442
+ hostShareScopeMap?: ShareScopeMap;
443
+ }>;
444
+ }>;
445
+ initTokens: InitTokens;
446
+ constructor(host: ModuleFederation);
447
+ private emitAfterRegisterShare;
448
+ private emitAfterLoadShare;
449
+ private emitErrorLoadShare;
450
+ registerShared(globalOptions: Options, userOptions: UserOptions): {
451
+ newShareInfos: ShareInfos;
452
+ allShareInfos: {
453
+ [pkgName: string]: Shared[];
454
+ };
455
+ };
456
+ loadShare<T>(pkgName: string, extraOptions?: LoadShareExtraOptions): Promise<false | (() => T | undefined)>;
457
+ /**
458
+ * This function initializes the sharing sequence (executed only once per share scope).
459
+ * It accepts one argument, the name of the share scope.
460
+ * If the share scope does not exist, it creates one.
461
+ */
462
+ initializeSharing(shareScopeName?: string, extraOptions?: {
463
+ initScope?: InitScope;
464
+ from?: CallFrom;
465
+ strategy?: ShareStrategy;
466
+ context?: SharedLoadContext;
467
+ }): Array<Promise<void>>;
468
+ loadShareSync<T>(pkgName: string, extraOptions?: LoadShareExtraOptions): () => T | never;
469
+ initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
470
+ hostShareScopeMap?: ShareScopeMap;
471
+ }): void;
472
+ private setShared;
473
+ private _setGlobalShareScopeMap;
474
+ } //#endregion
475
+ //#endregion
476
+ //#region ../runtime-core/dist/type/plugin.d.ts
477
+ //#region src/type/plugin.d.ts
478
+ type CoreLifeCycle = ModuleFederation['hooks']['lifecycle'];
479
+ type CoreLifeCyclePartial = Partial<{ [k in keyof CoreLifeCycle]: Parameters<CoreLifeCycle[k]['on']>[0] }>;
480
+ type SnapshotLifeCycle = SnapshotHandler['hooks']['lifecycle'];
481
+ type SnapshotLifeCycleCyclePartial = Partial<{ [k in keyof SnapshotLifeCycle]: Parameters<SnapshotLifeCycle[k]['on']>[0] }>;
482
+ type ModuleLifeCycle = Module$1['host']['loaderHook']['lifecycle'];
483
+ type ModuleLifeCycleCyclePartial = Partial<{ [k in keyof ModuleLifeCycle]: Parameters<ModuleLifeCycle[k]['on']>[0] }>;
484
+ type ModuleBridgeLifeCycle = Module$1['host']['bridgeHook']['lifecycle'];
485
+ type ModuleBridgeLifeCycleCyclePartial = Partial<{ [k in keyof ModuleBridgeLifeCycle]: Parameters<ModuleBridgeLifeCycle[k]['on']>[0] }>;
486
+ type SharedLifeCycle = SharedHandler['hooks']['lifecycle'];
487
+ type SharedLifeCycleCyclePartial = Partial<{ [k in keyof SharedLifeCycle]: Parameters<SharedLifeCycle[k]['on']>[0] }>;
488
+ type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
489
+ type RemoteLifeCycleCyclePartial = Partial<{ [k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0] }>;
490
+ type RuntimePluginHooks = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial;
491
+ type ModuleFederationRuntimePlugin = RuntimePluginHooks & {
492
+ name: string;
493
+ version?: string;
494
+ apply?: (instance: ModuleFederation) => void | RuntimePluginHooks;
495
+ }; //#endregion
496
+ //#endregion
497
+ //#region ../runtime-core/dist/global.d.ts
498
+ //#region src/global.d.ts
499
+ interface Federation {
500
+ __GLOBAL_PLUGIN__: Array<ModuleFederationRuntimePlugin>;
501
+ __DEBUG_CONSTRUCTOR_VERSION__?: string;
502
+ moduleInfo: GlobalModuleInfo;
503
+ __DEBUG_CONSTRUCTOR__?: typeof ModuleFederation;
504
+ __INSTANCES__: Array<ModuleFederation>;
505
+ __SHARE__: GlobalShareScopeMap;
506
+ __MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
507
+ __PRELOADED_MAP__: Map<string, boolean>;
508
+ __PRELOADED_ASSETS__: Set<string>;
509
+ }
510
+ declare global {
511
+ var __FEDERATION__: Federation, __VMOK__: Federation, __GLOBAL_LOADING_REMOTE_ENTRY__: Record<string, undefined | Promise<RemoteEntryExports | void>>;
512
+ }
513
+ declare const getGlobalSnapshot: () => GlobalModuleInfo;
514
+ //#endregion
515
+ //#region ../runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts
516
+ //#region src/plugins/snapshot/SnapshotHandler.d.ts
517
+ declare class SnapshotHandler {
518
+ loadingHostSnapshot: Promise<GlobalModuleInfo | void> | null;
519
+ HostInstance: ModuleFederation;
520
+ manifestCache: Map<string, Manifest>;
521
+ hooks: PluginSystem<{
522
+ beforeLoadRemoteSnapshot: AsyncHook<[{
523
+ options: Options;
524
+ moduleInfo: Remote;
525
+ origin: ModuleFederation;
526
+ }], void>;
527
+ loadSnapshot: AsyncWaterfallHook<{
528
+ options: Options;
529
+ moduleInfo: Remote;
530
+ hostGlobalSnapshot: GlobalModuleInfo[string] | undefined;
531
+ globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
532
+ remoteSnapshot?: GlobalModuleInfo[string] | undefined;
533
+ }>;
534
+ loadRemoteSnapshot: AsyncWaterfallHook<{
535
+ options: Options;
536
+ moduleInfo: Remote;
537
+ manifestJson?: Manifest;
538
+ manifestUrl?: string;
539
+ remoteSnapshot: ModuleInfo;
540
+ from: "global" | "manifest";
541
+ }>;
542
+ afterLoadSnapshot: AsyncWaterfallHook<{
543
+ id?: string;
544
+ host: ModuleFederation;
545
+ options: Options;
546
+ moduleInfo: Remote;
547
+ remoteSnapshot: ModuleInfo;
548
+ }>;
549
+ beforeLoadManifest: AsyncHook<[{
550
+ manifestUrl: string;
551
+ moduleInfo: Remote;
552
+ resourceOptions?: {
553
+ initiator: ResourceLoadInitiator;
554
+ id: string;
555
+ };
556
+ origin: ModuleFederation;
557
+ }], void>;
558
+ afterLoadManifest: AsyncHook<[{
559
+ manifestUrl: string;
560
+ moduleInfo: Remote;
561
+ resourceOptions?: {
562
+ initiator: ResourceLoadInitiator;
563
+ id: string;
564
+ };
565
+ manifestJson?: Manifest;
566
+ response?: Response;
567
+ error?: unknown;
568
+ cached?: boolean;
569
+ recovered?: boolean;
570
+ origin: ModuleFederation;
571
+ }], void>;
572
+ }>;
573
+ loaderHook: ModuleFederation['loaderHook'];
574
+ manifestLoading: Record<string, Promise<ModuleInfo>>;
575
+ constructor(HostInstance: ModuleFederation);
576
+ loadRemoteSnapshotInfo({
577
+ moduleInfo,
578
+ id,
579
+ initiator
580
+ }: {
581
+ moduleInfo: Remote;
582
+ id?: string;
583
+ initiator?: ResourceLoadInitiator;
584
+ }): Promise<{
585
+ remoteSnapshot: ModuleInfo;
586
+ globalSnapshot: GlobalModuleInfo;
587
+ }> | never;
588
+ getGlobalRemoteInfo(moduleInfo: Remote): {
589
+ hostGlobalSnapshot: ModuleInfo | undefined;
590
+ globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
591
+ remoteSnapshot: GlobalModuleInfo[string] | undefined;
592
+ };
593
+ private getManifestJson;
594
+ private loadManifestSnapshot;
595
+ } //#endregion
596
+ //#endregion
597
+ //#region ../runtime-core/dist/utils/load.d.ts
598
+ //#region src/utils/load.d.ts
599
+ declare function getRemoteEntry(params: {
600
+ origin: ModuleFederation;
601
+ remoteInfo: RemoteInfo;
602
+ remoteEntryExports?: RemoteEntryExports | undefined;
603
+ getEntryUrl?: (url: string) => string;
604
+ _inErrorHandling?: boolean;
605
+ resourceContext?: ResourceLoadContext$1;
606
+ }): Promise<RemoteEntryExports | false | void>;
607
+ //#endregion
608
+ //#region ../runtime-core/dist/core.d.ts
609
+ //#region src/core.d.ts
610
+ type BridgeHookContext = object;
611
+ type BridgeHookResult = {
612
+ context: BridgeHookContext;
613
+ result?: unknown;
614
+ };
615
+ declare class ModuleFederation {
616
+ options: Options;
617
+ hooks: PluginSystem<{
618
+ beforeInit: SyncWaterfallHook<{
619
+ userOptions: UserOptions;
620
+ options: Options;
621
+ origin: ModuleFederation;
622
+ /**
623
+ * @deprecated shareInfo will be removed soon, please use userOptions directly!
624
+ */
625
+ shareInfo: ShareInfos;
626
+ }>;
627
+ init: SyncHook<[{
628
+ options: Options;
629
+ origin: ModuleFederation;
630
+ }], void>;
631
+ beforeInitContainer: AsyncWaterfallHook<{
632
+ shareScope: ShareScopeMap[string];
633
+ initScope: InitScope;
634
+ remoteEntryInitOptions: RemoteEntryInitOptions;
635
+ remoteInfo: RemoteInfo;
636
+ origin: ModuleFederation;
637
+ }>;
638
+ initContainer: AsyncWaterfallHook<{
639
+ shareScope: ShareScopeMap[string];
640
+ initScope: InitScope;
641
+ remoteEntryInitOptions: RemoteEntryInitOptions;
642
+ remoteInfo: RemoteInfo;
643
+ remoteEntryExports: RemoteEntryExports;
644
+ origin: ModuleFederation;
645
+ id?: string;
646
+ remoteSnapshot?: ModuleInfo;
647
+ }>;
648
+ }>;
649
+ version: string;
650
+ name: string;
651
+ moduleCache: Map<string, Module$1>;
652
+ snapshotHandler: SnapshotHandler;
653
+ sharedHandler: SharedHandler;
654
+ remoteHandler: RemoteHandler;
655
+ shareScopeMap: ShareScopeMap;
656
+ loaderHook: PluginSystem<{
657
+ getModuleInfo: SyncHook<[{
658
+ target: Record<string, any>;
659
+ key: any;
660
+ }], void | {
661
+ value: any | undefined;
662
+ key: string;
663
+ }>;
664
+ createScript: SyncHook<[{
665
+ url: string;
666
+ attrs?: Record<string, any>;
667
+ /**
668
+ * The producer(remote) info bound to this resource.
669
+ * Only present when the loader is invoked in a remote-related context
670
+ * (e.g. preloadRemote / loading remoteEntry).
671
+ */
672
+ remoteInfo?: RemoteInfo;
673
+ resourceContext?: ResourceLoadContext$1;
674
+ }], CreateScriptHookReturn>;
675
+ createLink: SyncHook<[{
676
+ url: string;
677
+ attrs?: Record<string, any>;
678
+ /**
679
+ * The producer(remote) info bound to this resource.
680
+ * Only present when the loader is invoked in a remote-related context
681
+ * (e.g. preloadRemote / loading remoteEntry).
682
+ */
683
+ remoteInfo?: RemoteInfo;
684
+ resourceContext?: ResourceLoadContext$1;
685
+ }], CreateLinkHookReturnDom>;
686
+ fetch: AsyncHook<[string, RequestInit, (RemoteInfo | undefined)?, (ResourceLoadContext$1 | undefined)?], false | void | Promise<Response>>;
687
+ loadEntryError: AsyncHook<[{
688
+ getRemoteEntry: typeof getRemoteEntry;
689
+ origin: ModuleFederation;
690
+ remoteInfo: RemoteInfo;
691
+ remoteEntryExports?: RemoteEntryExports | undefined;
692
+ globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
693
+ uniqueKey: string;
694
+ }], Promise<Promise<RemoteEntryExports | undefined> | undefined>>;
695
+ afterLoadEntry: AsyncHook<[{
696
+ origin: ModuleFederation;
697
+ remoteInfo: RemoteInfo;
698
+ remoteEntryExports?: false | void | RemoteEntryExports | undefined;
699
+ resourceContext?: ResourceLoadContext$1;
700
+ cached?: boolean;
701
+ error?: unknown;
702
+ recovered?: boolean;
703
+ }], void>;
704
+ beforeInitRemote: AsyncHook<[{
705
+ id?: string;
706
+ remoteInfo: RemoteInfo;
707
+ remoteSnapshot?: ModuleInfo;
708
+ origin: ModuleFederation;
709
+ }], void>;
710
+ afterInitRemote: AsyncHook<[{
711
+ id?: string;
712
+ remoteInfo: RemoteInfo;
713
+ remoteSnapshot?: ModuleInfo;
714
+ remoteEntryExports?: RemoteEntryExports;
715
+ error?: unknown;
716
+ cached?: boolean;
717
+ origin: ModuleFederation;
718
+ }], void>;
719
+ beforeGetExpose: AsyncHook<[{
720
+ id: string;
721
+ expose: string;
722
+ moduleInfo: RemoteInfo;
723
+ remoteEntryExports: RemoteEntryExports;
724
+ origin: ModuleFederation;
725
+ }], void>;
726
+ afterGetExpose: AsyncHook<[{
727
+ id: string;
728
+ expose: string;
729
+ moduleInfo: RemoteInfo;
730
+ remoteEntryExports: RemoteEntryExports;
731
+ moduleFactory?: RemoteModuleFactory;
732
+ error?: unknown;
733
+ origin: ModuleFederation;
734
+ }], void>;
735
+ beforeExecuteFactory: AsyncHook<[{
736
+ id: string;
737
+ expose: string;
738
+ moduleInfo: RemoteInfo;
739
+ loadFactory: boolean;
740
+ origin: ModuleFederation;
741
+ }], void>;
742
+ afterExecuteFactory: AsyncHook<[{
743
+ id: string;
744
+ expose: string;
745
+ moduleInfo: RemoteInfo;
746
+ loadFactory: boolean;
747
+ exposeModule?: unknown;
748
+ error?: unknown;
749
+ origin: ModuleFederation;
750
+ }], void>;
751
+ getModuleFactory: AsyncHook<[{
752
+ remoteEntryExports: RemoteEntryExports;
753
+ expose: string;
754
+ moduleInfo: RemoteInfo;
755
+ }], RemoteModuleFactory | Promise<RemoteModuleFactory | undefined> | undefined>;
756
+ }>;
757
+ bridgeHook: PluginSystem<{
758
+ beforeBridgeRender: SyncHook<[Record<string, any>, (object | undefined)?], void | Record<string, any>>;
759
+ afterBridgeRender: SyncHook<[Record<string, any>, (BridgeHookResult | undefined)?], void | Record<string, any>>;
760
+ beforeBridgeDestroy: SyncHook<[Record<string, any>, (object | undefined)?], void | Record<string, any>>;
761
+ afterBridgeDestroy: SyncHook<[Record<string, any>, (BridgeHookResult | undefined)?], void | Record<string, any>>;
762
+ afterBridgeRouteSync: SyncHook<[BridgeHookResult], void>;
763
+ }>;
764
+ moduleInfo?: GlobalModuleInfo[string];
765
+ constructor(userOptions: UserOptions);
766
+ initOptions(userOptions: UserOptions): Options;
767
+ loadShare<T>(pkgName: string, extraOptions?: LoadShareExtraOptions): Promise<false | (() => T | undefined)>;
768
+ loadShareSync<T>(pkgName: string, extraOptions?: LoadShareExtraOptions): () => T | never;
769
+ initializeSharing(shareScopeName?: string, extraOptions?: {
770
+ initScope?: InitScope;
771
+ from?: CallFrom;
772
+ strategy?: Shared['strategy'];
773
+ context?: SharedLoadContext;
774
+ }): Array<Promise<void>>;
775
+ initRawContainer(name: string, url: string, container: RemoteEntryExports): Module$1;
776
+ loadRemote<T>(id: string, options?: {
777
+ loadFactory?: boolean;
778
+ from: CallFrom;
779
+ }): Promise<T | null>;
780
+ preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
781
+ initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
782
+ hostShareScopeMap?: ShareScopeMap;
783
+ }): void;
784
+ formatOptions(globalOptions: Options, userOptions: UserOptions): Options;
785
+ registerPlugins(plugins: UserOptions['plugins']): void;
786
+ registerRemotes(remotes: Remote[], options?: {
787
+ force?: boolean;
788
+ }): void;
789
+ registerShared(shared: UserOptions['shared']): void;
790
+ } //#endregion
791
+ //#endregion
792
+ //#region ../runtime-core/dist/module/index.d.ts
793
+ //#region src/module/index.d.ts
794
+ type ModuleOptions = ConstructorParameters<typeof Module$1>[0];
795
+ type RemoteModuleFactory = () => unknown | Promise<unknown>;
796
+ declare class Module$1 {
797
+ remoteInfo: RemoteInfo;
798
+ inited: boolean;
799
+ initing: boolean;
800
+ initPromise?: Promise<void>;
801
+ remoteEntryExports?: RemoteEntryExports;
802
+ lib: RemoteEntryExports | undefined;
803
+ host: ModuleFederation;
804
+ constructor({
805
+ remoteInfo,
806
+ host
807
+ }: {
808
+ remoteInfo: RemoteInfo;
809
+ host: ModuleFederation;
810
+ });
811
+ getEntry(expose?: string, resourceContext?: ResourceLoadContext$1): Promise<RemoteEntryExports>;
812
+ init(id?: string, remoteSnapshot?: ModuleInfo, rawInitScope?: InitScope, expose?: string, resourceContext?: ResourceLoadContext$1): Promise<RemoteEntryExports>;
813
+ get(id: string, expose: string, options?: {
814
+ loadFactory?: boolean;
815
+ }, remoteSnapshot?: ModuleInfo): Promise<unknown>;
816
+ private wraperFactory;
817
+ } //#endregion
818
+ //#endregion
819
+ //#region src/runtime-plugins/dynamic-remote-type-hints-plugin.d.ts
3
820
  declare function dynamicRemoteTypeHintsPlugin(): ModuleFederationRuntimePlugin;
4
-
5
- export { dynamicRemoteTypeHintsPlugin as default };
821
+ export = dynamicRemoteTypeHintsPlugin;