@module-federation/utilities 3.1.97 → 3.1.99

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 (34) hide show
  1. package/dist/cjs/Logger.js +17 -14
  2. package/dist/cjs/components/ErrorBoundary.js +14 -12
  3. package/dist/cjs/components/FederationBoundary.js +14 -12
  4. package/dist/cjs/index.js +62 -60
  5. package/dist/cjs/plugins/DelegateModulesPlugin.js +22 -18
  6. package/dist/cjs/plugins/DelegateModulesPlugin.test.js +87 -0
  7. package/dist/cjs/types/index.js +2 -4
  8. package/dist/cjs/utils/common.js +17 -15
  9. package/dist/cjs/utils/getRuntimeRemotes.js +13 -11
  10. package/dist/cjs/utils/getRuntimeRemotes.test.js +2 -2
  11. package/dist/cjs/utils/importDelegateModule.test.js +2 -4
  12. package/dist/cjs/utils/importDelegatedModule.js +13 -11
  13. package/dist/cjs/utils/importRemote.js +21 -19
  14. package/dist/cjs/utils/isEmpty.js +18 -14
  15. package/dist/cjs/utils/pure.js +21 -18
  16. package/dist/cjs/utils/react.js +13 -11
  17. package/dist/esm/Logger.mjs +0 -2
  18. package/dist/esm/components/ErrorBoundary.mjs +2 -4
  19. package/dist/esm/components/FederationBoundary.mjs +2 -5
  20. package/dist/esm/index.mjs +7 -17
  21. package/dist/esm/plugins/DelegateModulesPlugin.mjs +5 -7
  22. package/dist/esm/plugins/DelegateModulesPlugin.test.mjs +39 -0
  23. package/dist/esm/rslib-runtime.mjs +37 -0
  24. package/dist/esm/types/index.mjs +0 -2
  25. package/dist/esm/utils/common.mjs +2 -12
  26. package/dist/esm/utils/getRuntimeRemotes.mjs +0 -2
  27. package/dist/esm/utils/getRuntimeRemotes.test.mjs +0 -3
  28. package/dist/esm/utils/importDelegateModule.test.mjs +1 -19
  29. package/dist/esm/utils/importDelegatedModule.mjs +0 -2
  30. package/dist/esm/utils/importRemote.mjs +4 -36
  31. package/dist/esm/utils/isEmpty.mjs +0 -2
  32. package/dist/esm/utils/pure.mjs +1 -27
  33. package/dist/esm/utils/react.mjs +1 -5
  34. package/package.json +2 -2
@@ -1,11 +1,8 @@
1
1
  import { getRuntimeRemotes } from "./getRuntimeRemotes.mjs";
2
2
  import { remoteVars } from "./pure.mjs";
3
3
 
4
- ;// CONCATENATED MODULE: external "./getRuntimeRemotes.mjs"
5
4
 
6
- ;// CONCATENATED MODULE: external "./pure.mjs"
7
5
 
8
- ;// CONCATENATED MODULE: ./src/utils/getRuntimeRemotes.test.ts
9
6
 
10
7
 
11
8
  xdescribe('getRuntimeRemotes', ()=>{
@@ -1,27 +1,9 @@
1
1
  import { importDelegatedModule } from "./importDelegatedModule.mjs";
2
2
  import { loadScript } from "./pure.mjs";
3
- // The require scope
4
- var __webpack_require__ = {};
3
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
5
4
 
6
- /************************************************************************/
7
- // webpack/runtime/global
8
- (() => {
9
- __webpack_require__.g = (() => {
10
- if (typeof globalThis === 'object') return globalThis;
11
- try {
12
- return this || new Function('return this')();
13
- } catch (e) {
14
- if (typeof window === 'object') return window;
15
- }
16
- })();
17
- })();
18
- /************************************************************************/
19
5
 
20
- ;// CONCATENATED MODULE: external "./importDelegatedModule.mjs"
21
6
 
22
- ;// CONCATENATED MODULE: external "./pure.mjs"
23
-
24
- ;// CONCATENATED MODULE: ./src/utils/importDelegateModule.test.ts
25
7
 
26
8
 
27
9
  jest.mock('./pure');
@@ -1,8 +1,6 @@
1
1
  import { loadScript } from "./pure.mjs";
2
2
 
3
- ;// CONCATENATED MODULE: external "./pure.mjs"
4
3
 
5
- ;// CONCATENATED MODULE: ./src/utils/importDelegatedModule.ts
6
4
 
7
5
  const importDelegatedModule = async (keyOrRuntimeRemoteItem)=>{
8
6
  // @ts-ignore
@@ -1,36 +1,5 @@
1
- var __webpack_modules__ = ({});
2
- /************************************************************************/
3
- // The module cache
4
- var __webpack_module_cache__ = {};
1
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
5
2
 
6
- // The require function
7
- function __webpack_require__(moduleId) {
8
-
9
- // Check if module is in cache
10
- var cachedModule = __webpack_module_cache__[moduleId];
11
- if (cachedModule !== undefined) {
12
- return cachedModule.exports;
13
- }
14
- // Create a new module (and put it into the cache)
15
- var module = (__webpack_module_cache__[moduleId] = {
16
- exports: {}
17
- });
18
- // Execute the module function
19
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
20
-
21
- // Return the exports of the module
22
- return module.exports;
23
-
24
- }
25
-
26
- /************************************************************************/
27
- // webpack/runtime/has_own_property
28
- (() => {
29
- __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
30
- })();
31
- /************************************************************************/
32
-
33
- ;// CONCATENATED MODULE: ./src/utils/importRemote.ts
34
3
  /**
35
4
  * Constant for remote entry file
36
5
  * @constant {string}
@@ -46,12 +15,11 @@ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj
46
15
  const timestamp = bustRemoteEntryCache ? `?t=${new Date().getTime()}` : '';
47
16
  const webpackRequire = __webpack_require__;
48
17
  webpackRequire.l(`${url}${timestamp}`, (event)=>{
49
- var _event_target;
50
- if ((event === null || event === void 0 ? void 0 : event.type) === 'load') {
18
+ if (event?.type === 'load') {
51
19
  // Script loaded successfully:
52
20
  return resolve();
53
21
  }
54
- const realSrc = event === null || event === void 0 ? void 0 : (_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.src;
22
+ const realSrc = event?.target?.src;
55
23
  const error = new Error();
56
24
  error.message = 'Loading script failed.\n(missing: ' + realSrc + ')';
57
25
  error.name = 'ScriptExternalLoadError';
@@ -75,7 +43,7 @@ const loadEsmRemote = async (url, scope)=>{
75
43
  * @function
76
44
  */ const initSharing = async ()=>{
77
45
  const webpackShareScopes = __webpack_require__.S;
78
- if (!(webpackShareScopes === null || webpackShareScopes === void 0 ? void 0 : webpackShareScopes.default)) {
46
+ if (!webpackShareScopes?.default) {
79
47
  await __webpack_require__.I('default');
80
48
  }
81
49
  };
@@ -1,5 +1,3 @@
1
-
2
- ;// CONCATENATED MODULE: ./src/utils/isEmpty.ts
3
1
  const isObjectEmpty = (obj)=>{
4
2
  for(const x in obj){
5
3
  return false;
@@ -1,31 +1,5 @@
1
- var __webpack_modules__ = ({});
2
- /************************************************************************/
3
- // The module cache
4
- var __webpack_module_cache__ = {};
1
+ import { __webpack_require__ } from "../rslib-runtime.mjs";
5
2
 
6
- // The require function
7
- function __webpack_require__(moduleId) {
8
-
9
- // Check if module is in cache
10
- var cachedModule = __webpack_module_cache__[moduleId];
11
- if (cachedModule !== undefined) {
12
- return cachedModule.exports;
13
- }
14
- // Create a new module (and put it into the cache)
15
- var module = (__webpack_module_cache__[moduleId] = {
16
- exports: {}
17
- });
18
- // Execute the module function
19
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
20
-
21
- // Return the exports of the module
22
- return module.exports;
23
-
24
- }
25
-
26
- /************************************************************************/
27
-
28
- ;// CONCATENATED MODULE: ./src/utils/pure.ts
29
3
  const pure = typeof process !== 'undefined' ? process.env['REMOTES'] || {} : {};
30
4
  const remoteVars = pure;
31
5
  const extractUrlAndGlobal = (urlAndGlobal)=>{
@@ -1,8 +1,4 @@
1
- import FederationBoundary from "../components/FederationBoundary.mjs";
2
1
 
3
- ;// CONCATENATED MODULE: external "../components/FederationBoundary.mjs"
4
2
 
5
- ;// CONCATENATED MODULE: ./src/utils/react.tsx
6
3
 
7
-
8
- export { FederationBoundary };
4
+ export { default as FederationBoundary } from "../components/FederationBoundary.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/utilities",
3
- "version": "3.1.97",
3
+ "version": "3.1.99",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.mjs",
6
6
  "types": "./dist/types/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "rsbuild-plugin-publint": "^0.2.1"
24
24
  },
25
25
  "dependencies": {
26
- "@module-federation/sdk": "2.6.0"
26
+ "@module-federation/sdk": "2.8.0"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "react": "^16 || ^17 || ^18",