@module-federation/runtime 1.1.0-canary.1 → 2.0.0
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 +13 -0
- package/dist/LICENSE +21 -0
- package/dist/core.cjs.cjs +33 -0
- package/dist/core.cjs.cjs.map +1 -0
- package/dist/core.cjs.d.ts +2 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.esm.js +4 -0
- package/dist/core.esm.js.map +1 -0
- package/dist/helpers.cjs.cjs +15 -0
- package/dist/helpers.cjs.cjs.map +1 -0
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.esm.js +13 -0
- package/dist/helpers.esm.js.map +1 -0
- package/dist/index.cjs.cjs +95 -0
- package/dist/index.cjs.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +78 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/src/core.d.ts +3 -0
- package/dist/src/helpers.d.ts +11 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/types.d.ts +1 -0
- package/dist/src/utils.d.ts +3 -0
- package/dist/types.cjs.cjs +17 -0
- package/dist/types.cjs.cjs.map +1 -0
- package/dist/types.cjs.d.ts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.esm.js +2 -0
- package/dist/types.esm.js.map +1 -0
- package/dist/utils.cjs.cjs +34 -0
- package/dist/utils.cjs.cjs.map +1 -0
- package/dist/utils.esm.js +32 -0
- package/dist/utils.esm.js.map +1 -0
- package/package.json +62 -16
- package/helpers.cjs.js +0 -33
- package/helpers.esm.js +0 -31
- package/index.cjs.js +0 -1619
- package/index.esm.js +0 -1610
- package/share.cjs.js +0 -771
- package/share.esm.js +0 -734
- package/src/constant.d.ts +0 -2
- package/src/core.d.ts +0 -121
- package/src/global.d.ts +0 -57
- package/src/helpers.d.ts +0 -32
- package/src/index.d.ts +0 -10
- package/src/module/index.d.ts +0 -25
- package/src/plugins/generate-preload-assets.d.ts +0 -8
- package/src/plugins/snapshot/SnapshotHandler.d.ts +0 -44
- package/src/plugins/snapshot/index.d.ts +0 -5
- package/src/type/config.d.ts +0 -94
- package/src/type/index.d.ts +0 -3
- package/src/type/plugin.d.ts +0 -20
- package/src/type/preload.d.ts +0 -26
- package/src/types.d.ts +0 -1
- package/src/utils/env.d.ts +0 -4
- package/src/utils/hooks/asyncHook.d.ts +0 -6
- package/src/utils/hooks/asyncWaterfallHooks.d.ts +0 -10
- package/src/utils/hooks/index.d.ts +0 -6
- package/src/utils/hooks/pluginSystem.d.ts +0 -15
- package/src/utils/hooks/syncHook.d.ts +0 -12
- package/src/utils/hooks/syncWaterfallHook.d.ts +0 -9
- package/src/utils/index.d.ts +0 -5
- package/src/utils/load.d.ts +0 -17
- package/src/utils/logger.d.ts +0 -3
- package/src/utils/manifest.d.ts +0 -7
- package/src/utils/plugin.d.ts +0 -4
- package/src/utils/preload.d.ts +0 -6
- package/src/utils/semver/compare.d.ts +0 -9
- package/src/utils/semver/constants.d.ts +0 -10
- package/src/utils/semver/index.d.ts +0 -2
- package/src/utils/semver/parser.d.ts +0 -9
- package/src/utils/semver/utils.d.ts +0 -11
- package/src/utils/share.d.ts +0 -7
- package/src/utils/tool.d.ts +0 -12
- package/type.cjs.d.ts +0 -1
- package/type.cjs.js +0 -2
- package/type.esm.js +0 -1
- /package/{helpers.cjs.d.ts → dist/helpers.cjs.d.ts} +0 -0
- /package/{index.cjs.d.ts → dist/index.cjs.d.ts} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @module-federation/runtime
|
|
2
|
+
|
|
3
|
+
- Can be combined with the build plug-in to share basic dependencies according to policies to reduce the number of module downloads and improve the loading speed of modules.
|
|
4
|
+
- Only consume part of the export of the remote module and will not fully download the remote module
|
|
5
|
+
- The runtime calling process can be extended through the module-runtime plug-in mechanism
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
See [https://module-federation.io/guide/basic/runtime/runtime.html](https://module-federation.io/guide/basic/runtime/runtime.html) for details.
|
|
10
|
+
|
|
11
|
+
## License
|
|
12
|
+
|
|
13
|
+
`@module-federation/runtime` is [MIT licensed](https://github.com/module-federation/core/blob/main/packages/runtime/LICENSE).
|
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present zhouxiao(zhoushaw)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var runtimeCore = require('@module-federation/runtime-core');
|
|
6
|
+
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
for (var k in e) {
|
|
11
|
+
n[k] = e[k];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
n.default = e;
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var runtimeCore__namespace = /*#__PURE__*/_interopNamespaceDefault(runtimeCore);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.default = runtimeCore__namespace;
|
|
23
|
+
Object.prototype.hasOwnProperty.call(runtimeCore, '__proto__') &&
|
|
24
|
+
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
25
|
+
Object.defineProperty(exports, '__proto__', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
value: runtimeCore['__proto__']
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
Object.keys(runtimeCore).forEach(function (k) {
|
|
31
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = runtimeCore[k];
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=core.cjs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.cjs.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/core.d.ts
ADDED
package/dist/core.esm.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var runtimeCore = require('@module-federation/runtime-core');
|
|
4
|
+
var utils = require('./utils.cjs.cjs');
|
|
5
|
+
|
|
6
|
+
var helpers = {
|
|
7
|
+
...runtimeCore.helpers,
|
|
8
|
+
global: {
|
|
9
|
+
...runtimeCore.helpers.global,
|
|
10
|
+
getGlobalFederationInstance: utils.getGlobalFederationInstance,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = helpers;
|
|
15
|
+
//# sourceMappingURL=helpers.cjs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.cjs.cjs","sources":["../src/helpers.ts"],"sourcesContent":[null],"names":["helpers","getGlobalFederationInstance"],"mappings":";;;;;AAQA,cAAe;AACb,IAAA,GAAGA,mBAAO;AACV,IAAA,MAAM,EAAE;QACN,GAAGA,mBAAO,CAAC,MAAM;qCACjBC,iCAA2B;AAC5B,KAAA;CAOF;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { helpers as helpers$1 } from '@module-federation/runtime-core';
|
|
2
|
+
import { g as getGlobalFederationInstance } from './utils.esm.js';
|
|
3
|
+
|
|
4
|
+
var helpers = {
|
|
5
|
+
...helpers$1,
|
|
6
|
+
global: {
|
|
7
|
+
...helpers$1.global,
|
|
8
|
+
getGlobalFederationInstance,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { helpers as default };
|
|
13
|
+
//# sourceMappingURL=helpers.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.esm.js","sources":["../src/helpers.ts"],"sourcesContent":[null],"names":["helpers"],"mappings":";;;AAQA,cAAe;AACb,IAAA,GAAGA,SAAO;AACV,IAAA,MAAM,EAAE;QACN,GAAGA,SAAO,CAAC,MAAM;QACjB,2BAA2B;AAC5B,KAAA;CAOF;;;;"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var runtimeCore = require('@module-federation/runtime-core');
|
|
4
|
+
var errorCodes = require('@module-federation/error-codes');
|
|
5
|
+
var utils = require('./utils.cjs.cjs');
|
|
6
|
+
|
|
7
|
+
function createInstance(options) {
|
|
8
|
+
// Retrieve debug constructor
|
|
9
|
+
const ModuleFederationConstructor = runtimeCore.getGlobalFederationConstructor() || runtimeCore.ModuleFederation;
|
|
10
|
+
const instance = new ModuleFederationConstructor(options);
|
|
11
|
+
runtimeCore.setGlobalFederationInstance(instance);
|
|
12
|
+
return instance;
|
|
13
|
+
}
|
|
14
|
+
let FederationInstance = null;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use createInstance or getInstance instead
|
|
17
|
+
*/
|
|
18
|
+
function init(options) {
|
|
19
|
+
// Retrieve the same instance with the same name
|
|
20
|
+
const instance = utils.getGlobalFederationInstance(options.name, options.version);
|
|
21
|
+
if (!instance) {
|
|
22
|
+
FederationInstance = createInstance(options);
|
|
23
|
+
return FederationInstance;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// Merge options
|
|
27
|
+
instance.initOptions(options);
|
|
28
|
+
if (!FederationInstance) {
|
|
29
|
+
FederationInstance = instance;
|
|
30
|
+
}
|
|
31
|
+
return instance;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function loadRemote(...args) {
|
|
35
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
36
|
+
const loadRemote = FederationInstance.loadRemote;
|
|
37
|
+
// eslint-disable-next-line prefer-spread
|
|
38
|
+
return loadRemote.apply(FederationInstance, args);
|
|
39
|
+
}
|
|
40
|
+
function loadShare(...args) {
|
|
41
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
42
|
+
// eslint-disable-next-line prefer-spread
|
|
43
|
+
const loadShare = FederationInstance.loadShare;
|
|
44
|
+
return loadShare.apply(FederationInstance, args);
|
|
45
|
+
}
|
|
46
|
+
function loadShareSync(...args) {
|
|
47
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
48
|
+
const loadShareSync = FederationInstance.loadShareSync;
|
|
49
|
+
// eslint-disable-next-line prefer-spread
|
|
50
|
+
return loadShareSync.apply(FederationInstance, args);
|
|
51
|
+
}
|
|
52
|
+
function preloadRemote(...args) {
|
|
53
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
54
|
+
// eslint-disable-next-line prefer-spread
|
|
55
|
+
return FederationInstance.preloadRemote.apply(FederationInstance, args);
|
|
56
|
+
}
|
|
57
|
+
function registerRemotes(...args) {
|
|
58
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
59
|
+
// eslint-disable-next-line prefer-spread
|
|
60
|
+
return FederationInstance.registerRemotes.apply(FederationInstance, args);
|
|
61
|
+
}
|
|
62
|
+
function registerPlugins(...args) {
|
|
63
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
64
|
+
// eslint-disable-next-line prefer-spread
|
|
65
|
+
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
66
|
+
}
|
|
67
|
+
function getInstance() {
|
|
68
|
+
return FederationInstance;
|
|
69
|
+
}
|
|
70
|
+
function registerShared(...args) {
|
|
71
|
+
runtimeCore.assert(FederationInstance, errorCodes.getShortErrorMsg(errorCodes.RUNTIME_009, errorCodes.runtimeDescMap));
|
|
72
|
+
// eslint-disable-next-line prefer-spread
|
|
73
|
+
return FederationInstance.registerShared.apply(FederationInstance, args);
|
|
74
|
+
}
|
|
75
|
+
// Inject for debug
|
|
76
|
+
runtimeCore.setGlobalFederationConstructor(runtimeCore.ModuleFederation);
|
|
77
|
+
|
|
78
|
+
exports.Module = runtimeCore.Module;
|
|
79
|
+
exports.ModuleFederation = runtimeCore.ModuleFederation;
|
|
80
|
+
exports.getRemoteEntry = runtimeCore.getRemoteEntry;
|
|
81
|
+
exports.getRemoteInfo = runtimeCore.getRemoteInfo;
|
|
82
|
+
exports.loadScript = runtimeCore.loadScript;
|
|
83
|
+
exports.loadScriptNode = runtimeCore.loadScriptNode;
|
|
84
|
+
exports.registerGlobalPlugins = runtimeCore.registerGlobalPlugins;
|
|
85
|
+
exports.createInstance = createInstance;
|
|
86
|
+
exports.getInstance = getInstance;
|
|
87
|
+
exports.init = init;
|
|
88
|
+
exports.loadRemote = loadRemote;
|
|
89
|
+
exports.loadShare = loadShare;
|
|
90
|
+
exports.loadShareSync = loadShareSync;
|
|
91
|
+
exports.preloadRemote = preloadRemote;
|
|
92
|
+
exports.registerPlugins = registerPlugins;
|
|
93
|
+
exports.registerRemotes = registerRemotes;
|
|
94
|
+
exports.registerShared = registerShared;
|
|
95
|
+
//# sourceMappingURL=index.cjs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.cjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":["getGlobalFederationConstructor","ModuleFederation","setGlobalFederationInstance","getGlobalFederationInstance","assert","getShortErrorMsg","RUNTIME_009","runtimeDescMap","setGlobalFederationConstructor"],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { setGlobalFederationConstructor, ModuleFederation, getGlobalFederationConstructor, setGlobalFederationInstance, assert } from '@module-federation/runtime-core';
|
|
2
|
+
export { Module, ModuleFederation, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, registerGlobalPlugins } from '@module-federation/runtime-core';
|
|
3
|
+
import { getShortErrorMsg, RUNTIME_009, runtimeDescMap } from '@module-federation/error-codes';
|
|
4
|
+
import { g as getGlobalFederationInstance } from './utils.esm.js';
|
|
5
|
+
|
|
6
|
+
function createInstance(options) {
|
|
7
|
+
// Retrieve debug constructor
|
|
8
|
+
const ModuleFederationConstructor = getGlobalFederationConstructor() || ModuleFederation;
|
|
9
|
+
const instance = new ModuleFederationConstructor(options);
|
|
10
|
+
setGlobalFederationInstance(instance);
|
|
11
|
+
return instance;
|
|
12
|
+
}
|
|
13
|
+
let FederationInstance = null;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use createInstance or getInstance instead
|
|
16
|
+
*/
|
|
17
|
+
function init(options) {
|
|
18
|
+
// Retrieve the same instance with the same name
|
|
19
|
+
const instance = getGlobalFederationInstance(options.name, options.version);
|
|
20
|
+
if (!instance) {
|
|
21
|
+
FederationInstance = createInstance(options);
|
|
22
|
+
return FederationInstance;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Merge options
|
|
26
|
+
instance.initOptions(options);
|
|
27
|
+
if (!FederationInstance) {
|
|
28
|
+
FederationInstance = instance;
|
|
29
|
+
}
|
|
30
|
+
return instance;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function loadRemote(...args) {
|
|
34
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
35
|
+
const loadRemote = FederationInstance.loadRemote;
|
|
36
|
+
// eslint-disable-next-line prefer-spread
|
|
37
|
+
return loadRemote.apply(FederationInstance, args);
|
|
38
|
+
}
|
|
39
|
+
function loadShare(...args) {
|
|
40
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
41
|
+
// eslint-disable-next-line prefer-spread
|
|
42
|
+
const loadShare = FederationInstance.loadShare;
|
|
43
|
+
return loadShare.apply(FederationInstance, args);
|
|
44
|
+
}
|
|
45
|
+
function loadShareSync(...args) {
|
|
46
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
47
|
+
const loadShareSync = FederationInstance.loadShareSync;
|
|
48
|
+
// eslint-disable-next-line prefer-spread
|
|
49
|
+
return loadShareSync.apply(FederationInstance, args);
|
|
50
|
+
}
|
|
51
|
+
function preloadRemote(...args) {
|
|
52
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
53
|
+
// eslint-disable-next-line prefer-spread
|
|
54
|
+
return FederationInstance.preloadRemote.apply(FederationInstance, args);
|
|
55
|
+
}
|
|
56
|
+
function registerRemotes(...args) {
|
|
57
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
58
|
+
// eslint-disable-next-line prefer-spread
|
|
59
|
+
return FederationInstance.registerRemotes.apply(FederationInstance, args);
|
|
60
|
+
}
|
|
61
|
+
function registerPlugins(...args) {
|
|
62
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
63
|
+
// eslint-disable-next-line prefer-spread
|
|
64
|
+
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
65
|
+
}
|
|
66
|
+
function getInstance() {
|
|
67
|
+
return FederationInstance;
|
|
68
|
+
}
|
|
69
|
+
function registerShared(...args) {
|
|
70
|
+
assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
|
|
71
|
+
// eslint-disable-next-line prefer-spread
|
|
72
|
+
return FederationInstance.registerShared.apply(FederationInstance, args);
|
|
73
|
+
}
|
|
74
|
+
// Inject for debug
|
|
75
|
+
setGlobalFederationConstructor(ModuleFederation);
|
|
76
|
+
|
|
77
|
+
export { createInstance, getInstance, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerPlugins, registerRemotes, registerShared };
|
|
78
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AA4BM,SAAU,cAAc,CAAC,OAAoB,EAAA;;AAEjD,IAAA,MAAM,2BAA2B,GAC/B,8BAA8B,EAAE,IAAI,gBAAgB;AACtD,IAAA,MAAM,QAAQ,GAAG,IAAI,2BAA2B,CAAC,OAAO,CAAC;IACzD,2BAA2B,CAAC,QAAQ,CAAC;AACrC,IAAA,OAAO,QAAQ;AACjB;AAEA,IAAI,kBAAkB,GAA4B,IAAI;AACtD;;AAEG;AACG,SAAU,IAAI,CAAC,OAAoB,EAAA;;AAEvC,IAAA,MAAM,QAAQ,GAAG,2BAA2B,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;IAC3E,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,kBAAkB,GAAG,cAAc,CAAC,OAAO,CAAC;AAC5C,QAAA,OAAO,kBAAkB;IAC3B;SAAO;;AAEL,QAAA,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,kBAAkB,EAAE;YACvB,kBAAkB,GAAG,QAAQ;QAC/B;AACA,QAAA,OAAO,QAAQ;IACjB;AACF;AAEM,SAAU,UAAU,CACxB,GAAG,IAAgD,EAAA;IAEnD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACzE,IAAA,MAAM,UAAU,GACd,kBAAkB,CAAC,UAAU;;IAE/B,OAAO,UAAU,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AACnD;AAEM,SAAU,SAAS,CACvB,GAAG,IAA+C,EAAA;IAElD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;;AAEzE,IAAA,MAAM,SAAS,GACb,kBAAkB,CAAC,SAAS;IAC9B,OAAO,SAAS,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AAClD;AAEM,SAAU,aAAa,CAC3B,GAAG,IAAmD,EAAA;IAEtD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;AACzE,IAAA,MAAM,aAAa,GACjB,kBAAkB,CAAC,aAAa;;IAElC,OAAO,aAAa,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AACtD;AAEM,SAAU,aAAa,CAC3B,GAAG,IAAmD,EAAA;IAEtD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;;IAEzE,OAAO,kBAAkB,CAAC,aAAa,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AACzE;AAEM,SAAU,eAAe,CAC7B,GAAG,IAAqD,EAAA;IAExD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;;IAEzE,OAAO,kBAAkB,CAAC,eAAe,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AAC3E;AAEM,SAAU,eAAe,CAC7B,GAAG,IAAqD,EAAA;IAExD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;;IAEzE,OAAO,kBAAkB,CAAC,eAAe,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AAC3E;SAEgB,WAAW,GAAA;AACzB,IAAA,OAAO,kBAAkB;AAC3B;AAEM,SAAU,cAAc,CAC5B,GAAG,IAAoD,EAAA;IAEvD,MAAM,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;;IAEzE,OAAO,kBAAkB,CAAC,cAAc,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AAC1E;AAEA;AACA,8BAA8B,CAAC,gBAAgB,CAAC;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { helpers } from '@module-federation/runtime-core';
|
|
2
|
+
import { getGlobalFederationInstance } from './utils';
|
|
3
|
+
export type { IGlobalUtils, IShareUtils, } from '@module-federation/runtime-core';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
global: typeof helpers.global & {
|
|
6
|
+
getGlobalFederationInstance: typeof getGlobalFederationInstance;
|
|
7
|
+
};
|
|
8
|
+
share: typeof helpers.share;
|
|
9
|
+
utils: typeof helpers.utils;
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ModuleFederation, type UserOptions } from '@module-federation/runtime-core';
|
|
2
|
+
export { loadScript, loadScriptNode, Module, getRemoteEntry, getRemoteInfo, registerGlobalPlugins, type ModuleFederationRuntimePlugin, type Federation, } from '@module-federation/runtime-core';
|
|
3
|
+
export { ModuleFederation };
|
|
4
|
+
export declare function createInstance(options: UserOptions): ModuleFederation;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use createInstance or getInstance instead
|
|
7
|
+
*/
|
|
8
|
+
export declare function init(options: UserOptions): ModuleFederation;
|
|
9
|
+
export declare function loadRemote<T>(...args: Parameters<ModuleFederation['loadRemote']>): Promise<T | null>;
|
|
10
|
+
export declare function loadShare<T>(...args: Parameters<ModuleFederation['loadShare']>): Promise<false | (() => T | undefined)>;
|
|
11
|
+
export declare function loadShareSync<T>(...args: Parameters<ModuleFederation['loadShareSync']>): () => T | never;
|
|
12
|
+
export declare function preloadRemote(...args: Parameters<ModuleFederation['preloadRemote']>): ReturnType<ModuleFederation['preloadRemote']>;
|
|
13
|
+
export declare function registerRemotes(...args: Parameters<ModuleFederation['registerRemotes']>): ReturnType<ModuleFederation['registerRemotes']>;
|
|
14
|
+
export declare function registerPlugins(...args: Parameters<ModuleFederation['registerPlugins']>): ReturnType<ModuleFederation['registerRemotes']>;
|
|
15
|
+
export declare function getInstance(): ModuleFederation | null;
|
|
16
|
+
export declare function registerShared(...args: Parameters<ModuleFederation['registerShared']>): ReturnType<ModuleFederation['registerShared']>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@module-federation/runtime-core/types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var types = require('@module-federation/runtime-core/types');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.prototype.hasOwnProperty.call(types, '__proto__') &&
|
|
8
|
+
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
|
|
9
|
+
Object.defineProperty(exports, '__proto__', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
value: types['__proto__']
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Object.keys(types).forEach(function (k) {
|
|
15
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = types[k];
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=types.cjs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/types";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/types";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var runtimeCore = require('@module-federation/runtime-core');
|
|
4
|
+
|
|
5
|
+
// injected by bundler, so it can not use runtime-core stuff
|
|
6
|
+
function getBuilderId() {
|
|
7
|
+
//@ts-ignore
|
|
8
|
+
return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined'
|
|
9
|
+
? //@ts-ignore
|
|
10
|
+
FEDERATION_BUILD_IDENTIFIER
|
|
11
|
+
: '';
|
|
12
|
+
}
|
|
13
|
+
function getGlobalFederationInstance(name, version) {
|
|
14
|
+
const buildId = getBuilderId();
|
|
15
|
+
return runtimeCore.CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => {
|
|
16
|
+
if (buildId && GMInstance.options.id === buildId) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (GMInstance.options.name === name &&
|
|
20
|
+
!GMInstance.options.version &&
|
|
21
|
+
!version) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (GMInstance.options.name === name &&
|
|
25
|
+
version &&
|
|
26
|
+
GMInstance.options.version === version) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
exports.getGlobalFederationInstance = getGlobalFederationInstance;
|
|
34
|
+
//# sourceMappingURL=utils.cjs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs.cjs","sources":["../src/utils.ts"],"sourcesContent":[null],"names":["CurrentGlobal"],"mappings":";;;;AAGA;SACgB,YAAY,GAAA;;IAE1B,OAAO,OAAO,2BAA2B,KAAK;AAC5C;YACE;UACA,EAAE;AACR;AAEM,SAAU,2BAA2B,CACzC,IAAY,EACZ,OAA2B,EAAA;AAE3B,IAAA,MAAM,OAAO,GAAG,YAAY,EAAE;IAC9B,OAAOA,yBAAa,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CACpD,CAAC,UAA4B,KAAI;QAC/B,IAAI,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,EAAE;AAChD,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IACE,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI;AAChC,YAAA,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO;YAC3B,CAAC,OAAO,EACR;AACA,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IACE,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI;YAChC,OAAO;AACP,YAAA,UAAU,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,EACtC;AACA,YAAA,OAAO,IAAI;QACb;AACA,QAAA,OAAO,KAAK;AACd,IAAA,CAAC,CACF;AACH;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CurrentGlobal } from '@module-federation/runtime-core';
|
|
2
|
+
|
|
3
|
+
// injected by bundler, so it can not use runtime-core stuff
|
|
4
|
+
function getBuilderId() {
|
|
5
|
+
//@ts-ignore
|
|
6
|
+
return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined'
|
|
7
|
+
? //@ts-ignore
|
|
8
|
+
FEDERATION_BUILD_IDENTIFIER
|
|
9
|
+
: '';
|
|
10
|
+
}
|
|
11
|
+
function getGlobalFederationInstance(name, version) {
|
|
12
|
+
const buildId = getBuilderId();
|
|
13
|
+
return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => {
|
|
14
|
+
if (buildId && GMInstance.options.id === buildId) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (GMInstance.options.name === name &&
|
|
18
|
+
!GMInstance.options.version &&
|
|
19
|
+
!version) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
if (GMInstance.options.name === name &&
|
|
23
|
+
version &&
|
|
24
|
+
GMInstance.options.version === version) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { getGlobalFederationInstance as g };
|
|
32
|
+
//# sourceMappingURL=utils.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.esm.js","sources":["../src/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;SACgB,YAAY,GAAA;;IAE1B,OAAO,OAAO,2BAA2B,KAAK;AAC5C;YACE;UACA,EAAE;AACR;AAEM,SAAU,2BAA2B,CACzC,IAAY,EACZ,OAA2B,EAAA;AAE3B,IAAA,MAAM,OAAO,GAAG,YAAY,EAAE;IAC9B,OAAO,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CACpD,CAAC,UAA4B,KAAI;QAC/B,IAAI,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,KAAK,OAAO,EAAE;AAChD,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IACE,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI;AAChC,YAAA,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO;YAC3B,CAAC,OAAO,EACR;AACA,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IACE,UAAU,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI;YAChC,OAAO;AACP,YAAA,UAAU,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,EACtC;AACA,YAAA,OAAO,IAAI;QACb;AACA,QAAA,OAAO,KAAK;AACd,IAAA,CAAC,CACF;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,40 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
|
-
"main": "./index.cjs.
|
|
6
|
-
"module": "./index.esm.js",
|
|
7
|
-
"types": "./index.
|
|
6
|
+
"main": "./dist/index.cjs.cjs",
|
|
7
|
+
"module": "./dist/index.esm.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
8
9
|
"license": "MIT",
|
|
9
10
|
"publishConfig": {
|
|
10
11
|
"access": "public"
|
|
11
12
|
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/module-federation/core.git",
|
|
16
|
+
"directory": "packages/runtime"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist/",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
12
22
|
"exports": {
|
|
13
23
|
".": {
|
|
14
|
-
"import":
|
|
15
|
-
|
|
24
|
+
"import": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.esm.js"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.cjs.cjs"
|
|
31
|
+
}
|
|
16
32
|
},
|
|
17
33
|
"./helpers": {
|
|
18
|
-
"import":
|
|
19
|
-
|
|
34
|
+
"import": {
|
|
35
|
+
"types": "./dist/helpers.d.ts",
|
|
36
|
+
"default": "./dist/helpers.esm.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/helpers.d.ts",
|
|
40
|
+
"default": "./dist/helpers.cjs.cjs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"./types": {
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/types.d.ts",
|
|
46
|
+
"default": "./dist/types.esm.js"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./dist/types.d.ts",
|
|
50
|
+
"default": "./dist/types.cjs.cjs"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"./core": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/core.d.ts",
|
|
56
|
+
"default": "./dist/core.esm.js"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./dist/core.d.ts",
|
|
60
|
+
"default": "./dist/core.cjs.cjs"
|
|
61
|
+
}
|
|
20
62
|
},
|
|
21
63
|
"./*": "./*"
|
|
22
64
|
},
|
|
23
65
|
"typesVersions": {
|
|
24
66
|
"*": {
|
|
25
67
|
".": [
|
|
26
|
-
"./index.
|
|
68
|
+
"./dist/index.d.ts"
|
|
27
69
|
],
|
|
28
70
|
"helpers": [
|
|
29
|
-
"./helpers.
|
|
71
|
+
"./dist/helpers.d.ts"
|
|
30
72
|
],
|
|
31
|
-
"
|
|
32
|
-
"./
|
|
73
|
+
"types": [
|
|
74
|
+
"./dist/types.d.ts"
|
|
75
|
+
],
|
|
76
|
+
"core": [
|
|
77
|
+
"./dist/core.d.ts"
|
|
33
78
|
]
|
|
34
79
|
}
|
|
35
80
|
},
|
|
36
81
|
"dependencies": {
|
|
37
|
-
"@module-federation/sdk": "
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
82
|
+
"@module-federation/sdk": "2.0.0",
|
|
83
|
+
"@module-federation/error-codes": "2.0.0",
|
|
84
|
+
"@module-federation/runtime-core": "2.0.0"
|
|
85
|
+
}
|
|
86
|
+
}
|
package/helpers.cjs.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var share = require('./share.cjs.js');
|
|
4
|
-
|
|
5
|
-
const ShareUtils = {
|
|
6
|
-
getGlobalShare: share.getGlobalShare,
|
|
7
|
-
getGlobalShareScope: share.getGlobalShareScope
|
|
8
|
-
};
|
|
9
|
-
const GlobalUtils = {
|
|
10
|
-
nativeGlobal: share.nativeGlobal,
|
|
11
|
-
resetFederationGlobalInfo: share.resetFederationGlobalInfo,
|
|
12
|
-
getGlobalFederationInstance: share.getGlobalFederationInstance,
|
|
13
|
-
setGlobalFederationInstance: share.setGlobalFederationInstance,
|
|
14
|
-
getGlobalFederationConstructor: share.getGlobalFederationConstructor,
|
|
15
|
-
setGlobalFederationConstructor: share.setGlobalFederationConstructor,
|
|
16
|
-
getInfoWithoutType: share.getInfoWithoutType,
|
|
17
|
-
getGlobalSnapshot: share.getGlobalSnapshot,
|
|
18
|
-
getTargetSnapshotInfoByModuleInfo: share.getTargetSnapshotInfoByModuleInfo,
|
|
19
|
-
getGlobalSnapshotInfoByModuleInfo: share.getGlobalSnapshotInfoByModuleInfo,
|
|
20
|
-
setGlobalSnapshotInfoByModuleInfo: share.setGlobalSnapshotInfoByModuleInfo,
|
|
21
|
-
addGlobalSnapshot: share.addGlobalSnapshot,
|
|
22
|
-
getRemoteEntryExports: share.getRemoteEntryExports,
|
|
23
|
-
registerGlobalPlugins: share.registerGlobalPlugins,
|
|
24
|
-
getGlobalHostPlugins: share.getGlobalHostPlugins,
|
|
25
|
-
getPreloaded: share.getPreloaded,
|
|
26
|
-
setPreloaded: share.setPreloaded
|
|
27
|
-
};
|
|
28
|
-
var helpers = {
|
|
29
|
-
global: GlobalUtils,
|
|
30
|
-
share: ShareUtils
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
module.exports = helpers;
|