@module-federation/runtime 0.10.0 → 0.11.1
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/package.json +4 -9
- package/dist/embedded.cjs.d.ts +0 -1
- package/dist/embedded.cjs.js +0 -283
- package/dist/embedded.esm.d.ts +0 -1
- package/dist/embedded.esm.mjs +0 -267
- package/dist/src/embedded.d.ts +0 -131
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.mjs",
|
|
@@ -39,11 +39,6 @@
|
|
|
39
39
|
"import": "./dist/core.esm.mjs",
|
|
40
40
|
"require": "./dist/core.cjs.js"
|
|
41
41
|
},
|
|
42
|
-
"./embedded": {
|
|
43
|
-
"types": "./dist/embedded.cjs.d.ts",
|
|
44
|
-
"import": "./dist/embedded.esm.mjs",
|
|
45
|
-
"require": "./dist/embedded.cjs.js"
|
|
46
|
-
},
|
|
47
42
|
"./*": "./*"
|
|
48
43
|
},
|
|
49
44
|
"typesVersions": {
|
|
@@ -63,8 +58,8 @@
|
|
|
63
58
|
}
|
|
64
59
|
},
|
|
65
60
|
"dependencies": {
|
|
66
|
-
"@module-federation/sdk": "0.
|
|
67
|
-
"@module-federation/error-codes": "0.
|
|
68
|
-
"@module-federation/runtime-core": "0.
|
|
61
|
+
"@module-federation/sdk": "0.11.1",
|
|
62
|
+
"@module-federation/error-codes": "0.11.1",
|
|
63
|
+
"@module-federation/runtime-core": "0.11.1"
|
|
69
64
|
}
|
|
70
65
|
}
|
package/dist/embedded.cjs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/embedded";
|
package/dist/embedded.cjs.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function getRuntime() {
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
const runtime = __webpack_require__.federation.runtime;
|
|
6
|
-
if (!runtime) {
|
|
7
|
-
throw new Error('Federation runtime accessed before instantiation or installation');
|
|
8
|
-
}
|
|
9
|
-
return runtime;
|
|
10
|
-
}
|
|
11
|
-
const registerGlobalPlugins = (...args)=>{
|
|
12
|
-
return getRuntime().registerGlobalPlugins(...args);
|
|
13
|
-
};
|
|
14
|
-
const getRemoteEntry = (...args)=>{
|
|
15
|
-
return getRuntime().getRemoteEntry(...args);
|
|
16
|
-
};
|
|
17
|
-
const getRemoteInfo = (...args)=>{
|
|
18
|
-
return getRuntime().getRemoteInfo(...args);
|
|
19
|
-
};
|
|
20
|
-
const loadScript = (...args)=>{
|
|
21
|
-
return getRuntime().loadScript(...args);
|
|
22
|
-
};
|
|
23
|
-
const loadScriptNode = (...args)=>{
|
|
24
|
-
return getRuntime().loadScriptNode(...args);
|
|
25
|
-
};
|
|
26
|
-
const init = (...args)=>{
|
|
27
|
-
return getRuntime().init(...args);
|
|
28
|
-
};
|
|
29
|
-
const loadRemote = (...args)=>{
|
|
30
|
-
return getRuntime().loadRemote(...args);
|
|
31
|
-
};
|
|
32
|
-
const loadShare = (...args)=>{
|
|
33
|
-
return getRuntime().loadShare(...args);
|
|
34
|
-
};
|
|
35
|
-
const loadShareSync = (...args)=>{
|
|
36
|
-
return getRuntime().loadShareSync(...args);
|
|
37
|
-
};
|
|
38
|
-
const preloadRemote = (...args)=>{
|
|
39
|
-
return getRuntime().preloadRemote(...args);
|
|
40
|
-
};
|
|
41
|
-
const registerRemotes = (...args)=>{
|
|
42
|
-
return getRuntime().registerRemotes(...args);
|
|
43
|
-
};
|
|
44
|
-
const registerPlugins = (...args)=>{
|
|
45
|
-
return getRuntime().registerPlugins(...args);
|
|
46
|
-
};
|
|
47
|
-
const getInstance = (...args)=>{
|
|
48
|
-
return getRuntime().getInstance(...args);
|
|
49
|
-
};
|
|
50
|
-
class FederationHost {
|
|
51
|
-
_getInstance() {
|
|
52
|
-
if (!this._instance) {
|
|
53
|
-
const RealFederationHost = getRuntime().FederationHost;
|
|
54
|
-
this._instance = new RealFederationHost(...this._args);
|
|
55
|
-
}
|
|
56
|
-
return this._instance;
|
|
57
|
-
}
|
|
58
|
-
get options() {
|
|
59
|
-
return this._getInstance().options;
|
|
60
|
-
}
|
|
61
|
-
set options(value) {
|
|
62
|
-
this._getInstance().options = value;
|
|
63
|
-
}
|
|
64
|
-
get hooks() {
|
|
65
|
-
return this._getInstance().hooks;
|
|
66
|
-
}
|
|
67
|
-
get version() {
|
|
68
|
-
return this._getInstance().version;
|
|
69
|
-
}
|
|
70
|
-
get name() {
|
|
71
|
-
return this._getInstance().name;
|
|
72
|
-
}
|
|
73
|
-
get moduleCache() {
|
|
74
|
-
return this._getInstance().moduleCache;
|
|
75
|
-
}
|
|
76
|
-
get snapshotHandler() {
|
|
77
|
-
return this._getInstance().snapshotHandler;
|
|
78
|
-
}
|
|
79
|
-
get sharedHandler() {
|
|
80
|
-
return this._getInstance().sharedHandler;
|
|
81
|
-
}
|
|
82
|
-
get remoteHandler() {
|
|
83
|
-
return this._getInstance().remoteHandler;
|
|
84
|
-
}
|
|
85
|
-
get shareScopeMap() {
|
|
86
|
-
return this._getInstance().shareScopeMap;
|
|
87
|
-
}
|
|
88
|
-
get loaderHook() {
|
|
89
|
-
return this._getInstance().loaderHook;
|
|
90
|
-
}
|
|
91
|
-
get bridgeHook() {
|
|
92
|
-
return this._getInstance().bridgeHook;
|
|
93
|
-
}
|
|
94
|
-
initOptions(...args) {
|
|
95
|
-
return this._getInstance().initOptions(...args);
|
|
96
|
-
}
|
|
97
|
-
loadShare(...args) {
|
|
98
|
-
return this._getInstance().loadShare(...args);
|
|
99
|
-
}
|
|
100
|
-
loadShareSync(...args) {
|
|
101
|
-
return this._getInstance().loadShareSync(...args);
|
|
102
|
-
}
|
|
103
|
-
initializeSharing(...args) {
|
|
104
|
-
return this._getInstance().initializeSharing(...args);
|
|
105
|
-
}
|
|
106
|
-
initRawContainer(...args) {
|
|
107
|
-
return this._getInstance().initRawContainer(...args);
|
|
108
|
-
}
|
|
109
|
-
loadRemote(...args) {
|
|
110
|
-
return this._getInstance().loadRemote(...args);
|
|
111
|
-
}
|
|
112
|
-
preloadRemote(...args) {
|
|
113
|
-
return this._getInstance().preloadRemote(...args);
|
|
114
|
-
}
|
|
115
|
-
initShareScopeMap(...args) {
|
|
116
|
-
return this._getInstance().initShareScopeMap(...args);
|
|
117
|
-
}
|
|
118
|
-
registerPlugins(...args) {
|
|
119
|
-
return this._getInstance().registerPlugins(...args);
|
|
120
|
-
}
|
|
121
|
-
registerRemotes(...args) {
|
|
122
|
-
return this._getInstance().registerRemotes(...args);
|
|
123
|
-
}
|
|
124
|
-
formatOptions(...args) {
|
|
125
|
-
//@ts-ignore
|
|
126
|
-
return this._getInstance().formatOptions(...args);
|
|
127
|
-
}
|
|
128
|
-
constructor(...args){
|
|
129
|
-
this._instance = null;
|
|
130
|
-
this._args = args;
|
|
131
|
-
const RealFederationHost = getRuntime().FederationHost;
|
|
132
|
-
this._instance = new RealFederationHost(...this._args);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
class Module {
|
|
136
|
-
_getInstance() {
|
|
137
|
-
if (!this._instance) {
|
|
138
|
-
const RealModule = getRuntime().Module;
|
|
139
|
-
this._instance = new RealModule(...this._args);
|
|
140
|
-
}
|
|
141
|
-
return this._instance;
|
|
142
|
-
}
|
|
143
|
-
get remoteInfo() {
|
|
144
|
-
return this._getInstance().remoteInfo;
|
|
145
|
-
}
|
|
146
|
-
set remoteInfo(value) {
|
|
147
|
-
this._getInstance().remoteInfo = value;
|
|
148
|
-
}
|
|
149
|
-
get inited() {
|
|
150
|
-
return this._getInstance().inited;
|
|
151
|
-
}
|
|
152
|
-
set inited(value) {
|
|
153
|
-
this._getInstance().inited = value;
|
|
154
|
-
}
|
|
155
|
-
get lib() {
|
|
156
|
-
return this._getInstance().lib;
|
|
157
|
-
}
|
|
158
|
-
set lib(value) {
|
|
159
|
-
this._getInstance().lib = value;
|
|
160
|
-
}
|
|
161
|
-
get host() {
|
|
162
|
-
return this._getInstance().host;
|
|
163
|
-
}
|
|
164
|
-
set host(value) {
|
|
165
|
-
this._getInstance().host = value;
|
|
166
|
-
}
|
|
167
|
-
async getEntry(...args) {
|
|
168
|
-
return this._getInstance().getEntry(...args);
|
|
169
|
-
}
|
|
170
|
-
async get(...args) {
|
|
171
|
-
return this._getInstance().get(...args);
|
|
172
|
-
}
|
|
173
|
-
wraperFactory(...args) {
|
|
174
|
-
//@ts-ignore
|
|
175
|
-
return this._getInstance().wraperFactory(...args);
|
|
176
|
-
}
|
|
177
|
-
constructor(...args){
|
|
178
|
-
this._instance = null;
|
|
179
|
-
this._args = args;
|
|
180
|
-
}
|
|
181
|
-
} //maybe use proxy?
|
|
182
|
-
//export class Module implements ModuleInterface {
|
|
183
|
-
// private _instance: IndexModule.Module | null = null;
|
|
184
|
-
// private _args: ConstructorParameters<typeof IndexModule.Module>;
|
|
185
|
-
// constructor(...args: ConstructorParameters<typeof IndexModule.Module>) {
|
|
186
|
-
// this._args = args;
|
|
187
|
-
// return new Proxy(this, {
|
|
188
|
-
// get(target, prop) {
|
|
189
|
-
// if (prop in target) {
|
|
190
|
-
// return target[prop as keyof Module];
|
|
191
|
-
// }
|
|
192
|
-
// const instance = target._getInstance();
|
|
193
|
-
// const value = instance[prop as keyof IndexModule.Module];
|
|
194
|
-
// return typeof value === 'function' ? value.bind(instance) : value;
|
|
195
|
-
// },
|
|
196
|
-
// set(target, prop, value) {
|
|
197
|
-
// const instance = target._getInstance();
|
|
198
|
-
// instance[prop as keyof IndexModule.Module] = value;
|
|
199
|
-
// return true;
|
|
200
|
-
// },
|
|
201
|
-
// });
|
|
202
|
-
// }
|
|
203
|
-
// private _getInstance(): IndexModule.Module {
|
|
204
|
-
// if (!this._instance) {
|
|
205
|
-
// const RealModule = getRuntime().Module;
|
|
206
|
-
// this._instance = new RealModule(...this._args);
|
|
207
|
-
// }
|
|
208
|
-
// return this._instance;
|
|
209
|
-
// }
|
|
210
|
-
// // Keep only the methods that have custom logic
|
|
211
|
-
// private wraperFactory(...args: Parameters<IndexModule.Module['wraperFactory']>) {
|
|
212
|
-
// return this._getInstance().wraperFactory(...args);
|
|
213
|
-
// }
|
|
214
|
-
// }
|
|
215
|
-
//export class FederationHost implements IndexModule.FederationHost {
|
|
216
|
-
// private _instance: IndexModule.FederationHost | null = null;
|
|
217
|
-
// private _args: ConstructorParameters<typeof IndexModule.FederationHost>;
|
|
218
|
-
// constructor(...args: ConstructorParameters<typeof IndexModule.FederationHost>) {
|
|
219
|
-
// this._args = args;
|
|
220
|
-
// return new Proxy(this, {
|
|
221
|
-
// get(target, prop) {
|
|
222
|
-
// if (prop in target) {
|
|
223
|
-
// return target[prop as keyof FederationHost];
|
|
224
|
-
// }
|
|
225
|
-
// const instance = target._getInstance();
|
|
226
|
-
// const value = instance[prop as keyof IndexModule.FederationHost];
|
|
227
|
-
// return typeof value === 'function' ? value.bind(instance) : value;
|
|
228
|
-
// },
|
|
229
|
-
// set(target, prop, value) {
|
|
230
|
-
// const instance = target._getInstance();
|
|
231
|
-
// instance[prop as keyof IndexModule.FederationHost] = value;
|
|
232
|
-
// return true;
|
|
233
|
-
// },
|
|
234
|
-
// });
|
|
235
|
-
// }
|
|
236
|
-
// private _getInstance(): IndexModule.FederationHost {
|
|
237
|
-
// if (!this._instance) {
|
|
238
|
-
// const RealFederationHost = getRuntime().FederationHost;
|
|
239
|
-
// this._instance = new RealFederationHost(...this._args);
|
|
240
|
-
// }
|
|
241
|
-
// return this._instance;
|
|
242
|
-
// }
|
|
243
|
-
// // Keep only the methods that have custom logic
|
|
244
|
-
// formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>) {
|
|
245
|
-
// return this._getInstance().formatOptions(...args);
|
|
246
|
-
// }
|
|
247
|
-
// }
|
|
248
|
-
//function createRuntimeFunction<T extends keyof typeof IndexModule>(
|
|
249
|
-
// name: T
|
|
250
|
-
// ): typeof IndexModule[T] {
|
|
251
|
-
// return (...args: any[]) => {
|
|
252
|
-
// return getRuntime()[name](...args);
|
|
253
|
-
// };
|
|
254
|
-
// }
|
|
255
|
-
// export const registerGlobalPlugins = createRuntimeFunction('registerGlobalPlugins');
|
|
256
|
-
// export const getRemoteEntry = createRuntimeFunction('getRemoteEntry');
|
|
257
|
-
// export const getRemoteInfo = createRuntimeFunction('getRemoteInfo');
|
|
258
|
-
// export const loadScript = createRuntimeFunction('loadScript');
|
|
259
|
-
// export const loadScriptNode = createRuntimeFunction('loadScriptNode');
|
|
260
|
-
// export const init = createRuntimeFunction('init');
|
|
261
|
-
// export const loadRemote = createRuntimeFunction('loadRemote');
|
|
262
|
-
// export const loadShare = createRuntimeFunction('loadShare');
|
|
263
|
-
// export const loadShareSync = createRuntimeFunction('loadShareSync');
|
|
264
|
-
// export const preloadRemote = createRuntimeFunction('preloadRemote');
|
|
265
|
-
// export const registerRemotes = createRuntimeFunction('registerRemotes');
|
|
266
|
-
// export const registerPlugins = createRuntimeFunction('registerPlugins');
|
|
267
|
-
// export const getInstance = createRuntimeFunction('getInstance');
|
|
268
|
-
|
|
269
|
-
exports.FederationHost = FederationHost;
|
|
270
|
-
exports.Module = Module;
|
|
271
|
-
exports.getInstance = getInstance;
|
|
272
|
-
exports.getRemoteEntry = getRemoteEntry;
|
|
273
|
-
exports.getRemoteInfo = getRemoteInfo;
|
|
274
|
-
exports.init = init;
|
|
275
|
-
exports.loadRemote = loadRemote;
|
|
276
|
-
exports.loadScript = loadScript;
|
|
277
|
-
exports.loadScriptNode = loadScriptNode;
|
|
278
|
-
exports.loadShare = loadShare;
|
|
279
|
-
exports.loadShareSync = loadShareSync;
|
|
280
|
-
exports.preloadRemote = preloadRemote;
|
|
281
|
-
exports.registerGlobalPlugins = registerGlobalPlugins;
|
|
282
|
-
exports.registerPlugins = registerPlugins;
|
|
283
|
-
exports.registerRemotes = registerRemotes;
|
package/dist/embedded.esm.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/embedded";
|
package/dist/embedded.esm.mjs
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
function getRuntime() {
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
const runtime = __webpack_require__.federation.runtime;
|
|
4
|
-
if (!runtime) {
|
|
5
|
-
throw new Error('Federation runtime accessed before instantiation or installation');
|
|
6
|
-
}
|
|
7
|
-
return runtime;
|
|
8
|
-
}
|
|
9
|
-
const registerGlobalPlugins = (...args)=>{
|
|
10
|
-
return getRuntime().registerGlobalPlugins(...args);
|
|
11
|
-
};
|
|
12
|
-
const getRemoteEntry = (...args)=>{
|
|
13
|
-
return getRuntime().getRemoteEntry(...args);
|
|
14
|
-
};
|
|
15
|
-
const getRemoteInfo = (...args)=>{
|
|
16
|
-
return getRuntime().getRemoteInfo(...args);
|
|
17
|
-
};
|
|
18
|
-
const loadScript = (...args)=>{
|
|
19
|
-
return getRuntime().loadScript(...args);
|
|
20
|
-
};
|
|
21
|
-
const loadScriptNode = (...args)=>{
|
|
22
|
-
return getRuntime().loadScriptNode(...args);
|
|
23
|
-
};
|
|
24
|
-
const init = (...args)=>{
|
|
25
|
-
return getRuntime().init(...args);
|
|
26
|
-
};
|
|
27
|
-
const loadRemote = (...args)=>{
|
|
28
|
-
return getRuntime().loadRemote(...args);
|
|
29
|
-
};
|
|
30
|
-
const loadShare = (...args)=>{
|
|
31
|
-
return getRuntime().loadShare(...args);
|
|
32
|
-
};
|
|
33
|
-
const loadShareSync = (...args)=>{
|
|
34
|
-
return getRuntime().loadShareSync(...args);
|
|
35
|
-
};
|
|
36
|
-
const preloadRemote = (...args)=>{
|
|
37
|
-
return getRuntime().preloadRemote(...args);
|
|
38
|
-
};
|
|
39
|
-
const registerRemotes = (...args)=>{
|
|
40
|
-
return getRuntime().registerRemotes(...args);
|
|
41
|
-
};
|
|
42
|
-
const registerPlugins = (...args)=>{
|
|
43
|
-
return getRuntime().registerPlugins(...args);
|
|
44
|
-
};
|
|
45
|
-
const getInstance = (...args)=>{
|
|
46
|
-
return getRuntime().getInstance(...args);
|
|
47
|
-
};
|
|
48
|
-
class FederationHost {
|
|
49
|
-
_getInstance() {
|
|
50
|
-
if (!this._instance) {
|
|
51
|
-
const RealFederationHost = getRuntime().FederationHost;
|
|
52
|
-
this._instance = new RealFederationHost(...this._args);
|
|
53
|
-
}
|
|
54
|
-
return this._instance;
|
|
55
|
-
}
|
|
56
|
-
get options() {
|
|
57
|
-
return this._getInstance().options;
|
|
58
|
-
}
|
|
59
|
-
set options(value) {
|
|
60
|
-
this._getInstance().options = value;
|
|
61
|
-
}
|
|
62
|
-
get hooks() {
|
|
63
|
-
return this._getInstance().hooks;
|
|
64
|
-
}
|
|
65
|
-
get version() {
|
|
66
|
-
return this._getInstance().version;
|
|
67
|
-
}
|
|
68
|
-
get name() {
|
|
69
|
-
return this._getInstance().name;
|
|
70
|
-
}
|
|
71
|
-
get moduleCache() {
|
|
72
|
-
return this._getInstance().moduleCache;
|
|
73
|
-
}
|
|
74
|
-
get snapshotHandler() {
|
|
75
|
-
return this._getInstance().snapshotHandler;
|
|
76
|
-
}
|
|
77
|
-
get sharedHandler() {
|
|
78
|
-
return this._getInstance().sharedHandler;
|
|
79
|
-
}
|
|
80
|
-
get remoteHandler() {
|
|
81
|
-
return this._getInstance().remoteHandler;
|
|
82
|
-
}
|
|
83
|
-
get shareScopeMap() {
|
|
84
|
-
return this._getInstance().shareScopeMap;
|
|
85
|
-
}
|
|
86
|
-
get loaderHook() {
|
|
87
|
-
return this._getInstance().loaderHook;
|
|
88
|
-
}
|
|
89
|
-
get bridgeHook() {
|
|
90
|
-
return this._getInstance().bridgeHook;
|
|
91
|
-
}
|
|
92
|
-
initOptions(...args) {
|
|
93
|
-
return this._getInstance().initOptions(...args);
|
|
94
|
-
}
|
|
95
|
-
loadShare(...args) {
|
|
96
|
-
return this._getInstance().loadShare(...args);
|
|
97
|
-
}
|
|
98
|
-
loadShareSync(...args) {
|
|
99
|
-
return this._getInstance().loadShareSync(...args);
|
|
100
|
-
}
|
|
101
|
-
initializeSharing(...args) {
|
|
102
|
-
return this._getInstance().initializeSharing(...args);
|
|
103
|
-
}
|
|
104
|
-
initRawContainer(...args) {
|
|
105
|
-
return this._getInstance().initRawContainer(...args);
|
|
106
|
-
}
|
|
107
|
-
loadRemote(...args) {
|
|
108
|
-
return this._getInstance().loadRemote(...args);
|
|
109
|
-
}
|
|
110
|
-
preloadRemote(...args) {
|
|
111
|
-
return this._getInstance().preloadRemote(...args);
|
|
112
|
-
}
|
|
113
|
-
initShareScopeMap(...args) {
|
|
114
|
-
return this._getInstance().initShareScopeMap(...args);
|
|
115
|
-
}
|
|
116
|
-
registerPlugins(...args) {
|
|
117
|
-
return this._getInstance().registerPlugins(...args);
|
|
118
|
-
}
|
|
119
|
-
registerRemotes(...args) {
|
|
120
|
-
return this._getInstance().registerRemotes(...args);
|
|
121
|
-
}
|
|
122
|
-
formatOptions(...args) {
|
|
123
|
-
//@ts-ignore
|
|
124
|
-
return this._getInstance().formatOptions(...args);
|
|
125
|
-
}
|
|
126
|
-
constructor(...args){
|
|
127
|
-
this._instance = null;
|
|
128
|
-
this._args = args;
|
|
129
|
-
const RealFederationHost = getRuntime().FederationHost;
|
|
130
|
-
this._instance = new RealFederationHost(...this._args);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
class Module {
|
|
134
|
-
_getInstance() {
|
|
135
|
-
if (!this._instance) {
|
|
136
|
-
const RealModule = getRuntime().Module;
|
|
137
|
-
this._instance = new RealModule(...this._args);
|
|
138
|
-
}
|
|
139
|
-
return this._instance;
|
|
140
|
-
}
|
|
141
|
-
get remoteInfo() {
|
|
142
|
-
return this._getInstance().remoteInfo;
|
|
143
|
-
}
|
|
144
|
-
set remoteInfo(value) {
|
|
145
|
-
this._getInstance().remoteInfo = value;
|
|
146
|
-
}
|
|
147
|
-
get inited() {
|
|
148
|
-
return this._getInstance().inited;
|
|
149
|
-
}
|
|
150
|
-
set inited(value) {
|
|
151
|
-
this._getInstance().inited = value;
|
|
152
|
-
}
|
|
153
|
-
get lib() {
|
|
154
|
-
return this._getInstance().lib;
|
|
155
|
-
}
|
|
156
|
-
set lib(value) {
|
|
157
|
-
this._getInstance().lib = value;
|
|
158
|
-
}
|
|
159
|
-
get host() {
|
|
160
|
-
return this._getInstance().host;
|
|
161
|
-
}
|
|
162
|
-
set host(value) {
|
|
163
|
-
this._getInstance().host = value;
|
|
164
|
-
}
|
|
165
|
-
async getEntry(...args) {
|
|
166
|
-
return this._getInstance().getEntry(...args);
|
|
167
|
-
}
|
|
168
|
-
async get(...args) {
|
|
169
|
-
return this._getInstance().get(...args);
|
|
170
|
-
}
|
|
171
|
-
wraperFactory(...args) {
|
|
172
|
-
//@ts-ignore
|
|
173
|
-
return this._getInstance().wraperFactory(...args);
|
|
174
|
-
}
|
|
175
|
-
constructor(...args){
|
|
176
|
-
this._instance = null;
|
|
177
|
-
this._args = args;
|
|
178
|
-
}
|
|
179
|
-
} //maybe use proxy?
|
|
180
|
-
//export class Module implements ModuleInterface {
|
|
181
|
-
// private _instance: IndexModule.Module | null = null;
|
|
182
|
-
// private _args: ConstructorParameters<typeof IndexModule.Module>;
|
|
183
|
-
// constructor(...args: ConstructorParameters<typeof IndexModule.Module>) {
|
|
184
|
-
// this._args = args;
|
|
185
|
-
// return new Proxy(this, {
|
|
186
|
-
// get(target, prop) {
|
|
187
|
-
// if (prop in target) {
|
|
188
|
-
// return target[prop as keyof Module];
|
|
189
|
-
// }
|
|
190
|
-
// const instance = target._getInstance();
|
|
191
|
-
// const value = instance[prop as keyof IndexModule.Module];
|
|
192
|
-
// return typeof value === 'function' ? value.bind(instance) : value;
|
|
193
|
-
// },
|
|
194
|
-
// set(target, prop, value) {
|
|
195
|
-
// const instance = target._getInstance();
|
|
196
|
-
// instance[prop as keyof IndexModule.Module] = value;
|
|
197
|
-
// return true;
|
|
198
|
-
// },
|
|
199
|
-
// });
|
|
200
|
-
// }
|
|
201
|
-
// private _getInstance(): IndexModule.Module {
|
|
202
|
-
// if (!this._instance) {
|
|
203
|
-
// const RealModule = getRuntime().Module;
|
|
204
|
-
// this._instance = new RealModule(...this._args);
|
|
205
|
-
// }
|
|
206
|
-
// return this._instance;
|
|
207
|
-
// }
|
|
208
|
-
// // Keep only the methods that have custom logic
|
|
209
|
-
// private wraperFactory(...args: Parameters<IndexModule.Module['wraperFactory']>) {
|
|
210
|
-
// return this._getInstance().wraperFactory(...args);
|
|
211
|
-
// }
|
|
212
|
-
// }
|
|
213
|
-
//export class FederationHost implements IndexModule.FederationHost {
|
|
214
|
-
// private _instance: IndexModule.FederationHost | null = null;
|
|
215
|
-
// private _args: ConstructorParameters<typeof IndexModule.FederationHost>;
|
|
216
|
-
// constructor(...args: ConstructorParameters<typeof IndexModule.FederationHost>) {
|
|
217
|
-
// this._args = args;
|
|
218
|
-
// return new Proxy(this, {
|
|
219
|
-
// get(target, prop) {
|
|
220
|
-
// if (prop in target) {
|
|
221
|
-
// return target[prop as keyof FederationHost];
|
|
222
|
-
// }
|
|
223
|
-
// const instance = target._getInstance();
|
|
224
|
-
// const value = instance[prop as keyof IndexModule.FederationHost];
|
|
225
|
-
// return typeof value === 'function' ? value.bind(instance) : value;
|
|
226
|
-
// },
|
|
227
|
-
// set(target, prop, value) {
|
|
228
|
-
// const instance = target._getInstance();
|
|
229
|
-
// instance[prop as keyof IndexModule.FederationHost] = value;
|
|
230
|
-
// return true;
|
|
231
|
-
// },
|
|
232
|
-
// });
|
|
233
|
-
// }
|
|
234
|
-
// private _getInstance(): IndexModule.FederationHost {
|
|
235
|
-
// if (!this._instance) {
|
|
236
|
-
// const RealFederationHost = getRuntime().FederationHost;
|
|
237
|
-
// this._instance = new RealFederationHost(...this._args);
|
|
238
|
-
// }
|
|
239
|
-
// return this._instance;
|
|
240
|
-
// }
|
|
241
|
-
// // Keep only the methods that have custom logic
|
|
242
|
-
// formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>) {
|
|
243
|
-
// return this._getInstance().formatOptions(...args);
|
|
244
|
-
// }
|
|
245
|
-
// }
|
|
246
|
-
//function createRuntimeFunction<T extends keyof typeof IndexModule>(
|
|
247
|
-
// name: T
|
|
248
|
-
// ): typeof IndexModule[T] {
|
|
249
|
-
// return (...args: any[]) => {
|
|
250
|
-
// return getRuntime()[name](...args);
|
|
251
|
-
// };
|
|
252
|
-
// }
|
|
253
|
-
// export const registerGlobalPlugins = createRuntimeFunction('registerGlobalPlugins');
|
|
254
|
-
// export const getRemoteEntry = createRuntimeFunction('getRemoteEntry');
|
|
255
|
-
// export const getRemoteInfo = createRuntimeFunction('getRemoteInfo');
|
|
256
|
-
// export const loadScript = createRuntimeFunction('loadScript');
|
|
257
|
-
// export const loadScriptNode = createRuntimeFunction('loadScriptNode');
|
|
258
|
-
// export const init = createRuntimeFunction('init');
|
|
259
|
-
// export const loadRemote = createRuntimeFunction('loadRemote');
|
|
260
|
-
// export const loadShare = createRuntimeFunction('loadShare');
|
|
261
|
-
// export const loadShareSync = createRuntimeFunction('loadShareSync');
|
|
262
|
-
// export const preloadRemote = createRuntimeFunction('preloadRemote');
|
|
263
|
-
// export const registerRemotes = createRuntimeFunction('registerRemotes');
|
|
264
|
-
// export const registerPlugins = createRuntimeFunction('registerPlugins');
|
|
265
|
-
// export const getInstance = createRuntimeFunction('getInstance');
|
|
266
|
-
|
|
267
|
-
export { FederationHost, Module, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadScript, loadScriptNode, loadShare, loadShareSync, preloadRemote, registerGlobalPlugins, registerPlugins, registerRemotes };
|
package/dist/src/embedded.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type * as IndexModule from './index';
|
|
2
|
-
export declare const registerGlobalPlugins: typeof IndexModule.registerGlobalPlugins;
|
|
3
|
-
export declare const getRemoteEntry: typeof IndexModule.getRemoteEntry;
|
|
4
|
-
export declare const getRemoteInfo: typeof IndexModule.getRemoteInfo;
|
|
5
|
-
export declare const loadScript: typeof IndexModule.loadScript;
|
|
6
|
-
export declare const loadScriptNode: typeof IndexModule.loadScriptNode;
|
|
7
|
-
export declare const init: typeof IndexModule.init;
|
|
8
|
-
export declare const loadRemote: typeof IndexModule.loadRemote;
|
|
9
|
-
export declare const loadShare: typeof IndexModule.loadShare;
|
|
10
|
-
export declare const loadShareSync: typeof IndexModule.loadShareSync;
|
|
11
|
-
export declare const preloadRemote: typeof IndexModule.preloadRemote;
|
|
12
|
-
export declare const registerRemotes: typeof IndexModule.registerRemotes;
|
|
13
|
-
export declare const registerPlugins: typeof IndexModule.registerPlugins;
|
|
14
|
-
export declare const getInstance: typeof IndexModule.getInstance;
|
|
15
|
-
export declare class FederationHost implements IndexModule.FederationHost {
|
|
16
|
-
private _instance;
|
|
17
|
-
private _args;
|
|
18
|
-
constructor(...args: ConstructorParameters<typeof IndexModule.FederationHost>);
|
|
19
|
-
private _getInstance;
|
|
20
|
-
get options(): import("packages/runtime-core/dist/types.cjs").Options;
|
|
21
|
-
set options(value: import("packages/runtime-core/dist/types.cjs").Options);
|
|
22
|
-
get hooks(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
23
|
-
beforeInit: import("packages/runtime-core/dist/src/utils/hooks").SyncWaterfallHook<{
|
|
24
|
-
userOptions: import("packages/runtime-core/dist/src").UserOptions;
|
|
25
|
-
options: import("packages/runtime-core/dist/types.cjs").Options;
|
|
26
|
-
origin: IndexModule.FederationHost;
|
|
27
|
-
shareInfo: import("packages/runtime-core/dist/types.cjs").ShareInfos;
|
|
28
|
-
}>;
|
|
29
|
-
init: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
30
|
-
options: import("packages/runtime-core/dist/types.cjs").Options;
|
|
31
|
-
origin: IndexModule.FederationHost;
|
|
32
|
-
}], void>;
|
|
33
|
-
beforeInitContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
|
|
34
|
-
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
|
|
35
|
-
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
|
|
36
|
-
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
|
|
37
|
-
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
38
|
-
origin: IndexModule.FederationHost;
|
|
39
|
-
}>;
|
|
40
|
-
initContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
|
|
41
|
-
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
|
|
42
|
-
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
|
|
43
|
-
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
|
|
44
|
-
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
45
|
-
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
|
|
46
|
-
origin: IndexModule.FederationHost;
|
|
47
|
-
id: string;
|
|
48
|
-
remoteSnapshot?: import("packages/sdk/dist/src").ModuleInfo;
|
|
49
|
-
}>;
|
|
50
|
-
}>;
|
|
51
|
-
get version(): string;
|
|
52
|
-
get name(): string;
|
|
53
|
-
get moduleCache(): Map<string, IndexModule.Module>;
|
|
54
|
-
get snapshotHandler(): import("packages/runtime-core/dist/src/plugins/snapshot/SnapshotHandler").SnapshotHandler;
|
|
55
|
-
get sharedHandler(): import("packages/runtime-core/dist/src/shared").SharedHandler;
|
|
56
|
-
get remoteHandler(): import("packages/runtime-core/dist/src/remote").RemoteHandler;
|
|
57
|
-
get shareScopeMap(): import("packages/runtime-core/dist/types.cjs").ShareScopeMap;
|
|
58
|
-
get loaderHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
59
|
-
getModuleInfo: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
60
|
-
target: Record<string, any>;
|
|
61
|
-
key: any;
|
|
62
|
-
}], void | {
|
|
63
|
-
value: any | undefined;
|
|
64
|
-
key: string;
|
|
65
|
-
}>;
|
|
66
|
-
createScript: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
67
|
-
url: string;
|
|
68
|
-
attrs?: Record<string, any>;
|
|
69
|
-
}], import("packages/sdk/dist/src").CreateScriptHookReturn>;
|
|
70
|
-
createLink: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
|
|
71
|
-
url: string;
|
|
72
|
-
attrs?: Record<string, any>;
|
|
73
|
-
}], void | HTMLLinkElement>;
|
|
74
|
-
fetch: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
|
|
75
|
-
loadEntryError: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
|
|
76
|
-
getRemoteEntry: typeof IndexModule.getRemoteEntry;
|
|
77
|
-
origin: IndexModule.FederationHost;
|
|
78
|
-
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
79
|
-
remoteEntryExports?: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
|
|
80
|
-
globalLoading: Record<string, Promise<void | import("packages/runtime-core/dist/types.cjs").RemoteEntryExports> | undefined>;
|
|
81
|
-
uniqueKey: string;
|
|
82
|
-
}], Promise<(() => Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined>) | undefined>>;
|
|
83
|
-
getModuleFactory: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
|
|
84
|
-
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
|
|
85
|
-
expose: string;
|
|
86
|
-
moduleInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
87
|
-
}], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
|
|
88
|
-
}>;
|
|
89
|
-
get bridgeHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
|
|
90
|
-
beforeBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
91
|
-
afterBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
92
|
-
beforeBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
93
|
-
afterBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
|
|
94
|
-
}>;
|
|
95
|
-
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
|
|
96
|
-
loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;
|
|
97
|
-
loadShareSync<T>(...args: Parameters<IndexModule.FederationHost['loadShareSync']>): () => T | never;
|
|
98
|
-
initializeSharing(...args: Parameters<IndexModule.FederationHost['initializeSharing']>): Promise<void>[];
|
|
99
|
-
initRawContainer(...args: Parameters<IndexModule.FederationHost['initRawContainer']>): IndexModule.Module;
|
|
100
|
-
loadRemote<T>(...args: Parameters<IndexModule.FederationHost['loadRemote']>): Promise<T | null>;
|
|
101
|
-
preloadRemote(...args: Parameters<IndexModule.FederationHost['preloadRemote']>): Promise<void>;
|
|
102
|
-
initShareScopeMap(...args: Parameters<IndexModule.FederationHost['initShareScopeMap']>): void;
|
|
103
|
-
registerPlugins(...args: Parameters<IndexModule.FederationHost['registerPlugins']>): void;
|
|
104
|
-
registerRemotes(...args: Parameters<IndexModule.FederationHost['registerRemotes']>): void;
|
|
105
|
-
formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
|
|
106
|
-
}
|
|
107
|
-
export interface ModuleInterface {
|
|
108
|
-
remoteInfo: IndexModule.Module['remoteInfo'];
|
|
109
|
-
inited: IndexModule.Module['inited'];
|
|
110
|
-
lib: IndexModule.Module['lib'];
|
|
111
|
-
host: IndexModule.Module['host'];
|
|
112
|
-
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): ReturnType<IndexModule.Module['getEntry']>;
|
|
113
|
-
get(...args: Parameters<IndexModule.Module['get']>): ReturnType<IndexModule.Module['get']>;
|
|
114
|
-
}
|
|
115
|
-
export declare class Module implements ModuleInterface {
|
|
116
|
-
private _instance;
|
|
117
|
-
private _args;
|
|
118
|
-
constructor(...args: ConstructorParameters<typeof IndexModule.Module>);
|
|
119
|
-
private _getInstance;
|
|
120
|
-
get remoteInfo(): import("packages/runtime-core/dist/types.cjs").RemoteInfo;
|
|
121
|
-
set remoteInfo(value: import("packages/runtime-core/dist/types.cjs").RemoteInfo);
|
|
122
|
-
get inited(): boolean;
|
|
123
|
-
set inited(value: boolean);
|
|
124
|
-
get lib(): import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
|
|
125
|
-
set lib(value: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined);
|
|
126
|
-
get host(): IndexModule.FederationHost;
|
|
127
|
-
set host(value: IndexModule.FederationHost);
|
|
128
|
-
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports>;
|
|
129
|
-
get(...args: Parameters<IndexModule.Module['get']>): Promise<any>;
|
|
130
|
-
private wraperFactory;
|
|
131
|
-
}
|