@module-federation/runtime 0.6.14 → 0.6.16
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/helpers.cjs.js +0 -2
- package/dist/helpers.esm.js +0 -2
- package/dist/index.cjs.js +50 -45
- package/dist/index.esm.js +51 -46
- package/dist/package.json +3 -2
- package/dist/share.cjs.js +1 -1
- package/dist/share.esm.js +2 -2
- package/dist/src/core.d.ts +6 -0
- package/dist/src/embedded.d.ts +5 -0
- package/dist/src/shared/index.d.ts +1 -0
- package/package.json +3 -2
package/dist/helpers.cjs.js
CHANGED
package/dist/helpers.esm.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { g as getRegisteredShare, a as getGlobalShareScope, G as Global, n as nativeGlobal, r as resetFederationGlobalInfo, b as getGlobalFederationInstance, s as setGlobalFederationInstance, c as getGlobalFederationConstructor, d as setGlobalFederationConstructor, e as getInfoWithoutType, f as getGlobalSnapshot, h as getTargetSnapshotInfoByModuleInfo, i as getGlobalSnapshotInfoByModuleInfo, j as setGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, l as getRemoteEntryExports, m as registerGlobalPlugins, o as getGlobalHostPlugins, p as getPreloaded, q as setPreloaded } from './share.esm.js';
|
|
2
|
-
import './polyfills.esm.js';
|
|
3
|
-
import '@module-federation/sdk';
|
|
4
2
|
|
|
5
3
|
const ShareUtils = {
|
|
6
4
|
getRegisteredShare,
|
package/dist/index.cjs.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var polyfills = require('./polyfills.cjs.js');
|
|
4
4
|
var sdk = require('@module-federation/sdk');
|
|
5
5
|
var share = require('./share.cjs.js');
|
|
6
|
+
var errorCodes = require('@module-federation/error-codes');
|
|
6
7
|
|
|
7
8
|
// Function to match a remote with its name and expose
|
|
8
9
|
// id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
|
|
@@ -146,12 +147,11 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
146
147
|
}
|
|
147
148
|
}).then(()=>{
|
|
148
149
|
const { remoteEntryKey, entryExports } = share.getRemoteEntryExports(name, globalName);
|
|
149
|
-
share.assert(entryExports,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`);
|
|
150
|
+
share.assert(entryExports, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_001, errorCodes.runtimeDescMap, {
|
|
151
|
+
remoteName: name,
|
|
152
|
+
remoteEntryUrl: entry,
|
|
153
|
+
remoteEntryKey
|
|
154
|
+
}));
|
|
155
155
|
return entryExports;
|
|
156
156
|
}).catch((e)=>{
|
|
157
157
|
throw e;
|
|
@@ -205,12 +205,11 @@ async function loadEntryNode({ remoteInfo, createScriptHook }) {
|
|
|
205
205
|
}
|
|
206
206
|
}).then(()=>{
|
|
207
207
|
const { remoteEntryKey, entryExports } = share.getRemoteEntryExports(name, globalName);
|
|
208
|
-
share.assert(entryExports,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
`);
|
|
208
|
+
share.assert(entryExports, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_001, errorCodes.runtimeDescMap, {
|
|
209
|
+
remoteName: name,
|
|
210
|
+
remoteEntryUrl: entry,
|
|
211
|
+
remoteEntryKey
|
|
212
|
+
}));
|
|
214
213
|
return entryExports;
|
|
215
214
|
}).catch((e)=>{
|
|
216
215
|
throw e;
|
|
@@ -305,7 +304,11 @@ let Module = class Module {
|
|
|
305
304
|
origin: this.host
|
|
306
305
|
});
|
|
307
306
|
if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
|
|
308
|
-
share.
|
|
307
|
+
share.error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_002, errorCodes.runtimeDescMap, {
|
|
308
|
+
remoteName: name,
|
|
309
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
310
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
311
|
+
}));
|
|
309
312
|
}
|
|
310
313
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
311
314
|
await this.host.hooks.lifecycle.initContainer.emit(polyfills._extends({}, initContainerOptions, {
|
|
@@ -316,8 +319,16 @@ let Module = class Module {
|
|
|
316
319
|
}
|
|
317
320
|
this.lib = remoteEntryExports;
|
|
318
321
|
this.inited = true;
|
|
322
|
+
let moduleFactory;
|
|
323
|
+
moduleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
324
|
+
remoteEntryExports,
|
|
325
|
+
expose,
|
|
326
|
+
moduleInfo: this.remoteInfo
|
|
327
|
+
});
|
|
319
328
|
// get exposeGetter
|
|
320
|
-
|
|
329
|
+
if (!moduleFactory) {
|
|
330
|
+
moduleFactory = await remoteEntryExports.get(expose);
|
|
331
|
+
}
|
|
321
332
|
share.assert(moduleFactory, `${share.getFMId(this.remoteInfo)} remote don't export ${expose}.`);
|
|
322
333
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
|
|
323
334
|
if (!loadFactory) {
|
|
@@ -1101,12 +1112,11 @@ class SnapshotHandler {
|
|
|
1101
1112
|
globalSnapshot: globalSnapshotRes
|
|
1102
1113
|
};
|
|
1103
1114
|
} else {
|
|
1104
|
-
share.error(
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
`);
|
|
1115
|
+
share.error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_007, errorCodes.runtimeDescMap, {
|
|
1116
|
+
hostName: moduleInfo.name,
|
|
1117
|
+
hostVersion: moduleInfo.version,
|
|
1118
|
+
globalSnapshot: JSON.stringify(globalSnapshotRes)
|
|
1119
|
+
}));
|
|
1110
1120
|
}
|
|
1111
1121
|
}
|
|
1112
1122
|
}
|
|
@@ -1130,9 +1140,10 @@ class SnapshotHandler {
|
|
|
1130
1140
|
return manifestJson;
|
|
1131
1141
|
} catch (err) {
|
|
1132
1142
|
delete this.manifestLoading[manifestUrl];
|
|
1133
|
-
share.error(
|
|
1134
|
-
|
|
1135
|
-
|
|
1143
|
+
share.error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_003, errorCodes.runtimeDescMap, {
|
|
1144
|
+
manifestUrl,
|
|
1145
|
+
moduleName: moduleInfo.name
|
|
1146
|
+
}, `${err}`));
|
|
1136
1147
|
}
|
|
1137
1148
|
};
|
|
1138
1149
|
const asyncLoadProcess = async ()=>{
|
|
@@ -1435,12 +1446,11 @@ class SharedHandler {
|
|
|
1435
1446
|
if (shareInfo.get) {
|
|
1436
1447
|
const module = shareInfo.get();
|
|
1437
1448
|
if (module instanceof Promise) {
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
`);
|
|
1449
|
+
const errorCode = (extraOptions == null ? void 0 : extraOptions.from) === 'build' ? errorCodes.RUNTIME_005 : errorCodes.RUNTIME_006;
|
|
1450
|
+
throw new Error(errorCodes.getShortErrorMsg(errorCode, errorCodes.runtimeDescMap, {
|
|
1451
|
+
hostName: host.options.name,
|
|
1452
|
+
sharedPkgName: pkgName
|
|
1453
|
+
}));
|
|
1444
1454
|
}
|
|
1445
1455
|
shareInfo.lib = module;
|
|
1446
1456
|
this.setShared({
|
|
@@ -1452,12 +1462,10 @@ class SharedHandler {
|
|
|
1452
1462
|
});
|
|
1453
1463
|
return shareInfo.lib;
|
|
1454
1464
|
}
|
|
1455
|
-
throw new Error(
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1460
|
-
`);
|
|
1465
|
+
throw new Error(errorCodes.getShortErrorMsg(errorCodes.RUNTIME_006, errorCodes.runtimeDescMap, {
|
|
1466
|
+
hostName: host.options.name,
|
|
1467
|
+
sharedPkgName: pkgName
|
|
1468
|
+
}));
|
|
1461
1469
|
}
|
|
1462
1470
|
initShareScopeMap(scopeName, shareScope, extraOptions = {}) {
|
|
1463
1471
|
const { host } = this;
|
|
@@ -1677,14 +1685,10 @@ class RemoteHandler {
|
|
|
1677
1685
|
}
|
|
1678
1686
|
const { id: idRes } = loadRemoteArgs;
|
|
1679
1687
|
const remoteSplitInfo = matchRemoteWithNameAndExpose(host.options.remotes, idRes);
|
|
1680
|
-
share.assert(remoteSplitInfo,
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
3. ${idRes} is not online, injected, or loaded.
|
|
1685
|
-
4. ${idRes} cannot be accessed on the expected.
|
|
1686
|
-
5. The 'beforeRequest' hook was provided but did not return the correct 'remoteInfo' when attempting to load ${idRes}.
|
|
1687
|
-
`);
|
|
1688
|
+
share.assert(remoteSplitInfo, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_004, errorCodes.runtimeDescMap, {
|
|
1689
|
+
hostName: host.options.name,
|
|
1690
|
+
requestId: idRes
|
|
1691
|
+
}));
|
|
1688
1692
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
1689
1693
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
1690
1694
|
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(polyfills._extends({
|
|
@@ -1992,7 +1996,7 @@ class FederationHost {
|
|
|
1992
1996
|
// maybe will change, temporarily for internal use only
|
|
1993
1997
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
1998
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
1999
|
+
this.version = "0.6.16";
|
|
1996
2000
|
this.moduleCache = new Map();
|
|
1997
2001
|
this.loaderHook = new PluginSystem({
|
|
1998
2002
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2000,7 +2004,8 @@ class FederationHost {
|
|
|
2000
2004
|
createScript: new SyncHook(),
|
|
2001
2005
|
createLink: new SyncHook(),
|
|
2002
2006
|
// only work for manifest , so not open to the public yet
|
|
2003
|
-
fetch: new AsyncHook()
|
|
2007
|
+
fetch: new AsyncHook(),
|
|
2008
|
+
getModuleFactory: new AsyncHook()
|
|
2004
2009
|
});
|
|
2005
2010
|
// TODO: Validate the details of the options
|
|
2006
2011
|
// Initialize options with default values
|
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.js';
|
|
2
2
|
import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
|
|
3
3
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
4
|
-
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as
|
|
4
|
+
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as logger, L as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.js';
|
|
5
5
|
export { m as registerGlobalPlugins } from './share.esm.js';
|
|
6
|
+
import { getShortErrorMsg, RUNTIME_001, runtimeDescMap, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
|
|
6
7
|
|
|
7
8
|
// Function to match a remote with its name and expose
|
|
8
9
|
// id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
|
|
@@ -146,12 +147,11 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
146
147
|
}
|
|
147
148
|
}).then(()=>{
|
|
148
149
|
const { remoteEntryKey, entryExports } = getRemoteEntryExports(name, globalName);
|
|
149
|
-
assert(entryExports,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`);
|
|
150
|
+
assert(entryExports, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
|
|
151
|
+
remoteName: name,
|
|
152
|
+
remoteEntryUrl: entry,
|
|
153
|
+
remoteEntryKey
|
|
154
|
+
}));
|
|
155
155
|
return entryExports;
|
|
156
156
|
}).catch((e)=>{
|
|
157
157
|
throw e;
|
|
@@ -205,12 +205,11 @@ async function loadEntryNode({ remoteInfo, createScriptHook }) {
|
|
|
205
205
|
}
|
|
206
206
|
}).then(()=>{
|
|
207
207
|
const { remoteEntryKey, entryExports } = getRemoteEntryExports(name, globalName);
|
|
208
|
-
assert(entryExports,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
`);
|
|
208
|
+
assert(entryExports, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
|
|
209
|
+
remoteName: name,
|
|
210
|
+
remoteEntryUrl: entry,
|
|
211
|
+
remoteEntryKey
|
|
212
|
+
}));
|
|
214
213
|
return entryExports;
|
|
215
214
|
}).catch((e)=>{
|
|
216
215
|
throw e;
|
|
@@ -305,7 +304,11 @@ let Module = class Module {
|
|
|
305
304
|
origin: this.host
|
|
306
305
|
});
|
|
307
306
|
if (typeof (remoteEntryExports == null ? void 0 : remoteEntryExports.init) === 'undefined') {
|
|
308
|
-
|
|
307
|
+
error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
|
|
308
|
+
remoteName: name,
|
|
309
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
310
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
311
|
+
}));
|
|
309
312
|
}
|
|
310
313
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
311
314
|
await this.host.hooks.lifecycle.initContainer.emit(_extends({}, initContainerOptions, {
|
|
@@ -316,8 +319,16 @@ let Module = class Module {
|
|
|
316
319
|
}
|
|
317
320
|
this.lib = remoteEntryExports;
|
|
318
321
|
this.inited = true;
|
|
322
|
+
let moduleFactory;
|
|
323
|
+
moduleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
324
|
+
remoteEntryExports,
|
|
325
|
+
expose,
|
|
326
|
+
moduleInfo: this.remoteInfo
|
|
327
|
+
});
|
|
319
328
|
// get exposeGetter
|
|
320
|
-
|
|
329
|
+
if (!moduleFactory) {
|
|
330
|
+
moduleFactory = await remoteEntryExports.get(expose);
|
|
331
|
+
}
|
|
321
332
|
assert(moduleFactory, `${getFMId(this.remoteInfo)} remote don't export ${expose}.`);
|
|
322
333
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, id);
|
|
323
334
|
if (!loadFactory) {
|
|
@@ -1101,12 +1112,11 @@ class SnapshotHandler {
|
|
|
1101
1112
|
globalSnapshot: globalSnapshotRes
|
|
1102
1113
|
};
|
|
1103
1114
|
} else {
|
|
1104
|
-
error(
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
`);
|
|
1115
|
+
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1116
|
+
hostName: moduleInfo.name,
|
|
1117
|
+
hostVersion: moduleInfo.version,
|
|
1118
|
+
globalSnapshot: JSON.stringify(globalSnapshotRes)
|
|
1119
|
+
}));
|
|
1110
1120
|
}
|
|
1111
1121
|
}
|
|
1112
1122
|
}
|
|
@@ -1130,9 +1140,10 @@ class SnapshotHandler {
|
|
|
1130
1140
|
return manifestJson;
|
|
1131
1141
|
} catch (err) {
|
|
1132
1142
|
delete this.manifestLoading[manifestUrl];
|
|
1133
|
-
error(
|
|
1134
|
-
|
|
1135
|
-
|
|
1143
|
+
error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
|
|
1144
|
+
manifestUrl,
|
|
1145
|
+
moduleName: moduleInfo.name
|
|
1146
|
+
}, `${err}`));
|
|
1136
1147
|
}
|
|
1137
1148
|
};
|
|
1138
1149
|
const asyncLoadProcess = async ()=>{
|
|
@@ -1435,12 +1446,11 @@ class SharedHandler {
|
|
|
1435
1446
|
if (shareInfo.get) {
|
|
1436
1447
|
const module = shareInfo.get();
|
|
1437
1448
|
if (module instanceof Promise) {
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
`);
|
|
1449
|
+
const errorCode = (extraOptions == null ? void 0 : extraOptions.from) === 'build' ? RUNTIME_005 : RUNTIME_006;
|
|
1450
|
+
throw new Error(getShortErrorMsg(errorCode, runtimeDescMap, {
|
|
1451
|
+
hostName: host.options.name,
|
|
1452
|
+
sharedPkgName: pkgName
|
|
1453
|
+
}));
|
|
1444
1454
|
}
|
|
1445
1455
|
shareInfo.lib = module;
|
|
1446
1456
|
this.setShared({
|
|
@@ -1452,12 +1462,10 @@ class SharedHandler {
|
|
|
1452
1462
|
});
|
|
1453
1463
|
return shareInfo.lib;
|
|
1454
1464
|
}
|
|
1455
|
-
throw new Error(
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
2. The ${pkgName} share was not registered with the 'lib' attribute.\n
|
|
1460
|
-
`);
|
|
1465
|
+
throw new Error(getShortErrorMsg(RUNTIME_006, runtimeDescMap, {
|
|
1466
|
+
hostName: host.options.name,
|
|
1467
|
+
sharedPkgName: pkgName
|
|
1468
|
+
}));
|
|
1461
1469
|
}
|
|
1462
1470
|
initShareScopeMap(scopeName, shareScope, extraOptions = {}) {
|
|
1463
1471
|
const { host } = this;
|
|
@@ -1677,14 +1685,10 @@ class RemoteHandler {
|
|
|
1677
1685
|
}
|
|
1678
1686
|
const { id: idRes } = loadRemoteArgs;
|
|
1679
1687
|
const remoteSplitInfo = matchRemoteWithNameAndExpose(host.options.remotes, idRes);
|
|
1680
|
-
assert(remoteSplitInfo,
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
3. ${idRes} is not online, injected, or loaded.
|
|
1685
|
-
4. ${idRes} cannot be accessed on the expected.
|
|
1686
|
-
5. The 'beforeRequest' hook was provided but did not return the correct 'remoteInfo' when attempting to load ${idRes}.
|
|
1687
|
-
`);
|
|
1688
|
+
assert(remoteSplitInfo, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
|
|
1689
|
+
hostName: host.options.name,
|
|
1690
|
+
requestId: idRes
|
|
1691
|
+
}));
|
|
1688
1692
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
1689
1693
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
1690
1694
|
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends({
|
|
@@ -1992,7 +1996,7 @@ class FederationHost {
|
|
|
1992
1996
|
// maybe will change, temporarily for internal use only
|
|
1993
1997
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1994
1998
|
});
|
|
1995
|
-
this.version = "0.6.
|
|
1999
|
+
this.version = "0.6.16";
|
|
1996
2000
|
this.moduleCache = new Map();
|
|
1997
2001
|
this.loaderHook = new PluginSystem({
|
|
1998
2002
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2000,7 +2004,8 @@ class FederationHost {
|
|
|
2000
2004
|
createScript: new SyncHook(),
|
|
2001
2005
|
createLink: new SyncHook(),
|
|
2002
2006
|
// only work for manifest , so not open to the public yet
|
|
2003
|
-
fetch: new AsyncHook()
|
|
2007
|
+
fetch: new AsyncHook(),
|
|
2008
|
+
getModuleFactory: new AsyncHook()
|
|
2004
2009
|
});
|
|
2005
2010
|
// TODO: Validate the details of the options
|
|
2006
2011
|
// Initialize options with default values
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.16",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "workspace:*"
|
|
53
|
+
"@module-federation/sdk": "workspace:*",
|
|
54
|
+
"@module-federation/error-codes": "workspace:*"
|
|
54
55
|
}
|
|
55
56
|
}
|
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.16";
|
|
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.16";
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -867,4 +867,4 @@ function getTargetSharedOptions(options) {
|
|
|
867
867
|
return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
-
export {
|
|
870
|
+
export { isPlainObject as A, isRemoteInfoWithEntry as B, isPureRemoteEntry as C, DEFAULT_REMOTE_TYPE as D, getRemoteEntryInfoFromSnapshot as E, arrayOptions as F, Global as G, formatShareConfigs as H, getTargetSharedOptions as I, addUniqueItem as J, logger as K, getBuilderId as L, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, error as w, getFMId as x, isObject as y, warn as z };
|
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;
|
|
@@ -69,6 +74,7 @@ export declare class FederationHost {
|
|
|
69
74
|
}): Promise<false | (() => T | undefined)>;
|
|
70
75
|
loadShareSync<T>(pkgName: string, extraOptions?: {
|
|
71
76
|
customShareInfo?: Partial<Shared>;
|
|
77
|
+
from?: 'build' | 'runtime';
|
|
72
78
|
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
73
79
|
}): () => T | never;
|
|
74
80
|
initializeSharing(shareScopeName?: string, extraOptions?: {
|
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)>;
|
|
@@ -54,6 +54,7 @@ export declare class SharedHandler {
|
|
|
54
54
|
strategy?: ShareStrategy;
|
|
55
55
|
}): Array<Promise<void>>;
|
|
56
56
|
loadShareSync<T>(pkgName: string, extraOptions?: {
|
|
57
|
+
from?: 'build' | 'runtime';
|
|
57
58
|
customShareInfo?: Partial<Shared>;
|
|
58
59
|
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
|
|
59
60
|
}): () => T | never;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.16",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.6.
|
|
53
|
+
"@module-federation/sdk": "0.6.16",
|
|
54
|
+
"@module-federation/error-codes": "0.6.14"
|
|
54
55
|
}
|
|
55
56
|
}
|