@module-federation/utilities 0.0.0-chore-bump-node-22-20260710161714

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/dist/cjs/Logger.js +63 -0
  4. package/dist/cjs/components/ErrorBoundary.js +98 -0
  5. package/dist/cjs/components/FederationBoundary.js +103 -0
  6. package/dist/cjs/index.js +172 -0
  7. package/dist/cjs/plugins/DelegateModulesPlugin.js +133 -0
  8. package/dist/cjs/types/index.js +31 -0
  9. package/dist/cjs/utils/common.js +175 -0
  10. package/dist/cjs/utils/getRuntimeRemotes.js +104 -0
  11. package/dist/cjs/utils/getRuntimeRemotes.test.js +98 -0
  12. package/dist/cjs/utils/importDelegateModule.test.js +99 -0
  13. package/dist/cjs/utils/importDelegatedModule.js +126 -0
  14. package/dist/cjs/utils/importRemote.js +176 -0
  15. package/dist/cjs/utils/isEmpty.js +60 -0
  16. package/dist/cjs/utils/pure.js +215 -0
  17. package/dist/cjs/utils/react.js +73 -0
  18. package/dist/esm/Logger.mjs +12 -0
  19. package/dist/esm/components/ErrorBoundary.mjs +31 -0
  20. package/dist/esm/components/FederationBoundary.mjs +35 -0
  21. package/dist/esm/index.mjs +24 -0
  22. package/dist/esm/plugins/DelegateModulesPlugin.mjs +81 -0
  23. package/dist/esm/rslib-runtime.mjs +37 -0
  24. package/dist/esm/types/index.mjs +4 -0
  25. package/dist/esm/utils/common.mjs +116 -0
  26. package/dist/esm/utils/getRuntimeRemotes.mjs +50 -0
  27. package/dist/esm/utils/getRuntimeRemotes.test.mjs +84 -0
  28. package/dist/esm/utils/importDelegateModule.test.mjs +72 -0
  29. package/dist/esm/utils/importDelegatedModule.mjs +72 -0
  30. package/dist/esm/utils/importRemote.mjs +105 -0
  31. package/dist/esm/utils/isEmpty.mjs +8 -0
  32. package/dist/esm/utils/pure.mjs +138 -0
  33. package/dist/esm/utils/react.mjs +4 -0
  34. package/dist/types/Logger.d.ts +7 -0
  35. package/dist/types/components/ErrorBoundary.d.ts +19 -0
  36. package/dist/types/components/FederationBoundary.d.ts +14 -0
  37. package/dist/types/index.d.ts +10 -0
  38. package/dist/types/plugins/DelegateModulesPlugin.d.ts +18 -0
  39. package/dist/types/types/index.d.ts +76 -0
  40. package/dist/types/utils/common.d.ts +31 -0
  41. package/dist/types/utils/getRuntimeRemotes.d.ts +2 -0
  42. package/dist/types/utils/importDelegatedModule.d.ts +2 -0
  43. package/dist/types/utils/importRemote.d.ts +31 -0
  44. package/dist/types/utils/isEmpty.d.ts +1 -0
  45. package/dist/types/utils/pure.d.ts +5 -0
  46. package/dist/types/utils/react.d.ts +1 -0
  47. package/package.json +68 -0
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ // ESM COMPAT FLAG
42
+ __webpack_require__.r(__webpack_exports__);
43
+
44
+ // EXPORTS
45
+ __webpack_require__.d(__webpack_exports__, {
46
+ importDelegatedModule: () => (/* binding */ importDelegatedModule)
47
+ });
48
+
49
+ ;// CONCATENATED MODULE: external "./pure.js"
50
+ const external_pure_js_namespaceObject = require("./pure.js");
51
+ ;// CONCATENATED MODULE: ./src/utils/importDelegatedModule.ts
52
+
53
+ const importDelegatedModule = async (keyOrRuntimeRemoteItem)=>{
54
+ // @ts-ignore
55
+ return (0,external_pure_js_namespaceObject.loadScript)(keyOrRuntimeRemoteItem).then((asyncContainer)=>{
56
+ return asyncContainer;
57
+ }).then((asyncContainer)=>{
58
+ // most of this is only needed because of legacy promise based implementation
59
+ // can remove proxies once we remove promise based implementations
60
+ if (typeof window === 'undefined') {
61
+ if (!Object.hasOwnProperty.call(keyOrRuntimeRemoteItem, 'globalThis')) {
62
+ return asyncContainer;
63
+ }
64
+ // return asyncContainer;
65
+ //TODO: need to solve chunk flushing with delegated modules
66
+ return {
67
+ get: function(arg) {
68
+ //@ts-ignore
69
+ return asyncContainer.get(arg).then((f)=>{
70
+ const m = f();
71
+ const result = {
72
+ __esModule: m.__esModule
73
+ };
74
+ for(const prop in m){
75
+ if (typeof m[prop] === 'function') {
76
+ Object.defineProperty(result, prop, {
77
+ get: function() {
78
+ return function() {
79
+ //@ts-ignore
80
+ if (globalThis.usedChunks) {
81
+ //@ts-ignore
82
+ globalThis.usedChunks.add(//@ts-ignore
83
+ `${keyOrRuntimeRemoteItem.global}->${arg}`);
84
+ }
85
+ //eslint-disable-next-line prefer-rest-params
86
+ return m[prop](...arguments);
87
+ };
88
+ },
89
+ enumerable: true
90
+ });
91
+ } else {
92
+ Object.defineProperty(result, prop, {
93
+ get: ()=>{
94
+ //@ts-ignore
95
+ if (globalThis.usedChunks) {
96
+ //@ts-ignore
97
+ globalThis.usedChunks.add(//@ts-ignore
98
+ `${keyOrRuntimeRemoteItem.global}->${arg}`);
99
+ }
100
+ return m[prop];
101
+ },
102
+ enumerable: true
103
+ });
104
+ }
105
+ }
106
+ if (m.then) {
107
+ return Promise.resolve(()=>result);
108
+ }
109
+ return ()=>result;
110
+ });
111
+ },
112
+ init: asyncContainer.init
113
+ };
114
+ } else {
115
+ return asyncContainer;
116
+ }
117
+ });
118
+ };
119
+
120
+ exports.importDelegatedModule = __webpack_exports__.importDelegatedModule;
121
+ for(var __rspack_i in __webpack_exports__) {
122
+ if(["importDelegatedModule"].indexOf(__rspack_i) === -1) {
123
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
124
+ }
125
+ }
126
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ var __webpack_modules__ = ({});
10
+ // The module cache
11
+ var __webpack_module_cache__ = {};
12
+
13
+ // The require function
14
+ function __webpack_require__(moduleId) {
15
+
16
+ // Check if module is in cache
17
+ var cachedModule = __webpack_module_cache__[moduleId];
18
+ if (cachedModule !== undefined) {
19
+ return cachedModule.exports;
20
+ }
21
+ // Create a new module (and put it into the cache)
22
+ var module = (__webpack_module_cache__[moduleId] = {
23
+ exports: {}
24
+ });
25
+ // Execute the module function
26
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
27
+
28
+ // Return the exports of the module
29
+ return module.exports;
30
+
31
+ }
32
+
33
+ // webpack/runtime/define_property_getters
34
+ (() => {
35
+ __webpack_require__.d = (exports, getters, values) => {
36
+ var define = (defs, kind) => {
37
+ for(var key in defs) {
38
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
39
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
40
+ }
41
+ }
42
+ };
43
+ define(getters, "get");
44
+ define(values, "value");
45
+ };
46
+ })();
47
+ // webpack/runtime/has_own_property
48
+ (() => {
49
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
50
+ })();
51
+ // webpack/runtime/make_namespace_object
52
+ (() => {
53
+ // define __esModule on exports
54
+ __webpack_require__.r = (exports) => {
55
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
+ }
58
+ Object.defineProperty(exports, '__esModule', { value: true });
59
+ };
60
+ })();
61
+ var __webpack_exports__ = {};
62
+ __webpack_require__.r(__webpack_exports__);
63
+ /**
64
+ * Constant for remote entry file
65
+ * @constant {string}
66
+ */ const REMOTE_ENTRY_FILE = 'remoteEntry.js';
67
+ /**
68
+ * Function to load remote
69
+ * @function
70
+ * @param {ImportRemoteOptions['url']} url - The url of the remote module
71
+ * @param {ImportRemoteOptions['scope']} scope - The scope of the remote module
72
+ * @param {ImportRemoteOptions['bustRemoteEntryCache']} bustRemoteEntryCache - Flag to bust the remote entry cache
73
+ * @returns {Promise<void>} A promise that resolves when the remote is loaded
74
+ */ const loadRemote = (url, scope, bustRemoteEntryCache)=>new Promise((resolve, reject)=>{
75
+ const timestamp = bustRemoteEntryCache ? `?t=${new Date().getTime()}` : '';
76
+ const webpackRequire = __webpack_require__;
77
+ webpackRequire.l(`${url}${timestamp}`, (event)=>{
78
+ if (event?.type === 'load') {
79
+ // Script loaded successfully:
80
+ return resolve();
81
+ }
82
+ const realSrc = event?.target?.src;
83
+ const error = new Error();
84
+ error.message = 'Loading script failed.\n(missing: ' + realSrc + ')';
85
+ error.name = 'ScriptExternalLoadError';
86
+ reject(error);
87
+ }, scope);
88
+ });
89
+ const loadEsmRemote = async (url, scope)=>{
90
+ const module = await import(/* webpackIgnore: true */ url);
91
+ if (!module) {
92
+ throw new Error(`Unable to load requested remote from ${url} with scope ${scope}`);
93
+ }
94
+ window[scope] = {
95
+ ...module,
96
+ __initializing: false,
97
+ __initialized: false
98
+ };
99
+ };
100
+ /**
101
+ * Function to initialize sharing
102
+ * @async
103
+ * @function
104
+ */ const initSharing = async ()=>{
105
+ const webpackShareScopes = __webpack_require__.S;
106
+ if (!webpackShareScopes?.default) {
107
+ await __webpack_require__.I('default');
108
+ }
109
+ };
110
+ /**
111
+ * Function to initialize container
112
+ * @async
113
+ * @function
114
+ * @param {WebpackRemoteContainer} containerScope - The container scope
115
+ */ const initContainer = async (containerScope)=>{
116
+ try {
117
+ const webpackShareScopes = __webpack_require__.S;
118
+ if (!containerScope.__initialized && !containerScope.__initializing) {
119
+ containerScope.__initializing = true;
120
+ await containerScope.init(webpackShareScopes.default);
121
+ containerScope.__initialized = true;
122
+ delete containerScope.__initializing;
123
+ }
124
+ } catch (error) {
125
+ console.error(error);
126
+ }
127
+ };
128
+ /**
129
+ * Function to import remote
130
+ * @async
131
+ * @function
132
+ * @param {ImportRemoteOptions} options - The options for importing the remote
133
+ * @returns {Promise<T>} A promise that resolves with the imported module
134
+ */ const importRemote = async ({ url, scope, module, remoteEntryFileName = REMOTE_ENTRY_FILE, bustRemoteEntryCache = true, esm = false })=>{
135
+ const remoteScope = scope;
136
+ if (!window[remoteScope]) {
137
+ let remoteUrl = '';
138
+ if (typeof url === 'string') {
139
+ remoteUrl = url;
140
+ } else {
141
+ remoteUrl = await url();
142
+ }
143
+ const remoteUrlWithEntryFile = `${remoteUrl}/${remoteEntryFileName}`;
144
+ const asyncContainer = !esm ? loadRemote(remoteUrlWithEntryFile, scope, bustRemoteEntryCache) : loadEsmRemote(remoteUrlWithEntryFile, scope);
145
+ // Load the remote and initialize the share scope if it's empty
146
+ await Promise.all([
147
+ asyncContainer,
148
+ initSharing()
149
+ ]);
150
+ if (!window[remoteScope]) {
151
+ throw new Error(`Remote loaded successfully but ${scope} could not be found! Verify that the name is correct in the Webpack configuration!`);
152
+ }
153
+ // Initialize the container to get shared modules and get the module factory:
154
+ const [, moduleFactory] = await Promise.all([
155
+ initContainer(window[remoteScope]),
156
+ window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`)
157
+ ]);
158
+ return moduleFactory();
159
+ } else {
160
+ const moduleFactory = await window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`);
161
+ return moduleFactory();
162
+ }
163
+ };
164
+
165
+ __webpack_require__.d(__webpack_exports__, {
166
+ }, {
167
+ importRemote: importRemote
168
+ });
169
+
170
+ exports.importRemote = __webpack_exports__.importRemote;
171
+ for(var __rspack_i in __webpack_exports__) {
172
+ if(["importRemote"].indexOf(__rspack_i) === -1) {
173
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
174
+ }
175
+ }
176
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ __webpack_require__.r(__webpack_exports__);
42
+ const isObjectEmpty = (obj)=>{
43
+ for(const x in obj){
44
+ return false;
45
+ }
46
+ return true;
47
+ };
48
+
49
+ __webpack_require__.d(__webpack_exports__, {
50
+ }, {
51
+ isObjectEmpty: isObjectEmpty
52
+ });
53
+
54
+ exports.isObjectEmpty = __webpack_exports__.isObjectEmpty;
55
+ for(var __rspack_i in __webpack_exports__) {
56
+ if(["isObjectEmpty"].indexOf(__rspack_i) === -1) {
57
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
58
+ }
59
+ }
60
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ var __webpack_modules__ = ({});
10
+ // The module cache
11
+ var __webpack_module_cache__ = {};
12
+
13
+ // The require function
14
+ function __webpack_require__(moduleId) {
15
+
16
+ // Check if module is in cache
17
+ var cachedModule = __webpack_module_cache__[moduleId];
18
+ if (cachedModule !== undefined) {
19
+ return cachedModule.exports;
20
+ }
21
+ // Create a new module (and put it into the cache)
22
+ var module = (__webpack_module_cache__[moduleId] = {
23
+ exports: {}
24
+ });
25
+ // Execute the module function
26
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
27
+
28
+ // Return the exports of the module
29
+ return module.exports;
30
+
31
+ }
32
+
33
+ // webpack/runtime/define_property_getters
34
+ (() => {
35
+ __webpack_require__.d = (exports, getters, values) => {
36
+ var define = (defs, kind) => {
37
+ for(var key in defs) {
38
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
39
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
40
+ }
41
+ }
42
+ };
43
+ define(getters, "get");
44
+ define(values, "value");
45
+ };
46
+ })();
47
+ // webpack/runtime/has_own_property
48
+ (() => {
49
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
50
+ })();
51
+ // webpack/runtime/make_namespace_object
52
+ (() => {
53
+ // define __esModule on exports
54
+ __webpack_require__.r = (exports) => {
55
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57
+ }
58
+ Object.defineProperty(exports, '__esModule', { value: true });
59
+ };
60
+ })();
61
+ var __webpack_exports__ = {};
62
+ __webpack_require__.r(__webpack_exports__);
63
+ const pure = typeof process !== 'undefined' ? process.env['REMOTES'] || {} : {};
64
+ const remoteVars = pure;
65
+ const extractUrlAndGlobal = (urlAndGlobal)=>{
66
+ const index = urlAndGlobal.indexOf('@');
67
+ if (index <= 0 || index === urlAndGlobal.length - 1) {
68
+ throw new Error(`Invalid request "${urlAndGlobal}"`);
69
+ }
70
+ return [
71
+ urlAndGlobal.substring(index + 1),
72
+ urlAndGlobal.substring(0, index)
73
+ ];
74
+ };
75
+ const loadScript = (keyOrRuntimeRemoteItem)=>{
76
+ const runtimeRemotes = getRuntimeRemotes();
77
+ // 1) Load remote container if needed
78
+ let asyncContainer;
79
+ const reference = typeof keyOrRuntimeRemoteItem === 'string' ? runtimeRemotes[keyOrRuntimeRemoteItem] : keyOrRuntimeRemoteItem;
80
+ if (reference.asyncContainer) {
81
+ asyncContainer = typeof reference.asyncContainer.then === 'function' ? reference.asyncContainer : reference.asyncContainer();
82
+ } else {
83
+ // This casting is just to satisfy typescript,
84
+ // In reality remoteGlobal will always be a string;
85
+ const remoteGlobal = reference.global;
86
+ // Check if theres an override for container key if not use remote global
87
+ const containerKey = reference.uniqueKey ? reference.uniqueKey : remoteGlobal;
88
+ const __webpack_error__ = new Error();
89
+ // @ts-ignore
90
+ const globalScope = // @ts-ignore
91
+ typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
92
+ if (typeof window === 'undefined') {
93
+ //@ts-ignore
94
+ globalScope['_config'][containerKey] = reference.url;
95
+ } else {
96
+ // to match promise template system, can be removed once promise template is gone
97
+ //@ts-ignore
98
+ if (!globalScope['remoteLoading']) {
99
+ //@ts-ignore
100
+ globalScope['remoteLoading'] = {};
101
+ }
102
+ //@ts-ignore
103
+ if (globalScope['remoteLoading'][containerKey]) {
104
+ //@ts-ignore
105
+ return globalScope['remoteLoading'][containerKey];
106
+ }
107
+ }
108
+ // @ts-ignore
109
+ asyncContainer = new Promise(function(resolve, reject) {
110
+ function resolveRemoteGlobal() {
111
+ //@ts-ignore
112
+ const asyncContainer = globalScope[remoteGlobal];
113
+ return resolve(asyncContainer);
114
+ }
115
+ //@ts-ignore
116
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
117
+ return resolveRemoteGlobal();
118
+ }
119
+ __webpack_require__.l(reference.url, function(event) {
120
+ //@ts-ignore
121
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
122
+ return resolveRemoteGlobal();
123
+ }
124
+ const errorType = event && (event.type === 'load' ? 'missing' : event.type);
125
+ const realSrc = event && event.target && event.target.src;
126
+ __webpack_error__.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ' or global var ' + remoteGlobal + ')';
127
+ __webpack_error__.name = 'ScriptExternalLoadError';
128
+ __webpack_error__.type = errorType;
129
+ __webpack_error__.request = realSrc;
130
+ reject(__webpack_error__);
131
+ }, containerKey);
132
+ }).catch(function(err) {
133
+ console.error('container is offline, returning fake remote');
134
+ console.error(err);
135
+ return {
136
+ fake: true,
137
+ // @ts-ignore
138
+ get: (arg)=>{
139
+ console.warn('faking', arg, 'module on, its offline');
140
+ return Promise.resolve(()=>{
141
+ return {
142
+ __esModule: true,
143
+ default: ()=>{
144
+ return null;
145
+ }
146
+ };
147
+ });
148
+ },
149
+ //eslint-disable-next-line
150
+ init: ()=>{}
151
+ };
152
+ });
153
+ if (typeof window !== 'undefined') {
154
+ //@ts-ignore
155
+ globalScope['remoteLoading'][containerKey] = asyncContainer;
156
+ }
157
+ }
158
+ return asyncContainer;
159
+ };
160
+ const getRuntimeRemotes = ()=>{
161
+ return Object.entries(remoteVars).reduce((acc, [key, value])=>{
162
+ if (typeof value === 'object' && typeof value.then === 'function') {
163
+ acc[key] = {
164
+ asyncContainer: value
165
+ };
166
+ } else if (typeof value === 'function') {
167
+ acc[key] = {
168
+ asyncContainer: Promise.resolve(value())
169
+ };
170
+ } else if (typeof value === 'string') {
171
+ if (value.startsWith('internal ')) {
172
+ const [request, query] = value.replace('internal ', '').split('?');
173
+ if (query) {
174
+ const remoteSyntax = new URLSearchParams(query).get('remote');
175
+ if (remoteSyntax) {
176
+ const [url, global] = extractUrlAndGlobal(remoteSyntax);
177
+ acc[key] = {
178
+ global,
179
+ url
180
+ };
181
+ }
182
+ }
183
+ } else {
184
+ const [url, global] = extractUrlAndGlobal(value);
185
+ acc[key] = {
186
+ global,
187
+ url
188
+ };
189
+ }
190
+ } else {
191
+ console.warn('remotes process', process.env['REMOTES']);
192
+ throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
193
+ }
194
+ return acc;
195
+ }, {});
196
+ };
197
+
198
+ __webpack_require__.d(__webpack_exports__, {
199
+ }, {
200
+ extractUrlAndGlobal: extractUrlAndGlobal,
201
+ getRuntimeRemotes: getRuntimeRemotes,
202
+ loadScript: loadScript,
203
+ remoteVars: remoteVars
204
+ });
205
+
206
+ exports.extractUrlAndGlobal = __webpack_exports__.extractUrlAndGlobal;
207
+ exports.getRuntimeRemotes = __webpack_exports__.getRuntimeRemotes;
208
+ exports.loadScript = __webpack_exports__.loadScript;
209
+ exports.remoteVars = __webpack_exports__.remoteVars;
210
+ for(var __rspack_i in __webpack_exports__) {
211
+ if(["extractUrlAndGlobal","getRuntimeRemotes","loadScript","remoteVars"].indexOf(__rspack_i) === -1) {
212
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
213
+ }
214
+ }
215
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/compat_get_default_export
13
+ (() => {
14
+ // getDefaultExport function for compatibility with non-ESM modules
15
+ __webpack_require__.n = (module) => {
16
+ var getter = module && module.__esModule ?
17
+ () => (module['default']) :
18
+ () => (module);
19
+ __webpack_require__.d(getter, { a: getter });
20
+ return getter;
21
+ };
22
+
23
+ })();
24
+ // webpack/runtime/define_property_getters
25
+ (() => {
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
36
+ };
37
+ })();
38
+ // webpack/runtime/has_own_property
39
+ (() => {
40
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
41
+ })();
42
+ // webpack/runtime/make_namespace_object
43
+ (() => {
44
+ // define __esModule on exports
45
+ __webpack_require__.r = (exports) => {
46
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ }
49
+ Object.defineProperty(exports, '__esModule', { value: true });
50
+ };
51
+ })();
52
+ var __webpack_exports__ = {};
53
+ // ESM COMPAT FLAG
54
+ __webpack_require__.r(__webpack_exports__);
55
+
56
+ // EXPORTS
57
+ __webpack_require__.d(__webpack_exports__, {
58
+ FederationBoundary: () => (/* reexport */ (FederationBoundary_js_default()))
59
+ });
60
+
61
+ ;// CONCATENATED MODULE: external "../components/FederationBoundary.js"
62
+ const FederationBoundary_js_namespaceObject = require("../components/FederationBoundary.js");
63
+ var FederationBoundary_js_default = /*#__PURE__*/__webpack_require__.n(FederationBoundary_js_namespaceObject);
64
+ ;// CONCATENATED MODULE: ./src/utils/react.tsx
65
+
66
+
67
+ exports.FederationBoundary = __webpack_exports__.FederationBoundary;
68
+ for(var __rspack_i in __webpack_exports__) {
69
+ if(["FederationBoundary"].indexOf(__rspack_i) === -1) {
70
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
71
+ }
72
+ }
73
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,12 @@
1
+ class Logger {
2
+ static getLogger() {
3
+ return this.loggerInstance;
4
+ }
5
+ static setLogger(logger) {
6
+ this.loggerInstance = logger || console;
7
+ return logger;
8
+ }
9
+ }
10
+ Logger.loggerInstance = console;
11
+
12
+ export { Logger };
@@ -0,0 +1,31 @@
1
+ import react from "react";
2
+
3
+
4
+
5
+ /**
6
+ * Generic error boundary component.
7
+ */ class ErrorBoundary extends react.Component {
8
+ static getDerivedStateFromError() {
9
+ return {
10
+ hasError: true
11
+ };
12
+ }
13
+ componentDidCatch(error, errorInfo) {
14
+ console.error(error, errorInfo);
15
+ }
16
+ render() {
17
+ if (this.state.hasError) {
18
+ return 'An error has occurred.';
19
+ }
20
+ return this.props.children;
21
+ }
22
+ constructor(props){
23
+ super(props);
24
+ this.state = {
25
+ hasError: false
26
+ };
27
+ }
28
+ }
29
+ /* export default */ const components_ErrorBoundary = (ErrorBoundary);
30
+
31
+ export default components_ErrorBoundary;