@module-federation/utilities 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,116 +1,135 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/ban-ts-comment */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.getModule = exports.getContainer = exports.createRuntimeVariables = exports.injectScript = exports.createDelegatedModule = exports.importDelegatedModule = exports.extractUrlAndGlobal = void 0;
5
- var tslib_1 = require("tslib");
4
+ exports.getModule = exports.getContainer = exports.createRuntimeVariables = exports.injectScript = exports.loadScript = exports.createDelegatedModule = exports.importDelegatedModule = exports.extractUrlAndGlobal = exports.remoteVars = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const getRuntimeRemotes_1 = require("./getRuntimeRemotes");
7
+ let remotesFromProcess = {};
8
+ try {
9
+ // @ts-ignore
10
+ remotesFromProcess = process.env['REMOTES'] || {};
11
+ }
12
+ catch (e) {
13
+ // not in webpack bundle
14
+ }
15
+ exports.remoteVars = remotesFromProcess;
6
16
  // split the @ syntax into url and global
7
- var extractUrlAndGlobal = function (urlAndGlobal) {
8
- var index = urlAndGlobal.indexOf('@');
17
+ const extractUrlAndGlobal = (urlAndGlobal) => {
18
+ const index = urlAndGlobal.indexOf('@');
9
19
  if (index <= 0 || index === urlAndGlobal.length - 1) {
10
- throw new Error("Invalid request \"".concat(urlAndGlobal, "\""));
20
+ throw new Error(`Invalid request "${urlAndGlobal}"`);
11
21
  }
12
22
  return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)];
13
23
  };
14
24
  exports.extractUrlAndGlobal = extractUrlAndGlobal;
15
- var getRuntimeRemotes = function () {
16
- try {
17
- //@ts-ignore
18
- var remoteVars = (process.env.REMOTES || {});
19
- var runtimeRemotes = Object.entries(remoteVars).reduce(function (acc, item) {
20
- var key = item[0], value = item[1];
21
- // if its an object with a thenable (eagerly executing function)
22
- if (typeof value === 'object' && typeof value.then === 'function') {
23
- acc[key] = { asyncContainer: value };
24
- }
25
- // if its a function that must be called (lazily executing function)
26
- else if (typeof value === 'function') {
27
- // @ts-ignore
28
- acc[key] = { asyncContainer: value };
29
- }
30
- // if its a delegate module, skip it
31
- else if (typeof value === 'string' && value.startsWith('internal ')) {
32
- // do nothing to internal modules
33
- }
34
- // if its just a string (global@url)
35
- else if (typeof value === 'string') {
36
- var _a = (0, exports.extractUrlAndGlobal)(value), url = _a[0], global_1 = _a[1];
37
- acc[key] = { global: global_1, url: url };
38
- }
39
- // we dont know or currently support this type
40
- else {
41
- //@ts-ignore
42
- console.log('remotes process', process.env.REMOTES);
43
- throw new Error("[mf] Invalid value received for runtime_remote \"".concat(key, "\""));
44
- }
45
- return acc;
46
- }, {});
47
- return runtimeRemotes;
48
- }
49
- catch (err) {
50
- console.warn('Unable to retrieve runtime remotes: ', err);
51
- }
52
- return {};
53
- };
54
- var importDelegatedModule = function (keyOrRuntimeRemoteItem) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
55
- return tslib_1.__generator(this, function (_a) {
56
- // @ts-ignore
57
- return [2 /*return*/, loadScript(keyOrRuntimeRemoteItem)
58
- .then(function (asyncContainer) {
25
+ const importDelegatedModule = (keyOrRuntimeRemoteItem) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
26
+ // @ts-ignore
27
+ return (0, exports.loadScript)(keyOrRuntimeRemoteItem)
28
+ .then((asyncContainer) => {
29
+ return asyncContainer;
30
+ })
31
+ .then((asyncContainer) => {
32
+ // most of this is only needed because of legacy promise based implementation
33
+ // can remove proxies once we remove promise based implementations
34
+ if (typeof window === 'undefined') {
35
+ if (!Object.hasOwnProperty.call(keyOrRuntimeRemoteItem, 'global')) {
59
36
  return asyncContainer;
60
- })
61
- .then(function (asyncContainer) {
62
- // most of this is only needed because of legacy promise based implementation
63
- // can remove proxies once we remove promise based implementations
64
- if (typeof window === 'undefined') {
65
- //TODO: need to solve chunk flushing with delegated modules
66
- return asyncContainer;
67
- }
68
- else {
69
- var proxy_1 = {
70
- get: asyncContainer.get,
71
- //@ts-ignore
72
- init: function (shareScope, initScope) {
73
- try {
74
- //@ts-ignore
75
- asyncContainer.init(shareScope, initScope);
76
- // for legacy reasons, we must mark container a initialized
77
- // here otherwise older promise based implementation will try to init again with diff object
78
- //@ts-ignore
79
- proxy_1.__initialized = true;
37
+ }
38
+ //TODO: need to solve chunk flushing with delegated modules
39
+ return {
40
+ get: function (arg) {
41
+ //@ts-ignore
42
+ return asyncContainer.get(arg).then((f) => {
43
+ const m = f();
44
+ const result = {
45
+ __esModule: m.__esModule,
46
+ };
47
+ for (const prop in m) {
48
+ if (typeof m[prop] === 'function') {
49
+ Object.defineProperty(result, prop, {
50
+ get: function () {
51
+ return function () {
52
+ //@ts-ignore
53
+ if (global.usedChunks)
54
+ //@ts-ignore
55
+ global.usedChunks.add(
56
+ //@ts-ignore
57
+ `${keyOrRuntimeRemoteItem.global}->${arg}`);
58
+ // eslint-disable-next-line prefer-rest-params
59
+ return m[prop](arguments);
60
+ };
61
+ },
62
+ enumerable: true,
63
+ });
80
64
  }
81
- catch (e) {
82
- return 1;
65
+ else {
66
+ Object.defineProperty(result, prop, {
67
+ get: () => {
68
+ //@ts-ignore
69
+ if (global.usedChunks)
70
+ //@ts-ignore
71
+ global.usedChunks.add(
72
+ //@ts-ignore
73
+ `${keyOrRuntimeRemoteItem.global}->${arg}`);
74
+ return m[prop];
75
+ },
76
+ enumerable: true,
77
+ });
83
78
  }
84
- },
85
- };
86
- // @ts-ignore
87
- if (!proxy_1.__initialized) {
79
+ }
80
+ if (m.then) {
81
+ return Promise.resolve(() => result);
82
+ }
83
+ return () => result;
84
+ });
85
+ },
86
+ init: asyncContainer.init,
87
+ };
88
+ }
89
+ else {
90
+ const proxy = {
91
+ get: asyncContainer.get,
92
+ //@ts-ignore
93
+ init: function (shareScope, initScope) {
94
+ try {
88
95
  //@ts-ignore
89
- proxy_1.init(__webpack_share_scopes__.default);
96
+ asyncContainer.init(shareScope, initScope);
97
+ // for legacy reasons, we must mark container a initialized
98
+ // here otherwise older promise based implementation will try to init again with diff object
99
+ //@ts-ignore
100
+ proxy.__initialized = true;
90
101
  }
91
- return proxy_1;
92
- }
93
- })];
102
+ catch (e) {
103
+ return 1;
104
+ }
105
+ },
106
+ };
107
+ // @ts-ignore
108
+ if (!proxy.__initialized) {
109
+ //@ts-ignore
110
+ proxy.init(__webpack_share_scopes__.default);
111
+ }
112
+ return proxy;
113
+ }
94
114
  });
95
- }); };
115
+ });
96
116
  exports.importDelegatedModule = importDelegatedModule;
97
- var createDelegatedModule = function (delegate, params) {
98
- var queries = [];
99
- for (var _i = 0, _a = Object.entries(params); _i < _a.length; _i++) {
100
- var _b = _a[_i], key = _b[0], value = _b[1];
117
+ const createDelegatedModule = (delegate, params) => {
118
+ const queries = [];
119
+ for (const [key, value] of Object.entries(params)) {
101
120
  if (Array.isArray(value) || typeof value === 'object') {
102
- throw new Error("[Module Federation] Delegated module params cannot be an array or object. Key \"".concat(key, "\" should be a string or number"));
121
+ throw new Error(`[Module Federation] Delegated module params cannot be an array or object. Key "${key}" should be a string or number`);
103
122
  }
104
- queries.push("".concat(key, "=").concat(value));
123
+ queries.push(`${key}=${value}`);
105
124
  }
106
- return "internal ".concat(delegate, "?").concat(queries.join('&'));
125
+ return `internal ${delegate}?${queries.join('&')}`;
107
126
  };
108
127
  exports.createDelegatedModule = createDelegatedModule;
109
- var loadScript = function (keyOrRuntimeRemoteItem) {
110
- var runtimeRemotes = getRuntimeRemotes();
128
+ const loadScript = (keyOrRuntimeRemoteItem) => {
129
+ const runtimeRemotes = (0, getRuntimeRemotes_1.getRuntimeRemotes)();
111
130
  // 1) Load remote container if needed
112
- var asyncContainer;
113
- var reference = typeof keyOrRuntimeRemoteItem === 'string'
131
+ let asyncContainer;
132
+ const reference = typeof keyOrRuntimeRemoteItem === 'string'
114
133
  ? runtimeRemotes[keyOrRuntimeRemoteItem]
115
134
  : keyOrRuntimeRemoteItem;
116
135
  if (reference.asyncContainer) {
@@ -123,12 +142,12 @@ var loadScript = function (keyOrRuntimeRemoteItem) {
123
142
  else {
124
143
  // This casting is just to satisfy typescript,
125
144
  // In reality remoteGlobal will always be a string;
126
- var remoteGlobal_1 = reference.global;
145
+ const remoteGlobal = reference.global;
127
146
  // Check if theres an override for container key if not use remote global
128
- var containerKey_1 = reference.uniqueKey
147
+ const containerKey = reference.uniqueKey
129
148
  ? reference.uniqueKey
130
- : remoteGlobal_1;
131
- var __webpack_error__1 = new Error();
149
+ : remoteGlobal;
150
+ const __webpack_error__ = new Error();
132
151
  // @ts-ignore
133
152
  if (!global.__remote_scope__) {
134
153
  // create a global scope for container, similar to how remotes are set on window in the browser
@@ -138,56 +157,58 @@ var loadScript = function (keyOrRuntimeRemoteItem) {
138
157
  _config: {},
139
158
  };
140
159
  }
141
- var globalScope_1 =
160
+ // @ts-ignore
161
+ const globalScope =
142
162
  // @ts-ignore
143
163
  typeof window !== 'undefined' ? window : global.__remote_scope__;
144
164
  if (typeof window === 'undefined') {
145
- globalScope_1['_config'][containerKey_1] = reference.url;
165
+ globalScope['_config'][containerKey] = reference.url;
146
166
  }
147
167
  else {
148
168
  // to match promise template system, can be removed once promise template is gone
149
- if (!globalScope_1['remoteLoading']) {
150
- globalScope_1['remoteLoading'] = {};
169
+ if (!globalScope['remoteLoading']) {
170
+ globalScope['remoteLoading'] = {};
151
171
  }
152
- if (globalScope_1['remoteLoading'][containerKey_1]) {
153
- return globalScope_1['remoteLoading'][containerKey_1];
172
+ if (globalScope['remoteLoading'][containerKey]) {
173
+ return globalScope['remoteLoading'][containerKey];
154
174
  }
155
175
  }
156
176
  asyncContainer = new Promise(function (resolve, reject) {
157
177
  function resolveRemoteGlobal() {
158
- var asyncContainer = globalScope_1[remoteGlobal_1];
178
+ const asyncContainer = globalScope[remoteGlobal];
159
179
  return resolve(asyncContainer);
160
180
  }
161
- if (typeof globalScope_1[remoteGlobal_1] !== 'undefined') {
181
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
162
182
  return resolveRemoteGlobal();
163
183
  }
164
184
  __webpack_require__.l(reference.url, function (event) {
165
- if (typeof globalScope_1[remoteGlobal_1] !== 'undefined') {
185
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
166
186
  return resolveRemoteGlobal();
167
187
  }
168
- var errorType = event && (event.type === 'load' ? 'missing' : event.type);
169
- var realSrc = event && event.target && event.target.src;
170
- __webpack_error__1.message =
188
+ const errorType = event && (event.type === 'load' ? 'missing' : event.type);
189
+ const realSrc = event && event.target && event.target.src;
190
+ __webpack_error__.message =
171
191
  'Loading script failed.\n(' +
172
192
  errorType +
173
193
  ': ' +
174
194
  realSrc +
175
195
  ' or global var ' +
176
- remoteGlobal_1 +
196
+ remoteGlobal +
177
197
  ')';
178
- __webpack_error__1.name = 'ScriptExternalLoadError';
179
- __webpack_error__1.type = errorType;
180
- __webpack_error__1.request = realSrc;
181
- reject(__webpack_error__1);
182
- }, containerKey_1);
198
+ __webpack_error__.name = 'ScriptExternalLoadError';
199
+ __webpack_error__.type = errorType;
200
+ __webpack_error__.request = realSrc;
201
+ reject(__webpack_error__);
202
+ }, containerKey);
183
203
  });
184
204
  if (typeof window !== 'undefined') {
185
- globalScope_1['remoteLoading'][containerKey_1] = asyncContainer;
205
+ globalScope['remoteLoading'][containerKey] = asyncContainer;
186
206
  }
187
207
  }
188
208
  return asyncContainer;
189
209
  };
190
- var createContainerSharingScope = function (asyncContainer) {
210
+ exports.loadScript = loadScript;
211
+ const createContainerSharingScope = (asyncContainer) => {
191
212
  // @ts-ignore
192
213
  return asyncContainer
193
214
  .then(function (container) {
@@ -226,22 +247,24 @@ var createContainerSharingScope = function (asyncContainer) {
226
247
  * or
227
248
  * { asyncContainer } - async container is a promise that resolves to the remote container
228
249
  */
229
- var injectScript = function (keyOrRuntimeRemoteItem) {
230
- var asyncContainer = loadScript(keyOrRuntimeRemoteItem);
250
+ const injectScript = (keyOrRuntimeRemoteItem) => {
251
+ const asyncContainer = (0, exports.loadScript)(keyOrRuntimeRemoteItem);
231
252
  return createContainerSharingScope(asyncContainer);
232
253
  };
233
254
  exports.injectScript = injectScript;
234
- var createRuntimeVariables = function (remotes) {
255
+ const createRuntimeVariables = (remotes) => {
235
256
  if (!remotes) {
236
257
  return {};
237
258
  }
238
- return Object.entries(remotes).reduce(function (acc, remote) {
259
+ return Object.entries(remotes).reduce((acc, remote) => {
239
260
  // handle promise new promise and external new promise
240
261
  if (remote[1].startsWith('promise ') || remote[1].startsWith('external ')) {
241
- var promiseCall = remote[1]
262
+ const promiseCall = remote[1]
242
263
  .replace('promise ', '')
243
264
  .replace('external ', '');
244
- acc[remote[0]] = "function() {\n return ".concat(promiseCall, "\n }");
265
+ acc[remote[0]] = `function() {
266
+ return ${promiseCall}
267
+ }`;
245
268
  return acc;
246
269
  }
247
270
  // if somehow its just the @ syntax or something else, pass it through
@@ -254,40 +277,35 @@ exports.createRuntimeVariables = createRuntimeVariables;
254
277
  * Returns initialized webpack RemoteContainer.
255
278
  * If its' script does not loaded - then load & init it firstly.
256
279
  */
257
- var getContainer = function (remoteContainer) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
258
- var containerScope, uniqueKey, container;
259
- return tslib_1.__generator(this, function (_a) {
260
- switch (_a.label) {
261
- case 0:
262
- if (!remoteContainer) {
263
- throw Error("Remote container options is empty");
264
- }
265
- containerScope =
266
- //@ts-ignore
267
- typeof window !== 'undefined' ? window : global.__remote_scope__;
268
- if (!(typeof remoteContainer === 'string')) return [3 /*break*/, 1];
269
- if (containerScope[remoteContainer]) {
270
- return [2 /*return*/, containerScope[remoteContainer]];
271
- }
272
- return [2 /*return*/];
273
- case 1:
274
- uniqueKey = remoteContainer.uniqueKey;
275
- if (containerScope[uniqueKey]) {
276
- return [2 /*return*/, containerScope[uniqueKey]];
277
- }
278
- return [4 /*yield*/, (0, exports.injectScript)({
279
- global: remoteContainer.global,
280
- url: remoteContainer.url,
281
- })];
282
- case 2:
283
- container = _a.sent();
284
- if (container) {
285
- return [2 /*return*/, container];
286
- }
287
- throw Error("Remote container ".concat(remoteContainer.url, " is empty"));
280
+ const getContainer = (remoteContainer) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
281
+ if (!remoteContainer) {
282
+ throw Error(`Remote container options is empty`);
283
+ }
284
+ // @ts-ignore
285
+ const containerScope =
286
+ // @ts-ignore
287
+ typeof window !== 'undefined' ? window : global.__remote_scope__;
288
+ if (typeof remoteContainer === 'string') {
289
+ if (containerScope[remoteContainer]) {
290
+ return containerScope[remoteContainer];
288
291
  }
289
- });
290
- }); };
292
+ return;
293
+ }
294
+ else {
295
+ const uniqueKey = remoteContainer.uniqueKey;
296
+ if (containerScope[uniqueKey]) {
297
+ return containerScope[uniqueKey];
298
+ }
299
+ const container = yield (0, exports.injectScript)({
300
+ global: remoteContainer.global,
301
+ url: remoteContainer.url,
302
+ });
303
+ if (container) {
304
+ return container;
305
+ }
306
+ throw Error(`Remote container ${remoteContainer.url} is empty`);
307
+ }
308
+ });
291
309
  exports.getContainer = getContainer;
292
310
  /**
293
311
  * Return remote module from container.
@@ -296,39 +314,24 @@ exports.getContainer = getContainer;
296
314
  * @example
297
315
  * remote.getModule('./pages/index', 'default')
298
316
  */
299
- var getModule = function (_a) {
300
- var remoteContainer = _a.remoteContainer, modulePath = _a.modulePath, exportName = _a.exportName;
301
- return tslib_1.__awaiter(void 0, void 0, void 0, function () {
302
- var container, modFactory, mod, error_1;
303
- return tslib_1.__generator(this, function (_b) {
304
- switch (_b.label) {
305
- case 0: return [4 /*yield*/, (0, exports.getContainer)(remoteContainer)];
306
- case 1:
307
- container = _b.sent();
308
- _b.label = 2;
309
- case 2:
310
- _b.trys.push([2, 4, , 5]);
311
- return [4 /*yield*/, (container === null || container === void 0 ? void 0 : container.get(modulePath))];
312
- case 3:
313
- modFactory = _b.sent();
314
- if (!modFactory)
315
- return [2 /*return*/, undefined];
316
- mod = modFactory();
317
- if (exportName) {
318
- return [2 /*return*/, mod && typeof mod === 'object' ? mod[exportName] : undefined];
319
- }
320
- else {
321
- return [2 /*return*/, mod];
322
- }
323
- return [3 /*break*/, 5];
324
- case 4:
325
- error_1 = _b.sent();
326
- console.log(error_1);
327
- return [2 /*return*/, undefined];
328
- case 5: return [2 /*return*/];
329
- }
330
- });
331
- });
332
- };
317
+ const getModule = ({ remoteContainer, modulePath, exportName, }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
318
+ const container = yield (0, exports.getContainer)(remoteContainer);
319
+ try {
320
+ const modFactory = yield (container === null || container === void 0 ? void 0 : container.get(modulePath));
321
+ if (!modFactory)
322
+ return undefined;
323
+ const mod = modFactory();
324
+ if (exportName) {
325
+ return mod && typeof mod === 'object' ? mod[exportName] : undefined;
326
+ }
327
+ else {
328
+ return mod;
329
+ }
330
+ }
331
+ catch (error) {
332
+ console.log(error);
333
+ return undefined;
334
+ }
335
+ });
333
336
  exports.getModule = getModule;
334
337
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/common.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;;AAmBtD,yCAAyC;AAClC,IAAM,mBAAmB,GAAG,UAAC,YAAoB;IACtD,IAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,KAAK,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,4BAAoB,YAAY,OAAG,CAAC,CAAC;KACtD;IACD,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AANW,QAAA,mBAAmB,uBAM9B;AAEF,IAAM,iBAAiB,GAAG;IACxB,IAAI;QACF,YAAY;QACZ,IAAM,UAAU,GAAG,CAAC,OAA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ACzB,IAAI,UAAU,EAAE;YACd,OAAO,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACrE;aAAM;YACL,OAAO,GAAG,CAAC;SACZ;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,SAAS,CAAC;KAClB;AACH,CAAC,CAAA,CAAC;AAnBW,QAAA,SAAS,aAmBpB"}
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.correctImportPath = void 0;
4
- var tslib_1 = require("tslib");
5
- var os_1 = tslib_1.__importDefault(require("os"));
6
- var path_1 = tslib_1.__importDefault(require("path"));
7
- var correctImportPath = function (context, entryFile) {
4
+ const tslib_1 = require("tslib");
5
+ const os_1 = tslib_1.__importDefault(require("os"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const correctImportPath = (context, entryFile) => {
8
8
  if (os_1.default.platform() !== 'win32') {
9
9
  return entryFile;
10
10
  }
11
11
  if (entryFile.match(/^\.?\.\\/) || !entryFile.match(/^[A-Z]:\\\\/i)) {
12
12
  return entryFile.replace(/\\/g, '/');
13
13
  }
14
- var joint = path_1.default.win32.relative(context, entryFile);
15
- var relative = joint.replace(/\\/g, '/');
14
+ const joint = path_1.default.win32.relative(context, entryFile);
15
+ const relative = joint.replace(/\\/g, '/');
16
16
  if (relative.includes('node_modules/')) {
17
17
  return relative.split('node_modules/')[1];
18
18
  }
19
- return "./".concat(relative);
19
+ return `./${relative}`;
20
20
  };
21
21
  exports.correctImportPath = correctImportPath;
22
22
  //# sourceMappingURL=correctImportPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"correctImportPath.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/correctImportPath.ts"],"names":[],"mappings":";;;;AAAA,kDAAoB;AACpB,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AAE,SAAS,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAE3C,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;QACtC,OAAO,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,KAAK,QAAQ,EAAE,CAAC;AACzB,CAAC,CAAC;AAjBW,QAAA,iBAAiB,qBAiB5B"}
@@ -0,0 +1,2 @@
1
+ import { RuntimeRemotesMap } from '../types';
2
+ export declare const getRuntimeRemotes: () => RuntimeRemotesMap;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRuntimeRemotes = void 0;
4
+ const common_1 = require("./common");
5
+ const getRuntimeRemotes = () => {
6
+ try {
7
+ const runtimeRemotes = Object.entries(common_1.remoteVars).reduce(function (acc, item) {
8
+ const [key, value] = item;
9
+ // if its an object with a thenable (eagerly executing function)
10
+ if (typeof value === 'object' && typeof value.then === 'function') {
11
+ acc[key] = { asyncContainer: value };
12
+ }
13
+ // if its a function that must be called (lazily executing function)
14
+ else if (typeof value === 'function') {
15
+ // @ts-ignore
16
+ acc[key] = { asyncContainer: value };
17
+ }
18
+ // if its a delegate module, skip it
19
+ else if (typeof value === 'string' && value.startsWith('internal ')) {
20
+ const [request, query] = value.replace('internal ', '').split('?');
21
+ if (query) {
22
+ const remoteSyntax = new URLSearchParams(query).get('remote');
23
+ if (remoteSyntax) {
24
+ const [url, global] = (0, common_1.extractUrlAndGlobal)(remoteSyntax);
25
+ acc[key] = { global, url };
26
+ }
27
+ }
28
+ }
29
+ // if its just a string (global@url)
30
+ else if (typeof value === 'string') {
31
+ const [url, global] = (0, common_1.extractUrlAndGlobal)(value);
32
+ acc[key] = { global, url };
33
+ }
34
+ // we dont know or currently support this type
35
+ else {
36
+ //@ts-ignore
37
+ console.log('remotes process', process.env.REMOTES);
38
+ throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
39
+ }
40
+ return acc;
41
+ }, {});
42
+ return runtimeRemotes;
43
+ }
44
+ catch (err) {
45
+ console.warn('Unable to retrieve runtime remotes: ', err);
46
+ }
47
+ return {};
48
+ };
49
+ exports.getRuntimeRemotes = getRuntimeRemotes;
50
+ //# sourceMappingURL=getRuntimeRemotes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRuntimeRemotes.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/getRuntimeRemotes.ts"],"names":[],"mappings":";;;AACA,qCAA2D;AAEpD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,IAAI;QACF,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAU,CAAC,CAAC,MAAM,CAAC,UACvD,GAAG,EACH,IAAI;YAEJ,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;YAC1B,gEAAgE;YAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;gBACjE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;aACtC;YACD,oEAAoE;iBAC/D,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;gBACpC,aAAa;gBACb,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;aACtC;YACD,oCAAoC;iBAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACnE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnE,IAAI,KAAK,EAAE;oBACT,MAAM,YAAY,GAAG,IAAI,eAAe,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