@module-federation/webpack-bundler-runtime 2.6.0 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/index.cjs +13 -11
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +5 -27
  4. package/dist/index.js +13 -11
  5. package/dist/index.js.map +1 -1
  6. package/dist/init.cjs +65 -62
  7. package/dist/init.cjs.map +1 -1
  8. package/dist/init.js +65 -62
  9. package/dist/init.js.map +1 -1
  10. package/dist/types.d.ts +1 -1
  11. package/package.json +4 -4
  12. package/dist/runtime-core/dist/core.d.ts +0 -198
  13. package/dist/runtime-core/dist/global.d.ts +0 -24
  14. package/dist/runtime-core/dist/helpers.d.ts +0 -1
  15. package/dist/runtime-core/dist/index.d.ts +0 -6
  16. package/dist/runtime-core/dist/module/index.d.ts +0 -33
  17. package/dist/runtime-core/dist/plugins/snapshot/SnapshotHandler.d.ts +0 -70
  18. package/dist/runtime-core/dist/remote/index.d.ts +0 -146
  19. package/dist/runtime-core/dist/shared/index.d.ts +0 -106
  20. package/dist/runtime-core/dist/type/config.d.ts +0 -117
  21. package/dist/runtime-core/dist/type/index.d.ts +0 -1
  22. package/dist/runtime-core/dist/type/plugin.d.ts +0 -28
  23. package/dist/runtime-core/dist/type/preload.d.ts +0 -55
  24. package/dist/runtime-core/dist/types.d.ts +0 -3
  25. package/dist/runtime-core/dist/utils/hooks/asyncHook.d.ts +0 -11
  26. package/dist/runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts +0 -13
  27. package/dist/runtime-core/dist/utils/hooks/pluginSystem.d.ts +0 -20
  28. package/dist/runtime-core/dist/utils/hooks/syncHook.d.ts +0 -17
  29. package/dist/runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts +0 -12
  30. package/dist/runtime-core/dist/utils/load.d.ts +0 -17
  31. package/dist/runtime-core/dist/utils/manifest.d.ts +0 -1
  32. package/dist/runtime-core/dist/utils/preload.d.ts +0 -1
  33. package/dist/runtime-core/dist/utils/share.d.ts +0 -1
@@ -1,117 +0,0 @@
1
- import { ModuleFederationRuntimePlugin } from "./plugin.js";
2
- import { Module, RemoteEntryType, RemoteWithEntry, RemoteWithVersion, TreeShakingStatus } from "@module-federation/sdk";
3
-
4
- //#region ../runtime-core/dist/type/config.d.ts
5
- //#region src/type/config.d.ts
6
- type Optional<T, K extends keyof T> = Omit<T, K> & Partial<T>;
7
- interface RemoteInfoCommon {
8
- alias?: string;
9
- shareScope?: string | string[];
10
- type?: RemoteEntryType;
11
- entryGlobalName?: string;
12
- }
13
- type Remote = (RemoteWithEntry | RemoteWithVersion) & RemoteInfoCommon;
14
- interface RemoteInfo {
15
- alias?: string;
16
- name: string;
17
- version?: string;
18
- buildVersion?: string;
19
- entry: string;
20
- type: RemoteEntryType;
21
- entryGlobalName: string;
22
- shareScope: string | string[];
23
- }
24
- interface SharedConfig {
25
- singleton?: boolean;
26
- requiredVersion: false | string;
27
- eager?: boolean;
28
- strictVersion?: boolean;
29
- layer?: string | null;
30
- }
31
- type TreeShakingArgs = {
32
- usedExports?: string[];
33
- get?: SharedGetter;
34
- lib?: () => Module;
35
- status?: TreeShakingStatus;
36
- mode?: 'server-calc' | 'runtime-infer';
37
- loading?: null | Promise<any>;
38
- loaded?: boolean;
39
- useIn?: Array<string>;
40
- };
41
- type SharedBaseArgs = {
42
- version?: string;
43
- shareConfig?: SharedConfig;
44
- scope?: string | Array<string>;
45
- deps?: Array<string>;
46
- strategy?: 'version-first' | 'loaded-first';
47
- loaded?: boolean;
48
- treeShaking?: TreeShakingArgs;
49
- };
50
- type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
51
- type ShareArgs = (SharedBaseArgs & {
52
- get: SharedGetter;
53
- }) | (SharedBaseArgs & {
54
- lib: () => Module;
55
- }) | SharedBaseArgs;
56
- type ShareStrategy = 'version-first' | 'loaded-first';
57
- type Shared = {
58
- version: string;
59
- get: SharedGetter;
60
- shareConfig: SharedConfig;
61
- scope: Array<string>;
62
- useIn: Array<string>;
63
- from: string;
64
- deps: Array<string>;
65
- lib?: () => Module;
66
- loaded?: boolean;
67
- loading?: null | Promise<any>;
68
- eager?: boolean;
69
- /**
70
- * @deprecated set in initOptions.shareStrategy instead
71
- */
72
- strategy: ShareStrategy;
73
- treeShaking?: TreeShakingArgs;
74
- };
75
- type ShareScopeMap = {
76
- [scope: string]: {
77
- [pkgName: string]: {
78
- [sharedVersion: string]: Shared;
79
- };
80
- };
81
- };
82
- type GlobalShareScopeMap = {
83
- [instanceName: string]: ShareScopeMap;
84
- };
85
- type ShareInfos = {
86
- [pkgName: string]: Shared[];
87
- };
88
- interface Options {
89
- id?: string;
90
- name: string;
91
- version?: string;
92
- remotes: Array<Remote>;
93
- shared: ShareInfos;
94
- plugins: Array<ModuleFederationRuntimePlugin>;
95
- inBrowser: boolean;
96
- shareStrategy?: ShareStrategy;
97
- }
98
- type UserOptions = Omit<Optional<Options, 'plugins'>, 'shared' | 'inBrowser'> & {
99
- shared?: {
100
- [pkgName: string]: ShareArgs | ShareArgs[];
101
- };
102
- };
103
- type RemoteEntryInitOptions = {
104
- version: string;
105
- shareScopeMap?: ShareScopeMap;
106
- shareScopeKeys: string | string[];
107
- };
108
- type InitTokens = Record<string, Record<string, any>>;
109
- type InitScope = InitTokens[];
110
- type CallFrom = 'build' | 'runtime';
111
- type RemoteEntryExports = {
112
- get: (id: string) => () => Promise<Module>;
113
- init: (shareScope: ShareScopeMap[string], initScope?: InitScope, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void | Promise<void>;
114
- }; //#endregion
115
- //#endregion
116
- export { CallFrom, GlobalShareScopeMap, InitScope, InitTokens, Optional, Options, Remote, RemoteEntryExports, RemoteEntryInitOptions, RemoteInfo, RemoteInfoCommon, ShareArgs, ShareInfos, ShareScopeMap, ShareStrategy, Shared, SharedConfig, SharedGetter, TreeShakingArgs, UserOptions };
117
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- export { };
@@ -1,28 +0,0 @@
1
- import { RemoteHandler } from "../remote/index.js";
2
- import { SharedHandler } from "../shared/index.js";
3
- import { SnapshotHandler } from "../plugins/snapshot/SnapshotHandler.js";
4
- import { ModuleFederation } from "../core.js";
5
- import { Module$1 } from "../module/index.js";
6
-
7
- //#region ../runtime-core/dist/type/plugin.d.ts
8
- //#region src/type/plugin.d.ts
9
- type CoreLifeCycle = ModuleFederation['hooks']['lifecycle'];
10
- type CoreLifeCyclePartial = Partial<{ [k in keyof CoreLifeCycle]: Parameters<CoreLifeCycle[k]['on']>[0] }>;
11
- type SnapshotLifeCycle = SnapshotHandler['hooks']['lifecycle'];
12
- type SnapshotLifeCycleCyclePartial = Partial<{ [k in keyof SnapshotLifeCycle]: Parameters<SnapshotLifeCycle[k]['on']>[0] }>;
13
- type ModuleLifeCycle = Module$1['host']['loaderHook']['lifecycle'];
14
- type ModuleLifeCycleCyclePartial = Partial<{ [k in keyof ModuleLifeCycle]: Parameters<ModuleLifeCycle[k]['on']>[0] }>;
15
- type ModuleBridgeLifeCycle = Module$1['host']['bridgeHook']['lifecycle'];
16
- type ModuleBridgeLifeCycleCyclePartial = Partial<{ [k in keyof ModuleBridgeLifeCycle]: Parameters<ModuleBridgeLifeCycle[k]['on']>[0] }>;
17
- type SharedLifeCycle = SharedHandler['hooks']['lifecycle'];
18
- type SharedLifeCycleCyclePartial = Partial<{ [k in keyof SharedLifeCycle]: Parameters<SharedLifeCycle[k]['on']>[0] }>;
19
- type RemoteLifeCycle = RemoteHandler['hooks']['lifecycle'];
20
- type RemoteLifeCycleCyclePartial = Partial<{ [k in keyof RemoteLifeCycle]: Parameters<RemoteLifeCycle[k]['on']>[0] }>;
21
- type ModuleFederationRuntimePlugin = CoreLifeCyclePartial & SnapshotLifeCycleCyclePartial & SharedLifeCycleCyclePartial & RemoteLifeCycleCyclePartial & ModuleLifeCycleCyclePartial & ModuleBridgeLifeCycleCyclePartial & {
22
- name: string;
23
- version?: string;
24
- apply?: (instance: ModuleFederation) => void;
25
- }; //#endregion
26
- //#endregion
27
- export { ModuleFederationRuntimePlugin };
28
- //# sourceMappingURL=plugin.d.ts.map
@@ -1,55 +0,0 @@
1
- import { Remote, RemoteInfo } from "./config.js";
2
-
3
- //#region ../runtime-core/dist/type/preload.d.ts
4
- //#region src/type/preload.d.ts
5
- type depsPreloadArg = Omit<PreloadRemoteArgs, 'depsRemote'>;
6
- interface PreloadRemoteArgs {
7
- nameOrAlias: string;
8
- exposes?: Array<string>;
9
- resourceCategory?: 'all' | 'sync';
10
- share?: boolean;
11
- depsRemote?: boolean | Array<depsPreloadArg>;
12
- filter?: (assetUrl: string) => boolean;
13
- }
14
- type PreloadConfig = PreloadRemoteArgs;
15
- type PreloadOptions = Array<{
16
- remote: Remote;
17
- preloadConfig: PreloadConfig;
18
- }>;
19
- type ResourceLoadInitiator = 'loadRemote' | 'preloadRemote';
20
- type ResourceLoadType = 'manifest' | 'remoteEntry' | 'js' | 'css';
21
- interface ResourceLoadContext {
22
- initiator: ResourceLoadInitiator;
23
- id: string;
24
- resourceType: ResourceLoadType;
25
- url?: string;
26
- }
27
- type PreloadAssetStatus = 'success' | 'error' | 'timeout' | 'cached';
28
- interface PreloadAssetResult {
29
- url: string;
30
- status: PreloadAssetStatus;
31
- resourceType: ResourceLoadType;
32
- initiator: ResourceLoadInitiator;
33
- id: string;
34
- error?: unknown;
35
- }
36
- interface PreloadRemoteResult {
37
- remote: Remote;
38
- remoteInfo: RemoteInfo;
39
- preloadConfig: PreloadConfig;
40
- id: string;
41
- results: PreloadAssetResult[];
42
- }
43
- type EntryAssets = {
44
- name: string;
45
- url: string;
46
- moduleInfo: RemoteInfo;
47
- };
48
- interface PreloadAssets {
49
- cssAssets: Array<string>;
50
- jsAssetsWithoutEntry: Array<string>;
51
- entryAssets: Array<EntryAssets>;
52
- } //#endregion
53
- //#endregion
54
- export { EntryAssets, PreloadAssetResult, PreloadAssetStatus, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult, ResourceLoadContext, ResourceLoadInitiator, ResourceLoadType, depsPreloadArg };
55
- //# sourceMappingURL=preload.d.ts.map
@@ -1,3 +0,0 @@
1
- import { CallFrom, GlobalShareScopeMap, InitScope, InitTokens, Optional, Options, Remote, RemoteEntryExports, RemoteEntryInitOptions, RemoteInfo, RemoteInfoCommon, ShareArgs, ShareInfos, ShareScopeMap, ShareStrategy, Shared, SharedConfig, SharedGetter, TreeShakingArgs, UserOptions } from "./type/config.js";
2
- import { EntryAssets, PreloadAssetResult, PreloadAssetStatus, PreloadAssets, PreloadConfig, PreloadOptions, PreloadRemoteArgs, PreloadRemoteResult, ResourceLoadContext, ResourceLoadInitiator, ResourceLoadType, depsPreloadArg } from "./type/preload.js";
3
- import { ModuleFederationRuntimePlugin } from "./type/plugin.js";
@@ -1,11 +0,0 @@
1
- import { ArgsType, SyncHook } from "./syncHook.js";
2
-
3
- //#region ../runtime-core/dist/utils/hooks/asyncHook.d.ts
4
- //#region src/utils/hooks/asyncHook.d.ts
5
- type CallbackReturnType = void | false | Promise<void | false>;
6
- declare class AsyncHook<T, ExternalEmitReturnType = CallbackReturnType> extends SyncHook<T, ExternalEmitReturnType> {
7
- emit(...data: ArgsType<T>): Promise<void | false | ExternalEmitReturnType>;
8
- } //#endregion
9
- //#endregion
10
- export { AsyncHook };
11
- //# sourceMappingURL=asyncHook.d.ts.map
@@ -1,13 +0,0 @@
1
- import { SyncHook } from "./syncHook.js";
2
-
3
- //#region ../runtime-core/dist/utils/hooks/asyncWaterfallHooks.d.ts
4
- //#region src/utils/hooks/asyncWaterfallHooks.d.ts
5
- type CallbackReturnType<T> = T | void | Promise<T | void>;
6
- declare class AsyncWaterfallHook<T extends object> extends SyncHook<[T], CallbackReturnType<T>> {
7
- onerror: (errMsg: string | Error | unknown) => void;
8
- constructor(type: string);
9
- emit(data: T): Promise<T>;
10
- } //#endregion
11
- //#endregion
12
- export { AsyncWaterfallHook };
13
- //# sourceMappingURL=asyncWaterfallHooks.d.ts.map
@@ -1,20 +0,0 @@
1
- import { ModuleFederation } from "../../core.js";
2
-
3
- //#region ../runtime-core/dist/utils/hooks/pluginSystem.d.ts
4
- //#region src/utils/hooks/pluginSystem.d.ts
5
- type Plugin<T extends Record<string, any>> = { [k in keyof T]?: Parameters<T[k]['on']>[0] } & {
6
- name: string;
7
- version?: string;
8
- apply?: (instance: ModuleFederation) => void;
9
- };
10
- declare class PluginSystem<T extends Record<string, any>> {
11
- lifecycle: T;
12
- lifecycleKeys: Array<keyof T>;
13
- registerPlugins: Record<string, Plugin<T>>;
14
- constructor(lifecycle: T);
15
- applyPlugin(plugin: Plugin<T>, instance: ModuleFederation): void;
16
- removePlugin(pluginName: string): void;
17
- } //#endregion
18
- //#endregion
19
- export { PluginSystem };
20
- //# sourceMappingURL=pluginSystem.d.ts.map
@@ -1,17 +0,0 @@
1
- //#region ../runtime-core/dist/utils/hooks/syncHook.d.ts
2
- //#region src/utils/hooks/syncHook.d.ts
3
- type Callback<T, K> = (...args: ArgsType<T>) => K;
4
- type ArgsType<T> = T extends Array<any> ? T : Array<any>;
5
- declare class SyncHook<T, K> {
6
- type: string;
7
- listeners: Set<Callback<T, K>>;
8
- constructor(type?: string);
9
- on(fn: Callback<T, K>): void;
10
- once(fn: Callback<T, K>): void;
11
- emit(...data: ArgsType<T>): void | K | Promise<any>;
12
- remove(fn: Callback<T, K>): void;
13
- removeAll(): void;
14
- } //#endregion
15
- //#endregion
16
- export { ArgsType, SyncHook };
17
- //# sourceMappingURL=syncHook.d.ts.map
@@ -1,12 +0,0 @@
1
- import { SyncHook } from "./syncHook.js";
2
-
3
- //#region ../runtime-core/dist/utils/hooks/syncWaterfallHook.d.ts
4
- //#region src/utils/hooks/syncWaterfallHook.d.ts
5
- declare class SyncWaterfallHook<T extends Record<string, any>> extends SyncHook<[T], T | void> {
6
- onerror: (errMsg: string | Error | unknown) => void;
7
- constructor(type: string);
8
- emit(data: T): T;
9
- } //#endregion
10
- //#endregion
11
- export { SyncWaterfallHook };
12
- //# sourceMappingURL=syncWaterfallHook.d.ts.map
@@ -1,17 +0,0 @@
1
- import { RemoteEntryExports, RemoteInfo } from "../type/config.js";
2
- import { ResourceLoadContext } from "../type/preload.js";
3
- import { ModuleFederation } from "../core.js";
4
-
5
- //#region ../runtime-core/dist/utils/load.d.ts
6
- //#region src/utils/load.d.ts
7
- declare function getRemoteEntry(params: {
8
- origin: ModuleFederation;
9
- remoteInfo: RemoteInfo;
10
- remoteEntryExports?: RemoteEntryExports | undefined;
11
- getEntryUrl?: (url: string) => string;
12
- _inErrorHandling?: boolean;
13
- resourceContext?: ResourceLoadContext;
14
- }): Promise<RemoteEntryExports | false | void>;
15
- //#endregion
16
- export { getRemoteEntry };
17
- //# sourceMappingURL=load.d.ts.map
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };
@@ -1 +0,0 @@
1
- export { };