@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.
- package/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/cjs/Logger.js +63 -0
- package/dist/cjs/components/ErrorBoundary.js +98 -0
- package/dist/cjs/components/FederationBoundary.js +103 -0
- package/dist/cjs/index.js +172 -0
- package/dist/cjs/plugins/DelegateModulesPlugin.js +133 -0
- package/dist/cjs/types/index.js +31 -0
- package/dist/cjs/utils/common.js +175 -0
- package/dist/cjs/utils/getRuntimeRemotes.js +104 -0
- package/dist/cjs/utils/getRuntimeRemotes.test.js +98 -0
- package/dist/cjs/utils/importDelegateModule.test.js +99 -0
- package/dist/cjs/utils/importDelegatedModule.js +126 -0
- package/dist/cjs/utils/importRemote.js +176 -0
- package/dist/cjs/utils/isEmpty.js +60 -0
- package/dist/cjs/utils/pure.js +215 -0
- package/dist/cjs/utils/react.js +73 -0
- package/dist/esm/Logger.mjs +12 -0
- package/dist/esm/components/ErrorBoundary.mjs +31 -0
- package/dist/esm/components/FederationBoundary.mjs +35 -0
- package/dist/esm/index.mjs +24 -0
- package/dist/esm/plugins/DelegateModulesPlugin.mjs +81 -0
- package/dist/esm/rslib-runtime.mjs +37 -0
- package/dist/esm/types/index.mjs +4 -0
- package/dist/esm/utils/common.mjs +116 -0
- package/dist/esm/utils/getRuntimeRemotes.mjs +50 -0
- package/dist/esm/utils/getRuntimeRemotes.test.mjs +84 -0
- package/dist/esm/utils/importDelegateModule.test.mjs +72 -0
- package/dist/esm/utils/importDelegatedModule.mjs +72 -0
- package/dist/esm/utils/importRemote.mjs +105 -0
- package/dist/esm/utils/isEmpty.mjs +8 -0
- package/dist/esm/utils/pure.mjs +138 -0
- package/dist/esm/utils/react.mjs +4 -0
- package/dist/types/Logger.d.ts +7 -0
- package/dist/types/components/ErrorBoundary.d.ts +19 -0
- package/dist/types/components/FederationBoundary.d.ts +14 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/plugins/DelegateModulesPlugin.d.ts +18 -0
- package/dist/types/types/index.d.ts +76 -0
- package/dist/types/utils/common.d.ts +31 -0
- package/dist/types/utils/getRuntimeRemotes.d.ts +2 -0
- package/dist/types/utils/importDelegatedModule.d.ts +2 -0
- package/dist/types/utils/importRemote.d.ts +31 -0
- package/dist/types/utils/isEmpty.d.ts +1 -0
- package/dist/types/utils/pure.d.ts +5 -0
- package/dist/types/utils/react.d.ts +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 ScriptedAlchemy LLC (Zack Jackson)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# utils
|
|
2
|
+
|
|
3
|
+
For warning: [`@module-federation/runtime`](https://module-federation.io/guide/basic/runtime/runtime.html) is recommended as a replacement
|
|
4
|
+
|
|
5
|
+
This library was generated with [Nx](https://nx.dev).
|
|
6
|
+
|
|
7
|
+
## Building
|
|
8
|
+
|
|
9
|
+
Run `nx build utils` to build the library.
|
|
10
|
+
|
|
11
|
+
## Running unit tests
|
|
12
|
+
|
|
13
|
+
Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io).
|
|
14
|
+
|
|
15
|
+
## React utilities
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
`FederatedBoundary`
|
|
20
|
+
|
|
21
|
+
A component wrapper that provides a fallback for safe imports if something were to fail when grabbing a module off of a remote host.
|
|
22
|
+
|
|
23
|
+
This wrapper also exposes an optional property for a custom react error boundary component.
|
|
24
|
+
|
|
25
|
+
Any extra props will be passed directly to the imported module.
|
|
26
|
+
|
|
27
|
+
Usage looks something like this:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { FederationBoundary } from '@module-federation/utilities/src/utils/react';
|
|
31
|
+
|
|
32
|
+
// defining dynamicImport and fallback outside the Component to keep the component identity
|
|
33
|
+
// another alternative would be to use useMemo
|
|
34
|
+
const dynamicImport = () => import('some_remote_host_name').then((m) => m.Component);
|
|
35
|
+
const fallback = () => import('@npm/backup').then((m) => m.Component);
|
|
36
|
+
|
|
37
|
+
const MyPage = () => {
|
|
38
|
+
return <FederationBoundary dynamicImporter={dynamicImport} fallback={fallback} customBoundary={CustomErrorBoundary} />;
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
`ImportRemote`
|
|
45
|
+
|
|
46
|
+
A function which will enable dynamic imports of remotely exposed modules using the Module Federation plugin. It uses the method described in the official Webpack configuration under <a href="https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers" target="_blank">Dynamic Remote Containers</a>.
|
|
47
|
+
|
|
48
|
+
This function will allow you to provide a static url or an async method to retrieve a url from a configuration service.
|
|
49
|
+
|
|
50
|
+
Usage looks something like this:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import { importRemote } from '@module-federation/utilities';
|
|
54
|
+
|
|
55
|
+
// --
|
|
56
|
+
// If it's a regular js module:
|
|
57
|
+
// --
|
|
58
|
+
importRemote({
|
|
59
|
+
url: 'http://localhost:3001',
|
|
60
|
+
scope: 'Foo',
|
|
61
|
+
module: 'Bar',
|
|
62
|
+
}).then(
|
|
63
|
+
(
|
|
64
|
+
{
|
|
65
|
+
/* list of Bar exports */
|
|
66
|
+
},
|
|
67
|
+
) => {
|
|
68
|
+
// Use Bar exports
|
|
69
|
+
},
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// --
|
|
73
|
+
// If it's a ESM module (this is currently the default for NX):
|
|
74
|
+
// --
|
|
75
|
+
const Bar = lazy(() => importRemote({ url: 'http://localhost:3001', scope: 'Foo', module: 'Bar', esm: true }));
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<Suspense fallback={<div>Loading Bar...</div>}>
|
|
79
|
+
<Bar />
|
|
80
|
+
</Suspense>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// --
|
|
84
|
+
// If Bar is a React component you can use it with lazy and Suspense just like a dynamic import:
|
|
85
|
+
// --
|
|
86
|
+
const Bar = lazy(() => importRemote({ url: 'http://localhost:3001', scope: 'Foo', module: 'Bar' }));
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Suspense fallback={<div>Loading Bar...</div>}>
|
|
90
|
+
<Bar />
|
|
91
|
+
</Suspense>
|
|
92
|
+
);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
import { importRemote } from '@module-federation/utilities';
|
|
97
|
+
|
|
98
|
+
// If it's a regular js module:
|
|
99
|
+
importRemote({
|
|
100
|
+
url: () => MyAsyncMethod('remote_name'),
|
|
101
|
+
scope: 'Foo',
|
|
102
|
+
module: 'Bar',
|
|
103
|
+
}).then(
|
|
104
|
+
(
|
|
105
|
+
{
|
|
106
|
+
/* list of Bar exports */
|
|
107
|
+
},
|
|
108
|
+
) => {
|
|
109
|
+
// Use Bar exports
|
|
110
|
+
},
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// If Bar is a React component you can use it with lazy and Suspense just like a dynamic import:
|
|
114
|
+
const Bar = lazy(() =>
|
|
115
|
+
importRemote({
|
|
116
|
+
url: () => MyAsyncMethod('remote_name'),
|
|
117
|
+
scope: 'Foo',
|
|
118
|
+
module: 'Bar',
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<Suspense fallback={<div>Loading Bar...</div>}>
|
|
124
|
+
<Bar />
|
|
125
|
+
</Suspense>
|
|
126
|
+
);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
// You can also combine importRemote and FederationBoundary to have a dynamic remote URL and a fallback when there is an error on the remote
|
|
131
|
+
|
|
132
|
+
const dynamicImporter = () =>
|
|
133
|
+
importRemote({
|
|
134
|
+
url: 'http://localhost:3001',
|
|
135
|
+
scope: 'Foo',
|
|
136
|
+
module: 'Bar',
|
|
137
|
+
});
|
|
138
|
+
const fallback = () => import('@npm/backup').then((m) => m.Component);
|
|
139
|
+
|
|
140
|
+
const Bar = () => {
|
|
141
|
+
return <FederationBoundary dynamicImporter={dynamicImporter} fallback={fallback} />;
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Apart from **url**, **scope** and **module** you can also pass additional options to the **importRemote()** function:
|
|
146
|
+
|
|
147
|
+
- **remoteEntryFileName**: The name of the remote entry file. Defaults to "remoteEntry.js".
|
|
148
|
+
- **bustRemoteEntryCache**: Whether to add a cache busting query parameter to the remote entry file URL. Defaults to **true**. You can disable it if cachebusting is handled by the server.
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
class Logger {
|
|
43
|
+
static getLogger() {
|
|
44
|
+
return this.loggerInstance;
|
|
45
|
+
}
|
|
46
|
+
static setLogger(logger) {
|
|
47
|
+
this.loggerInstance = logger || console;
|
|
48
|
+
return logger;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
Logger.loggerInstance = console;
|
|
52
|
+
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
+
Logger: () => (Logger)
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
exports.Logger = __webpack_exports__.Logger;
|
|
58
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
59
|
+
if(["Logger"].indexOf(__rspack_i) === -1) {
|
|
60
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
"default": () => (/* binding */ components_ErrorBoundary)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "react"
|
|
62
|
+
const external_react_namespaceObject = require("react");
|
|
63
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: ./src/components/ErrorBoundary.tsx
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generic error boundary component.
|
|
68
|
+
*/ class ErrorBoundary extends (external_react_default()).Component {
|
|
69
|
+
static getDerivedStateFromError() {
|
|
70
|
+
return {
|
|
71
|
+
hasError: true
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
componentDidCatch(error, errorInfo) {
|
|
75
|
+
console.error(error, errorInfo);
|
|
76
|
+
}
|
|
77
|
+
render() {
|
|
78
|
+
if (this.state.hasError) {
|
|
79
|
+
return 'An error has occurred.';
|
|
80
|
+
}
|
|
81
|
+
return this.props.children;
|
|
82
|
+
}
|
|
83
|
+
constructor(props){
|
|
84
|
+
super(props);
|
|
85
|
+
this.state = {
|
|
86
|
+
hasError: false
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/* export default */ const components_ErrorBoundary = (ErrorBoundary);
|
|
91
|
+
|
|
92
|
+
exports["default"] = __webpack_exports__["default"];
|
|
93
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
94
|
+
if(["default"].indexOf(__rspack_i) === -1) {
|
|
95
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
"default": () => (/* binding */ components_FederationBoundary)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "react"
|
|
62
|
+
const external_react_namespaceObject = require("react");
|
|
63
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: external "./ErrorBoundary.js"
|
|
65
|
+
const external_ErrorBoundary_js_namespaceObject = require("./ErrorBoundary.js");
|
|
66
|
+
var external_ErrorBoundary_js_default = /*#__PURE__*/__webpack_require__.n(external_ErrorBoundary_js_namespaceObject);
|
|
67
|
+
;// CONCATENATED MODULE: ./src/components/FederationBoundary.tsx
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A fallback component that renders nothing.
|
|
72
|
+
*/ const FallbackComponent = ()=>{
|
|
73
|
+
return null;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Wrapper around dynamic import.
|
|
77
|
+
* Adds error boundaries and fallback options.
|
|
78
|
+
*/ const FederationBoundary = ({ dynamicImporter, fallback = ()=>Promise.resolve(FallbackComponent), customBoundary: CustomBoundary = (external_ErrorBoundary_js_default()), ...rest })=>{
|
|
79
|
+
const ImportResult = (0,external_react_namespaceObject.useMemo)(()=>{
|
|
80
|
+
return /*#__PURE__*/ (0,external_react_namespaceObject.lazy)(()=>dynamicImporter().catch((e)=>{
|
|
81
|
+
console.error(e);
|
|
82
|
+
return fallback();
|
|
83
|
+
}).then((m)=>{
|
|
84
|
+
return {
|
|
85
|
+
//@ts-ignore
|
|
86
|
+
default: m.default || m
|
|
87
|
+
};
|
|
88
|
+
}));
|
|
89
|
+
}, [
|
|
90
|
+
dynamicImporter,
|
|
91
|
+
fallback
|
|
92
|
+
]);
|
|
93
|
+
return /*#__PURE__*/ external_react_default().createElement(CustomBoundary, null, /*#__PURE__*/ external_react_default().createElement(ImportResult, rest));
|
|
94
|
+
};
|
|
95
|
+
/* export default */ const components_FederationBoundary = (FederationBoundary);
|
|
96
|
+
|
|
97
|
+
exports["default"] = __webpack_exports__["default"];
|
|
98
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
99
|
+
if(["default"].indexOf(__rspack_i) === -1) {
|
|
100
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
160(module) {
|
|
11
|
+
module.exports = require("./Logger.js");
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
704(module) {
|
|
15
|
+
module.exports = require("./types/index.js");
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
37(module) {
|
|
19
|
+
module.exports = require("./utils/common.js");
|
|
20
|
+
|
|
21
|
+
},
|
|
22
|
+
953(module) {
|
|
23
|
+
module.exports = require("./utils/getRuntimeRemotes.js");
|
|
24
|
+
|
|
25
|
+
},
|
|
26
|
+
158(module) {
|
|
27
|
+
module.exports = require("./utils/importDelegatedModule.js");
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
711(module) {
|
|
31
|
+
module.exports = require("./utils/importRemote.js");
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
755(module) {
|
|
35
|
+
module.exports = require("./utils/isEmpty.js");
|
|
36
|
+
|
|
37
|
+
},
|
|
38
|
+
576(module) {
|
|
39
|
+
module.exports = require("./utils/pure.js");
|
|
40
|
+
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
});
|
|
44
|
+
// The module cache
|
|
45
|
+
var __webpack_module_cache__ = {};
|
|
46
|
+
|
|
47
|
+
// The require function
|
|
48
|
+
function __webpack_require__(moduleId) {
|
|
49
|
+
|
|
50
|
+
// Check if module is in cache
|
|
51
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
52
|
+
if (cachedModule !== undefined) {
|
|
53
|
+
return cachedModule.exports;
|
|
54
|
+
}
|
|
55
|
+
// Create a new module (and put it into the cache)
|
|
56
|
+
var module = (__webpack_module_cache__[moduleId] = {
|
|
57
|
+
exports: {}
|
|
58
|
+
});
|
|
59
|
+
// Execute the module function
|
|
60
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
61
|
+
|
|
62
|
+
// Return the exports of the module
|
|
63
|
+
return module.exports;
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// webpack/runtime/compat_get_default_export
|
|
68
|
+
(() => {
|
|
69
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
70
|
+
__webpack_require__.n = (module) => {
|
|
71
|
+
var getter = module && module.__esModule ?
|
|
72
|
+
() => (module['default']) :
|
|
73
|
+
() => (module);
|
|
74
|
+
__webpack_require__.d(getter, { a: getter });
|
|
75
|
+
return getter;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
})();
|
|
79
|
+
// webpack/runtime/define_property_getters
|
|
80
|
+
(() => {
|
|
81
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
82
|
+
var define = (defs, kind) => {
|
|
83
|
+
for(var key in defs) {
|
|
84
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
85
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
define(getters, "get");
|
|
90
|
+
define(values, "value");
|
|
91
|
+
};
|
|
92
|
+
})();
|
|
93
|
+
// webpack/runtime/has_own_property
|
|
94
|
+
(() => {
|
|
95
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
96
|
+
})();
|
|
97
|
+
// webpack/runtime/make_namespace_object
|
|
98
|
+
(() => {
|
|
99
|
+
// define __esModule on exports
|
|
100
|
+
__webpack_require__.r = (exports) => {
|
|
101
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
102
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
103
|
+
}
|
|
104
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
105
|
+
};
|
|
106
|
+
})();
|
|
107
|
+
var __webpack_exports__ = {};
|
|
108
|
+
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
|
|
109
|
+
(() => {
|
|
110
|
+
__webpack_require__.r(__webpack_exports__);
|
|
111
|
+
/* import */ var _types__rspack_import_0 = __webpack_require__(704);
|
|
112
|
+
/* import */ var _types__rspack_import_0_default = /*#__PURE__*/__webpack_require__.n(_types__rspack_import_0);
|
|
113
|
+
|
|
114
|
+
/* reexport */ var __rspack_reexport = {};
|
|
115
|
+
/* reexport */ for( const __rspack_import_key in _types__rspack_import_0) if(["getContainer","importRemote","isObjectEmpty","default","getRuntimeRemotes","loadScript","createRuntimeVariables","injectScript","getModule","Logger","importDelegatedModule","extractUrlAndGlobal"].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] =() => _types__rspack_import_0[__rspack_import_key]
|
|
116
|
+
/* reexport */ __webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
117
|
+
/* import */ var _utils_common__rspack_import_1 = __webpack_require__(37);
|
|
118
|
+
/* import */ var _utils_common__rspack_import_1_default = /*#__PURE__*/__webpack_require__.n(_utils_common__rspack_import_1);
|
|
119
|
+
/* import */ var _utils_isEmpty__rspack_import_2 = __webpack_require__(755);
|
|
120
|
+
/* import */ var _utils_isEmpty__rspack_import_2_default = /*#__PURE__*/__webpack_require__.n(_utils_isEmpty__rspack_import_2);
|
|
121
|
+
/* import */ var _utils_importRemote__rspack_import_3 = __webpack_require__(711);
|
|
122
|
+
/* import */ var _utils_importRemote__rspack_import_3_default = /*#__PURE__*/__webpack_require__.n(_utils_importRemote__rspack_import_3);
|
|
123
|
+
/* import */ var _Logger__rspack_import_4 = __webpack_require__(160);
|
|
124
|
+
/* import */ var _Logger__rspack_import_4_default = /*#__PURE__*/__webpack_require__.n(_Logger__rspack_import_4);
|
|
125
|
+
/* import */ var _utils_getRuntimeRemotes__rspack_import_5 = __webpack_require__(953);
|
|
126
|
+
/* import */ var _utils_getRuntimeRemotes__rspack_import_5_default = /*#__PURE__*/__webpack_require__.n(_utils_getRuntimeRemotes__rspack_import_5);
|
|
127
|
+
/* import */ var _utils_importDelegatedModule__rspack_import_6 = __webpack_require__(158);
|
|
128
|
+
/* import */ var _utils_importDelegatedModule__rspack_import_6_default = /*#__PURE__*/__webpack_require__.n(_utils_importDelegatedModule__rspack_import_6);
|
|
129
|
+
/* import */ var _utils_pure__rspack_import_7 = __webpack_require__(576);
|
|
130
|
+
/* import */ var _utils_pure__rspack_import_7_default = /*#__PURE__*/__webpack_require__.n(_utils_pure__rspack_import_7);
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
141
|
+
Logger: () => (/* reexport safe */ _Logger__rspack_import_4.Logger),
|
|
142
|
+
createRuntimeVariables: () => (/* reexport safe */ _utils_common__rspack_import_1.createRuntimeVariables),
|
|
143
|
+
extractUrlAndGlobal: () => (/* reexport safe */ _utils_pure__rspack_import_7.extractUrlAndGlobal),
|
|
144
|
+
getContainer: () => (/* reexport safe */ _utils_common__rspack_import_1.getContainer),
|
|
145
|
+
getModule: () => (/* reexport safe */ _utils_common__rspack_import_1.getModule),
|
|
146
|
+
getRuntimeRemotes: () => (/* reexport safe */ _utils_getRuntimeRemotes__rspack_import_5.getRuntimeRemotes),
|
|
147
|
+
importDelegatedModule: () => (/* reexport safe */ _utils_importDelegatedModule__rspack_import_6.importDelegatedModule),
|
|
148
|
+
importRemote: () => (/* reexport safe */ _utils_importRemote__rspack_import_3.importRemote),
|
|
149
|
+
injectScript: () => (/* reexport safe */ _utils_common__rspack_import_1.injectScript),
|
|
150
|
+
isObjectEmpty: () => (/* reexport safe */ _utils_isEmpty__rspack_import_2.isObjectEmpty),
|
|
151
|
+
loadScript: () => (/* reexport safe */ _utils_pure__rspack_import_7.loadScript)
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
})();
|
|
155
|
+
|
|
156
|
+
exports.Logger = __webpack_exports__.Logger;
|
|
157
|
+
exports.createRuntimeVariables = __webpack_exports__.createRuntimeVariables;
|
|
158
|
+
exports.extractUrlAndGlobal = __webpack_exports__.extractUrlAndGlobal;
|
|
159
|
+
exports.getContainer = __webpack_exports__.getContainer;
|
|
160
|
+
exports.getModule = __webpack_exports__.getModule;
|
|
161
|
+
exports.getRuntimeRemotes = __webpack_exports__.getRuntimeRemotes;
|
|
162
|
+
exports.importDelegatedModule = __webpack_exports__.importDelegatedModule;
|
|
163
|
+
exports.importRemote = __webpack_exports__.importRemote;
|
|
164
|
+
exports.injectScript = __webpack_exports__.injectScript;
|
|
165
|
+
exports.isObjectEmpty = __webpack_exports__.isObjectEmpty;
|
|
166
|
+
exports.loadScript = __webpack_exports__.loadScript;
|
|
167
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
168
|
+
if(["Logger","createRuntimeVariables","extractUrlAndGlobal","getContainer","getModule","getRuntimeRemotes","importDelegatedModule","importRemote","injectScript","isObjectEmpty","loadScript"].indexOf(__rspack_i) === -1) {
|
|
169
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|