@module-federation/runtime 0.0.4 → 0.0.6
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 +4 -4
- package/dist/index.esm.js +4 -4
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +2 -2
- package/dist/share.esm.js +2 -2
- package/dist/src/utils/hooks/pluginSystem.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -82,7 +82,7 @@ function registerPlugins(plugins, hookInstances) {
|
|
|
82
82
|
if (plugins && plugins.length > 0) {
|
|
83
83
|
plugins.forEach((plugin)=>{
|
|
84
84
|
hookInstances.forEach((hookInstance)=>{
|
|
85
|
-
hookInstance.
|
|
85
|
+
hookInstance.applyPlugin(plugin);
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -400,7 +400,7 @@ class AsyncWaterfallHook extends SyncHook {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
class PluginSystem {
|
|
403
|
-
|
|
403
|
+
applyPlugin(plugin) {
|
|
404
404
|
share.assert(share.isPlainObject(plugin), 'Plugin configuration is invalid.');
|
|
405
405
|
// The plugin's name is mandatory and must be unique
|
|
406
406
|
const pluginName = plugin.name;
|
|
@@ -433,7 +433,7 @@ class PluginSystem {
|
|
|
433
433
|
});
|
|
434
434
|
Object.keys(registerPlugins).forEach((pluginName)=>{
|
|
435
435
|
share.assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
|
|
436
|
-
this.
|
|
436
|
+
this.applyPlugin(registerPlugins[pluginName]);
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
439
|
constructor(lifecycle){
|
|
@@ -1538,7 +1538,7 @@ class FederationHost {
|
|
|
1538
1538
|
generatePreloadAssets: new AsyncHook('generatePreloadAssets'),
|
|
1539
1539
|
afterPreloadRemote: new AsyncHook()
|
|
1540
1540
|
});
|
|
1541
|
-
this.version = '0.0.
|
|
1541
|
+
this.version = '0.0.6';
|
|
1542
1542
|
this.moduleCache = new Map();
|
|
1543
1543
|
this.loaderHook = new PluginSystem({
|
|
1544
1544
|
// FIXME: may not be suitable
|
package/dist/index.esm.js
CHANGED
|
@@ -79,7 +79,7 @@ function registerPlugins(plugins, hookInstances) {
|
|
|
79
79
|
if (plugins && plugins.length > 0) {
|
|
80
80
|
plugins.forEach((plugin)=>{
|
|
81
81
|
hookInstances.forEach((hookInstance)=>{
|
|
82
|
-
hookInstance.
|
|
82
|
+
hookInstance.applyPlugin(plugin);
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
}
|
|
@@ -397,7 +397,7 @@ class AsyncWaterfallHook extends SyncHook {
|
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
class PluginSystem {
|
|
400
|
-
|
|
400
|
+
applyPlugin(plugin) {
|
|
401
401
|
assert(isPlainObject(plugin), 'Plugin configuration is invalid.');
|
|
402
402
|
// The plugin's name is mandatory and must be unique
|
|
403
403
|
const pluginName = plugin.name;
|
|
@@ -430,7 +430,7 @@ class PluginSystem {
|
|
|
430
430
|
});
|
|
431
431
|
Object.keys(registerPlugins).forEach((pluginName)=>{
|
|
432
432
|
assert(!this.registerPlugins[pluginName], `The plugin "${pluginName}" has a conflict and cannot be inherited.`);
|
|
433
|
-
this.
|
|
433
|
+
this.applyPlugin(registerPlugins[pluginName]);
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
constructor(lifecycle){
|
|
@@ -1535,7 +1535,7 @@ class FederationHost {
|
|
|
1535
1535
|
generatePreloadAssets: new AsyncHook('generatePreloadAssets'),
|
|
1536
1536
|
afterPreloadRemote: new AsyncHook()
|
|
1537
1537
|
});
|
|
1538
|
-
this.version = '0.0.
|
|
1538
|
+
this.version = '0.0.6';
|
|
1539
1539
|
this.moduleCache = new Map();
|
|
1540
1540
|
this.loaderHook = new PluginSystem({
|
|
1541
1541
|
// FIXME: may not be suitable
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -43,7 +43,7 @@ function isRemoteInfoWithEntry(remote) {
|
|
|
43
43
|
return typeof remote.entry !== 'undefined';
|
|
44
44
|
}
|
|
45
45
|
function isPureRemoteEntry(remote) {
|
|
46
|
-
return remote.entry.
|
|
46
|
+
return !remote.entry.includes('.json') && remote.entry.includes('.js');
|
|
47
47
|
}
|
|
48
48
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
49
49
|
function safeToString(info) {
|
|
@@ -168,7 +168,7 @@ function getGlobalFederationConstructor() {
|
|
|
168
168
|
function setGlobalFederationConstructor(FederationConstructor) {
|
|
169
169
|
if (isDebugMode()) {
|
|
170
170
|
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
171
|
-
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.
|
|
171
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.6';
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
package/dist/share.esm.js
CHANGED
|
@@ -41,7 +41,7 @@ function isRemoteInfoWithEntry(remote) {
|
|
|
41
41
|
return typeof remote.entry !== 'undefined';
|
|
42
42
|
}
|
|
43
43
|
function isPureRemoteEntry(remote) {
|
|
44
|
-
return remote.entry.
|
|
44
|
+
return !remote.entry.includes('.json') && remote.entry.includes('.js');
|
|
45
45
|
}
|
|
46
46
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
47
47
|
function safeToString(info) {
|
|
@@ -166,7 +166,7 @@ function getGlobalFederationConstructor() {
|
|
|
166
166
|
function setGlobalFederationConstructor(FederationConstructor) {
|
|
167
167
|
if (isDebugMode()) {
|
|
168
168
|
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
169
|
-
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.
|
|
169
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.6';
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -9,7 +9,7 @@ export declare class PluginSystem<T extends Record<string, any>> {
|
|
|
9
9
|
lifecycleKeys: Array<keyof T>;
|
|
10
10
|
registerPlugins: Record<string, Plugin<T>>;
|
|
11
11
|
constructor(lifecycle: T);
|
|
12
|
-
|
|
12
|
+
applyPlugin(plugin: Plugin<T>): void;
|
|
13
13
|
removePlugin(pluginName: string): void;
|
|
14
14
|
inherit<T extends PluginSystem<any>>({ lifecycle, registerPlugins, }: T): void;
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@module-federation/sdk": "0.0.
|
|
48
|
+
"@module-federation/sdk": "0.0.6"
|
|
49
49
|
}
|
|
50
50
|
}
|