@module-federation/webpack-bundler-runtime 0.6.7 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constant.cjs.js +2 -4
- package/dist/constant.esm.d.ts +1 -0
- package/dist/constant.esm.js +1 -1
- package/dist/container.cjs.js +53 -216
- package/dist/container.esm.d.ts +1 -0
- package/dist/container.esm.js +53 -214
- package/dist/index.cjs.js +68 -111
- package/dist/index.esm.d.ts +2 -0
- package/dist/index.esm.js +66 -108
- package/dist/package.json +2 -2
- package/dist/polyfills.cjs.js +14 -0
- package/dist/polyfills.esm.js +12 -0
- package/package.json +4 -4
package/dist/container.esm.js
CHANGED
|
@@ -2,155 +2,27 @@ import federation from './index.esm.js';
|
|
|
2
2
|
import '@module-federation/runtime';
|
|
3
3
|
import './constant.esm.js';
|
|
4
4
|
import '@module-federation/sdk';
|
|
5
|
+
import './polyfills.esm.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} catch (error) {
|
|
11
|
-
reject(error);
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (info.done) {
|
|
15
|
-
resolve(value);
|
|
16
|
-
} else {
|
|
17
|
-
Promise.resolve(value).then(_next, _throw);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function _async_to_generator(fn) {
|
|
21
|
-
return function() {
|
|
22
|
-
var self = this, args = arguments;
|
|
23
|
-
return new Promise(function(resolve, reject) {
|
|
24
|
-
var gen = fn.apply(self, args);
|
|
25
|
-
function _next(value) {
|
|
26
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
27
|
-
}
|
|
28
|
-
function _throw(err) {
|
|
29
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
30
|
-
}
|
|
31
|
-
_next(undefined);
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function _type_of(obj) {
|
|
36
|
-
"@swc/helpers - typeof";
|
|
37
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
38
|
-
}
|
|
39
|
-
function _ts_generator(thisArg, body) {
|
|
40
|
-
var f, y, t, g, _ = {
|
|
41
|
-
label: 0,
|
|
42
|
-
sent: function() {
|
|
43
|
-
if (t[0] & 1) throw t[1];
|
|
44
|
-
return t[1];
|
|
45
|
-
},
|
|
46
|
-
trys: [],
|
|
47
|
-
ops: []
|
|
48
|
-
};
|
|
49
|
-
return g = {
|
|
50
|
-
next: verb(0),
|
|
51
|
-
"throw": verb(1),
|
|
52
|
-
"return": verb(2)
|
|
53
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
54
|
-
return this;
|
|
55
|
-
}), g;
|
|
56
|
-
function verb(n) {
|
|
57
|
-
return function(v) {
|
|
58
|
-
return step([
|
|
59
|
-
n,
|
|
60
|
-
v
|
|
61
|
-
]);
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function step(op) {
|
|
65
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
66
|
-
while(_)try {
|
|
67
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
68
|
-
if (y = 0, t) op = [
|
|
69
|
-
op[0] & 2,
|
|
70
|
-
t.value
|
|
71
|
-
];
|
|
72
|
-
switch(op[0]){
|
|
73
|
-
case 0:
|
|
74
|
-
case 1:
|
|
75
|
-
t = op;
|
|
76
|
-
break;
|
|
77
|
-
case 4:
|
|
78
|
-
_.label++;
|
|
79
|
-
return {
|
|
80
|
-
value: op[1],
|
|
81
|
-
done: false
|
|
82
|
-
};
|
|
83
|
-
case 5:
|
|
84
|
-
_.label++;
|
|
85
|
-
y = op[1];
|
|
86
|
-
op = [
|
|
87
|
-
0
|
|
88
|
-
];
|
|
89
|
-
continue;
|
|
90
|
-
case 7:
|
|
91
|
-
op = _.ops.pop();
|
|
92
|
-
_.trys.pop();
|
|
93
|
-
continue;
|
|
94
|
-
default:
|
|
95
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
96
|
-
_ = 0;
|
|
97
|
-
continue;
|
|
98
|
-
}
|
|
99
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
100
|
-
_.label = op[1];
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
104
|
-
_.label = t[1];
|
|
105
|
-
t = op;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
if (t && _.label < t[2]) {
|
|
109
|
-
_.label = t[2];
|
|
110
|
-
_.ops.push(op);
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
if (t[2]) _.ops.pop();
|
|
114
|
-
_.trys.pop();
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
op = body.call(thisArg, _);
|
|
118
|
-
} catch (e) {
|
|
119
|
-
op = [
|
|
120
|
-
6,
|
|
121
|
-
e
|
|
122
|
-
];
|
|
123
|
-
y = 0;
|
|
124
|
-
} finally{
|
|
125
|
-
f = t = 0;
|
|
126
|
-
}
|
|
127
|
-
if (op[0] & 5) throw op[1];
|
|
128
|
-
return {
|
|
129
|
-
value: op[0] ? op[1] : void 0,
|
|
130
|
-
done: true
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
var _this = undefined;
|
|
135
|
-
var createContainer = function(federationOptions) {
|
|
136
|
-
var exposes = federationOptions.exposes, name = federationOptions.name, _federationOptions_remotes = federationOptions.remotes, remotes = _federationOptions_remotes === void 0 ? [] : _federationOptions_remotes, shared = federationOptions.shared, plugins = federationOptions.plugins;
|
|
137
|
-
var __webpack_modules__ = {
|
|
138
|
-
'./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js': function(//@ts-ignore
|
|
7
|
+
const createContainer = (federationOptions)=>{
|
|
8
|
+
const { exposes, name, remotes = [], shared, plugins } = federationOptions;
|
|
9
|
+
const __webpack_modules__ = {
|
|
10
|
+
'./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js': (//@ts-ignore
|
|
139
11
|
module, //@ts-ignore
|
|
140
12
|
__webpack_exports__, //@ts-ignore
|
|
141
|
-
__webpack_require__)
|
|
13
|
+
__webpack_require__)=>{
|
|
142
14
|
__webpack_require__.r(__webpack_exports__);
|
|
143
|
-
|
|
144
|
-
|
|
15
|
+
const bundler_runtime = __webpack_require__.n(federation);
|
|
16
|
+
const prevFederation = __webpack_require__.federation;
|
|
145
17
|
__webpack_require__.federation = {};
|
|
146
|
-
for(
|
|
18
|
+
for(const key in bundler_runtime()){
|
|
147
19
|
__webpack_require__.federation[key] = bundler_runtime()[key];
|
|
148
20
|
}
|
|
149
|
-
for(
|
|
150
|
-
__webpack_require__.federation[
|
|
21
|
+
for(const key in prevFederation){
|
|
22
|
+
__webpack_require__.federation[key] = prevFederation[key];
|
|
151
23
|
}
|
|
152
24
|
if (!__webpack_require__.federation.instance) {
|
|
153
|
-
|
|
25
|
+
const pluginsToAdd = plugins || [];
|
|
154
26
|
__webpack_require__.federation.initOptions.plugins = __webpack_require__.federation.initOptions.plugins ? __webpack_require__.federation.initOptions.plugins.concat(pluginsToAdd) : pluginsToAdd;
|
|
155
27
|
__webpack_require__.federation.instance = __webpack_require__.federation.runtime.init(__webpack_require__.federation.initOptions);
|
|
156
28
|
if (__webpack_require__.federation.attachShareScopeMap) {
|
|
@@ -162,35 +34,28 @@ var createContainer = function(federationOptions) {
|
|
|
162
34
|
}
|
|
163
35
|
},
|
|
164
36
|
//@ts-ignore
|
|
165
|
-
'webpack/container/entry/createContainer':
|
|
37
|
+
'webpack/container/entry/createContainer': (//@ts-ignore
|
|
166
38
|
module, //@ts-ignore
|
|
167
39
|
exports, //@ts-ignore
|
|
168
|
-
__webpack_require__)
|
|
169
|
-
|
|
40
|
+
__webpack_require__)=>{
|
|
41
|
+
const moduleMap = {};
|
|
42
|
+
for(const key in exposes){
|
|
170
43
|
if (Object.prototype.hasOwnProperty.call(exposes, key)) {
|
|
171
44
|
//@ts-ignore
|
|
172
|
-
moduleMap[key] =
|
|
173
|
-
return Promise.resolve(exposes[key]()).then(function(m) {
|
|
174
|
-
return function() {
|
|
175
|
-
return m;
|
|
176
|
-
};
|
|
177
|
-
});
|
|
178
|
-
};
|
|
45
|
+
moduleMap[key] = ()=>Promise.resolve(exposes[key]()).then((m)=>()=>m);
|
|
179
46
|
}
|
|
180
|
-
}
|
|
181
|
-
var moduleMap = {};
|
|
182
|
-
for(var key in exposes)_loop(key);
|
|
47
|
+
}
|
|
183
48
|
//@ts-ignore
|
|
184
|
-
|
|
49
|
+
const get = (module, getScope)=>{
|
|
185
50
|
__webpack_require__.R = getScope;
|
|
186
|
-
getScope = __webpack_require__.o(moduleMap, module) ? moduleMap[module]() : Promise.resolve().then(
|
|
187
|
-
throw new Error(
|
|
51
|
+
getScope = __webpack_require__.o(moduleMap, module) ? moduleMap[module]() : Promise.resolve().then(()=>{
|
|
52
|
+
throw new Error(`Module "${module}" does not exist in container.`);
|
|
188
53
|
});
|
|
189
54
|
__webpack_require__.R = undefined;
|
|
190
55
|
return getScope;
|
|
191
56
|
};
|
|
192
57
|
//@ts-ignore
|
|
193
|
-
|
|
58
|
+
const init = (shareScope, initScope, remoteEntryInitOptions)=>{
|
|
194
59
|
return __webpack_require__.federation.bundlerRuntime.initContainerEntry({
|
|
195
60
|
webpackRequire: __webpack_require__,
|
|
196
61
|
shareScope: shareScope,
|
|
@@ -202,40 +67,34 @@ var createContainer = function(federationOptions) {
|
|
|
202
67
|
__webpack_require__('./node_modules/.federation/entry.1f2288102e035e2ed66b2efaf60ad043.js');
|
|
203
68
|
// This exports getters to disallow modifications
|
|
204
69
|
__webpack_require__.d(exports, {
|
|
205
|
-
get:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
init: function() {
|
|
209
|
-
return init;
|
|
210
|
-
},
|
|
211
|
-
moduleMap: function() {
|
|
212
|
-
return moduleMap;
|
|
213
|
-
}
|
|
70
|
+
get: ()=>get,
|
|
71
|
+
init: ()=>init,
|
|
72
|
+
moduleMap: ()=>moduleMap
|
|
214
73
|
});
|
|
215
74
|
}
|
|
216
75
|
};
|
|
217
|
-
|
|
76
|
+
const __webpack_module_cache__ = {};
|
|
218
77
|
//@ts-ignore
|
|
219
|
-
|
|
78
|
+
const __webpack_require__ = (moduleId)=>{
|
|
220
79
|
//@ts-ignore
|
|
221
|
-
|
|
80
|
+
let cachedModule = __webpack_module_cache__[moduleId];
|
|
222
81
|
if (cachedModule !== undefined) {
|
|
223
82
|
return cachedModule.exports;
|
|
224
83
|
}
|
|
225
84
|
//@ts-ignore
|
|
226
|
-
|
|
85
|
+
let module = __webpack_module_cache__[moduleId] = {
|
|
227
86
|
id: moduleId,
|
|
228
87
|
loaded: false,
|
|
229
88
|
exports: {}
|
|
230
89
|
};
|
|
231
|
-
|
|
90
|
+
const execOptions = {
|
|
232
91
|
id: moduleId,
|
|
233
92
|
module: module,
|
|
234
93
|
//@ts-ignore
|
|
235
94
|
factory: __webpack_modules__[moduleId],
|
|
236
95
|
require: __webpack_require__
|
|
237
96
|
};
|
|
238
|
-
__webpack_require__.i.forEach(
|
|
97
|
+
__webpack_require__.i.forEach((handler)=>{
|
|
239
98
|
handler(execOptions);
|
|
240
99
|
});
|
|
241
100
|
module = execOptions.module;
|
|
@@ -253,40 +112,32 @@ var createContainer = function(federationOptions) {
|
|
|
253
112
|
initOptions: {
|
|
254
113
|
name: name,
|
|
255
114
|
//@ts-ignore
|
|
256
|
-
remotes: remotes.map(
|
|
257
|
-
return {
|
|
115
|
+
remotes: remotes.map((remote)=>({
|
|
258
116
|
type: remote.type,
|
|
259
117
|
alias: remote.alias,
|
|
260
118
|
name: remote.name,
|
|
261
119
|
//@ts-ignore
|
|
262
120
|
entry: remote.entry,
|
|
263
121
|
shareScope: remote.shareScope || 'default'
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
},
|
|
267
|
-
chunkMatcher: function() {
|
|
268
|
-
return true;
|
|
122
|
+
}))
|
|
269
123
|
},
|
|
124
|
+
chunkMatcher: ()=>true,
|
|
270
125
|
rootOutputDir: '',
|
|
271
126
|
initialConsumes: undefined,
|
|
272
127
|
bundlerRuntimeOptions: {}
|
|
273
128
|
};
|
|
274
129
|
}
|
|
275
130
|
//@ts-ignore
|
|
276
|
-
__webpack_require__.n =
|
|
277
|
-
|
|
278
|
-
return module['default'];
|
|
279
|
-
} : function() {
|
|
280
|
-
return module;
|
|
281
|
-
};
|
|
131
|
+
__webpack_require__.n = (module)=>{
|
|
132
|
+
const getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
282
133
|
__webpack_require__.d(getter, {
|
|
283
134
|
a: getter
|
|
284
135
|
});
|
|
285
136
|
return getter;
|
|
286
137
|
};
|
|
287
138
|
//@ts-ignore
|
|
288
|
-
__webpack_require__.d =
|
|
289
|
-
for(
|
|
139
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
140
|
+
for(const key in definition){
|
|
290
141
|
if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
291
142
|
Object.defineProperty(exports, key, {
|
|
292
143
|
enumerable: true,
|
|
@@ -296,20 +147,18 @@ var createContainer = function(federationOptions) {
|
|
|
296
147
|
}
|
|
297
148
|
};
|
|
298
149
|
__webpack_require__.f = {};
|
|
299
|
-
__webpack_require__.g =
|
|
300
|
-
if (
|
|
150
|
+
__webpack_require__.g = (()=>{
|
|
151
|
+
if (typeof globalThis === 'object') return globalThis;
|
|
301
152
|
try {
|
|
302
|
-
return
|
|
153
|
+
return undefined || new Function('return this')();
|
|
303
154
|
} catch (e) {
|
|
304
|
-
if (
|
|
155
|
+
if (typeof window === 'object') return window;
|
|
305
156
|
}
|
|
306
|
-
}();
|
|
157
|
+
})();
|
|
307
158
|
//@ts-ignore
|
|
308
|
-
__webpack_require__.o =
|
|
309
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
310
|
-
};
|
|
159
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
311
160
|
//@ts-ignore
|
|
312
|
-
__webpack_require__.r =
|
|
161
|
+
__webpack_require__.r = (exports)=>{
|
|
313
162
|
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
314
163
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
315
164
|
value: 'Module'
|
|
@@ -322,10 +171,10 @@ var createContainer = function(federationOptions) {
|
|
|
322
171
|
//@ts-ignore
|
|
323
172
|
__webpack_require__.federation.initOptions.shared = shared;
|
|
324
173
|
__webpack_require__.S = {};
|
|
325
|
-
|
|
326
|
-
|
|
174
|
+
const initPromises = {};
|
|
175
|
+
const initTokens = {};
|
|
327
176
|
//@ts-ignore
|
|
328
|
-
__webpack_require__.I =
|
|
177
|
+
__webpack_require__.I = (name, initScope)=>{
|
|
329
178
|
//@ts-ignore
|
|
330
179
|
return __webpack_require__.federation.bundlerRuntime.I({
|
|
331
180
|
shareScopeName: name,
|
|
@@ -335,24 +184,14 @@ var createContainer = function(federationOptions) {
|
|
|
335
184
|
initScope: initScope
|
|
336
185
|
});
|
|
337
186
|
};
|
|
338
|
-
|
|
187
|
+
const __webpack_exports__ = __webpack_require__('webpack/container/entry/createContainer');
|
|
339
188
|
__webpack_exports__.get;
|
|
340
189
|
__webpack_exports__.init;
|
|
341
190
|
return __webpack_exports__;
|
|
342
191
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
return [
|
|
348
|
-
2,
|
|
349
|
-
createContainer(federationOptions)
|
|
350
|
-
];
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
return function createContainerAsync(federationOptions) {
|
|
354
|
-
return _ref.apply(this, arguments);
|
|
355
|
-
};
|
|
356
|
-
}();
|
|
192
|
+
const createContainerAsync = async (federationOptions)=>{
|
|
193
|
+
// todo: consider async startup options here, for "async boundary" provision.
|
|
194
|
+
return createContainer(federationOptions);
|
|
195
|
+
};
|
|
357
196
|
|
|
358
197
|
export { createContainer, createContainerAsync };
|