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