@module-federation/runtime 0.0.0-next-20240228073832 → 0.0.0-next-20240301034824
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 +17 -1
- package/dist/index.esm.js +14 -2
- package/dist/src/core.d.ts +1 -0
- package/dist/src/index.d.ts +1 -1
- 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;
|
|
@@ -1276,6 +1275,19 @@ class FederationHost {
|
|
|
1276
1275
|
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1277
1276
|
`);
|
|
1278
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
|
+
}
|
|
1279
1291
|
async _getRemoteModuleAndOptions(id) {
|
|
1280
1292
|
const loadRemoteArgs = await this.hooks.lifecycle.beforeRequest.emit({
|
|
1281
1293
|
id,
|
|
@@ -1673,6 +1685,10 @@ Object.defineProperty(exports, 'loadScript', {
|
|
|
1673
1685
|
enumerable: true,
|
|
1674
1686
|
get: function () { return sdk.loadScript; }
|
|
1675
1687
|
});
|
|
1688
|
+
Object.defineProperty(exports, 'loadScriptNode', {
|
|
1689
|
+
enumerable: true,
|
|
1690
|
+
get: function () { return sdk.loadScriptNode; }
|
|
1691
|
+
});
|
|
1676
1692
|
exports.FederationHost = FederationHost;
|
|
1677
1693
|
exports.init = init;
|
|
1678
1694
|
exports.loadRemote = loadRemote;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, 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;
|
|
@@ -1274,6 +1273,19 @@ class FederationHost {
|
|
|
1274
1273
|
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1275
1274
|
`);
|
|
1276
1275
|
}
|
|
1276
|
+
initRawContainer(name, url, container) {
|
|
1277
|
+
const remoteInfo = getRemoteInfo({
|
|
1278
|
+
name,
|
|
1279
|
+
entry: url
|
|
1280
|
+
});
|
|
1281
|
+
const module = new Module({
|
|
1282
|
+
host: this,
|
|
1283
|
+
remoteInfo
|
|
1284
|
+
});
|
|
1285
|
+
module.remoteEntryExports = container;
|
|
1286
|
+
this.moduleCache.set(name, module);
|
|
1287
|
+
return module;
|
|
1288
|
+
}
|
|
1277
1289
|
async _getRemoteModuleAndOptions(id) {
|
|
1278
1290
|
const loadRemoteArgs = await this.hooks.lifecycle.beforeRequest.emit({
|
|
1279
1291
|
id,
|
package/dist/src/core.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ export declare class FederationHost {
|
|
|
136
136
|
initOptions(userOptions: UserOptions): Options;
|
|
137
137
|
loadShare<T>(pkgName: string, customShareInfo?: Partial<Shared>): Promise<false | (() => T | undefined)>;
|
|
138
138
|
loadShareSync<T>(pkgName: string, customShareInfo?: Partial<Shared>): () => T | never;
|
|
139
|
+
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module;
|
|
139
140
|
private _getRemoteModuleAndOptions;
|
|
140
141
|
loadRemote<T>(id: string, options?: {
|
|
141
142
|
loadFactory?: boolean;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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 { loadScript } from '@module-federation/sdk';
|
|
5
|
+
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
6
6
|
export type { Federation } from './global';
|
|
7
7
|
export type { FederationRuntimePlugin };
|
|
8
8
|
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-20240301034824",
|
|
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-20240301034824"
|
|
49
49
|
}
|
|
50
50
|
}
|