@module-federation/webpack-bundler-runtime 0.1.4 → 0.1.5
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 +3 -3
- package/dist/LICENSE +0 -21
- package/dist/constant.cjs.d.ts +0 -1
- package/dist/constant.cjs.js +0 -11
- package/dist/constant.esm.js +0 -6
- package/dist/index.cjs.d.ts +0 -2
- package/dist/index.cjs.js +0 -320
- package/dist/index.esm.js +0 -298
- package/dist/package.json +0 -47
- package/dist/src/attachShareScopeMap.d.ts +0 -2
- package/dist/src/constant.d.ts +0 -2
- package/dist/src/consumes.d.ts +0 -2
- package/dist/src/index.d.ts +0 -4
- package/dist/src/initContainerEntry.d.ts +0 -2
- package/dist/src/initializeSharing.d.ts +0 -2
- package/dist/src/installInitialConsumes.d.ts +0 -2
- package/dist/src/remotes.d.ts +0 -2
- package/dist/src/types.d.ts +0 -112
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"public": true,
|
|
3
3
|
"name": "@module-federation/webpack-bundler-runtime",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Module Federation Runtime for webpack",
|
|
7
7
|
"keywords": [
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"module": "./dist/index.esm.js",
|
|
21
21
|
"types": "./dist/index.cjs.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@module-federation/runtime": "0.1.
|
|
24
|
-
"@module-federation/sdk": "0.1.
|
|
23
|
+
"@module-federation/runtime": "0.1.5",
|
|
24
|
+
"@module-federation/sdk": "0.1.5"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
package/dist/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-present zhanghang(2heal1)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/dist/constant.cjs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/constant";
|
package/dist/constant.cjs.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var ENCODE_NAME_PREFIX = "ENCODE_NAME_PREFIX";
|
|
6
|
-
var FEDERATION_SUPPORTED_TYPES = [
|
|
7
|
-
"script"
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
exports.ENCODE_NAME_PREFIX = ENCODE_NAME_PREFIX;
|
|
11
|
-
exports.FEDERATION_SUPPORTED_TYPES = FEDERATION_SUPPORTED_TYPES;
|
package/dist/constant.esm.js
DELETED
package/dist/index.cjs.d.ts
DELETED
package/dist/index.cjs.js
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var runtime = require('@module-federation/runtime');
|
|
4
|
-
var sdk = require('@module-federation/sdk');
|
|
5
|
-
var constant = require('./constant.cjs.js');
|
|
6
|
-
|
|
7
|
-
function _interopNamespace(e) {
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
9
|
-
var n = Object.create(null);
|
|
10
|
-
if (e) {
|
|
11
|
-
Object.keys(e).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') {
|
|
13
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () { return e[k]; }
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
n["default"] = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var runtime__namespace = /*#__PURE__*/_interopNamespace(runtime);
|
|
26
|
-
|
|
27
|
-
function attachShareScopeMap(webpackRequire) {
|
|
28
|
-
if (!webpackRequire.S || webpackRequire.federation.hasAttachShareScopeMap || !webpackRequire.federation.instance || !webpackRequire.federation.instance.shareScopeMap) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
webpackRequire.S = webpackRequire.federation.instance.shareScopeMap;
|
|
32
|
-
webpackRequire.federation.hasAttachShareScopeMap = true;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function remotes(options) {
|
|
36
|
-
var chunkId = options.chunkId, promises = options.promises, chunkMapping = options.chunkMapping, idToExternalAndNameMapping = options.idToExternalAndNameMapping, webpackRequire = options.webpackRequire, idToRemoteMap = options.idToRemoteMap;
|
|
37
|
-
attachShareScopeMap(webpackRequire);
|
|
38
|
-
if (webpackRequire.o(chunkMapping, chunkId)) {
|
|
39
|
-
chunkMapping[chunkId].forEach(function(id) {
|
|
40
|
-
var getScope = webpackRequire.R;
|
|
41
|
-
if (!getScope) {
|
|
42
|
-
getScope = [];
|
|
43
|
-
}
|
|
44
|
-
var data = idToExternalAndNameMapping[id];
|
|
45
|
-
var remoteInfos = idToRemoteMap[id];
|
|
46
|
-
// @ts-ignore seems not work
|
|
47
|
-
if (getScope.indexOf(data) >= 0) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
// @ts-ignore seems not work
|
|
51
|
-
getScope.push(data);
|
|
52
|
-
if (data.p) {
|
|
53
|
-
return promises.push(data.p);
|
|
54
|
-
}
|
|
55
|
-
var onError = function(error) {
|
|
56
|
-
if (!error) {
|
|
57
|
-
error = new Error("Container missing");
|
|
58
|
-
}
|
|
59
|
-
if (typeof error.message === "string") {
|
|
60
|
-
error.message += '\nwhile loading "'.concat(data[1], '" from ').concat(data[2]);
|
|
61
|
-
}
|
|
62
|
-
webpackRequire.m[id] = function() {
|
|
63
|
-
throw error;
|
|
64
|
-
};
|
|
65
|
-
data.p = 0;
|
|
66
|
-
};
|
|
67
|
-
var handleFunction = function(fn, arg1, arg2, d, next, first) {
|
|
68
|
-
try {
|
|
69
|
-
var promise = fn(arg1, arg2);
|
|
70
|
-
if (promise && promise.then) {
|
|
71
|
-
var p = promise.then(function(result) {
|
|
72
|
-
return next(result, d);
|
|
73
|
-
}, onError);
|
|
74
|
-
if (first) {
|
|
75
|
-
promises.push(data.p = p);
|
|
76
|
-
} else {
|
|
77
|
-
return p;
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
return next(promise, d, first);
|
|
81
|
-
}
|
|
82
|
-
} catch (error) {
|
|
83
|
-
onError(error);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
var onExternal = function(external, _, first) {
|
|
87
|
-
return external ? handleFunction(webpackRequire.I, data[0], 0, external, onInitialized, first) : onError();
|
|
88
|
-
};
|
|
89
|
-
// eslint-disable-next-line no-var
|
|
90
|
-
var onInitialized = function(_, external, first) {
|
|
91
|
-
return handleFunction(external.get, data[1], getScope, 0, onFactory, first);
|
|
92
|
-
};
|
|
93
|
-
// eslint-disable-next-line no-var
|
|
94
|
-
var onFactory = function(factory) {
|
|
95
|
-
data.p = 1;
|
|
96
|
-
webpackRequire.m[id] = function(module) {
|
|
97
|
-
module.exports = factory();
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
var onRemoteLoaded = function() {
|
|
101
|
-
try {
|
|
102
|
-
var remoteName = sdk.decodeName(remoteInfos[0].name, constant.ENCODE_NAME_PREFIX);
|
|
103
|
-
var remoteModuleName = remoteName + data[1].slice(1);
|
|
104
|
-
return webpackRequire.federation.instance.loadRemote(remoteModuleName, {
|
|
105
|
-
loadFactory: false,
|
|
106
|
-
from: "build"
|
|
107
|
-
});
|
|
108
|
-
} catch (error) {
|
|
109
|
-
onError(error);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
var useRuntimeLoad = remoteInfos.length === 1 && [
|
|
113
|
-
"script"
|
|
114
|
-
].includes(remoteInfos[0].externalType) && remoteInfos[0].name;
|
|
115
|
-
if (useRuntimeLoad) {
|
|
116
|
-
handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
|
|
117
|
-
} else {
|
|
118
|
-
handleFunction(webpackRequire, data[2], 0, 0, onExternal, 1);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function consumes(options) {
|
|
125
|
-
var chunkId = options.chunkId, promises = options.promises, chunkMapping = options.chunkMapping, installedModules = options.installedModules, moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire;
|
|
126
|
-
attachShareScopeMap(webpackRequire);
|
|
127
|
-
if (webpackRequire.o(chunkMapping, chunkId)) {
|
|
128
|
-
chunkMapping[chunkId].forEach(function(id) {
|
|
129
|
-
if (webpackRequire.o(installedModules, id)) {
|
|
130
|
-
return promises.push(installedModules[id]);
|
|
131
|
-
}
|
|
132
|
-
var onFactory = function(factory) {
|
|
133
|
-
installedModules[id] = 0;
|
|
134
|
-
webpackRequire.m[id] = function(module) {
|
|
135
|
-
delete webpackRequire.c[id];
|
|
136
|
-
module.exports = factory();
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
var onError = function(error) {
|
|
140
|
-
delete installedModules[id];
|
|
141
|
-
webpackRequire.m[id] = function(module) {
|
|
142
|
-
delete webpackRequire.c[id];
|
|
143
|
-
throw error;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
try {
|
|
147
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
148
|
-
if (!federationInstance) {
|
|
149
|
-
throw new Error("Federation instance not found!");
|
|
150
|
-
}
|
|
151
|
-
var _moduleToHandlerMapping_id = moduleToHandlerMapping[id], shareKey = _moduleToHandlerMapping_id.shareKey, getter = _moduleToHandlerMapping_id.getter, shareInfo = _moduleToHandlerMapping_id.shareInfo;
|
|
152
|
-
var promise = federationInstance.loadShare(shareKey, shareInfo).then(function(factory) {
|
|
153
|
-
if (factory === false) {
|
|
154
|
-
return getter();
|
|
155
|
-
}
|
|
156
|
-
return factory;
|
|
157
|
-
});
|
|
158
|
-
if (promise.then) {
|
|
159
|
-
promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
|
|
160
|
-
} else {
|
|
161
|
-
// @ts-ignore maintain previous logic
|
|
162
|
-
onFactory(promise);
|
|
163
|
-
}
|
|
164
|
-
} catch (e) {
|
|
165
|
-
onError(e);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function initializeSharing(param) {
|
|
172
|
-
var shareScopeName = param.shareScopeName, webpackRequire = param.webpackRequire, initPromises = param.initPromises, initTokens = param.initTokens, initScope = param.initScope;
|
|
173
|
-
if (!initScope) initScope = [];
|
|
174
|
-
// handling circular init calls
|
|
175
|
-
var initToken = initTokens[shareScopeName];
|
|
176
|
-
if (!initToken) initToken = initTokens[shareScopeName] = {};
|
|
177
|
-
if (initScope.indexOf(initToken) >= 0) return;
|
|
178
|
-
initScope.push(initToken);
|
|
179
|
-
var promise = initPromises[shareScopeName];
|
|
180
|
-
if (promise) return promise;
|
|
181
|
-
var warn = function(msg) {
|
|
182
|
-
return typeof console !== "undefined" && console.warn && console.warn(msg);
|
|
183
|
-
};
|
|
184
|
-
var initExternal = function(id) {
|
|
185
|
-
var handleError = function(err) {
|
|
186
|
-
return warn("Initialization of sharing external failed: " + err);
|
|
187
|
-
};
|
|
188
|
-
try {
|
|
189
|
-
var module = webpackRequire(id);
|
|
190
|
-
if (!module) return;
|
|
191
|
-
var initFn = function(module) {
|
|
192
|
-
return module && module.init && // @ts-ignore compat legacy mf shared behavior
|
|
193
|
-
module.init(webpackRequire.S[shareScopeName], initScope);
|
|
194
|
-
};
|
|
195
|
-
if (module.then) return promises.push(module.then(initFn, handleError));
|
|
196
|
-
var initResult = initFn(module);
|
|
197
|
-
// @ts-ignore
|
|
198
|
-
if (initResult && typeof initResult !== "boolean" && initResult.then) // @ts-ignore
|
|
199
|
-
return promises.push(initResult["catch"](handleError));
|
|
200
|
-
} catch (err) {
|
|
201
|
-
handleError(err);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
var promises = webpackRequire.federation.instance.initializeSharing(shareScopeName);
|
|
205
|
-
attachShareScopeMap(webpackRequire);
|
|
206
|
-
var bundlerRuntimeRemotesOptions = webpackRequire.federation.bundlerRuntimeOptions.remotes;
|
|
207
|
-
if (bundlerRuntimeRemotesOptions) {
|
|
208
|
-
Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach(function(moduleId) {
|
|
209
|
-
var info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];
|
|
210
|
-
var externalModuleId = bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[moduleId][2];
|
|
211
|
-
if (info.length > 1) {
|
|
212
|
-
initExternal(externalModuleId);
|
|
213
|
-
} else if (info.length === 1) {
|
|
214
|
-
var remoteInfo = info[0];
|
|
215
|
-
if (!constant.FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) {
|
|
216
|
-
initExternal(externalModuleId);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
if (!promises.length) {
|
|
222
|
-
return initPromises[shareScopeName] = true;
|
|
223
|
-
}
|
|
224
|
-
return initPromises[shareScopeName] = Promise.all(promises).then(function() {
|
|
225
|
-
return initPromises[shareScopeName] = true;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function handleInitialConsumes(options) {
|
|
230
|
-
var moduleId = options.moduleId, moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire;
|
|
231
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
232
|
-
if (!federationInstance) {
|
|
233
|
-
throw new Error("Federation instance not found!");
|
|
234
|
-
}
|
|
235
|
-
var _moduleToHandlerMapping_moduleId = moduleToHandlerMapping[moduleId], shareKey = _moduleToHandlerMapping_moduleId.shareKey, shareInfo = _moduleToHandlerMapping_moduleId.shareInfo;
|
|
236
|
-
return federationInstance.loadShareSync(shareKey, shareInfo);
|
|
237
|
-
}
|
|
238
|
-
function installInitialConsumes(options) {
|
|
239
|
-
var moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire, installedModules = options.installedModules, initialConsumes = options.initialConsumes;
|
|
240
|
-
initialConsumes.forEach(function(id) {
|
|
241
|
-
webpackRequire.m[id] = function(module) {
|
|
242
|
-
// Handle scenario when module is used synchronously
|
|
243
|
-
installedModules[id] = 0;
|
|
244
|
-
delete webpackRequire.c[id];
|
|
245
|
-
var factory = handleInitialConsumes({
|
|
246
|
-
moduleId: id,
|
|
247
|
-
moduleToHandlerMapping: moduleToHandlerMapping,
|
|
248
|
-
webpackRequire: webpackRequire
|
|
249
|
-
});
|
|
250
|
-
if (typeof factory !== "function") {
|
|
251
|
-
throw new Error("Shared module is not available for eager consumption: ".concat(id));
|
|
252
|
-
}
|
|
253
|
-
module.exports = factory();
|
|
254
|
-
};
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function _define_property(obj, key, value) {
|
|
259
|
-
if (key in obj) {
|
|
260
|
-
Object.defineProperty(obj, key, {
|
|
261
|
-
value: value,
|
|
262
|
-
enumerable: true,
|
|
263
|
-
configurable: true,
|
|
264
|
-
writable: true
|
|
265
|
-
});
|
|
266
|
-
} else {
|
|
267
|
-
obj[key] = value;
|
|
268
|
-
}
|
|
269
|
-
return obj;
|
|
270
|
-
}
|
|
271
|
-
function _object_spread(target) {
|
|
272
|
-
for(var i = 1; i < arguments.length; i++){
|
|
273
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
274
|
-
var ownKeys = Object.keys(source);
|
|
275
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
276
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
277
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
278
|
-
}));
|
|
279
|
-
}
|
|
280
|
-
ownKeys.forEach(function(key) {
|
|
281
|
-
_define_property(target, key, source[key]);
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
return target;
|
|
285
|
-
}
|
|
286
|
-
function initContainerEntry(options) {
|
|
287
|
-
var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey, remoteEntryInitOptions = options.remoteEntryInitOptions;
|
|
288
|
-
if (!webpackRequire.S) return;
|
|
289
|
-
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
|
|
290
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
291
|
-
var name = shareScopeKey || "default";
|
|
292
|
-
federationInstance.initOptions(_object_spread({
|
|
293
|
-
name: webpackRequire.federation.initOptions.name,
|
|
294
|
-
remotes: []
|
|
295
|
-
}, remoteEntryInitOptions));
|
|
296
|
-
federationInstance.initShareScopeMap(name, shareScope);
|
|
297
|
-
if (webpackRequire.federation.attachShareScopeMap) {
|
|
298
|
-
webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
299
|
-
}
|
|
300
|
-
// @ts-ignore
|
|
301
|
-
return webpackRequire.I(name, initScope);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
var federation = {
|
|
305
|
-
runtime: runtime__namespace,
|
|
306
|
-
instance: undefined,
|
|
307
|
-
initOptions: undefined,
|
|
308
|
-
bundlerRuntime: {
|
|
309
|
-
remotes: remotes,
|
|
310
|
-
consumes: consumes,
|
|
311
|
-
I: initializeSharing,
|
|
312
|
-
S: {},
|
|
313
|
-
installInitialConsumes: installInitialConsumes,
|
|
314
|
-
initContainerEntry: initContainerEntry
|
|
315
|
-
},
|
|
316
|
-
attachShareScopeMap: attachShareScopeMap,
|
|
317
|
-
bundlerRuntimeOptions: {}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
module.exports = federation;
|
package/dist/index.esm.js
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import * as runtime from '@module-federation/runtime';
|
|
2
|
-
import { decodeName } from '@module-federation/sdk';
|
|
3
|
-
import { ENCODE_NAME_PREFIX, FEDERATION_SUPPORTED_TYPES } from './constant.esm.js';
|
|
4
|
-
|
|
5
|
-
function attachShareScopeMap(webpackRequire) {
|
|
6
|
-
if (!webpackRequire.S || webpackRequire.federation.hasAttachShareScopeMap || !webpackRequire.federation.instance || !webpackRequire.federation.instance.shareScopeMap) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
webpackRequire.S = webpackRequire.federation.instance.shareScopeMap;
|
|
10
|
-
webpackRequire.federation.hasAttachShareScopeMap = true;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function remotes(options) {
|
|
14
|
-
var chunkId = options.chunkId, promises = options.promises, chunkMapping = options.chunkMapping, idToExternalAndNameMapping = options.idToExternalAndNameMapping, webpackRequire = options.webpackRequire, idToRemoteMap = options.idToRemoteMap;
|
|
15
|
-
attachShareScopeMap(webpackRequire);
|
|
16
|
-
if (webpackRequire.o(chunkMapping, chunkId)) {
|
|
17
|
-
chunkMapping[chunkId].forEach(function(id) {
|
|
18
|
-
var getScope = webpackRequire.R;
|
|
19
|
-
if (!getScope) {
|
|
20
|
-
getScope = [];
|
|
21
|
-
}
|
|
22
|
-
var data = idToExternalAndNameMapping[id];
|
|
23
|
-
var remoteInfos = idToRemoteMap[id];
|
|
24
|
-
// @ts-ignore seems not work
|
|
25
|
-
if (getScope.indexOf(data) >= 0) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// @ts-ignore seems not work
|
|
29
|
-
getScope.push(data);
|
|
30
|
-
if (data.p) {
|
|
31
|
-
return promises.push(data.p);
|
|
32
|
-
}
|
|
33
|
-
var onError = function(error) {
|
|
34
|
-
if (!error) {
|
|
35
|
-
error = new Error("Container missing");
|
|
36
|
-
}
|
|
37
|
-
if (typeof error.message === "string") {
|
|
38
|
-
error.message += '\nwhile loading "'.concat(data[1], '" from ').concat(data[2]);
|
|
39
|
-
}
|
|
40
|
-
webpackRequire.m[id] = function() {
|
|
41
|
-
throw error;
|
|
42
|
-
};
|
|
43
|
-
data.p = 0;
|
|
44
|
-
};
|
|
45
|
-
var handleFunction = function(fn, arg1, arg2, d, next, first) {
|
|
46
|
-
try {
|
|
47
|
-
var promise = fn(arg1, arg2);
|
|
48
|
-
if (promise && promise.then) {
|
|
49
|
-
var p = promise.then(function(result) {
|
|
50
|
-
return next(result, d);
|
|
51
|
-
}, onError);
|
|
52
|
-
if (first) {
|
|
53
|
-
promises.push(data.p = p);
|
|
54
|
-
} else {
|
|
55
|
-
return p;
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
return next(promise, d, first);
|
|
59
|
-
}
|
|
60
|
-
} catch (error) {
|
|
61
|
-
onError(error);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var onExternal = function(external, _, first) {
|
|
65
|
-
return external ? handleFunction(webpackRequire.I, data[0], 0, external, onInitialized, first) : onError();
|
|
66
|
-
};
|
|
67
|
-
// eslint-disable-next-line no-var
|
|
68
|
-
var onInitialized = function(_, external, first) {
|
|
69
|
-
return handleFunction(external.get, data[1], getScope, 0, onFactory, first);
|
|
70
|
-
};
|
|
71
|
-
// eslint-disable-next-line no-var
|
|
72
|
-
var onFactory = function(factory) {
|
|
73
|
-
data.p = 1;
|
|
74
|
-
webpackRequire.m[id] = function(module) {
|
|
75
|
-
module.exports = factory();
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
var onRemoteLoaded = function() {
|
|
79
|
-
try {
|
|
80
|
-
var remoteName = decodeName(remoteInfos[0].name, ENCODE_NAME_PREFIX);
|
|
81
|
-
var remoteModuleName = remoteName + data[1].slice(1);
|
|
82
|
-
return webpackRequire.federation.instance.loadRemote(remoteModuleName, {
|
|
83
|
-
loadFactory: false,
|
|
84
|
-
from: "build"
|
|
85
|
-
});
|
|
86
|
-
} catch (error) {
|
|
87
|
-
onError(error);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
var useRuntimeLoad = remoteInfos.length === 1 && [
|
|
91
|
-
"script"
|
|
92
|
-
].includes(remoteInfos[0].externalType) && remoteInfos[0].name;
|
|
93
|
-
if (useRuntimeLoad) {
|
|
94
|
-
handleFunction(onRemoteLoaded, data[2], 0, 0, onFactory, 1);
|
|
95
|
-
} else {
|
|
96
|
-
handleFunction(webpackRequire, data[2], 0, 0, onExternal, 1);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function consumes(options) {
|
|
103
|
-
var chunkId = options.chunkId, promises = options.promises, chunkMapping = options.chunkMapping, installedModules = options.installedModules, moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire;
|
|
104
|
-
attachShareScopeMap(webpackRequire);
|
|
105
|
-
if (webpackRequire.o(chunkMapping, chunkId)) {
|
|
106
|
-
chunkMapping[chunkId].forEach(function(id) {
|
|
107
|
-
if (webpackRequire.o(installedModules, id)) {
|
|
108
|
-
return promises.push(installedModules[id]);
|
|
109
|
-
}
|
|
110
|
-
var onFactory = function(factory) {
|
|
111
|
-
installedModules[id] = 0;
|
|
112
|
-
webpackRequire.m[id] = function(module) {
|
|
113
|
-
delete webpackRequire.c[id];
|
|
114
|
-
module.exports = factory();
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
var onError = function(error) {
|
|
118
|
-
delete installedModules[id];
|
|
119
|
-
webpackRequire.m[id] = function(module) {
|
|
120
|
-
delete webpackRequire.c[id];
|
|
121
|
-
throw error;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
try {
|
|
125
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
126
|
-
if (!federationInstance) {
|
|
127
|
-
throw new Error("Federation instance not found!");
|
|
128
|
-
}
|
|
129
|
-
var _moduleToHandlerMapping_id = moduleToHandlerMapping[id], shareKey = _moduleToHandlerMapping_id.shareKey, getter = _moduleToHandlerMapping_id.getter, shareInfo = _moduleToHandlerMapping_id.shareInfo;
|
|
130
|
-
var promise = federationInstance.loadShare(shareKey, shareInfo).then(function(factory) {
|
|
131
|
-
if (factory === false) {
|
|
132
|
-
return getter();
|
|
133
|
-
}
|
|
134
|
-
return factory;
|
|
135
|
-
});
|
|
136
|
-
if (promise.then) {
|
|
137
|
-
promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
|
|
138
|
-
} else {
|
|
139
|
-
// @ts-ignore maintain previous logic
|
|
140
|
-
onFactory(promise);
|
|
141
|
-
}
|
|
142
|
-
} catch (e) {
|
|
143
|
-
onError(e);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function initializeSharing(param) {
|
|
150
|
-
var shareScopeName = param.shareScopeName, webpackRequire = param.webpackRequire, initPromises = param.initPromises, initTokens = param.initTokens, initScope = param.initScope;
|
|
151
|
-
if (!initScope) initScope = [];
|
|
152
|
-
// handling circular init calls
|
|
153
|
-
var initToken = initTokens[shareScopeName];
|
|
154
|
-
if (!initToken) initToken = initTokens[shareScopeName] = {};
|
|
155
|
-
if (initScope.indexOf(initToken) >= 0) return;
|
|
156
|
-
initScope.push(initToken);
|
|
157
|
-
var promise = initPromises[shareScopeName];
|
|
158
|
-
if (promise) return promise;
|
|
159
|
-
var warn = function(msg) {
|
|
160
|
-
return typeof console !== "undefined" && console.warn && console.warn(msg);
|
|
161
|
-
};
|
|
162
|
-
var initExternal = function(id) {
|
|
163
|
-
var handleError = function(err) {
|
|
164
|
-
return warn("Initialization of sharing external failed: " + err);
|
|
165
|
-
};
|
|
166
|
-
try {
|
|
167
|
-
var module = webpackRequire(id);
|
|
168
|
-
if (!module) return;
|
|
169
|
-
var initFn = function(module) {
|
|
170
|
-
return module && module.init && // @ts-ignore compat legacy mf shared behavior
|
|
171
|
-
module.init(webpackRequire.S[shareScopeName], initScope);
|
|
172
|
-
};
|
|
173
|
-
if (module.then) return promises.push(module.then(initFn, handleError));
|
|
174
|
-
var initResult = initFn(module);
|
|
175
|
-
// @ts-ignore
|
|
176
|
-
if (initResult && typeof initResult !== "boolean" && initResult.then) // @ts-ignore
|
|
177
|
-
return promises.push(initResult["catch"](handleError));
|
|
178
|
-
} catch (err) {
|
|
179
|
-
handleError(err);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
var promises = webpackRequire.federation.instance.initializeSharing(shareScopeName);
|
|
183
|
-
attachShareScopeMap(webpackRequire);
|
|
184
|
-
var bundlerRuntimeRemotesOptions = webpackRequire.federation.bundlerRuntimeOptions.remotes;
|
|
185
|
-
if (bundlerRuntimeRemotesOptions) {
|
|
186
|
-
Object.keys(bundlerRuntimeRemotesOptions.idToRemoteMap).forEach(function(moduleId) {
|
|
187
|
-
var info = bundlerRuntimeRemotesOptions.idToRemoteMap[moduleId];
|
|
188
|
-
var externalModuleId = bundlerRuntimeRemotesOptions.idToExternalAndNameMapping[moduleId][2];
|
|
189
|
-
if (info.length > 1) {
|
|
190
|
-
initExternal(externalModuleId);
|
|
191
|
-
} else if (info.length === 1) {
|
|
192
|
-
var remoteInfo = info[0];
|
|
193
|
-
if (!FEDERATION_SUPPORTED_TYPES.includes(remoteInfo.externalType)) {
|
|
194
|
-
initExternal(externalModuleId);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
if (!promises.length) {
|
|
200
|
-
return initPromises[shareScopeName] = true;
|
|
201
|
-
}
|
|
202
|
-
return initPromises[shareScopeName] = Promise.all(promises).then(function() {
|
|
203
|
-
return initPromises[shareScopeName] = true;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function handleInitialConsumes(options) {
|
|
208
|
-
var moduleId = options.moduleId, moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire;
|
|
209
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
210
|
-
if (!federationInstance) {
|
|
211
|
-
throw new Error("Federation instance not found!");
|
|
212
|
-
}
|
|
213
|
-
var _moduleToHandlerMapping_moduleId = moduleToHandlerMapping[moduleId], shareKey = _moduleToHandlerMapping_moduleId.shareKey, shareInfo = _moduleToHandlerMapping_moduleId.shareInfo;
|
|
214
|
-
return federationInstance.loadShareSync(shareKey, shareInfo);
|
|
215
|
-
}
|
|
216
|
-
function installInitialConsumes(options) {
|
|
217
|
-
var moduleToHandlerMapping = options.moduleToHandlerMapping, webpackRequire = options.webpackRequire, installedModules = options.installedModules, initialConsumes = options.initialConsumes;
|
|
218
|
-
initialConsumes.forEach(function(id) {
|
|
219
|
-
webpackRequire.m[id] = function(module) {
|
|
220
|
-
// Handle scenario when module is used synchronously
|
|
221
|
-
installedModules[id] = 0;
|
|
222
|
-
delete webpackRequire.c[id];
|
|
223
|
-
var factory = handleInitialConsumes({
|
|
224
|
-
moduleId: id,
|
|
225
|
-
moduleToHandlerMapping: moduleToHandlerMapping,
|
|
226
|
-
webpackRequire: webpackRequire
|
|
227
|
-
});
|
|
228
|
-
if (typeof factory !== "function") {
|
|
229
|
-
throw new Error("Shared module is not available for eager consumption: ".concat(id));
|
|
230
|
-
}
|
|
231
|
-
module.exports = factory();
|
|
232
|
-
};
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function _define_property(obj, key, value) {
|
|
237
|
-
if (key in obj) {
|
|
238
|
-
Object.defineProperty(obj, key, {
|
|
239
|
-
value: value,
|
|
240
|
-
enumerable: true,
|
|
241
|
-
configurable: true,
|
|
242
|
-
writable: true
|
|
243
|
-
});
|
|
244
|
-
} else {
|
|
245
|
-
obj[key] = value;
|
|
246
|
-
}
|
|
247
|
-
return obj;
|
|
248
|
-
}
|
|
249
|
-
function _object_spread(target) {
|
|
250
|
-
for(var i = 1; i < arguments.length; i++){
|
|
251
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
252
|
-
var ownKeys = Object.keys(source);
|
|
253
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
254
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
255
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
256
|
-
}));
|
|
257
|
-
}
|
|
258
|
-
ownKeys.forEach(function(key) {
|
|
259
|
-
_define_property(target, key, source[key]);
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
return target;
|
|
263
|
-
}
|
|
264
|
-
function initContainerEntry(options) {
|
|
265
|
-
var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey, remoteEntryInitOptions = options.remoteEntryInitOptions;
|
|
266
|
-
if (!webpackRequire.S) return;
|
|
267
|
-
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
|
|
268
|
-
var federationInstance = webpackRequire.federation.instance;
|
|
269
|
-
var name = shareScopeKey || "default";
|
|
270
|
-
federationInstance.initOptions(_object_spread({
|
|
271
|
-
name: webpackRequire.federation.initOptions.name,
|
|
272
|
-
remotes: []
|
|
273
|
-
}, remoteEntryInitOptions));
|
|
274
|
-
federationInstance.initShareScopeMap(name, shareScope);
|
|
275
|
-
if (webpackRequire.federation.attachShareScopeMap) {
|
|
276
|
-
webpackRequire.federation.attachShareScopeMap(webpackRequire);
|
|
277
|
-
}
|
|
278
|
-
// @ts-ignore
|
|
279
|
-
return webpackRequire.I(name, initScope);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
var federation = {
|
|
283
|
-
runtime: runtime,
|
|
284
|
-
instance: undefined,
|
|
285
|
-
initOptions: undefined,
|
|
286
|
-
bundlerRuntime: {
|
|
287
|
-
remotes: remotes,
|
|
288
|
-
consumes: consumes,
|
|
289
|
-
I: initializeSharing,
|
|
290
|
-
S: {},
|
|
291
|
-
installInitialConsumes: installInitialConsumes,
|
|
292
|
-
initContainerEntry: initContainerEntry
|
|
293
|
-
},
|
|
294
|
-
attachShareScopeMap: attachShareScopeMap,
|
|
295
|
-
bundlerRuntimeOptions: {}
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
export { federation as default };
|
package/dist/package.json
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"public": true,
|
|
3
|
-
"name": "@module-federation/webpack-bundler-runtime",
|
|
4
|
-
"version": "0.1.4",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"description": "Module Federation Runtime for webpack",
|
|
7
|
-
"keywords": [
|
|
8
|
-
"Module Federation",
|
|
9
|
-
"bundler runtime"
|
|
10
|
-
],
|
|
11
|
-
"files": [
|
|
12
|
-
"dist/",
|
|
13
|
-
"README.md"
|
|
14
|
-
],
|
|
15
|
-
"publishConfig": {
|
|
16
|
-
"access": "public"
|
|
17
|
-
},
|
|
18
|
-
"author": "zhanghang <hanric.zhang@gmail.com>",
|
|
19
|
-
"main": "./index.cjs.js",
|
|
20
|
-
"module": "./index.esm.js",
|
|
21
|
-
"types": "./dist/index.cjs.d.ts",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@module-federation/runtime": "workspace:*",
|
|
24
|
-
"@module-federation/sdk": "workspace:*"
|
|
25
|
-
},
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"import": "./dist/index.esm.js",
|
|
29
|
-
"require": "./dist/index.cjs.js"
|
|
30
|
-
},
|
|
31
|
-
"./constant": {
|
|
32
|
-
"import": "./dist/constant.esm.js",
|
|
33
|
-
"require": "./dist/constant.cjs.js"
|
|
34
|
-
},
|
|
35
|
-
"./*": "./*"
|
|
36
|
-
},
|
|
37
|
-
"typesVersions": {
|
|
38
|
-
"*": {
|
|
39
|
-
".": [
|
|
40
|
-
"./dist/index.cjs.d.ts"
|
|
41
|
-
],
|
|
42
|
-
"constant": [
|
|
43
|
-
"./dist/constant.cjs.d.ts"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
package/dist/src/constant.d.ts
DELETED
package/dist/src/consumes.d.ts
DELETED
package/dist/src/index.d.ts
DELETED
package/dist/src/remotes.d.ts
DELETED
package/dist/src/types.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import * as runtime from '@module-federation/runtime';
|
|
2
|
-
import type { RemoteEntryInitOptions } from '@module-federation/runtime/types';
|
|
3
|
-
import { initializeSharing } from './initializeSharing';
|
|
4
|
-
import { attachShareScopeMap } from './attachShareScopeMap';
|
|
5
|
-
import { initContainerEntry } from './initContainerEntry';
|
|
6
|
-
type ExcludeUndefined<T> = T extends undefined ? never : T;
|
|
7
|
-
type NonUndefined<T = Shared> = ExcludeUndefined<T>;
|
|
8
|
-
type InitOptions = Parameters<typeof runtime.init>[0];
|
|
9
|
-
type Shared = InitOptions['shared'];
|
|
10
|
-
type SharedConfig = NonUndefined<NonUndefined[string]['shareConfig']>;
|
|
11
|
-
type ModuleCache = runtime.FederationHost['moduleCache'];
|
|
12
|
-
type InferModule<T> = T extends Map<string, infer U> ? U : never;
|
|
13
|
-
type InferredModule = InferModule<ModuleCache>;
|
|
14
|
-
export type ShareScopeMap = runtime.FederationHost['shareScopeMap'];
|
|
15
|
-
type InitToken = Record<string, Record<string, any>>;
|
|
16
|
-
export interface InitializeSharingOptions {
|
|
17
|
-
shareScopeName: string;
|
|
18
|
-
webpackRequire: WebpackRequire;
|
|
19
|
-
initPromises: Record<string, Promise<boolean> | boolean>;
|
|
20
|
-
initTokens: InitToken;
|
|
21
|
-
initScope: InitToken[];
|
|
22
|
-
}
|
|
23
|
-
export type RemoteEntryExports = NonUndefined<InferredModule['remoteEntryExports']>;
|
|
24
|
-
type ExtractInitParameters<T> = T extends {
|
|
25
|
-
init: (shareScope: infer U, ...args: any[]) => void;
|
|
26
|
-
} ? U : never;
|
|
27
|
-
type InferredShareScope = ExtractInitParameters<RemoteEntryExports>;
|
|
28
|
-
type InferredGlobalShareScope = {
|
|
29
|
-
[scope: string]: InferredShareScope;
|
|
30
|
-
};
|
|
31
|
-
type IdToExternalAndNameMappingItem = [string, string, string | number];
|
|
32
|
-
interface IdToExternalAndNameMappingItemWithPromise extends IdToExternalAndNameMappingItem {
|
|
33
|
-
p?: Promise<any> | number;
|
|
34
|
-
}
|
|
35
|
-
export interface WebpackRequire {
|
|
36
|
-
(moduleId: string | number): any;
|
|
37
|
-
o: (obj: Record<string, any>, key: string | number) => boolean;
|
|
38
|
-
R: Array<string | number>;
|
|
39
|
-
m: Record<string, (mod: any) => any>;
|
|
40
|
-
c: Record<string, any>;
|
|
41
|
-
I: (scopeName: string, initScope?: InitializeSharingOptions['initScope']) => ReturnType<typeof initializeSharing>;
|
|
42
|
-
S?: InferredGlobalShareScope;
|
|
43
|
-
federation: Federation;
|
|
44
|
-
}
|
|
45
|
-
interface ShareInfo {
|
|
46
|
-
shareConfig: SharedConfig;
|
|
47
|
-
scope: Array<string>;
|
|
48
|
-
}
|
|
49
|
-
interface ModuleToHandlerMappingItem {
|
|
50
|
-
getter: () => Promise<any>;
|
|
51
|
-
shareInfo: ShareInfo;
|
|
52
|
-
shareKey: string;
|
|
53
|
-
}
|
|
54
|
-
interface IdToRemoteMapItem {
|
|
55
|
-
externalType: string;
|
|
56
|
-
name: string;
|
|
57
|
-
externalModuleId?: string | number;
|
|
58
|
-
}
|
|
59
|
-
export interface RemotesOptions {
|
|
60
|
-
chunkId: string | number;
|
|
61
|
-
promises: Promise<any>[];
|
|
62
|
-
chunkMapping: Record<string, Array<string | number>>;
|
|
63
|
-
idToExternalAndNameMapping: Record<string, IdToExternalAndNameMappingItemWithPromise>;
|
|
64
|
-
idToRemoteMap: Record<string, IdToRemoteMapItem[]>;
|
|
65
|
-
webpackRequire: WebpackRequire;
|
|
66
|
-
}
|
|
67
|
-
export interface HandleInitialConsumesOptions {
|
|
68
|
-
moduleId: string | number;
|
|
69
|
-
moduleToHandlerMapping: Record<string, ModuleToHandlerMappingItem>;
|
|
70
|
-
webpackRequire: WebpackRequire;
|
|
71
|
-
}
|
|
72
|
-
export interface InstallInitialConsumesOptions {
|
|
73
|
-
moduleToHandlerMapping: Record<string, ModuleToHandlerMappingItem>;
|
|
74
|
-
webpackRequire: WebpackRequire;
|
|
75
|
-
installedModules: Record<string, Promise<any> | 0>;
|
|
76
|
-
initialConsumes: Array<string | number>;
|
|
77
|
-
}
|
|
78
|
-
export interface ConsumesOptions {
|
|
79
|
-
chunkId: string | number;
|
|
80
|
-
promises: Promise<any>[];
|
|
81
|
-
chunkMapping: Record<string, Array<string | number>>;
|
|
82
|
-
installedModules: Record<string, Promise<any> | 0>;
|
|
83
|
-
moduleToHandlerMapping: Record<string, ModuleToHandlerMappingItem>;
|
|
84
|
-
webpackRequire: WebpackRequire;
|
|
85
|
-
}
|
|
86
|
-
export interface InitContainerEntryOptions {
|
|
87
|
-
shareScope: ShareScopeMap[string];
|
|
88
|
-
shareScopeKey: string;
|
|
89
|
-
webpackRequire: WebpackRequire;
|
|
90
|
-
remoteEntryInitOptions?: RemoteEntryInitOptions;
|
|
91
|
-
initScope?: InitializeSharingOptions['initScope'];
|
|
92
|
-
}
|
|
93
|
-
export interface Federation {
|
|
94
|
-
runtime?: typeof runtime;
|
|
95
|
-
instance?: runtime.FederationHost;
|
|
96
|
-
initOptions?: InitOptions;
|
|
97
|
-
installInitialConsumes?: (options: InstallInitialConsumesOptions) => any;
|
|
98
|
-
bundlerRuntime?: {
|
|
99
|
-
remotes: (options: RemotesOptions) => void;
|
|
100
|
-
consumes: (options: ConsumesOptions) => void;
|
|
101
|
-
I: typeof initializeSharing;
|
|
102
|
-
S: InferredGlobalShareScope;
|
|
103
|
-
installInitialConsumes: (options: InstallInitialConsumesOptions) => any;
|
|
104
|
-
initContainerEntry: typeof initContainerEntry;
|
|
105
|
-
};
|
|
106
|
-
bundlerRuntimeOptions: {
|
|
107
|
-
remotes?: Exclude<RemotesOptions, 'chunkId' | 'promises'>;
|
|
108
|
-
};
|
|
109
|
-
attachShareScopeMap?: typeof attachShareScopeMap;
|
|
110
|
-
hasAttachShareScopeMap?: boolean;
|
|
111
|
-
}
|
|
112
|
-
export {};
|