@module-federation/utilities 3.0.2 → 3.0.4

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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/index.cjs.d.ts +1 -0
  3. package/index.cjs.default.js +1 -0
  4. package/index.cjs.js +1426 -0
  5. package/index.cjs.mjs +2 -0
  6. package/index.esm.js +1393 -0
  7. package/package.json +26 -9
  8. package/src/index.d.ts +1 -1
  9. package/src/utils/importRemote.d.ts +2 -1
  10. package/src/utils/pure.d.ts +1 -1
  11. package/CHANGELOG.md +0 -941
  12. package/README.md +0 -131
  13. package/src/Logger.js +0 -15
  14. package/src/Logger.js.map +0 -1
  15. package/src/components/ErrorBoundary.js +0 -33
  16. package/src/components/ErrorBoundary.js.map +0 -1
  17. package/src/components/FederationBoundary.js +0 -71
  18. package/src/components/FederationBoundary.js.map +0 -1
  19. package/src/index.js +0 -37
  20. package/src/index.js.map +0 -1
  21. package/src/plugins/DelegateModulesPlugin.js +0 -86
  22. package/src/plugins/DelegateModulesPlugin.js.map +0 -1
  23. package/src/types/index.js +0 -5
  24. package/src/types/index.js.map +0 -1
  25. package/src/utils/common.js +0 -164
  26. package/src/utils/common.js.map +0 -1
  27. package/src/utils/correctImportPath.d.ts +0 -1
  28. package/src/utils/correctImportPath.js +0 -24
  29. package/src/utils/correctImportPath.js.map +0 -1
  30. package/src/utils/getRuntimeRemotes.js +0 -49
  31. package/src/utils/getRuntimeRemotes.js.map +0 -1
  32. package/src/utils/importDelegatedModule.js +0 -87
  33. package/src/utils/importDelegatedModule.js.map +0 -1
  34. package/src/utils/importRemote.js +0 -111
  35. package/src/utils/importRemote.js.map +0 -1
  36. package/src/utils/isEmpty.js +0 -11
  37. package/src/utils/isEmpty.js.map +0 -1
  38. package/src/utils/pure.js +0 -148
  39. package/src/utils/pure.js.map +0 -1
  40. package/src/utils/react.js +0 -9
  41. package/src/utils/react.js.map +0 -1
package/index.cjs.js ADDED
@@ -0,0 +1,1426 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n["default"] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ function _array_like_to_array$3(arr, len) {
24
+ if (len == null || len > arr.length) len = arr.length;
25
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
26
+ return arr2;
27
+ }
28
+ function _array_with_holes$3(arr) {
29
+ if (Array.isArray(arr)) return arr;
30
+ }
31
+ function _iterable_to_array_limit$3(arr, i) {
32
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
33
+ if (_i == null) return;
34
+ var _arr = [];
35
+ var _n = true;
36
+ var _d = false;
37
+ var _s, _e;
38
+ try {
39
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
40
+ _arr.push(_s.value);
41
+ if (i && _arr.length === i) break;
42
+ }
43
+ } catch (err) {
44
+ _d = true;
45
+ _e = err;
46
+ } finally{
47
+ try {
48
+ if (!_n && _i["return"] != null) _i["return"]();
49
+ } finally{
50
+ if (_d) throw _e;
51
+ }
52
+ }
53
+ return _arr;
54
+ }
55
+ function _non_iterable_rest$3() {
56
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
57
+ }
58
+ function _sliced_to_array$3(arr, i) {
59
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
60
+ }
61
+ function _unsupported_iterable_to_array$3(o, minLen) {
62
+ if (!o) return;
63
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
64
+ var n = Object.prototype.toString.call(o).slice(8, -1);
65
+ if (n === "Object" && o.constructor) n = o.constructor.name;
66
+ if (n === "Map" || n === "Set") return Array.from(n);
67
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
68
+ }
69
+ var pure = typeof process !== "undefined" ? process.env["REMOTES"] || {} : {};
70
+ var remoteVars = pure;
71
+ var extractUrlAndGlobal = function(urlAndGlobal) {
72
+ var index = urlAndGlobal.indexOf("@");
73
+ if (index <= 0 || index === urlAndGlobal.length - 1) {
74
+ throw new Error('Invalid request "'.concat(urlAndGlobal, '"'));
75
+ }
76
+ return [
77
+ urlAndGlobal.substring(index + 1),
78
+ urlAndGlobal.substring(0, index)
79
+ ];
80
+ };
81
+ var loadScript = function(keyOrRuntimeRemoteItem) {
82
+ var runtimeRemotes = getRuntimeRemotes$1();
83
+ // 1) Load remote container if needed
84
+ var asyncContainer;
85
+ var reference = typeof keyOrRuntimeRemoteItem === "string" ? runtimeRemotes[keyOrRuntimeRemoteItem] : keyOrRuntimeRemoteItem;
86
+ if (reference.asyncContainer) {
87
+ asyncContainer = typeof reference.asyncContainer.then === "function" ? reference.asyncContainer : reference.asyncContainer();
88
+ } else {
89
+ // This casting is just to satisfy typescript,
90
+ // In reality remoteGlobal will always be a string;
91
+ var remoteGlobal = reference.global;
92
+ // Check if theres an override for container key if not use remote global
93
+ var containerKey = reference.uniqueKey ? reference.uniqueKey : remoteGlobal;
94
+ var __webpack_error__ = new Error();
95
+ // @ts-ignore
96
+ var globalScope = // @ts-ignore
97
+ typeof window !== "undefined" ? window : globalThis.__remote_scope__;
98
+ if (typeof window === "undefined") {
99
+ //@ts-ignore
100
+ globalScope["_config"][containerKey] = reference.url;
101
+ } else {
102
+ // to match promise template system, can be removed once promise template is gone
103
+ //@ts-ignore
104
+ if (!globalScope["remoteLoading"]) {
105
+ //@ts-ignore
106
+ globalScope["remoteLoading"] = {};
107
+ }
108
+ //@ts-ignore
109
+ if (globalScope["remoteLoading"][containerKey]) {
110
+ //@ts-ignore
111
+ return globalScope["remoteLoading"][containerKey];
112
+ }
113
+ }
114
+ // @ts-ignore
115
+ asyncContainer = new Promise(function(resolve, reject) {
116
+ function resolveRemoteGlobal() {
117
+ //@ts-ignore
118
+ var asyncContainer = globalScope[remoteGlobal];
119
+ return resolve(asyncContainer);
120
+ }
121
+ //@ts-ignore
122
+ if (typeof globalScope[remoteGlobal] !== "undefined") {
123
+ return resolveRemoteGlobal();
124
+ }
125
+ __webpack_require__.l(reference.url, function(event) {
126
+ //@ts-ignore
127
+ if (typeof globalScope[remoteGlobal] !== "undefined") {
128
+ return resolveRemoteGlobal();
129
+ }
130
+ var errorType = event && (event.type === "load" ? "missing" : event.type);
131
+ var realSrc = event && event.target && event.target.src;
132
+ __webpack_error__.message = "Loading script failed.\n(" + errorType + ": " + realSrc + " or global var " + remoteGlobal + ")";
133
+ __webpack_error__.name = "ScriptExternalLoadError";
134
+ __webpack_error__.type = errorType;
135
+ __webpack_error__.request = realSrc;
136
+ reject(__webpack_error__);
137
+ }, containerKey);
138
+ }).catch(function(err) {
139
+ console.error("container is offline, returning fake remote");
140
+ console.error(err);
141
+ return {
142
+ fake: true,
143
+ // @ts-ignore
144
+ get: function(arg) {
145
+ console.warn("faking", arg, "module on, its offline");
146
+ return Promise.resolve(function() {
147
+ return {
148
+ __esModule: true,
149
+ default: function() {
150
+ return null;
151
+ }
152
+ };
153
+ });
154
+ },
155
+ //eslint-disable-next-line
156
+ init: function() {}
157
+ };
158
+ });
159
+ if (typeof window !== "undefined") {
160
+ //@ts-ignore
161
+ globalScope["remoteLoading"][containerKey] = asyncContainer;
162
+ }
163
+ }
164
+ return asyncContainer;
165
+ };
166
+ var getRuntimeRemotes$1 = function() {
167
+ return Object.entries(remoteVars).reduce(function(acc, param) {
168
+ var _param = _sliced_to_array$3(param, 2), key = _param[0], value = _param[1];
169
+ if (typeof value === "object" && typeof value.then === "function") {
170
+ acc[key] = {
171
+ asyncContainer: value
172
+ };
173
+ } else if (typeof value === "function") {
174
+ acc[key] = {
175
+ asyncContainer: Promise.resolve(value())
176
+ };
177
+ } else if (typeof value === "string") {
178
+ if (value.startsWith("internal ")) {
179
+ var _value_replace_split = _sliced_to_array$3(value.replace("internal ", "").split("?"), 2); _value_replace_split[0]; var query = _value_replace_split[1];
180
+ if (query) {
181
+ var remoteSyntax = new URLSearchParams(query).get("remote");
182
+ if (remoteSyntax) {
183
+ var _extractUrlAndGlobal = _sliced_to_array$3(extractUrlAndGlobal(remoteSyntax), 2), url = _extractUrlAndGlobal[0], global = _extractUrlAndGlobal[1];
184
+ acc[key] = {
185
+ global: global,
186
+ url: url
187
+ };
188
+ }
189
+ }
190
+ } else {
191
+ var _extractUrlAndGlobal1 = _sliced_to_array$3(extractUrlAndGlobal(value), 2), url1 = _extractUrlAndGlobal1[0], global1 = _extractUrlAndGlobal1[1];
192
+ acc[key] = {
193
+ global: global1,
194
+ url: url1
195
+ };
196
+ }
197
+ } else {
198
+ console.warn("remotes process", process.env["REMOTES"]);
199
+ throw new Error('[mf] Invalid value received for runtime_remote "'.concat(key, '"'));
200
+ }
201
+ return acc;
202
+ }, {});
203
+ };
204
+
205
+ /* eslint-disable @typescript-eslint/ban-ts-comment */ function _array_like_to_array$2(arr, len) {
206
+ if (len == null || len > arr.length) len = arr.length;
207
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
208
+ return arr2;
209
+ }
210
+ function _array_with_holes$2(arr) {
211
+ if (Array.isArray(arr)) return arr;
212
+ }
213
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
214
+ try {
215
+ var info = gen[key](arg);
216
+ var value = info.value;
217
+ } catch (error) {
218
+ reject(error);
219
+ return;
220
+ }
221
+ if (info.done) {
222
+ resolve(value);
223
+ } else {
224
+ Promise.resolve(value).then(_next, _throw);
225
+ }
226
+ }
227
+ function _async_to_generator$2(fn) {
228
+ return function() {
229
+ var self = this, args = arguments;
230
+ return new Promise(function(resolve, reject) {
231
+ var gen = fn.apply(self, args);
232
+ function _next(value) {
233
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
234
+ }
235
+ function _throw(err) {
236
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
237
+ }
238
+ _next(undefined);
239
+ });
240
+ };
241
+ }
242
+ function _iterable_to_array_limit$2(arr, i) {
243
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
244
+ if (_i == null) return;
245
+ var _arr = [];
246
+ var _n = true;
247
+ var _d = false;
248
+ var _s, _e;
249
+ try {
250
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
251
+ _arr.push(_s.value);
252
+ if (i && _arr.length === i) break;
253
+ }
254
+ } catch (err) {
255
+ _d = true;
256
+ _e = err;
257
+ } finally{
258
+ try {
259
+ if (!_n && _i["return"] != null) _i["return"]();
260
+ } finally{
261
+ if (_d) throw _e;
262
+ }
263
+ }
264
+ return _arr;
265
+ }
266
+ function _non_iterable_rest$2() {
267
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
268
+ }
269
+ function _sliced_to_array$2(arr, i) {
270
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
271
+ }
272
+ function _unsupported_iterable_to_array$2(o, minLen) {
273
+ if (!o) return;
274
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
275
+ var n = Object.prototype.toString.call(o).slice(8, -1);
276
+ if (n === "Object" && o.constructor) n = o.constructor.name;
277
+ if (n === "Map" || n === "Set") return Array.from(n);
278
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
279
+ }
280
+ function _ts_generator$2(thisArg, body) {
281
+ var f, y, t, g, _ = {
282
+ label: 0,
283
+ sent: function() {
284
+ if (t[0] & 1) throw t[1];
285
+ return t[1];
286
+ },
287
+ trys: [],
288
+ ops: []
289
+ };
290
+ return g = {
291
+ next: verb(0),
292
+ "throw": verb(1),
293
+ "return": verb(2)
294
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
295
+ return this;
296
+ }), g;
297
+ function verb(n) {
298
+ return function(v) {
299
+ return step([
300
+ n,
301
+ v
302
+ ]);
303
+ };
304
+ }
305
+ function step(op) {
306
+ if (f) throw new TypeError("Generator is already executing.");
307
+ while(_)try {
308
+ 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;
309
+ if (y = 0, t) op = [
310
+ op[0] & 2,
311
+ t.value
312
+ ];
313
+ switch(op[0]){
314
+ case 0:
315
+ case 1:
316
+ t = op;
317
+ break;
318
+ case 4:
319
+ _.label++;
320
+ return {
321
+ value: op[1],
322
+ done: false
323
+ };
324
+ case 5:
325
+ _.label++;
326
+ y = op[1];
327
+ op = [
328
+ 0
329
+ ];
330
+ continue;
331
+ case 7:
332
+ op = _.ops.pop();
333
+ _.trys.pop();
334
+ continue;
335
+ default:
336
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
337
+ _ = 0;
338
+ continue;
339
+ }
340
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
341
+ _.label = op[1];
342
+ break;
343
+ }
344
+ if (op[0] === 6 && _.label < t[1]) {
345
+ _.label = t[1];
346
+ t = op;
347
+ break;
348
+ }
349
+ if (t && _.label < t[2]) {
350
+ _.label = t[2];
351
+ _.ops.push(op);
352
+ break;
353
+ }
354
+ if (t[2]) _.ops.pop();
355
+ _.trys.pop();
356
+ continue;
357
+ }
358
+ op = body.call(thisArg, _);
359
+ } catch (e) {
360
+ op = [
361
+ 6,
362
+ e
363
+ ];
364
+ y = 0;
365
+ } finally{
366
+ f = t = 0;
367
+ }
368
+ if (op[0] & 5) throw op[1];
369
+ return {
370
+ value: op[0] ? op[1] : void 0,
371
+ done: true
372
+ };
373
+ }
374
+ }
375
+ /**
376
+ * Creates a module that can be shared across different builds.
377
+ * @param {string} delegate - The delegate string.
378
+ * @param {Object} params - The parameters for the module.
379
+ * @returns {string} - The created module.
380
+ * @throws Will throw an error if the params are an array or object.
381
+ */ var createDelegatedModule = function(delegate, params) {
382
+ var queries = [];
383
+ var processParam = function(key, value) {
384
+ if (Array.isArray(value)) {
385
+ value.forEach(function(v, i) {
386
+ return processParam("".concat(key, "[").concat(i, "]"), v);
387
+ });
388
+ } else if (typeof value === "object" && value !== null) {
389
+ Object.entries(value).forEach(function(param) {
390
+ var _param = _sliced_to_array$2(param, 2), k = _param[0], v = _param[1];
391
+ return processParam("".concat(key, ".").concat(k), v);
392
+ });
393
+ } else {
394
+ queries.push("".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
395
+ }
396
+ };
397
+ Object.entries(params).forEach(function(param) {
398
+ var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
399
+ return processParam(key, value);
400
+ });
401
+ return queries.length === 0 ? "internal ".concat(delegate) : "internal ".concat(delegate, "?").concat(queries.join("&"));
402
+ };
403
+ var createContainerSharingScope = function(asyncContainer) {
404
+ // @ts-ignore
405
+ return asyncContainer.then(function(container) {
406
+ if (!__webpack_share_scopes__["default"]) {
407
+ // not always a promise, so we wrap it in a resolve
408
+ return Promise.resolve(__webpack_init_sharing__("default")).then(function() {
409
+ return container;
410
+ });
411
+ } else {
412
+ return container;
413
+ }
414
+ }).then(function(container) {
415
+ try {
416
+ // WARNING: here might be a potential BUG.
417
+ // `container.init` does not return a Promise, and here we do not call `then` on it.
418
+ // But according to [docs](https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers)
419
+ // it must be async.
420
+ // The problem may be in Proxy in NextFederationPlugin.js.
421
+ // or maybe a bug in the webpack itself - instead of returning rejected promise it just throws an error.
422
+ // But now everything works properly and we keep this code as is.
423
+ container.init(__webpack_share_scopes__["default"]);
424
+ } catch (e) {
425
+ // maybe container already initialized so nothing to throw
426
+ }
427
+ return container;
428
+ });
429
+ };
430
+ /**
431
+ * Return initialized remote container by remote's key or its runtime remote item data.
432
+ *
433
+ * `runtimeRemoteItem` might be
434
+ * { global, url } - values obtained from webpack remotes option `global@url`
435
+ * or
436
+ * { asyncContainer } - async container is a promise that resolves to the remote container
437
+ */ var injectScript = function() {
438
+ var _ref = _async_to_generator$2(function(keyOrRuntimeRemoteItem) {
439
+ var asyncContainer;
440
+ return _ts_generator$2(this, function(_state) {
441
+ asyncContainer = loadScript(keyOrRuntimeRemoteItem);
442
+ return [
443
+ 2,
444
+ createContainerSharingScope(asyncContainer)
445
+ ];
446
+ });
447
+ });
448
+ return function injectScript(keyOrRuntimeRemoteItem) {
449
+ return _ref.apply(this, arguments);
450
+ };
451
+ }();
452
+ /**
453
+ * Creates runtime variables from the provided remotes.
454
+ * If the value of a remote starts with 'promise ' or 'external ', it is transformed into a function that returns the promise call.
455
+ * Otherwise, the value is stringified.
456
+ * @param {Remotes} remotes - The remotes to create runtime variables from.
457
+ * @returns {Record<string, string>} - The created runtime variables.
458
+ */ var createRuntimeVariables = function(remotes) {
459
+ if (!remotes) {
460
+ return {};
461
+ }
462
+ return Object.entries(remotes).reduce(function(acc, param) {
463
+ var _param = _sliced_to_array$2(param, 2), key = _param[0], value = _param[1];
464
+ if (value.startsWith("promise ") || value.startsWith("external ")) {
465
+ var promiseCall = value.split(" ")[1];
466
+ acc[key] = "function() {\n return ".concat(promiseCall, "\n }");
467
+ } else {
468
+ acc[key] = JSON.stringify(value);
469
+ }
470
+ return acc;
471
+ }, {});
472
+ };
473
+ /**
474
+ * Returns initialized webpack RemoteContainer.
475
+ * If its' script does not loaded - then load & init it firstly.
476
+ */ var getContainer = function() {
477
+ var _ref = _async_to_generator$2(function(remoteContainer) {
478
+ var containerScope, containerKey, container;
479
+ return _ts_generator$2(this, function(_state) {
480
+ switch(_state.label){
481
+ case 0:
482
+ if (!remoteContainer) {
483
+ throw Error("Remote container options is empty");
484
+ }
485
+ containerScope = typeof window !== "undefined" ? window : globalThis.__remote_scope__;
486
+ if (!(typeof remoteContainer === "string")) return [
487
+ 3,
488
+ 1
489
+ ];
490
+ containerKey = remoteContainer;
491
+ return [
492
+ 3,
493
+ 3
494
+ ];
495
+ case 1:
496
+ containerKey = remoteContainer.uniqueKey;
497
+ if (!!containerScope[containerKey]) return [
498
+ 3,
499
+ 3
500
+ ];
501
+ return [
502
+ 4,
503
+ injectScript({
504
+ global: remoteContainer.global,
505
+ url: remoteContainer.url
506
+ })
507
+ ];
508
+ case 2:
509
+ container = _state.sent();
510
+ if (!container) {
511
+ throw Error("Remote container ".concat(remoteContainer.url, " is empty"));
512
+ }
513
+ _state.label = 3;
514
+ case 3:
515
+ return [
516
+ 2,
517
+ containerScope[containerKey]
518
+ ];
519
+ }
520
+ });
521
+ });
522
+ return function getContainer(remoteContainer) {
523
+ return _ref.apply(this, arguments);
524
+ };
525
+ }();
526
+ /**
527
+ * Return remote module from container.
528
+ * If you provide `exportName` it automatically return exact property value from module.
529
+ *
530
+ * @example
531
+ * remote.getModule('./pages/index', 'default')
532
+ */ var getModule = function() {
533
+ var _ref = _async_to_generator$2(function(param) {
534
+ var remoteContainer, modulePath, exportName, container, modFactory, mod, error;
535
+ return _ts_generator$2(this, function(_state) {
536
+ switch(_state.label){
537
+ case 0:
538
+ remoteContainer = param.remoteContainer, modulePath = param.modulePath, exportName = param.exportName;
539
+ return [
540
+ 4,
541
+ getContainer(remoteContainer)
542
+ ];
543
+ case 1:
544
+ container = _state.sent();
545
+ _state.label = 2;
546
+ case 2:
547
+ _state.trys.push([
548
+ 2,
549
+ 4,
550
+ ,
551
+ 5
552
+ ]);
553
+ return [
554
+ 4,
555
+ container === null || container === void 0 ? void 0 : container.get(modulePath)
556
+ ];
557
+ case 3:
558
+ modFactory = _state.sent();
559
+ if (!modFactory) {
560
+ return [
561
+ 2,
562
+ undefined
563
+ ];
564
+ }
565
+ mod = modFactory();
566
+ if (exportName) {
567
+ return [
568
+ 2,
569
+ mod && typeof mod === "object" ? mod[exportName] : undefined
570
+ ];
571
+ } else {
572
+ return [
573
+ 2,
574
+ mod
575
+ ];
576
+ }
577
+ case 4:
578
+ error = _state.sent();
579
+ console.error(error);
580
+ return [
581
+ 2,
582
+ undefined
583
+ ];
584
+ case 5:
585
+ return [
586
+ 2
587
+ ];
588
+ }
589
+ });
590
+ });
591
+ return function getModule(_) {
592
+ return _ref.apply(this, arguments);
593
+ };
594
+ }();
595
+
596
+ var isObjectEmpty = function(obj) {
597
+ for(var x in obj){
598
+ return false;
599
+ }
600
+ return true;
601
+ };
602
+
603
+ function _array_like_to_array$1(arr, len) {
604
+ if (len == null || len > arr.length) len = arr.length;
605
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
606
+ return arr2;
607
+ }
608
+ function _array_with_holes$1(arr) {
609
+ if (Array.isArray(arr)) return arr;
610
+ }
611
+ function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
612
+ try {
613
+ var info = gen[key](arg);
614
+ var value = info.value;
615
+ } catch (error) {
616
+ reject(error);
617
+ return;
618
+ }
619
+ if (info.done) {
620
+ resolve(value);
621
+ } else {
622
+ Promise.resolve(value).then(_next, _throw);
623
+ }
624
+ }
625
+ function _async_to_generator$1(fn) {
626
+ return function() {
627
+ var self = this, args = arguments;
628
+ return new Promise(function(resolve, reject) {
629
+ var gen = fn.apply(self, args);
630
+ function _next(value) {
631
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
632
+ }
633
+ function _throw(err) {
634
+ asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
635
+ }
636
+ _next(undefined);
637
+ });
638
+ };
639
+ }
640
+ function _define_property$1(obj, key, value) {
641
+ if (key in obj) {
642
+ Object.defineProperty(obj, key, {
643
+ value: value,
644
+ enumerable: true,
645
+ configurable: true,
646
+ writable: true
647
+ });
648
+ } else {
649
+ obj[key] = value;
650
+ }
651
+ return obj;
652
+ }
653
+ function _iterable_to_array_limit$1(arr, i) {
654
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
655
+ if (_i == null) return;
656
+ var _arr = [];
657
+ var _n = true;
658
+ var _d = false;
659
+ var _s, _e;
660
+ try {
661
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
662
+ _arr.push(_s.value);
663
+ if (i && _arr.length === i) break;
664
+ }
665
+ } catch (err) {
666
+ _d = true;
667
+ _e = err;
668
+ } finally{
669
+ try {
670
+ if (!_n && _i["return"] != null) _i["return"]();
671
+ } finally{
672
+ if (_d) throw _e;
673
+ }
674
+ }
675
+ return _arr;
676
+ }
677
+ function _non_iterable_rest$1() {
678
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
679
+ }
680
+ function _object_spread(target) {
681
+ for(var i = 1; i < arguments.length; i++){
682
+ var source = arguments[i] != null ? arguments[i] : {};
683
+ var ownKeys = Object.keys(source);
684
+ if (typeof Object.getOwnPropertySymbols === "function") {
685
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
686
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
687
+ }));
688
+ }
689
+ ownKeys.forEach(function(key) {
690
+ _define_property$1(target, key, source[key]);
691
+ });
692
+ }
693
+ return target;
694
+ }
695
+ function ownKeys(object, enumerableOnly) {
696
+ var keys = Object.keys(object);
697
+ if (Object.getOwnPropertySymbols) {
698
+ var symbols = Object.getOwnPropertySymbols(object);
699
+ if (enumerableOnly) {
700
+ symbols = symbols.filter(function(sym) {
701
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
702
+ });
703
+ }
704
+ keys.push.apply(keys, symbols);
705
+ }
706
+ return keys;
707
+ }
708
+ function _object_spread_props(target, source) {
709
+ source = source != null ? source : {};
710
+ if (Object.getOwnPropertyDescriptors) {
711
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
712
+ } else {
713
+ ownKeys(Object(source)).forEach(function(key) {
714
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
715
+ });
716
+ }
717
+ return target;
718
+ }
719
+ function _sliced_to_array$1(arr, i) {
720
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
721
+ }
722
+ function _unsupported_iterable_to_array$1(o, minLen) {
723
+ if (!o) return;
724
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
725
+ var n = Object.prototype.toString.call(o).slice(8, -1);
726
+ if (n === "Object" && o.constructor) n = o.constructor.name;
727
+ if (n === "Map" || n === "Set") return Array.from(n);
728
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
729
+ }
730
+ function _ts_generator$1(thisArg, body) {
731
+ var f, y, t, g, _ = {
732
+ label: 0,
733
+ sent: function() {
734
+ if (t[0] & 1) throw t[1];
735
+ return t[1];
736
+ },
737
+ trys: [],
738
+ ops: []
739
+ };
740
+ return g = {
741
+ next: verb(0),
742
+ "throw": verb(1),
743
+ "return": verb(2)
744
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
745
+ return this;
746
+ }), g;
747
+ function verb(n) {
748
+ return function(v) {
749
+ return step([
750
+ n,
751
+ v
752
+ ]);
753
+ };
754
+ }
755
+ function step(op) {
756
+ if (f) throw new TypeError("Generator is already executing.");
757
+ while(_)try {
758
+ 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;
759
+ if (y = 0, t) op = [
760
+ op[0] & 2,
761
+ t.value
762
+ ];
763
+ switch(op[0]){
764
+ case 0:
765
+ case 1:
766
+ t = op;
767
+ break;
768
+ case 4:
769
+ _.label++;
770
+ return {
771
+ value: op[1],
772
+ done: false
773
+ };
774
+ case 5:
775
+ _.label++;
776
+ y = op[1];
777
+ op = [
778
+ 0
779
+ ];
780
+ continue;
781
+ case 7:
782
+ op = _.ops.pop();
783
+ _.trys.pop();
784
+ continue;
785
+ default:
786
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
787
+ _ = 0;
788
+ continue;
789
+ }
790
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
791
+ _.label = op[1];
792
+ break;
793
+ }
794
+ if (op[0] === 6 && _.label < t[1]) {
795
+ _.label = t[1];
796
+ t = op;
797
+ break;
798
+ }
799
+ if (t && _.label < t[2]) {
800
+ _.label = t[2];
801
+ _.ops.push(op);
802
+ break;
803
+ }
804
+ if (t[2]) _.ops.pop();
805
+ _.trys.pop();
806
+ continue;
807
+ }
808
+ op = body.call(thisArg, _);
809
+ } catch (e) {
810
+ op = [
811
+ 6,
812
+ e
813
+ ];
814
+ y = 0;
815
+ } finally{
816
+ f = t = 0;
817
+ }
818
+ if (op[0] & 5) throw op[1];
819
+ return {
820
+ value: op[0] ? op[1] : void 0,
821
+ done: true
822
+ };
823
+ }
824
+ }
825
+ /**
826
+ * Constant for remote entry file
827
+ * @constant {string}
828
+ */ var REMOTE_ENTRY_FILE = "remoteEntry.js";
829
+ /**
830
+ * Function to load remote
831
+ * @function
832
+ * @param {ImportRemoteOptions['url']} url - The url of the remote module
833
+ * @param {ImportRemoteOptions['scope']} scope - The scope of the remote module
834
+ * @param {ImportRemoteOptions['bustRemoteEntryCache']} bustRemoteEntryCache - Flag to bust the remote entry cache
835
+ * @returns {Promise<void>} A promise that resolves when the remote is loaded
836
+ */ var loadRemote = function(url, scope, bustRemoteEntryCache) {
837
+ return new Promise(function(resolve, reject) {
838
+ var timestamp = bustRemoteEntryCache ? "?t=".concat(new Date().getTime()) : "";
839
+ var webpackRequire = __webpack_require__;
840
+ webpackRequire.l("".concat(url).concat(timestamp), function(event) {
841
+ var _event_target;
842
+ if ((event === null || event === void 0 ? void 0 : event.type) === "load") {
843
+ // Script loaded successfully:
844
+ return resolve();
845
+ }
846
+ var realSrc = event === null || event === void 0 ? void 0 : (_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.src;
847
+ var error = new Error();
848
+ error.message = "Loading script failed.\n(missing: " + realSrc + ")";
849
+ error.name = "ScriptExternalLoadError";
850
+ reject(error);
851
+ }, scope);
852
+ });
853
+ };
854
+ var loadEsmRemote = function() {
855
+ var _ref = _async_to_generator$1(function(url, scope) {
856
+ var module;
857
+ return _ts_generator$1(this, function(_state) {
858
+ switch(_state.label){
859
+ case 0:
860
+ return [
861
+ 4,
862
+ (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(/* webpackIgnore: true */ url)
863
+ ];
864
+ case 1:
865
+ module = _state.sent();
866
+ if (!module) {
867
+ throw new Error("Unable to load requested remote from ".concat(url, " with scope ").concat(scope));
868
+ }
869
+ window[scope] = _object_spread_props(_object_spread({}, module), {
870
+ __initializing: false,
871
+ __initialized: false
872
+ });
873
+ return [
874
+ 2
875
+ ];
876
+ }
877
+ });
878
+ });
879
+ return function loadEsmRemote(url, scope) {
880
+ return _ref.apply(this, arguments);
881
+ };
882
+ }();
883
+ /**
884
+ * Function to initialize sharing
885
+ * @async
886
+ * @function
887
+ */ var initSharing = function() {
888
+ var _ref = _async_to_generator$1(function() {
889
+ var webpackShareScopes;
890
+ return _ts_generator$1(this, function(_state) {
891
+ switch(_state.label){
892
+ case 0:
893
+ webpackShareScopes = __webpack_share_scopes__;
894
+ if (!!(webpackShareScopes === null || webpackShareScopes === void 0 ? void 0 : webpackShareScopes.default)) return [
895
+ 3,
896
+ 2
897
+ ];
898
+ return [
899
+ 4,
900
+ __webpack_init_sharing__("default")
901
+ ];
902
+ case 1:
903
+ _state.sent();
904
+ _state.label = 2;
905
+ case 2:
906
+ return [
907
+ 2
908
+ ];
909
+ }
910
+ });
911
+ });
912
+ return function initSharing() {
913
+ return _ref.apply(this, arguments);
914
+ };
915
+ }();
916
+ /**
917
+ * Function to initialize container
918
+ * @async
919
+ * @function
920
+ * @param {WebpackRemoteContainer} containerScope - The container scope
921
+ */ var initContainer = function() {
922
+ var _ref = _async_to_generator$1(function(containerScope) {
923
+ var webpackShareScopes, error;
924
+ return _ts_generator$1(this, function(_state) {
925
+ switch(_state.label){
926
+ case 0:
927
+ _state.trys.push([
928
+ 0,
929
+ 3,
930
+ ,
931
+ 4
932
+ ]);
933
+ webpackShareScopes = __webpack_share_scopes__;
934
+ if (!(!containerScope.__initialized && !containerScope.__initializing)) return [
935
+ 3,
936
+ 2
937
+ ];
938
+ containerScope.__initializing = true;
939
+ return [
940
+ 4,
941
+ containerScope.init(webpackShareScopes.default)
942
+ ];
943
+ case 1:
944
+ _state.sent();
945
+ containerScope.__initialized = true;
946
+ delete containerScope.__initializing;
947
+ _state.label = 2;
948
+ case 2:
949
+ return [
950
+ 3,
951
+ 4
952
+ ];
953
+ case 3:
954
+ error = _state.sent();
955
+ console.error(error);
956
+ return [
957
+ 3,
958
+ 4
959
+ ];
960
+ case 4:
961
+ return [
962
+ 2
963
+ ];
964
+ }
965
+ });
966
+ });
967
+ return function initContainer(containerScope) {
968
+ return _ref.apply(this, arguments);
969
+ };
970
+ }();
971
+ /**
972
+ * Function to import remote
973
+ * @async
974
+ * @function
975
+ * @param {ImportRemoteOptions} options - The options for importing the remote
976
+ * @returns {Promise<T>} A promise that resolves with the imported module
977
+ */ var importRemote = function() {
978
+ var _ref = _async_to_generator$1(function(param) {
979
+ var url, scope, module, _param_remoteEntryFileName, remoteEntryFileName, _param_bustRemoteEntryCache, bustRemoteEntryCache, _param_esm, esm, remoteScope, remoteUrl, remoteUrlWithEntryFile, asyncContainer, _ref, moduleFactory, moduleFactory1;
980
+ return _ts_generator$1(this, function(_state) {
981
+ switch(_state.label){
982
+ case 0:
983
+ url = param.url, scope = param.scope, module = param.module, _param_remoteEntryFileName = param.remoteEntryFileName, remoteEntryFileName = _param_remoteEntryFileName === void 0 ? REMOTE_ENTRY_FILE : _param_remoteEntryFileName, _param_bustRemoteEntryCache = param.bustRemoteEntryCache, bustRemoteEntryCache = _param_bustRemoteEntryCache === void 0 ? true : _param_bustRemoteEntryCache, _param_esm = param.esm, esm = _param_esm === void 0 ? false : _param_esm;
984
+ remoteScope = scope;
985
+ if (!!window[remoteScope]) return [
986
+ 3,
987
+ 6
988
+ ];
989
+ remoteUrl = "";
990
+ if (!(typeof url === "string")) return [
991
+ 3,
992
+ 1
993
+ ];
994
+ remoteUrl = url;
995
+ return [
996
+ 3,
997
+ 3
998
+ ];
999
+ case 1:
1000
+ return [
1001
+ 4,
1002
+ url()
1003
+ ];
1004
+ case 2:
1005
+ remoteUrl = _state.sent();
1006
+ _state.label = 3;
1007
+ case 3:
1008
+ remoteUrlWithEntryFile = "".concat(remoteUrl, "/").concat(remoteEntryFileName);
1009
+ asyncContainer = !esm ? loadRemote(remoteUrlWithEntryFile, scope, bustRemoteEntryCache) : loadEsmRemote(remoteUrlWithEntryFile, scope);
1010
+ // Load the remote and initialize the share scope if it's empty
1011
+ return [
1012
+ 4,
1013
+ Promise.all([
1014
+ asyncContainer,
1015
+ initSharing()
1016
+ ])
1017
+ ];
1018
+ case 4:
1019
+ _state.sent();
1020
+ if (!window[remoteScope]) {
1021
+ throw new Error("Remote loaded successfully but ".concat(scope, " could not be found! Verify that the name is correct in the Webpack configuration!"));
1022
+ }
1023
+ return [
1024
+ 4,
1025
+ Promise.all([
1026
+ initContainer(window[remoteScope]),
1027
+ window[remoteScope].get(module === "." || module.startsWith("./") ? module : "./".concat(module))
1028
+ ])
1029
+ ];
1030
+ case 5:
1031
+ _ref = _sliced_to_array$1.apply(void 0, [
1032
+ _state.sent(),
1033
+ 2
1034
+ ]), moduleFactory = _ref[1];
1035
+ return [
1036
+ 2,
1037
+ moduleFactory()
1038
+ ];
1039
+ case 6:
1040
+ return [
1041
+ 4,
1042
+ window[remoteScope].get(module === "." || module.startsWith("./") ? module : "./".concat(module))
1043
+ ];
1044
+ case 7:
1045
+ moduleFactory1 = _state.sent();
1046
+ return [
1047
+ 2,
1048
+ moduleFactory1()
1049
+ ];
1050
+ case 8:
1051
+ return [
1052
+ 2
1053
+ ];
1054
+ }
1055
+ });
1056
+ });
1057
+ return function importRemote(_) {
1058
+ return _ref.apply(this, arguments);
1059
+ };
1060
+ }();
1061
+
1062
+ function _class_call_check(instance, Constructor) {
1063
+ if (!(instance instanceof Constructor)) {
1064
+ throw new TypeError("Cannot call a class as a function");
1065
+ }
1066
+ }
1067
+ function _defineProperties(target, props) {
1068
+ for(var i = 0; i < props.length; i++){
1069
+ var descriptor = props[i];
1070
+ descriptor.enumerable = descriptor.enumerable || false;
1071
+ descriptor.configurable = true;
1072
+ if ("value" in descriptor) descriptor.writable = true;
1073
+ Object.defineProperty(target, descriptor.key, descriptor);
1074
+ }
1075
+ }
1076
+ function _create_class(Constructor, protoProps, staticProps) {
1077
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1078
+ if (staticProps) _defineProperties(Constructor, staticProps);
1079
+ return Constructor;
1080
+ }
1081
+ function _define_property(obj, key, value) {
1082
+ if (key in obj) {
1083
+ Object.defineProperty(obj, key, {
1084
+ value: value,
1085
+ enumerable: true,
1086
+ configurable: true,
1087
+ writable: true
1088
+ });
1089
+ } else {
1090
+ obj[key] = value;
1091
+ }
1092
+ return obj;
1093
+ }
1094
+ var Logger = /*#__PURE__*/ function() {
1095
+ function Logger() {
1096
+ _class_call_check(this, Logger);
1097
+ }
1098
+ _create_class(Logger, null, [
1099
+ {
1100
+ key: "getLogger",
1101
+ value: function getLogger() {
1102
+ return this.loggerInstance;
1103
+ }
1104
+ },
1105
+ {
1106
+ key: "setLogger",
1107
+ value: function setLogger(logger) {
1108
+ this.loggerInstance = logger || console;
1109
+ return logger;
1110
+ }
1111
+ }
1112
+ ]);
1113
+ return Logger;
1114
+ }();
1115
+ _define_property(Logger, "loggerInstance", console);
1116
+
1117
+ function _array_like_to_array(arr, len) {
1118
+ if (len == null || len > arr.length) len = arr.length;
1119
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1120
+ return arr2;
1121
+ }
1122
+ function _array_with_holes(arr) {
1123
+ if (Array.isArray(arr)) return arr;
1124
+ }
1125
+ function _iterable_to_array_limit(arr, i) {
1126
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1127
+ if (_i == null) return;
1128
+ var _arr = [];
1129
+ var _n = true;
1130
+ var _d = false;
1131
+ var _s, _e;
1132
+ try {
1133
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
1134
+ _arr.push(_s.value);
1135
+ if (i && _arr.length === i) break;
1136
+ }
1137
+ } catch (err) {
1138
+ _d = true;
1139
+ _e = err;
1140
+ } finally{
1141
+ try {
1142
+ if (!_n && _i["return"] != null) _i["return"]();
1143
+ } finally{
1144
+ if (_d) throw _e;
1145
+ }
1146
+ }
1147
+ return _arr;
1148
+ }
1149
+ function _non_iterable_rest() {
1150
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1151
+ }
1152
+ function _sliced_to_array(arr, i) {
1153
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
1154
+ }
1155
+ function _unsupported_iterable_to_array(o, minLen) {
1156
+ if (!o) return;
1157
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
1158
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1159
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1160
+ if (n === "Map" || n === "Set") return Array.from(n);
1161
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
1162
+ }
1163
+ var getRuntimeRemotes = function() {
1164
+ try {
1165
+ return Object.entries(remoteVars).reduce(function(acc, item) {
1166
+ var _item = _sliced_to_array(item, 2), key = _item[0], value = _item[1];
1167
+ // if its an object with a thenable (eagerly executing function)
1168
+ if (typeof value === "object" && typeof value.then === "function") {
1169
+ acc[key] = {
1170
+ asyncContainer: value
1171
+ };
1172
+ } else if (typeof value === "function") {
1173
+ // @ts-ignore
1174
+ acc[key] = {
1175
+ asyncContainer: value
1176
+ };
1177
+ } else if (typeof value === "string" && value.startsWith("internal ")) {
1178
+ var _value_replace_split = _sliced_to_array(value.replace("internal ", "").split("?"), 2), request = _value_replace_split[0], query = _value_replace_split[1];
1179
+ if (query) {
1180
+ var remoteSyntax = new URLSearchParams(query).get("remote");
1181
+ if (remoteSyntax) {
1182
+ var _extractUrlAndGlobal = _sliced_to_array(extractUrlAndGlobal(remoteSyntax), 2), url = _extractUrlAndGlobal[0], global = _extractUrlAndGlobal[1];
1183
+ acc[key] = {
1184
+ global: global,
1185
+ url: url
1186
+ };
1187
+ }
1188
+ }
1189
+ } else if (typeof value === "string") {
1190
+ var _extractUrlAndGlobal1 = _sliced_to_array(extractUrlAndGlobal(value), 2), url1 = _extractUrlAndGlobal1[0], global1 = _extractUrlAndGlobal1[1];
1191
+ acc[key] = {
1192
+ global: global1,
1193
+ url: url1
1194
+ };
1195
+ } else {
1196
+ //@ts-ignore
1197
+ console.warn("remotes process", process.env.REMOTES);
1198
+ throw new Error('[mf] Invalid value received for runtime_remote "'.concat(key, '"'));
1199
+ }
1200
+ return acc;
1201
+ }, {});
1202
+ } catch (err) {
1203
+ console.warn("Unable to retrieve runtime remotes: ", err);
1204
+ }
1205
+ return {};
1206
+ };
1207
+
1208
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
1209
+ try {
1210
+ var info = gen[key](arg);
1211
+ var value = info.value;
1212
+ } catch (error) {
1213
+ reject(error);
1214
+ return;
1215
+ }
1216
+ if (info.done) {
1217
+ resolve(value);
1218
+ } else {
1219
+ Promise.resolve(value).then(_next, _throw);
1220
+ }
1221
+ }
1222
+ function _async_to_generator(fn) {
1223
+ return function() {
1224
+ var self = this, args = arguments;
1225
+ return new Promise(function(resolve, reject) {
1226
+ var gen = fn.apply(self, args);
1227
+ function _next(value) {
1228
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
1229
+ }
1230
+ function _throw(err) {
1231
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
1232
+ }
1233
+ _next(undefined);
1234
+ });
1235
+ };
1236
+ }
1237
+ function _ts_generator(thisArg, body) {
1238
+ var f, y, t, g, _ = {
1239
+ label: 0,
1240
+ sent: function() {
1241
+ if (t[0] & 1) throw t[1];
1242
+ return t[1];
1243
+ },
1244
+ trys: [],
1245
+ ops: []
1246
+ };
1247
+ return g = {
1248
+ next: verb(0),
1249
+ "throw": verb(1),
1250
+ "return": verb(2)
1251
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1252
+ return this;
1253
+ }), g;
1254
+ function verb(n) {
1255
+ return function(v) {
1256
+ return step([
1257
+ n,
1258
+ v
1259
+ ]);
1260
+ };
1261
+ }
1262
+ function step(op) {
1263
+ if (f) throw new TypeError("Generator is already executing.");
1264
+ while(_)try {
1265
+ 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;
1266
+ if (y = 0, t) op = [
1267
+ op[0] & 2,
1268
+ t.value
1269
+ ];
1270
+ switch(op[0]){
1271
+ case 0:
1272
+ case 1:
1273
+ t = op;
1274
+ break;
1275
+ case 4:
1276
+ _.label++;
1277
+ return {
1278
+ value: op[1],
1279
+ done: false
1280
+ };
1281
+ case 5:
1282
+ _.label++;
1283
+ y = op[1];
1284
+ op = [
1285
+ 0
1286
+ ];
1287
+ continue;
1288
+ case 7:
1289
+ op = _.ops.pop();
1290
+ _.trys.pop();
1291
+ continue;
1292
+ default:
1293
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1294
+ _ = 0;
1295
+ continue;
1296
+ }
1297
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1298
+ _.label = op[1];
1299
+ break;
1300
+ }
1301
+ if (op[0] === 6 && _.label < t[1]) {
1302
+ _.label = t[1];
1303
+ t = op;
1304
+ break;
1305
+ }
1306
+ if (t && _.label < t[2]) {
1307
+ _.label = t[2];
1308
+ _.ops.push(op);
1309
+ break;
1310
+ }
1311
+ if (t[2]) _.ops.pop();
1312
+ _.trys.pop();
1313
+ continue;
1314
+ }
1315
+ op = body.call(thisArg, _);
1316
+ } catch (e) {
1317
+ op = [
1318
+ 6,
1319
+ e
1320
+ ];
1321
+ y = 0;
1322
+ } finally{
1323
+ f = t = 0;
1324
+ }
1325
+ if (op[0] & 5) throw op[1];
1326
+ return {
1327
+ value: op[0] ? op[1] : void 0,
1328
+ done: true
1329
+ };
1330
+ }
1331
+ }
1332
+ var importDelegatedModule = function() {
1333
+ var _ref = _async_to_generator(function(keyOrRuntimeRemoteItem) {
1334
+ return _ts_generator(this, function(_state) {
1335
+ // @ts-ignore
1336
+ return [
1337
+ 2,
1338
+ loadScript(keyOrRuntimeRemoteItem).then(function(asyncContainer) {
1339
+ return asyncContainer;
1340
+ }).then(function(asyncContainer) {
1341
+ // most of this is only needed because of legacy promise based implementation
1342
+ // can remove proxies once we remove promise based implementations
1343
+ if (typeof window === "undefined") {
1344
+ if (!Object.hasOwnProperty.call(keyOrRuntimeRemoteItem, "globalThis")) {
1345
+ return asyncContainer;
1346
+ }
1347
+ // return asyncContainer;
1348
+ //TODO: need to solve chunk flushing with delegated modules
1349
+ return {
1350
+ get: function get(arg) {
1351
+ //@ts-ignore
1352
+ return asyncContainer.get(arg).then(function(f) {
1353
+ var _loop = function(prop) {
1354
+ if (typeof m[prop] === "function") {
1355
+ Object.defineProperty(result, prop, {
1356
+ get: function get() {
1357
+ return function() {
1358
+ var _m;
1359
+ //@ts-ignore
1360
+ if (globalThis.usedChunks) {
1361
+ //@ts-ignore
1362
+ globalThis.usedChunks.add(//@ts-ignore
1363
+ "".concat(keyOrRuntimeRemoteItem.global, "->").concat(arg));
1364
+ }
1365
+ //eslint-disable-next-line prefer-rest-params
1366
+ return (_m = m)[prop].apply(_m, arguments);
1367
+ };
1368
+ },
1369
+ enumerable: true
1370
+ });
1371
+ } else {
1372
+ Object.defineProperty(result, prop, {
1373
+ get: function() {
1374
+ //@ts-ignore
1375
+ if (globalThis.usedChunks) {
1376
+ //@ts-ignore
1377
+ globalThis.usedChunks.add(//@ts-ignore
1378
+ "".concat(keyOrRuntimeRemoteItem.global, "->").concat(arg));
1379
+ }
1380
+ return m[prop];
1381
+ },
1382
+ enumerable: true
1383
+ });
1384
+ }
1385
+ };
1386
+ var m = f();
1387
+ var result = {
1388
+ __esModule: m.__esModule
1389
+ };
1390
+ for(var prop in m)_loop(prop);
1391
+ if (m.then) {
1392
+ return Promise.resolve(function() {
1393
+ return result;
1394
+ });
1395
+ }
1396
+ return function() {
1397
+ return result;
1398
+ };
1399
+ });
1400
+ },
1401
+ init: asyncContainer.init
1402
+ };
1403
+ } else {
1404
+ return asyncContainer;
1405
+ }
1406
+ })
1407
+ ];
1408
+ });
1409
+ });
1410
+ return function importDelegatedModule(keyOrRuntimeRemoteItem) {
1411
+ return _ref.apply(this, arguments);
1412
+ };
1413
+ }();
1414
+
1415
+ exports.Logger = Logger;
1416
+ exports.createDelegatedModule = createDelegatedModule;
1417
+ exports.createRuntimeVariables = createRuntimeVariables;
1418
+ exports.extractUrlAndGlobal = extractUrlAndGlobal;
1419
+ exports.getContainer = getContainer;
1420
+ exports.getModule = getModule;
1421
+ exports.getRuntimeRemotes = getRuntimeRemotes;
1422
+ exports.importDelegatedModule = importDelegatedModule;
1423
+ exports.importRemote = importRemote;
1424
+ exports.injectScript = injectScript;
1425
+ exports.isObjectEmpty = isObjectEmpty;
1426
+ exports.loadScript = loadScript;