@module-federation/runtime 0.6.14 → 0.6.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +12 -3
- package/dist/index.esm.js +12 -3
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +1 -1
- package/dist/share.esm.js +1 -1
- package/dist/src/core.d.ts +5 -0
- package/dist/src/embedded.d.ts +5 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -316,8 +316,16 @@ let Module = class Module {
|
|
|
316
316
|
}
|
|
317
317
|
this.lib = remoteEntryExports;
|
|
318
318
|
this.inited = true;
|
|
319
|
+
let moduleFactory;
|
|
320
|
+
moduleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
321
|
+
remoteEntryExports,
|
|
322
|
+
expose,
|
|
323
|
+
moduleInfo: this.remoteInfo
|
|
324
|
+
});
|
|
319
325
|
// get exposeGetter
|
|
320
|
-
|
|
326
|
+
if (!moduleFactory) {
|
|
327
|
+
moduleFactory = await remoteEntryExports.get(expose);
|
|
328
|
+
}
|
|
321
329
|
share.assert(moduleFactory, `${share.getFMId(this.remoteInfo)} remote don't export ${expose}.`);
|
|
322
330
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
|
|
323
331
|
if (!loadFactory) {
|
|
@@ -1992,7 +2000,7 @@ class FederationHost {
|
|
|
1992
2000
|
// maybe will change, temporarily for internal use only
|
|
1993
2001
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
2002
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
2003
|
+
this.version = "0.6.15";
|
|
1996
2004
|
this.moduleCache = new Map();
|
|
1997
2005
|
this.loaderHook = new PluginSystem({
|
|
1998
2006
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2000,7 +2008,8 @@ class FederationHost {
|
|
|
2000
2008
|
createScript: new SyncHook(),
|
|
2001
2009
|
createLink: new SyncHook(),
|
|
2002
2010
|
// only work for manifest , so not open to the public yet
|
|
2003
|
-
fetch: new AsyncHook()
|
|
2011
|
+
fetch: new AsyncHook(),
|
|
2012
|
+
getModuleFactory: new AsyncHook()
|
|
2004
2013
|
});
|
|
2005
2014
|
// TODO: Validate the details of the options
|
|
2006
2015
|
// Initialize options with default values
|
package/dist/index.esm.js
CHANGED
|
@@ -316,8 +316,16 @@ let Module = class Module {
|
|
|
316
316
|
}
|
|
317
317
|
this.lib = remoteEntryExports;
|
|
318
318
|
this.inited = true;
|
|
319
|
+
let moduleFactory;
|
|
320
|
+
moduleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
321
|
+
remoteEntryExports,
|
|
322
|
+
expose,
|
|
323
|
+
moduleInfo: this.remoteInfo
|
|
324
|
+
});
|
|
319
325
|
// get exposeGetter
|
|
320
|
-
|
|
326
|
+
if (!moduleFactory) {
|
|
327
|
+
moduleFactory = await remoteEntryExports.get(expose);
|
|
328
|
+
}
|
|
321
329
|
assert(moduleFactory, `${getFMId(this.remoteInfo)} remote don't export ${expose}.`);
|
|
322
330
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
|
|
323
331
|
if (!loadFactory) {
|
|
@@ -1992,7 +2000,7 @@ class FederationHost {
|
|
|
1992
2000
|
// maybe will change, temporarily for internal use only
|
|
1993
2001
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
2002
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
2003
|
+
this.version = "0.6.15";
|
|
1996
2004
|
this.moduleCache = new Map();
|
|
1997
2005
|
this.loaderHook = new PluginSystem({
|
|
1998
2006
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2000,7 +2008,8 @@ class FederationHost {
|
|
|
2000
2008
|
createScript: new SyncHook(),
|
|
2001
2009
|
createLink: new SyncHook(),
|
|
2002
2010
|
// only work for manifest , so not open to the public yet
|
|
2003
|
-
fetch: new AsyncHook()
|
|
2011
|
+
fetch: new AsyncHook(),
|
|
2012
|
+
getModuleFactory: new AsyncHook()
|
|
2004
2013
|
});
|
|
2005
2014
|
// TODO: Validate the details of the options
|
|
2006
2015
|
// Initialize options with default values
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -177,7 +177,7 @@ function getGlobalFederationConstructor() {
|
|
|
177
177
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
178
178
|
if (isDebug) {
|
|
179
179
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
180
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
180
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.15";
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/share.esm.js
CHANGED
|
@@ -175,7 +175,7 @@ function getGlobalFederationConstructor() {
|
|
|
175
175
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
176
176
|
if (isDebug) {
|
|
177
177
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
178
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
178
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.15";
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/src/core.d.ts
CHANGED
|
@@ -60,6 +60,11 @@ export declare class FederationHost {
|
|
|
60
60
|
attrs?: Record<string, any>;
|
|
61
61
|
}], void | HTMLLinkElement>;
|
|
62
62
|
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
63
|
+
getModuleFactory: AsyncHook<[{
|
|
64
|
+
remoteEntryExports: RemoteEntryExports;
|
|
65
|
+
expose: string;
|
|
66
|
+
moduleInfo: RemoteInfo;
|
|
67
|
+
}], Promise<(() => Promise<Module>) | undefined>>;
|
|
63
68
|
}>;
|
|
64
69
|
constructor(userOptions: UserOptions);
|
|
65
70
|
initOptions(userOptions: UserOptions): Options;
|
package/dist/src/embedded.d.ts
CHANGED
|
@@ -72,6 +72,11 @@ export declare class FederationHost implements IndexModule.FederationHost {
|
|
|
72
72
|
attrs?: Record<string, any>;
|
|
73
73
|
}], void | HTMLLinkElement>;
|
|
74
74
|
fetch: import("./utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
75
|
+
getModuleFactory: import("./utils/hooks").AsyncHook<[{
|
|
76
|
+
remoteEntryExports: import("./type").RemoteEntryExports;
|
|
77
|
+
expose: string;
|
|
78
|
+
moduleInfo: import("./type").RemoteInfo;
|
|
79
|
+
}], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
|
|
75
80
|
}>;
|
|
76
81
|
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("./type").Options;
|
|
77
82
|
loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.6.
|
|
53
|
+
"@module-federation/sdk": "0.6.15"
|
|
54
54
|
}
|
|
55
55
|
}
|