@module-federation/runtime 0.0.0-next-20240404164914 → 0.0.0-next-20240404165651
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/README.md +0 -42
- package/dist/index.cjs.js +2 -8
- package/dist/index.esm.js +3 -8
- package/dist/src/core.d.ts +1 -1
- package/dist/src/index.d.ts +0 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -325,48 +325,6 @@ registerRemotes([
|
|
|
325
325
|
]);
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
### registerPlugins
|
|
329
|
-
|
|
330
|
-
- Type: `registerPlugins(plugins: Array<FederationRuntimePlugin>): void`
|
|
331
|
-
- Used to register remotes after init .
|
|
332
|
-
|
|
333
|
-
- Type
|
|
334
|
-
|
|
335
|
-
```typescript
|
|
336
|
-
import type { FederationRuntimePlugin } from '@module-federation/runtime';
|
|
337
|
-
|
|
338
|
-
function registerPlugins(plugins: Array<FederationRuntimePlugin>) {}
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
- Details:
|
|
342
|
-
Allows plugins to be registered dynamically or lazily. Lazy plugins will be called after normal runtime plugins.
|
|
343
|
-
Similar function as registerRemote, but for runtime plugins.
|
|
344
|
-
* Example
|
|
345
|
-
|
|
346
|
-
```ts
|
|
347
|
-
import { init, registerPlugins } from '@module-federation/runtime';
|
|
348
|
-
|
|
349
|
-
init({
|
|
350
|
-
name: '@demo/register-new-remotes',
|
|
351
|
-
remotes: [
|
|
352
|
-
{
|
|
353
|
-
name: '@demo/sub1',
|
|
354
|
-
entry: 'http://localhost:2001/mf-manifest.json',
|
|
355
|
-
}
|
|
356
|
-
],
|
|
357
|
-
plugins: [
|
|
358
|
-
//normal/eager runtime plugins
|
|
359
|
-
]
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
import('./runtime-plugin').then(plugin => {
|
|
363
|
-
registerPlugins([
|
|
364
|
-
//more plugins loaded lazyily or dynamically
|
|
365
|
-
plugin
|
|
366
|
-
]);
|
|
367
|
-
})
|
|
368
|
-
```
|
|
369
|
-
|
|
370
328
|
## hooks
|
|
371
329
|
|
|
372
330
|
Lifecycle hooks for FederationHost interaction.
|
package/dist/index.cjs.js
CHANGED
|
@@ -69,7 +69,7 @@ function matchRemote(remotes, nameOrAlias) {
|
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
function registerPlugins
|
|
72
|
+
function registerPlugins(plugins, hookInstances) {
|
|
73
73
|
const globalPlugins = share.getGlobalHostPlugins();
|
|
74
74
|
// Incorporate global plugins
|
|
75
75
|
if (globalPlugins.length > 0) {
|
|
@@ -1527,7 +1527,7 @@ class FederationHost {
|
|
|
1527
1527
|
return optionsRes;
|
|
1528
1528
|
}
|
|
1529
1529
|
registerPlugins(plugins) {
|
|
1530
|
-
registerPlugins
|
|
1530
|
+
registerPlugins(plugins, [
|
|
1531
1531
|
this.hooks,
|
|
1532
1532
|
this.snapshotHandler.hooks,
|
|
1533
1533
|
this.loaderHook
|
|
@@ -1738,11 +1738,6 @@ function registerRemotes(...args) {
|
|
|
1738
1738
|
// eslint-disable-next-line prefer-spread
|
|
1739
1739
|
return FederationInstance.registerRemotes.apply(FederationInstance, args);
|
|
1740
1740
|
}
|
|
1741
|
-
function registerPlugins(...args) {
|
|
1742
|
-
share.assert(FederationInstance, 'Please call init first');
|
|
1743
|
-
// eslint-disable-next-line prefer-spread
|
|
1744
|
-
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
1745
|
-
}
|
|
1746
1741
|
// Inject for debug
|
|
1747
1742
|
share.setGlobalFederationConstructor(FederationHost);
|
|
1748
1743
|
|
|
@@ -1763,5 +1758,4 @@ exports.loadRemote = loadRemote;
|
|
|
1763
1758
|
exports.loadShare = loadShare;
|
|
1764
1759
|
exports.loadShareSync = loadShareSync;
|
|
1765
1760
|
exports.preloadRemote = preloadRemote;
|
|
1766
|
-
exports.registerPlugins = registerPlugins;
|
|
1767
1761
|
exports.registerRemotes = registerRemotes;
|
package/dist/index.esm.js
CHANGED
|
@@ -67,7 +67,7 @@ function matchRemote(remotes, nameOrAlias) {
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
function registerPlugins
|
|
70
|
+
function registerPlugins(plugins, hookInstances) {
|
|
71
71
|
const globalPlugins = getGlobalHostPlugins();
|
|
72
72
|
// Incorporate global plugins
|
|
73
73
|
if (globalPlugins.length > 0) {
|
|
@@ -1525,7 +1525,7 @@ class FederationHost {
|
|
|
1525
1525
|
return optionsRes;
|
|
1526
1526
|
}
|
|
1527
1527
|
registerPlugins(plugins) {
|
|
1528
|
-
registerPlugins
|
|
1528
|
+
registerPlugins(plugins, [
|
|
1529
1529
|
this.hooks,
|
|
1530
1530
|
this.snapshotHandler.hooks,
|
|
1531
1531
|
this.loaderHook
|
|
@@ -1736,12 +1736,7 @@ function registerRemotes(...args) {
|
|
|
1736
1736
|
// eslint-disable-next-line prefer-spread
|
|
1737
1737
|
return FederationInstance.registerRemotes.apply(FederationInstance, args);
|
|
1738
1738
|
}
|
|
1739
|
-
function registerPlugins(...args) {
|
|
1740
|
-
assert(FederationInstance, 'Please call init first');
|
|
1741
|
-
// eslint-disable-next-line prefer-spread
|
|
1742
|
-
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
1743
|
-
}
|
|
1744
1739
|
// Inject for debug
|
|
1745
1740
|
setGlobalFederationConstructor(FederationHost);
|
|
1746
1741
|
|
|
1747
|
-
export { FederationHost, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote,
|
|
1742
|
+
export { FederationHost, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes };
|
package/dist/src/core.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export declare class FederationHost {
|
|
|
153
153
|
initializeSharing(shareScopeName?: string, strategy?: Shared['strategy']): Array<Promise<void>>;
|
|
154
154
|
initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string]): void;
|
|
155
155
|
private formatOptions;
|
|
156
|
-
registerPlugins
|
|
156
|
+
private registerPlugins;
|
|
157
157
|
private setShared;
|
|
158
158
|
private removeRemote;
|
|
159
159
|
private registerRemote;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,4 +12,3 @@ export declare function loadShare(...args: Parameters<FederationHost['loadShare'
|
|
|
12
12
|
export declare function loadShareSync(...args: Parameters<FederationHost['loadShareSync']>): ReturnType<FederationHost['loadShareSync']>;
|
|
13
13
|
export declare function preloadRemote(...args: Parameters<FederationHost['preloadRemote']>): ReturnType<FederationHost['preloadRemote']>;
|
|
14
14
|
export declare function registerRemotes(...args: Parameters<FederationHost['registerRemotes']>): ReturnType<FederationHost['registerRemotes']>;
|
|
15
|
-
export declare function registerPlugins(...args: Parameters<FederationHost['registerPlugins']>): ReturnType<FederationHost['registerRemotes']>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240404165651",
|
|
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.0-next-
|
|
48
|
+
"@module-federation/sdk": "0.0.0-next-20240404165651"
|
|
49
49
|
}
|
|
50
50
|
}
|