@module-federation/runtime 2.0.1 → 2.1.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.
Files changed (54) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/core.cjs +18 -0
  3. package/dist/core.cjs.map +1 -0
  4. package/dist/core.d.ts +3 -2
  5. package/dist/core.js +10 -0
  6. package/dist/core.js.map +1 -0
  7. package/dist/helpers.cjs +24 -0
  8. package/dist/helpers.cjs.map +1 -0
  9. package/dist/helpers.d.ts +24 -2
  10. package/dist/helpers.js +19 -0
  11. package/dist/helpers.js.map +1 -0
  12. package/dist/index.cjs +109 -0
  13. package/dist/index.cjs.map +1 -0
  14. package/dist/index.d.ts +19 -1
  15. package/dist/index.js +61 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/types.cjs +10 -0
  18. package/dist/types.d.ts +1 -1
  19. package/dist/types.js +3 -0
  20. package/dist/utils.cjs +20 -0
  21. package/dist/utils.cjs.map +1 -0
  22. package/dist/utils.d.ts +7 -0
  23. package/dist/utils.js +19 -0
  24. package/dist/utils.js.map +1 -0
  25. package/package.json +14 -14
  26. package/dist/core.cjs.cjs +0 -33
  27. package/dist/core.cjs.cjs.map +0 -1
  28. package/dist/core.cjs.d.ts +0 -2
  29. package/dist/core.esm.js +0 -4
  30. package/dist/core.esm.js.map +0 -1
  31. package/dist/helpers.cjs.cjs +0 -24
  32. package/dist/helpers.cjs.cjs.map +0 -1
  33. package/dist/helpers.cjs.d.ts +0 -2
  34. package/dist/helpers.esm.js +0 -17
  35. package/dist/helpers.esm.js.map +0 -1
  36. package/dist/index.cjs.cjs +0 -95
  37. package/dist/index.cjs.cjs.map +0 -1
  38. package/dist/index.cjs.d.ts +0 -1
  39. package/dist/index.esm.js +0 -78
  40. package/dist/index.esm.js.map +0 -1
  41. package/dist/src/core.d.ts +0 -3
  42. package/dist/src/helpers.d.ts +0 -37
  43. package/dist/src/index.d.ts +0 -16
  44. package/dist/src/types.d.ts +0 -1
  45. package/dist/src/utils.d.ts +0 -3
  46. package/dist/types.cjs.cjs +0 -17
  47. package/dist/types.cjs.cjs.map +0 -1
  48. package/dist/types.cjs.d.ts +0 -1
  49. package/dist/types.esm.js +0 -2
  50. package/dist/types.esm.js.map +0 -1
  51. package/dist/utils.cjs.cjs +0 -34
  52. package/dist/utils.cjs.cjs.map +0 -1
  53. package/dist/utils.esm.js +0 -32
  54. package/dist/utils.esm.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/core.cjs ADDED
@@ -0,0 +1,18 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let _module_federation_runtime_core = require("@module-federation/runtime-core");
4
+ _module_federation_runtime_core = require_runtime.__toESM(_module_federation_runtime_core);
5
+
6
+ //#region src/core.ts
7
+ var core_default = _module_federation_runtime_core;
8
+
9
+ //#endregion
10
+ exports.default = core_default;
11
+ Object.keys(_module_federation_runtime_core).forEach(function (k) {
12
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
13
+ enumerable: true,
14
+ get: function () { return _module_federation_runtime_core[k]; }
15
+ });
16
+ });
17
+
18
+ //# sourceMappingURL=core.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.cjs","names":["runtimeCore"],"sources":["../src/core.ts"],"sourcesContent":["import * as runtimeCore from '@module-federation/runtime-core';\n\nexport * from '@module-federation/runtime-core';\n\nexport default runtimeCore;\n"],"mappings":";;;;;;AAIA,mBAAeA"}
package/dist/core.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export * from "./src/core";
2
- export { default } from "./src/core";
1
+ import * as runtimeCore from "@module-federation/runtime-core";
2
+ export * from "@module-federation/runtime-core";
3
+ export { runtimeCore as default };
package/dist/core.js ADDED
@@ -0,0 +1,10 @@
1
+ import * as runtimeCore from "@module-federation/runtime-core";
2
+
3
+ export * from "@module-federation/runtime-core"
4
+
5
+ //#region src/core.ts
6
+ var core_default = runtimeCore;
7
+
8
+ //#endregion
9
+ export { core_default as default };
10
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","names":[],"sources":["../src/core.ts"],"sourcesContent":["import * as runtimeCore from '@module-federation/runtime-core';\n\nexport * from '@module-federation/runtime-core';\n\nexport default runtimeCore;\n"],"mappings":";;;;;AAIA,mBAAe"}
@@ -0,0 +1,24 @@
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_utils = require('./utils.cjs');
4
+ let _module_federation_runtime_core = require("@module-federation/runtime-core");
5
+
6
+ //#region src/helpers.ts
7
+ const global = {
8
+ ..._module_federation_runtime_core.helpers.global,
9
+ getGlobalFederationInstance: require_utils.getGlobalFederationInstance
10
+ };
11
+ const share = _module_federation_runtime_core.helpers.share;
12
+ const utils = _module_federation_runtime_core.helpers.utils;
13
+ const runtimeHelpers = {
14
+ global,
15
+ share,
16
+ utils
17
+ };
18
+
19
+ //#endregion
20
+ exports.default = runtimeHelpers;
21
+ exports.global = global;
22
+ exports.share = share;
23
+ exports.utils = utils;
24
+ //# sourceMappingURL=helpers.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.cjs","names":["helpers"],"sources":["../src/helpers.ts"],"sourcesContent":["import {\n helpers,\n type IGlobalUtils,\n type IShareUtils,\n} from '@module-federation/runtime-core';\nimport { getGlobalFederationInstance } from './utils';\n\nexport type {\n IGlobalUtils,\n IShareUtils,\n} from '@module-federation/runtime-core';\n\ntype RuntimeGlobalUtils = IGlobalUtils & {\n getGlobalFederationInstance: typeof getGlobalFederationInstance;\n};\n\nexport const global: RuntimeGlobalUtils = {\n ...helpers.global,\n getGlobalFederationInstance,\n};\n\nexport const share: IShareUtils = helpers.share;\n\nexport interface IRuntimeUtils {\n matchRemoteWithNameAndExpose: typeof import('@module-federation/runtime-core').matchRemoteWithNameAndExpose;\n preloadAssets: (...args: any[]) => void;\n getRemoteInfo: typeof import('@module-federation/runtime-core').getRemoteInfo;\n}\n\nexport const utils: IRuntimeUtils = helpers.utils;\n\nconst runtimeHelpers: {\n global: RuntimeGlobalUtils;\n share: IShareUtils;\n utils: IRuntimeUtils;\n} = {\n global,\n share,\n utils,\n};\n\nexport default runtimeHelpers;\n"],"mappings":";;;;;;AAgBA,MAAa,SAA6B;CACxC,GAAGA,wCAAQ;CACX;CACD;AAED,MAAa,QAAqBA,wCAAQ;AAQ1C,MAAa,QAAuBA,wCAAQ;AAE5C,MAAM,iBAIF;CACF;CACA;CACA;CACD"}
package/dist/helpers.d.ts CHANGED
@@ -1,2 +1,24 @@
1
- export * from "./src/helpers";
2
- export { default } from "./src/helpers";
1
+ import { getGlobalFederationInstance } from "./utils.js";
2
+ import * as _module_federation_runtime_core0 from "@module-federation/runtime-core";
3
+ import { IGlobalUtils, IGlobalUtils as IGlobalUtils$1, IShareUtils, IShareUtils as IShareUtils$1 } from "@module-federation/runtime-core";
4
+
5
+ //#region src/helpers.d.ts
6
+ type RuntimeGlobalUtils = IGlobalUtils$1 & {
7
+ getGlobalFederationInstance: typeof getGlobalFederationInstance;
8
+ };
9
+ declare const global: RuntimeGlobalUtils;
10
+ declare const share: IShareUtils$1;
11
+ interface IRuntimeUtils {
12
+ matchRemoteWithNameAndExpose: typeof _module_federation_runtime_core0.matchRemoteWithNameAndExpose;
13
+ preloadAssets: (...args: any[]) => void;
14
+ getRemoteInfo: typeof _module_federation_runtime_core0.getRemoteInfo;
15
+ }
16
+ declare const utils: IRuntimeUtils;
17
+ declare const runtimeHelpers: {
18
+ global: RuntimeGlobalUtils;
19
+ share: IShareUtils$1;
20
+ utils: IRuntimeUtils;
21
+ };
22
+ //#endregion
23
+ export { type IGlobalUtils, IRuntimeUtils, type IShareUtils, runtimeHelpers as default, global, share, utils };
24
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { getGlobalFederationInstance } from "./utils.js";
2
+ import { helpers } from "@module-federation/runtime-core";
3
+
4
+ //#region src/helpers.ts
5
+ const global = {
6
+ ...helpers.global,
7
+ getGlobalFederationInstance
8
+ };
9
+ const share = helpers.share;
10
+ const utils = helpers.utils;
11
+ const runtimeHelpers = {
12
+ global,
13
+ share,
14
+ utils
15
+ };
16
+
17
+ //#endregion
18
+ export { runtimeHelpers as default, global, share, utils };
19
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","names":[],"sources":["../src/helpers.ts"],"sourcesContent":["import {\n helpers,\n type IGlobalUtils,\n type IShareUtils,\n} from '@module-federation/runtime-core';\nimport { getGlobalFederationInstance } from './utils';\n\nexport type {\n IGlobalUtils,\n IShareUtils,\n} from '@module-federation/runtime-core';\n\ntype RuntimeGlobalUtils = IGlobalUtils & {\n getGlobalFederationInstance: typeof getGlobalFederationInstance;\n};\n\nexport const global: RuntimeGlobalUtils = {\n ...helpers.global,\n getGlobalFederationInstance,\n};\n\nexport const share: IShareUtils = helpers.share;\n\nexport interface IRuntimeUtils {\n matchRemoteWithNameAndExpose: typeof import('@module-federation/runtime-core').matchRemoteWithNameAndExpose;\n preloadAssets: (...args: any[]) => void;\n getRemoteInfo: typeof import('@module-federation/runtime-core').getRemoteInfo;\n}\n\nexport const utils: IRuntimeUtils = helpers.utils;\n\nconst runtimeHelpers: {\n global: RuntimeGlobalUtils;\n share: IShareUtils;\n utils: IRuntimeUtils;\n} = {\n global,\n share,\n utils,\n};\n\nexport default runtimeHelpers;\n"],"mappings":";;;;AAgBA,MAAa,SAA6B;CACxC,GAAG,QAAQ;CACX;CACD;AAED,MAAa,QAAqB,QAAQ;AAQ1C,MAAa,QAAuB,QAAQ;AAE5C,MAAM,iBAIF;CACF;CACA;CACA;CACD"}
package/dist/index.cjs ADDED
@@ -0,0 +1,109 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_utils = require('./utils.cjs');
4
+ let _module_federation_runtime_core = require("@module-federation/runtime-core");
5
+ let _module_federation_error_codes = require("@module-federation/error-codes");
6
+
7
+ //#region src/index.ts
8
+ function createInstance(options) {
9
+ const instance = new (((0, _module_federation_runtime_core.getGlobalFederationConstructor)()) || _module_federation_runtime_core.ModuleFederation)(options);
10
+ (0, _module_federation_runtime_core.setGlobalFederationInstance)(instance);
11
+ return instance;
12
+ }
13
+ let FederationInstance = null;
14
+ /**
15
+ * @deprecated Use createInstance or getInstance instead
16
+ */
17
+ function init(options) {
18
+ const instance = require_utils.getGlobalFederationInstance(options.name, options.version);
19
+ if (!instance) {
20
+ FederationInstance = createInstance(options);
21
+ return FederationInstance;
22
+ } else {
23
+ instance.initOptions(options);
24
+ if (!FederationInstance) FederationInstance = instance;
25
+ return instance;
26
+ }
27
+ }
28
+ function loadRemote(...args) {
29
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
30
+ return FederationInstance.loadRemote.apply(FederationInstance, args);
31
+ }
32
+ function loadShare(...args) {
33
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
34
+ return FederationInstance.loadShare.apply(FederationInstance, args);
35
+ }
36
+ function loadShareSync(...args) {
37
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
38
+ return FederationInstance.loadShareSync.apply(FederationInstance, args);
39
+ }
40
+ function preloadRemote(...args) {
41
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
42
+ return FederationInstance.preloadRemote.apply(FederationInstance, args);
43
+ }
44
+ function registerRemotes(...args) {
45
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
46
+ return FederationInstance.registerRemotes.apply(FederationInstance, args);
47
+ }
48
+ function registerPlugins(...args) {
49
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
50
+ return FederationInstance.registerPlugins.apply(FederationInstance, args);
51
+ }
52
+ function getInstance() {
53
+ return FederationInstance;
54
+ }
55
+ function registerShared(...args) {
56
+ (0, _module_federation_runtime_core.assert)(FederationInstance, (0, _module_federation_error_codes.getShortErrorMsg)(_module_federation_error_codes.RUNTIME_009, _module_federation_error_codes.runtimeDescMap));
57
+ return FederationInstance.registerShared.apply(FederationInstance, args);
58
+ }
59
+ (0, _module_federation_runtime_core.setGlobalFederationConstructor)(_module_federation_runtime_core.ModuleFederation);
60
+
61
+ //#endregion
62
+ Object.defineProperty(exports, 'Module', {
63
+ enumerable: true,
64
+ get: function () {
65
+ return _module_federation_runtime_core.Module;
66
+ }
67
+ });
68
+ exports.ModuleFederation = _module_federation_runtime_core.ModuleFederation;
69
+ exports.createInstance = createInstance;
70
+ exports.getInstance = getInstance;
71
+ Object.defineProperty(exports, 'getRemoteEntry', {
72
+ enumerable: true,
73
+ get: function () {
74
+ return _module_federation_runtime_core.getRemoteEntry;
75
+ }
76
+ });
77
+ Object.defineProperty(exports, 'getRemoteInfo', {
78
+ enumerable: true,
79
+ get: function () {
80
+ return _module_federation_runtime_core.getRemoteInfo;
81
+ }
82
+ });
83
+ exports.init = init;
84
+ exports.loadRemote = loadRemote;
85
+ Object.defineProperty(exports, 'loadScript', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return _module_federation_runtime_core.loadScript;
89
+ }
90
+ });
91
+ Object.defineProperty(exports, 'loadScriptNode', {
92
+ enumerable: true,
93
+ get: function () {
94
+ return _module_federation_runtime_core.loadScriptNode;
95
+ }
96
+ });
97
+ exports.loadShare = loadShare;
98
+ exports.loadShareSync = loadShareSync;
99
+ exports.preloadRemote = preloadRemote;
100
+ Object.defineProperty(exports, 'registerGlobalPlugins', {
101
+ enumerable: true,
102
+ get: function () {
103
+ return _module_federation_runtime_core.registerGlobalPlugins;
104
+ }
105
+ });
106
+ exports.registerPlugins = registerPlugins;
107
+ exports.registerRemotes = registerRemotes;
108
+ exports.registerShared = registerShared;
109
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["ModuleFederation","getGlobalFederationInstance","RUNTIME_009","runtimeDescMap"],"sources":["../src/index.ts"],"sourcesContent":["import {\n ModuleFederation,\n type UserOptions,\n getGlobalFederationConstructor,\n setGlobalFederationInstance,\n assert,\n setGlobalFederationConstructor,\n} from '@module-federation/runtime-core';\nimport {\n runtimeDescMap,\n getShortErrorMsg,\n RUNTIME_009,\n} from '@module-federation/error-codes';\nimport { getGlobalFederationInstance } from './utils';\n\nexport {\n loadScript,\n loadScriptNode,\n Module,\n getRemoteEntry,\n getRemoteInfo,\n registerGlobalPlugins,\n type ModuleFederationRuntimePlugin,\n type Federation,\n} from '@module-federation/runtime-core';\n\nexport { ModuleFederation };\n\nexport function createInstance(options: UserOptions) {\n // Retrieve debug constructor\n const ModuleFederationConstructor =\n getGlobalFederationConstructor() || ModuleFederation;\n const instance = new ModuleFederationConstructor(options);\n setGlobalFederationInstance(instance);\n return instance;\n}\n\nlet FederationInstance: ModuleFederation | null = null;\n/**\n * @deprecated Use createInstance or getInstance instead\n */\nexport function init(options: UserOptions): ModuleFederation {\n // Retrieve the same instance with the same name\n const instance = getGlobalFederationInstance(options.name, options.version);\n if (!instance) {\n FederationInstance = createInstance(options);\n return FederationInstance;\n } else {\n // Merge options\n instance.initOptions(options);\n if (!FederationInstance) {\n FederationInstance = instance;\n }\n return instance;\n }\n}\n\nexport function loadRemote<T>(\n ...args: Parameters<ModuleFederation['loadRemote']>\n): Promise<T | null> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n const loadRemote: typeof FederationInstance.loadRemote<T> =\n FederationInstance.loadRemote;\n // eslint-disable-next-line prefer-spread\n return loadRemote.apply(FederationInstance, args);\n}\n\nexport function loadShare<T>(\n ...args: Parameters<ModuleFederation['loadShare']>\n): Promise<false | (() => T | undefined)> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n const loadShare: typeof FederationInstance.loadShare<T> =\n FederationInstance.loadShare;\n return loadShare.apply(FederationInstance, args);\n}\n\nexport function loadShareSync<T>(\n ...args: Parameters<ModuleFederation['loadShareSync']>\n): () => T | never {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n const loadShareSync: typeof FederationInstance.loadShareSync<T> =\n FederationInstance.loadShareSync;\n // eslint-disable-next-line prefer-spread\n return loadShareSync.apply(FederationInstance, args);\n}\n\nexport function preloadRemote(\n ...args: Parameters<ModuleFederation['preloadRemote']>\n): ReturnType<ModuleFederation['preloadRemote']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.preloadRemote.apply(FederationInstance, args);\n}\n\nexport function registerRemotes(\n ...args: Parameters<ModuleFederation['registerRemotes']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerRemotes.apply(FederationInstance, args);\n}\n\nexport function registerPlugins(\n ...args: Parameters<ModuleFederation['registerPlugins']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerPlugins.apply(FederationInstance, args);\n}\n\nexport function getInstance() {\n return FederationInstance;\n}\n\nexport function registerShared(\n ...args: Parameters<ModuleFederation['registerShared']>\n): ReturnType<ModuleFederation['registerShared']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerShared.apply(FederationInstance, args);\n}\n\n// Inject for debug\nsetGlobalFederationConstructor(ModuleFederation);\n"],"mappings":";;;;;;;AA4BA,SAAgB,eAAe,SAAsB;CAInD,MAAM,WAAW,2EADiB,KAAIA,kDACW,QAAQ;AACzD,kEAA4B,SAAS;AACrC,QAAO;;AAGT,IAAI,qBAA8C;;;;AAIlD,SAAgB,KAAK,SAAwC;CAE3D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UserOptions, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, registerGlobalPlugins } from "@module-federation/runtime-core";
2
+
3
+ //#region src/index.d.ts
4
+ declare function createInstance(options: UserOptions): ModuleFederation;
5
+ /**
6
+ * @deprecated Use createInstance or getInstance instead
7
+ */
8
+ declare function init(options: UserOptions): ModuleFederation;
9
+ declare function loadRemote<T>(...args: Parameters<ModuleFederation['loadRemote']>): Promise<T | null>;
10
+ declare function loadShare<T>(...args: Parameters<ModuleFederation['loadShare']>): Promise<false | (() => T | undefined)>;
11
+ declare function loadShareSync<T>(...args: Parameters<ModuleFederation['loadShareSync']>): () => T | never;
12
+ declare function preloadRemote(...args: Parameters<ModuleFederation['preloadRemote']>): ReturnType<ModuleFederation['preloadRemote']>;
13
+ declare function registerRemotes(...args: Parameters<ModuleFederation['registerRemotes']>): ReturnType<ModuleFederation['registerRemotes']>;
14
+ declare function registerPlugins(...args: Parameters<ModuleFederation['registerPlugins']>): ReturnType<ModuleFederation['registerRemotes']>;
15
+ declare function getInstance(): ModuleFederation | null;
16
+ declare function registerShared(...args: Parameters<ModuleFederation['registerShared']>): ReturnType<ModuleFederation['registerShared']>;
17
+ //#endregion
18
+ export { type Federation, Module, ModuleFederation, type ModuleFederationRuntimePlugin, createInstance, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadScript, loadScriptNode, loadShare, loadShareSync, preloadRemote, registerGlobalPlugins, registerPlugins, registerRemotes, registerShared };
19
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ import { getGlobalFederationInstance } from "./utils.js";
2
+ import { Module, ModuleFederation, assert, getGlobalFederationConstructor, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, registerGlobalPlugins, setGlobalFederationConstructor, setGlobalFederationInstance } from "@module-federation/runtime-core";
3
+ import { RUNTIME_009, getShortErrorMsg, runtimeDescMap } from "@module-federation/error-codes";
4
+
5
+ //#region src/index.ts
6
+ function createInstance(options) {
7
+ const instance = new ((getGlobalFederationConstructor()) || ModuleFederation)(options);
8
+ setGlobalFederationInstance(instance);
9
+ return instance;
10
+ }
11
+ let FederationInstance = null;
12
+ /**
13
+ * @deprecated Use createInstance or getInstance instead
14
+ */
15
+ function init(options) {
16
+ const instance = getGlobalFederationInstance(options.name, options.version);
17
+ if (!instance) {
18
+ FederationInstance = createInstance(options);
19
+ return FederationInstance;
20
+ } else {
21
+ instance.initOptions(options);
22
+ if (!FederationInstance) FederationInstance = instance;
23
+ return instance;
24
+ }
25
+ }
26
+ function loadRemote(...args) {
27
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
28
+ return FederationInstance.loadRemote.apply(FederationInstance, args);
29
+ }
30
+ function loadShare(...args) {
31
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
32
+ return FederationInstance.loadShare.apply(FederationInstance, args);
33
+ }
34
+ function loadShareSync(...args) {
35
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
36
+ return FederationInstance.loadShareSync.apply(FederationInstance, args);
37
+ }
38
+ function preloadRemote(...args) {
39
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
40
+ return FederationInstance.preloadRemote.apply(FederationInstance, args);
41
+ }
42
+ function registerRemotes(...args) {
43
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
44
+ return FederationInstance.registerRemotes.apply(FederationInstance, args);
45
+ }
46
+ function registerPlugins(...args) {
47
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
48
+ return FederationInstance.registerPlugins.apply(FederationInstance, args);
49
+ }
50
+ function getInstance() {
51
+ return FederationInstance;
52
+ }
53
+ function registerShared(...args) {
54
+ assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));
55
+ return FederationInstance.registerShared.apply(FederationInstance, args);
56
+ }
57
+ setGlobalFederationConstructor(ModuleFederation);
58
+
59
+ //#endregion
60
+ export { Module, ModuleFederation, createInstance, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadScript, loadScriptNode, loadShare, loadShareSync, preloadRemote, registerGlobalPlugins, registerPlugins, registerRemotes, registerShared };
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n ModuleFederation,\n type UserOptions,\n getGlobalFederationConstructor,\n setGlobalFederationInstance,\n assert,\n setGlobalFederationConstructor,\n} from '@module-federation/runtime-core';\nimport {\n runtimeDescMap,\n getShortErrorMsg,\n RUNTIME_009,\n} from '@module-federation/error-codes';\nimport { getGlobalFederationInstance } from './utils';\n\nexport {\n loadScript,\n loadScriptNode,\n Module,\n getRemoteEntry,\n getRemoteInfo,\n registerGlobalPlugins,\n type ModuleFederationRuntimePlugin,\n type Federation,\n} from '@module-federation/runtime-core';\n\nexport { ModuleFederation };\n\nexport function createInstance(options: UserOptions) {\n // Retrieve debug constructor\n const ModuleFederationConstructor =\n getGlobalFederationConstructor() || ModuleFederation;\n const instance = new ModuleFederationConstructor(options);\n setGlobalFederationInstance(instance);\n return instance;\n}\n\nlet FederationInstance: ModuleFederation | null = null;\n/**\n * @deprecated Use createInstance or getInstance instead\n */\nexport function init(options: UserOptions): ModuleFederation {\n // Retrieve the same instance with the same name\n const instance = getGlobalFederationInstance(options.name, options.version);\n if (!instance) {\n FederationInstance = createInstance(options);\n return FederationInstance;\n } else {\n // Merge options\n instance.initOptions(options);\n if (!FederationInstance) {\n FederationInstance = instance;\n }\n return instance;\n }\n}\n\nexport function loadRemote<T>(\n ...args: Parameters<ModuleFederation['loadRemote']>\n): Promise<T | null> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n const loadRemote: typeof FederationInstance.loadRemote<T> =\n FederationInstance.loadRemote;\n // eslint-disable-next-line prefer-spread\n return loadRemote.apply(FederationInstance, args);\n}\n\nexport function loadShare<T>(\n ...args: Parameters<ModuleFederation['loadShare']>\n): Promise<false | (() => T | undefined)> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n const loadShare: typeof FederationInstance.loadShare<T> =\n FederationInstance.loadShare;\n return loadShare.apply(FederationInstance, args);\n}\n\nexport function loadShareSync<T>(\n ...args: Parameters<ModuleFederation['loadShareSync']>\n): () => T | never {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n const loadShareSync: typeof FederationInstance.loadShareSync<T> =\n FederationInstance.loadShareSync;\n // eslint-disable-next-line prefer-spread\n return loadShareSync.apply(FederationInstance, args);\n}\n\nexport function preloadRemote(\n ...args: Parameters<ModuleFederation['preloadRemote']>\n): ReturnType<ModuleFederation['preloadRemote']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.preloadRemote.apply(FederationInstance, args);\n}\n\nexport function registerRemotes(\n ...args: Parameters<ModuleFederation['registerRemotes']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerRemotes.apply(FederationInstance, args);\n}\n\nexport function registerPlugins(\n ...args: Parameters<ModuleFederation['registerPlugins']>\n): ReturnType<ModuleFederation['registerRemotes']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerPlugins.apply(FederationInstance, args);\n}\n\nexport function getInstance() {\n return FederationInstance;\n}\n\nexport function registerShared(\n ...args: Parameters<ModuleFederation['registerShared']>\n): ReturnType<ModuleFederation['registerShared']> {\n assert(FederationInstance, getShortErrorMsg(RUNTIME_009, runtimeDescMap));\n // eslint-disable-next-line prefer-spread\n return FederationInstance.registerShared.apply(FederationInstance, args);\n}\n\n// Inject for debug\nsetGlobalFederationConstructor(ModuleFederation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,oBAAoB,iBAAiB,aAAa,eAAe,CAAC;AAEzE,QAAO,mBAAmB,eAAe,MAAM,oBAAoB,KAAK;;AAI1E,+BAA+B,iBAAiB"}
package/dist/types.cjs ADDED
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+
4
+ var _module_federation_runtime_core_types = require("@module-federation/runtime-core/types");
5
+ Object.keys(_module_federation_runtime_core_types).forEach(function (k) {
6
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
7
+ enumerable: true,
8
+ get: function () { return _module_federation_runtime_core_types[k]; }
9
+ });
10
+ });
package/dist/types.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src/types";
1
+ export * from "@module-federation/runtime-core/types";
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from "@module-federation/runtime-core/types"
2
+
3
+ export { };
package/dist/utils.cjs ADDED
@@ -0,0 +1,20 @@
1
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
+ let _module_federation_runtime_core = require("@module-federation/runtime-core");
3
+
4
+ //#region src/utils.ts
5
+ function getBuilderId() {
6
+ return typeof FEDERATION_BUILD_IDENTIFIER !== "undefined" ? FEDERATION_BUILD_IDENTIFIER : "";
7
+ }
8
+ function getGlobalFederationInstance(name, version) {
9
+ const buildId = getBuilderId();
10
+ return _module_federation_runtime_core.CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => {
11
+ if (buildId && GMInstance.options.id === buildId) return true;
12
+ if (GMInstance.options.name === name && !GMInstance.options.version && !version) return true;
13
+ if (GMInstance.options.name === name && version && GMInstance.options.version === version) return true;
14
+ return false;
15
+ });
16
+ }
17
+
18
+ //#endregion
19
+ exports.getGlobalFederationInstance = getGlobalFederationInstance;
20
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["CurrentGlobal"],"sources":["../src/utils.ts"],"sourcesContent":["import type { ModuleFederation } from '@module-federation/runtime-core';\nimport { CurrentGlobal } from '@module-federation/runtime-core';\n\n// injected by bundler, so it can not use runtime-core stuff\nexport function getBuilderId(): string {\n //@ts-ignore\n return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined'\n ? //@ts-ignore\n FEDERATION_BUILD_IDENTIFIER\n : '';\n}\n\nexport function getGlobalFederationInstance(\n name: string,\n version: string | undefined,\n): ModuleFederation | undefined {\n const buildId = getBuilderId();\n return CurrentGlobal.__FEDERATION__.__INSTANCES__.find(\n (GMInstance: ModuleFederation) => {\n if (buildId && GMInstance.options.id === buildId) {\n return true;\n }\n\n if (\n GMInstance.options.name === name &&\n !GMInstance.options.version &&\n !version\n ) {\n return true;\n }\n\n if (\n GMInstance.options.name === name &&\n version &&\n GMInstance.options.version === version\n ) {\n return true;\n }\n return false;\n },\n );\n}\n"],"mappings":";;;;AAIA,SAAgB,eAAuB;AAErC,QAAO,OAAO,gCAAgC,cAE1C,8BACA;;AAGN,SAAgB,4BACd,MACA,SAC8B;CAC9B,MAAM,UAAU,cAAc;AAC9B,QAAOA,8CAAc,eAAe,cAAc,MAC/C,eAAiC;AAChC,MAAI,WAAW,WAAW,QAAQ,OAAO,QACvC,QAAO;AAGT,MACE,WAAW,QAAQ,SAAS,QAC5B,CAAC,WAAW,QAAQ,WACpB,CAAC,QAED,QAAO;AAGT,MACE,WAAW,QAAQ,SAAS,QAC5B,WACA,WAAW,QAAQ,YAAY,QAE/B,QAAO;AAET,SAAO;GAEV"}
@@ -0,0 +1,7 @@
1
+ import { ModuleFederation } from "@module-federation/runtime-core";
2
+
3
+ //#region src/utils.d.ts
4
+ declare function getGlobalFederationInstance(name: string, version: string | undefined): ModuleFederation | undefined;
5
+ //#endregion
6
+ export { getGlobalFederationInstance };
7
+ //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js ADDED
@@ -0,0 +1,19 @@
1
+ import { CurrentGlobal } from "@module-federation/runtime-core";
2
+
3
+ //#region src/utils.ts
4
+ function getBuilderId() {
5
+ return typeof FEDERATION_BUILD_IDENTIFIER !== "undefined" ? FEDERATION_BUILD_IDENTIFIER : "";
6
+ }
7
+ function getGlobalFederationInstance(name, version) {
8
+ const buildId = getBuilderId();
9
+ return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => {
10
+ if (buildId && GMInstance.options.id === buildId) return true;
11
+ if (GMInstance.options.name === name && !GMInstance.options.version && !version) return true;
12
+ if (GMInstance.options.name === name && version && GMInstance.options.version === version) return true;
13
+ return false;
14
+ });
15
+ }
16
+
17
+ //#endregion
18
+ export { getGlobalFederationInstance };
19
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { ModuleFederation } from '@module-federation/runtime-core';\nimport { CurrentGlobal } from '@module-federation/runtime-core';\n\n// injected by bundler, so it can not use runtime-core stuff\nexport function getBuilderId(): string {\n //@ts-ignore\n return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined'\n ? //@ts-ignore\n FEDERATION_BUILD_IDENTIFIER\n : '';\n}\n\nexport function getGlobalFederationInstance(\n name: string,\n version: string | undefined,\n): ModuleFederation | undefined {\n const buildId = getBuilderId();\n return CurrentGlobal.__FEDERATION__.__INSTANCES__.find(\n (GMInstance: ModuleFederation) => {\n if (buildId && GMInstance.options.id === buildId) {\n return true;\n }\n\n if (\n GMInstance.options.name === name &&\n !GMInstance.options.version &&\n !version\n ) {\n return true;\n }\n\n if (\n GMInstance.options.name === name &&\n version &&\n GMInstance.options.version === version\n ) {\n return true;\n }\n return false;\n },\n );\n}\n"],"mappings":";;;AAIA,SAAgB,eAAuB;AAErC,QAAO,OAAO,gCAAgC,cAE1C,8BACA;;AAGN,SAAgB,4BACd,MACA,SAC8B;CAC9B,MAAM,UAAU,cAAc;AAC9B,QAAO,cAAc,eAAe,cAAc,MAC/C,eAAiC;AAChC,MAAI,WAAW,WAAW,QAAQ,OAAO,QACvC,QAAO;AAGT,MACE,WAAW,QAAQ,SAAS,QAC5B,CAAC,WAAW,QAAQ,WACpB,CAAC,QAED,QAAO;AAGT,MACE,WAAW,QAAQ,SAAS,QAC5B,WACA,WAAW,QAAQ,YAAY,QAE/B,QAAO;AAET,SAAO;GAEV"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "author": "zhouxiao <codingzx@gmail.com>",
6
- "main": "./dist/index.cjs.cjs",
7
- "module": "./dist/index.esm.js",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "browser": {
10
10
  "url": false
@@ -26,41 +26,41 @@
26
26
  ".": {
27
27
  "import": {
28
28
  "types": "./dist/index.d.ts",
29
- "default": "./dist/index.esm.js"
29
+ "default": "./dist/index.js"
30
30
  },
31
31
  "require": {
32
32
  "types": "./dist/index.d.ts",
33
- "default": "./dist/index.cjs.cjs"
33
+ "default": "./dist/index.cjs"
34
34
  }
35
35
  },
36
36
  "./helpers": {
37
37
  "import": {
38
38
  "types": "./dist/helpers.d.ts",
39
- "default": "./dist/helpers.esm.js"
39
+ "default": "./dist/helpers.js"
40
40
  },
41
41
  "require": {
42
42
  "types": "./dist/helpers.d.ts",
43
- "default": "./dist/helpers.cjs.cjs"
43
+ "default": "./dist/helpers.cjs"
44
44
  }
45
45
  },
46
46
  "./types": {
47
47
  "import": {
48
48
  "types": "./dist/types.d.ts",
49
- "default": "./dist/types.esm.js"
49
+ "default": "./dist/types.js"
50
50
  },
51
51
  "require": {
52
52
  "types": "./dist/types.d.ts",
53
- "default": "./dist/types.cjs.cjs"
53
+ "default": "./dist/types.cjs"
54
54
  }
55
55
  },
56
56
  "./core": {
57
57
  "import": {
58
58
  "types": "./dist/core.d.ts",
59
- "default": "./dist/core.esm.js"
59
+ "default": "./dist/core.js"
60
60
  },
61
61
  "require": {
62
62
  "types": "./dist/core.d.ts",
63
- "default": "./dist/core.cjs.cjs"
63
+ "default": "./dist/core.cjs"
64
64
  }
65
65
  },
66
66
  "./*": "./*"
@@ -82,8 +82,8 @@
82
82
  }
83
83
  },
84
84
  "dependencies": {
85
- "@module-federation/error-codes": "2.0.1",
86
- "@module-federation/runtime-core": "2.0.1",
87
- "@module-federation/sdk": "2.0.1"
85
+ "@module-federation/error-codes": "2.1.0",
86
+ "@module-federation/sdk": "2.1.0",
87
+ "@module-federation/runtime-core": "2.1.0"
88
88
  }
89
89
  }
package/dist/core.cjs.cjs DELETED
@@ -1,33 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.cjs.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from "./src/core";
2
- export { default } from "./src/core";
package/dist/core.esm.js DELETED
@@ -1,4 +0,0 @@
1
- import * as runtimeCore from '@module-federation/runtime-core';
2
- export * from '@module-federation/runtime-core';
3
- export { runtimeCore as default };
4
- //# sourceMappingURL=core.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,24 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var runtimeCore = require('@module-federation/runtime-core');
6
- var utils$1 = require('./utils.cjs.cjs');
7
-
8
- const global = {
9
- ...runtimeCore.helpers.global,
10
- getGlobalFederationInstance: utils$1.getGlobalFederationInstance,
11
- };
12
- const share = runtimeCore.helpers.share;
13
- const utils = runtimeCore.helpers.utils;
14
- const runtimeHelpers = {
15
- global,
16
- share,
17
- utils,
18
- };
19
-
20
- exports.default = runtimeHelpers;
21
- exports.global = global;
22
- exports.share = share;
23
- exports.utils = utils;
24
- //# sourceMappingURL=helpers.cjs.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.cjs.cjs","sources":["../src/helpers.ts"],"sourcesContent":[null],"names":["helpers","getGlobalFederationInstance"],"mappings":";;;;;;;AAQO,MAAM,MAAM,GAAG;IACpB,GAAGA,mBAAO,CAAC,MAAM;iCACjBC,mCAA2B;;AAGtB,MAAM,KAAK,GAAGD,mBAAO,CAAC;AAEtB,MAAM,KAAK,GAAGA,mBAAO,CAAC;AAE7B,MAAM,cAAc,GAAG;IACrB,MAAM;IACN,KAAK;IACL,KAAK;;;;;;;;"}
@@ -1,2 +0,0 @@
1
- export * from "./src/helpers";
2
- export { default } from "./src/helpers";
@@ -1,17 +0,0 @@
1
- import { helpers } from '@module-federation/runtime-core';
2
- import { g as getGlobalFederationInstance } from './utils.esm.js';
3
-
4
- const global = {
5
- ...helpers.global,
6
- getGlobalFederationInstance,
7
- };
8
- const share = helpers.share;
9
- const utils = helpers.utils;
10
- const runtimeHelpers = {
11
- global,
12
- share,
13
- utils,
14
- };
15
-
16
- export { runtimeHelpers as default, global, share, utils };
17
- //# sourceMappingURL=helpers.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.esm.js","sources":["../src/helpers.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQO,MAAM,MAAM,GAAG;IACpB,GAAG,OAAO,CAAC,MAAM;IACjB,2BAA2B;;AAGtB,MAAM,KAAK,GAAG,OAAO,CAAC;AAEtB,MAAM,KAAK,GAAG,OAAO,CAAC;AAE7B,MAAM,cAAc,GAAG;IACrB,MAAM;IACN,KAAK;IACL,KAAK;;;;;"}
@@ -1,95 +0,0 @@
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
@@ -1 +0,0 @@
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":";;;;;;AA4BM,SAAU,cAAc,CAAC,OAAoB,EAAA;;AAEjD,IAAA,MAAM,2BAA2B,GAC/BA,0CAA8B,EAAE,IAAIC,4BAAgB;AACtD,IAAA,MAAM,QAAQ,GAAG,IAAI,2BAA2B,CAAC,OAAO,CAAC;IACzDC,uCAA2B,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,GAAGC,iCAA2B,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;IAEnDC,kBAAM,CA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c,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;IAEvDH,kBAAM,CAAC,kBAAkB,EAAEC,2BAAgB,CAACC,sBAAW,EAAEC,yBAAc,CAAC,CAAC;;IAEzE,OAAO,kBAAkB,CAAC,cAAc,CAAC,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;AAC1E;AAEA;AACAC,0CAA8B,CAACP,4BAAgB,CAAC;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from "./src/index";
package/dist/index.esm.js DELETED
@@ -1,78 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sour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ore;
@@ -1,37 +0,0 @@
1
- import { helpers } from '@module-federation/runtime-core';
2
- import { getGlobalFederationInstance } from './utils';
3
- export type { IGlobalUtils, IShareUtils, } from '@module-federation/runtime-core';
4
- export declare const global: {
5
- getGlobalFederationInstance: typeof getGlobalFederationInstance;
6
- Global: typeof import("@module-federation/runtime-core").Global;
7
- nativeGlobal: typeof globalThis.global;
8
- resetFederationGlobalInfo: typeof import("@module-federation/runtime-core").resetFederationGlobalInfo;
9
- setGlobalFederationInstance: typeof import("@module-federation/runtime-core").setGlobalFederationInstance;
10
- getGlobalFederationConstructor: typeof import("@module-federation/runtime-core").getGlobalFederationConstructor;
11
- setGlobalFederationConstructor: typeof import("@module-federation/runtime-core").setGlobalFederationConstructor;
12
- getInfoWithoutType: typeof import("@module-federation/runtime-core").getInfoWithoutType;
13
- getGlobalSnapshot: typeof import("@module-federation/runtime-core").getGlobalSnapshot;
14
- getTargetSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getTargetSnapshotInfoByModuleInfo;
15
- getGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getGlobalSnapshotInfoByModuleInfo;
16
- setGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").setGlobalSnapshotInfoByModuleInfo;
17
- addGlobalSnapshot: typeof import("@module-federation/runtime-core").addGlobalSnapshot;
18
- getRemoteEntryExports: typeof import("packages/runtime-core/dist/src/global").getRemoteEntryExports;
19
- registerGlobalPlugins: typeof import("@module-federation/runtime-core").registerGlobalPlugins;
20
- getGlobalHostPlugins: typeof import("packages/runtime-core/dist/src/global").getGlobalHostPlugins;
21
- getPreloaded: typeof import("packages/runtime-core/dist/src/global").getPreloaded;
22
- setPreloaded: typeof import("packages/runtime-core/dist/src/global").setPreloaded;
23
- };
24
- export declare const share: import("@module-federation/runtime-core").IShareUtils;
25
- export declare const utils: {
26
- matchRemoteWithNameAndExpose: typeof import("@module-federation/runtime-core").matchRemoteWithNameAndExpose;
27
- preloadAssets: typeof import("packages/runtime-core/dist/src/utils/preload").preloadAssets;
28
- getRemoteInfo: typeof import("@module-federation/runtime-core").getRemoteInfo;
29
- };
30
- declare const _default: {
31
- global: typeof helpers.global & {
32
- getGlobalFederationInstance: typeof getGlobalFederationInstance;
33
- };
34
- share: typeof helpers.share;
35
- utils: typeof helpers.utils;
36
- };
37
- export default _default;
@@ -1,16 +0,0 @@
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']>;
@@ -1 +0,0 @@
1
- export * from '@module-federation/runtime-core/types';
@@ -1,3 +0,0 @@
1
- import type { ModuleFederation } from '@module-federation/runtime-core';
2
- export declare function getBuilderId(): string;
3
- export declare function getGlobalFederationInstance(name: string, version: string | undefined): ModuleFederation | undefined;
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.cjs.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- export * from "./src/types";
package/dist/types.esm.js DELETED
@@ -1,2 +0,0 @@
1
- export * from '@module-federation/runtime-core/types';
2
- //# sourceMappingURL=types.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,34 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}
package/dist/utils.esm.js DELETED
@@ -1,32 +0,0 @@
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
@@ -1 +0,0 @@
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;;;;"}