@module-federation/runtime 0.0.0-next-20240227135200 → 0.0.0-next-20240228024304
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 +22 -2
- package/dist/index.esm.js +19 -5
- package/dist/share.esm.js +1 -1
- package/dist/src/core.d.ts +3 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -136,7 +136,6 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
136
136
|
1. '${entry}' is not the correct URL, or the remoteEntry resource or name is incorrect.\n
|
|
137
137
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
138
138
|
`);
|
|
139
|
-
console.log(entryExports);
|
|
140
139
|
return entryExports;
|
|
141
140
|
}).catch((e)=>{
|
|
142
141
|
return e;
|
|
@@ -784,7 +783,9 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
784
783
|
id: assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,
|
|
785
784
|
name: remoteInfo.name,
|
|
786
785
|
remoteSnapshot: moduleInfoSnapshot,
|
|
787
|
-
preloadConfig
|
|
786
|
+
preloadConfig,
|
|
787
|
+
remote: remoteInfo,
|
|
788
|
+
origin
|
|
788
789
|
});
|
|
789
790
|
const preloaded = share.getPreloaded(exposeFullPath);
|
|
790
791
|
if (preloaded) {
|
|
@@ -1276,6 +1277,19 @@ class FederationHost {
|
|
|
1276
1277
|
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1277
1278
|
`);
|
|
1278
1279
|
}
|
|
1280
|
+
initRawContainer(name, url, container) {
|
|
1281
|
+
const remoteInfo = getRemoteInfo({
|
|
1282
|
+
name,
|
|
1283
|
+
entry: url
|
|
1284
|
+
});
|
|
1285
|
+
const module = new Module({
|
|
1286
|
+
host: this,
|
|
1287
|
+
remoteInfo
|
|
1288
|
+
});
|
|
1289
|
+
module.remoteEntryExports = container;
|
|
1290
|
+
this.moduleCache.set(name, module);
|
|
1291
|
+
return module;
|
|
1292
|
+
}
|
|
1279
1293
|
async _getRemoteModuleAndOptions(id) {
|
|
1280
1294
|
const loadRemoteArgs = await this.hooks.lifecycle.beforeRequest.emit({
|
|
1281
1295
|
id,
|
|
@@ -1673,7 +1687,13 @@ Object.defineProperty(exports, 'loadScript', {
|
|
|
1673
1687
|
enumerable: true,
|
|
1674
1688
|
get: function () { return sdk.loadScript; }
|
|
1675
1689
|
});
|
|
1690
|
+
Object.defineProperty(exports, 'loadScriptNode', {
|
|
1691
|
+
enumerable: true,
|
|
1692
|
+
get: function () { return sdk.loadScriptNode; }
|
|
1693
|
+
});
|
|
1676
1694
|
exports.FederationHost = FederationHost;
|
|
1695
|
+
exports.getRemoteEntry = getRemoteEntry;
|
|
1696
|
+
exports.getRemoteInfo = getRemoteInfo;
|
|
1677
1697
|
exports.init = init;
|
|
1678
1698
|
exports.loadRemote = loadRemote;
|
|
1679
1699
|
exports.loadShare = loadShare;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getGlobalHostPlugins,
|
|
1
|
+
import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as addGlobalSnapshot, r as setGlobalSnapshotInfoByModuleInfo, t as getGlobalSnapshot, G as Global, u as getGlobalShareScope, v as formatShareConfigs, x as isBrowserEnv, y as getBuilderId, z as addUniqueItem, A as setGlobalFederationConstructor, B as getGlobalFederationInstance, C as getGlobalFederationConstructor, E as setGlobalFederationInstance } from './share.esm.js';
|
|
2
2
|
export { F as registerGlobalPlugins } from './share.esm.js';
|
|
3
3
|
import { composeKeyWithSeparator, loadScriptNode, loadScript, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
|
|
4
|
-
export { loadScript } from '@module-federation/sdk';
|
|
4
|
+
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
5
5
|
|
|
6
6
|
// Function to match a remote with its name and expose
|
|
7
7
|
// id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
|
|
@@ -134,7 +134,6 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
134
134
|
1. '${entry}' is not the correct URL, or the remoteEntry resource or name is incorrect.\n
|
|
135
135
|
2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
|
|
136
136
|
`);
|
|
137
|
-
console.log(entryExports);
|
|
138
137
|
return entryExports;
|
|
139
138
|
}).catch((e)=>{
|
|
140
139
|
return e;
|
|
@@ -782,7 +781,9 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
782
781
|
id: assetsInfo.moduleName === '.' ? remoteInfo.name : exposeFullPath,
|
|
783
782
|
name: remoteInfo.name,
|
|
784
783
|
remoteSnapshot: moduleInfoSnapshot,
|
|
785
|
-
preloadConfig
|
|
784
|
+
preloadConfig,
|
|
785
|
+
remote: remoteInfo,
|
|
786
|
+
origin
|
|
786
787
|
});
|
|
787
788
|
const preloaded = getPreloaded(exposeFullPath);
|
|
788
789
|
if (preloaded) {
|
|
@@ -1274,6 +1275,19 @@ class FederationHost {
|
|
|
1274
1275
|
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1275
1276
|
`);
|
|
1276
1277
|
}
|
|
1278
|
+
initRawContainer(name, url, container) {
|
|
1279
|
+
const remoteInfo = getRemoteInfo({
|
|
1280
|
+
name,
|
|
1281
|
+
entry: url
|
|
1282
|
+
});
|
|
1283
|
+
const module = new Module({
|
|
1284
|
+
host: this,
|
|
1285
|
+
remoteInfo
|
|
1286
|
+
});
|
|
1287
|
+
module.remoteEntryExports = container;
|
|
1288
|
+
this.moduleCache.set(name, module);
|
|
1289
|
+
return module;
|
|
1290
|
+
}
|
|
1277
1291
|
async _getRemoteModuleAndOptions(id) {
|
|
1278
1292
|
const loadRemoteArgs = await this.hooks.lifecycle.beforeRequest.emit({
|
|
1279
1293
|
id,
|
|
@@ -1666,4 +1680,4 @@ function preloadRemote(...args) {
|
|
|
1666
1680
|
// Inject for debug
|
|
1667
1681
|
setGlobalFederationConstructor(FederationHost);
|
|
1668
1682
|
|
|
1669
|
-
export { FederationHost, init, loadRemote, loadShare, loadShareSync, preloadRemote };
|
|
1683
|
+
export { FederationHost, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote };
|
package/dist/share.esm.js
CHANGED
|
@@ -794,4 +794,4 @@ function getGlobalShareScope() {
|
|
|
794
794
|
return Global.__FEDERATION__.__SHARE__;
|
|
795
795
|
}
|
|
796
796
|
|
|
797
|
-
export { setGlobalFederationConstructor as A, getGlobalFederationInstance as B, getGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationInstance as E, registerGlobalPlugins as F, Global as G, nativeGlobal as H, resetFederationGlobalInfo as I, getTargetSnapshotInfoByModuleInfo as J,
|
|
797
|
+
export { setGlobalFederationConstructor as A, getGlobalFederationInstance as B, getGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationInstance as E, registerGlobalPlugins as F, Global as G, nativeGlobal as H, resetFederationGlobalInfo as I, getTargetSnapshotInfoByModuleInfo as J, globalLoading as a, DEFAULT_SCOPE as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, addGlobalSnapshot as q, setGlobalSnapshotInfoByModuleInfo as r, safeToString as s, getGlobalSnapshot as t, getGlobalShareScope as u, formatShareConfigs as v, warn as w, isBrowserEnv as x, getBuilderId as y, addUniqueItem as z };
|
package/dist/src/core.d.ts
CHANGED
|
@@ -67,8 +67,10 @@ export declare class FederationHost {
|
|
|
67
67
|
handlePreloadModule: SyncHook<{
|
|
68
68
|
id: string;
|
|
69
69
|
name: string;
|
|
70
|
+
remote: Remote;
|
|
70
71
|
remoteSnapshot: ModuleInfo;
|
|
71
72
|
preloadConfig: PreloadRemoteArgs;
|
|
73
|
+
origin: FederationHost;
|
|
72
74
|
}, void>;
|
|
73
75
|
errorLoadRemote: AsyncHook<[{
|
|
74
76
|
id: string;
|
|
@@ -136,6 +138,7 @@ export declare class FederationHost {
|
|
|
136
138
|
initOptions(userOptions: UserOptions): Options;
|
|
137
139
|
loadShare<T>(pkgName: string, customShareInfo?: Partial<Shared>): Promise<false | (() => T | undefined)>;
|
|
138
140
|
loadShareSync<T>(pkgName: string, customShareInfo?: Partial<Shared>): () => T | never;
|
|
141
|
+
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module;
|
|
139
142
|
private _getRemoteModuleAndOptions;
|
|
140
143
|
loadRemote<T>(id: string, options?: {
|
|
141
144
|
loadFactory?: boolean;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { FederationHost } from './core';
|
|
|
2
2
|
import { UserOptions, FederationRuntimePlugin } from './type';
|
|
3
3
|
export { FederationHost } from './core';
|
|
4
4
|
export { registerGlobalPlugins } from './global';
|
|
5
|
-
export {
|
|
5
|
+
export { getRemoteEntry, getRemoteInfo } from './utils';
|
|
6
|
+
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
6
7
|
export type { Federation } from './global';
|
|
7
8
|
export type { FederationRuntimePlugin };
|
|
8
9
|
export declare function init(options: UserOptions): FederationHost;
|
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-20240228024304",
|
|
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-20240228024304"
|
|
49
49
|
}
|
|
50
50
|
}
|