@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
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRuntimeRemotes = void 0;
4
- const pure_1 = require("./pure");
5
- const getRuntimeRemotes = () => {
6
- try {
7
- return Object.entries(pure_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, pure_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, pure_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.warn('remotes process', process.env.REMOTES);
38
- throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
39
- }
40
- return acc;
41
- }, {});
42
- }
43
- catch (err) {
44
- console.warn('Unable to retrieve runtime remotes: ', err);
45
- }
46
- return {};
47
- };
48
- exports.getRuntimeRemotes = getRuntimeRemotes;
49
- //# sourceMappingURL=getRuntimeRemotes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getRuntimeRemotes.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/getRuntimeRemotes.ts"],"names":[],"mappings":";;;AACA,iCAAyD;AAElD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,IAAI;QACF,OAAO,MAAM,CAAC,OAAO,CAAC,iBAAU,CAAC,CAAC,MAAM,CAAC,UACnC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,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACrD,MAAM,IAAI,KAAK,CACb,mDAAmD,GAAG,GAAG,CAC1D,CAAC;aACH;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAuB,CAAC,CAAC;KAC9B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;KAC3D;IAED,OAAO,EAAuB,CAAC;AACjC,CAAC,CAAC;AAhDW,QAAA,iBAAiB,qBAgD5B"}
@@ -1,87 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.importDelegatedModule = void 0;
13
- const pure_1 = require("./pure");
14
- const importDelegatedModule = (keyOrRuntimeRemoteItem) => __awaiter(void 0, void 0, void 0, function* () {
15
- // @ts-ignore
16
- return (0, pure_1.loadScript)(keyOrRuntimeRemoteItem)
17
- .then((asyncContainer) => {
18
- return asyncContainer;
19
- })
20
- .then((asyncContainer) => {
21
- // most of this is only needed because of legacy promise based implementation
22
- // can remove proxies once we remove promise based implementations
23
- if (typeof window === 'undefined') {
24
- if (!Object.hasOwnProperty.call(keyOrRuntimeRemoteItem, 'globalThis')) {
25
- return asyncContainer;
26
- }
27
- // return asyncContainer;
28
- //TODO: need to solve chunk flushing with delegated modules
29
- return {
30
- get: function (arg) {
31
- //@ts-ignore
32
- return asyncContainer.get(arg).then((f) => {
33
- const m = f();
34
- const result = {
35
- __esModule: m.__esModule,
36
- };
37
- for (const prop in m) {
38
- if (typeof m[prop] === 'function') {
39
- Object.defineProperty(result, prop, {
40
- get: function () {
41
- return function () {
42
- //@ts-ignore
43
- if (globalThis.usedChunks) {
44
- //@ts-ignore
45
- globalThis.usedChunks.add(
46
- //@ts-ignore
47
- `${keyOrRuntimeRemoteItem.global}->${arg}`);
48
- }
49
- //eslint-disable-next-line prefer-rest-params
50
- return m[prop](...arguments);
51
- };
52
- },
53
- enumerable: true,
54
- });
55
- }
56
- else {
57
- Object.defineProperty(result, prop, {
58
- get: () => {
59
- //@ts-ignore
60
- if (globalThis.usedChunks) {
61
- //@ts-ignore
62
- globalThis.usedChunks.add(
63
- //@ts-ignore
64
- `${keyOrRuntimeRemoteItem.global}->${arg}`);
65
- }
66
- return m[prop];
67
- },
68
- enumerable: true,
69
- });
70
- }
71
- }
72
- if (m.then) {
73
- return Promise.resolve(() => result);
74
- }
75
- return () => result;
76
- });
77
- },
78
- init: asyncContainer.init,
79
- };
80
- }
81
- else {
82
- return asyncContainer;
83
- }
84
- });
85
- });
86
- exports.importDelegatedModule = importDelegatedModule;
87
- //# sourceMappingURL=importDelegatedModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"importDelegatedModule.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/importDelegatedModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,iCAAoC;AAE7B,MAAM,qBAAqB,GAAG,CACnC,sBAA8C,EAC9C,EAAE;IACF,aAAa;IACb,OAAO,IAAA,iBAAU,EAAC,sBAAsB,CAAC;SACtC,IAAI,CAAC,CAAC,cAAsC,EAAE,EAAE;QAC/C,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,cAAsC,EAAE,EAAE;QAC/C,6EAA6E;QAC7E,kEAAkE;QAClE,IAAI,OAAO,MAAM,KAAK,WAAW,E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H;wCAED,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;oCACjB,CAAC;oCACD,UAAU,EAAE,IAAI;iCACjB,CAAC,CAAC;6BACJ;yBACF;wBAED,IAAI,CAAC,CAAC,IAAI,EAAE;4BACV,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;yBACtC;wBAED,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC;oBACtB,CAAC,CAAC,CAAC;gBACL,CAAC;gBACD,IAAI,EAAE,cAAc,CAAC,IAAI;aAC1B,CAAC;SACH;aAAM;YACL,OAAO,cAAc,CAAC;SACvB;IACH,CAAC,CAAC,CAAC;AACP,CAAC,CAAA,CAAC;AA9EW,QAAA,qBAAqB,yBA8EhC"}
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.importRemote = void 0;
13
- /**
14
- * Constant for remote entry file
15
- * @constant {string}
16
- */
17
- const REMOTE_ENTRY_FILE = 'remoteEntry.js';
18
- /**
19
- * Function to load remote
20
- * @function
21
- * @param {ImportRemoteOptions['url']} url - The url of the remote module
22
- * @param {ImportRemoteOptions['scope']} scope - The scope of the remote module
23
- * @param {ImportRemoteOptions['bustRemoteEntryCache']} bustRemoteEntryCache - Flag to bust the remote entry cache
24
- * @returns {Promise<void>} A promise that resolves when the remote is loaded
25
- */
26
- const loadRemote = (url, scope, bustRemoteEntryCache) => new Promise((resolve, reject) => {
27
- const timestamp = bustRemoteEntryCache ? `?t=${new Date().getTime()}` : '';
28
- const webpackRequire = __webpack_require__;
29
- webpackRequire.l(`${url}${timestamp}`, (event) => {
30
- var _a;
31
- if ((event === null || event === void 0 ? void 0 : event.type) === 'load') {
32
- // Script loaded successfully:
33
- return resolve();
34
- }
35
- const realSrc = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.src;
36
- const error = new Error();
37
- error.message = 'Loading script failed.\n(missing: ' + realSrc + ')';
38
- error.name = 'ScriptExternalLoadError';
39
- reject(error);
40
- }, scope);
41
- });
42
- /**
43
- * Function to initialize sharing
44
- * @async
45
- * @function
46
- */
47
- const initSharing = () => __awaiter(void 0, void 0, void 0, function* () {
48
- const webpackShareScopes = __webpack_share_scopes__;
49
- if (!(webpackShareScopes === null || webpackShareScopes === void 0 ? void 0 : webpackShareScopes.default)) {
50
- yield __webpack_init_sharing__('default');
51
- }
52
- });
53
- /**
54
- * Function to initialize container
55
- * @async
56
- * @function
57
- * @param {WebpackRemoteContainer} containerScope - The container scope
58
- */
59
- const initContainer = (containerScope) => __awaiter(void 0, void 0, void 0, function* () {
60
- try {
61
- const webpackShareScopes = __webpack_share_scopes__;
62
- if (!containerScope.__initialized && !containerScope.__initializing) {
63
- containerScope.__initializing = true;
64
- yield containerScope.init(webpackShareScopes.default);
65
- containerScope.__initialized = true;
66
- delete containerScope.__initializing;
67
- }
68
- }
69
- catch (error) {
70
- console.error(error);
71
- }
72
- });
73
- /**
74
- * Function to import remote
75
- * @async
76
- * @function
77
- * @param {ImportRemoteOptions} options - The options for importing the remote
78
- * @returns {Promise<T>} A promise that resolves with the imported module
79
- */
80
- const importRemote = ({ url, scope, module, remoteEntryFileName = REMOTE_ENTRY_FILE, bustRemoteEntryCache = true, }) => __awaiter(void 0, void 0, void 0, function* () {
81
- const remoteScope = scope;
82
- if (!window[remoteScope]) {
83
- let remoteUrl = '';
84
- if (typeof url === 'string') {
85
- remoteUrl = url;
86
- }
87
- else {
88
- remoteUrl = yield url();
89
- }
90
- // Load the remote and initialize the share scope if it's empty
91
- yield Promise.all([
92
- loadRemote(`${remoteUrl}/${remoteEntryFileName}`, scope, bustRemoteEntryCache),
93
- initSharing(),
94
- ]);
95
- if (!window[remoteScope]) {
96
- throw new Error(`Remote loaded successfully but ${scope} could not be found! Verify that the name is correct in the Webpack configuration!`);
97
- }
98
- // Initialize the container to get shared modules and get the module factory:
99
- const [, moduleFactory] = yield Promise.all([
100
- initContainer(window[remoteScope]),
101
- window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`),
102
- ]);
103
- return moduleFactory();
104
- }
105
- else {
106
- const moduleFactory = yield window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`);
107
- return moduleFactory();
108
- }
109
- });
110
- exports.importRemote = importRemote;
111
- //# sourceMappingURL=importRemote.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"importRemote.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/importRemote.ts"],"names":[],"mappings":";;;;;;;;;;;;AA8BA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,CACjB,GAA+B,EAC/B,KAAmC,EACnC,oBAAiE,EACjE,EAAE,CACF,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IACpC,MAAM,SAAS,GAAG,oBAAoB,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,MAAM,cAAc,GAAG,mBAAgD,CAAC;IACxE,cAAc,CAAC,CAAC,CACd,GAAG,GAAG,GAAG,SAAS,EAAE,EACpB,CAAC,KAAK,EAAE,EAAE;;QACR,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,MAAM,EAAE;YAC1B,8BAA8B;YAC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QAAA,YAAY,gBA6CvB"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isObjectEmpty = void 0;
4
- const isObjectEmpty = (obj) => {
5
- for (const x in obj) {
6
- return false;
7
- }
8
- return true;
9
- };
10
- exports.isObjectEmpty = isObjectEmpty;
11
- //# sourceMappingURL=isEmpty.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isEmpty.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/isEmpty.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAmB,GAAM,EAAE,EAAE;IACxD,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,aAAa,iBAKxB"}
package/src/utils/pure.js DELETED
@@ -1,148 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRuntimeRemotes = exports.loadScript = exports.extractUrlAndGlobal = exports.remoteVars = void 0;
4
- const pure = typeof process !== 'undefined' ? process.env['REMOTES'] || {} : {};
5
- exports.remoteVars = pure;
6
- const extractUrlAndGlobal = (urlAndGlobal) => {
7
- const index = urlAndGlobal.indexOf('@');
8
- if (index <= 0 || index === urlAndGlobal.length - 1) {
9
- throw new Error(`Invalid request "${urlAndGlobal}"`);
10
- }
11
- return [urlAndGlobal.substring(index + 1), urlAndGlobal.substring(0, index)];
12
- };
13
- exports.extractUrlAndGlobal = extractUrlAndGlobal;
14
- const loadScript = (keyOrRuntimeRemoteItem) => {
15
- const runtimeRemotes = (0, exports.getRuntimeRemotes)();
16
- // 1) Load remote container if needed
17
- let asyncContainer;
18
- const reference = typeof keyOrRuntimeRemoteItem === 'string' ? runtimeRemotes[keyOrRuntimeRemoteItem] : keyOrRuntimeRemoteItem;
19
- if (reference.asyncContainer) {
20
- asyncContainer =
21
- typeof reference.asyncContainer.then === 'function'
22
- ? reference.asyncContainer
23
- : // @ts-ignore
24
- reference.asyncContainer();
25
- }
26
- else {
27
- // This casting is just to satisfy typescript,
28
- // In reality remoteGlobal will always be a string;
29
- const remoteGlobal = reference.global;
30
- // Check if theres an override for container key if not use remote global
31
- const containerKey = reference.uniqueKey
32
- ? reference.uniqueKey
33
- : remoteGlobal;
34
- const __webpack_error__ = new Error();
35
- // @ts-ignore
36
- const globalScope =
37
- // @ts-ignore
38
- typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
39
- if (typeof window === 'undefined') {
40
- //@ts-ignore
41
- globalScope['_config'][containerKey] = reference.url;
42
- }
43
- else {
44
- // to match promise template system, can be removed once promise template is gone
45
- //@ts-ignore
46
- if (!globalScope['remoteLoading']) {
47
- //@ts-ignore
48
- globalScope['remoteLoading'] = {};
49
- }
50
- //@ts-ignore
51
- if (globalScope['remoteLoading'][containerKey]) {
52
- //@ts-ignore
53
- return globalScope['remoteLoading'][containerKey];
54
- }
55
- }
56
- // @ts-ignore
57
- asyncContainer = new Promise(function (resolve, reject) {
58
- function resolveRemoteGlobal() {
59
- //@ts-ignore
60
- const asyncContainer = globalScope[remoteGlobal];
61
- return resolve(asyncContainer);
62
- }
63
- //@ts-ignore
64
- if (typeof globalScope[remoteGlobal] !== 'undefined') {
65
- return resolveRemoteGlobal();
66
- }
67
- __webpack_require__.l(reference.url, function (event) {
68
- //@ts-ignore
69
- if (typeof globalScope[remoteGlobal] !== 'undefined') {
70
- return resolveRemoteGlobal();
71
- }
72
- const errorType = event && (event.type === 'load' ? 'missing' : event.type);
73
- const realSrc = event && event.target && event.target.src;
74
- __webpack_error__.message =
75
- 'Loading script failed.\n(' +
76
- errorType +
77
- ': ' +
78
- realSrc +
79
- ' or global var ' +
80
- remoteGlobal +
81
- ')';
82
- __webpack_error__.name = 'ScriptExternalLoadError';
83
- __webpack_error__.type = errorType;
84
- __webpack_error__.request = realSrc;
85
- reject(__webpack_error__);
86
- }, containerKey);
87
- }).catch(function (err) {
88
- console.error('container is offline, returning fake remote');
89
- console.error(err);
90
- return {
91
- fake: true,
92
- // @ts-ignore
93
- get: (arg) => {
94
- console.warn('faking', arg, 'module on, its offline');
95
- return Promise.resolve(() => {
96
- return {
97
- __esModule: true,
98
- default: () => {
99
- return null;
100
- },
101
- };
102
- });
103
- },
104
- //eslint-disable-next-line
105
- init: () => { },
106
- };
107
- });
108
- if (typeof window !== 'undefined') {
109
- //@ts-ignore
110
- globalScope['remoteLoading'][containerKey] = asyncContainer;
111
- }
112
- }
113
- return asyncContainer;
114
- };
115
- exports.loadScript = loadScript;
116
- const getRuntimeRemotes = () => {
117
- return Object.entries(exports.remoteVars).reduce((acc, [key, value]) => {
118
- if (typeof value === 'object' && typeof value.then === 'function') {
119
- acc[key] = { asyncContainer: value };
120
- }
121
- else if (typeof value === 'function') {
122
- acc[key] = { asyncContainer: Promise.resolve(value()) };
123
- }
124
- else if (typeof value === 'string') {
125
- if (value.startsWith('internal ')) {
126
- const [request, query] = value.replace('internal ', '').split('?');
127
- if (query) {
128
- const remoteSyntax = new URLSearchParams(query).get('remote');
129
- if (remoteSyntax) {
130
- const [url, global] = (0, exports.extractUrlAndGlobal)(remoteSyntax);
131
- acc[key] = { global, url };
132
- }
133
- }
134
- }
135
- else {
136
- const [url, global] = (0, exports.extractUrlAndGlobal)(value);
137
- acc[key] = { global, url };
138
- }
139
- }
140
- else {
141
- console.warn('remotes process', process.env['REMOTES']);
142
- throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
143
- }
144
- return acc;
145
- }, {});
146
- };
147
- exports.getRuntimeRemotes = getRuntimeRemotes;
148
- //# sourceMappingURL=pure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pure.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/pure.ts"],"names":[],"mappings":";;;AAQA,MAAM,IAAI,GAAG,OAAO,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAA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,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;aAC5B;SACF;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,GAAG,CAAC,CAAC;SAC5E;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAuB,CAAC,CAAC;AAChC,CAAC,CAAC;AA1BW,QAAA,iBAAiB,qBA0B5B"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FederationBoundary = void 0;
7
- var FederationBoundary_1 = require("../components/FederationBoundary");
8
- Object.defineProperty(exports, "FederationBoundary", { enumerable: true, get: function () { return __importDefault(FederationBoundary_1).default; } });
9
- //# sourceMappingURL=react.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/react.tsx"],"names":[],"mappings":";;;;;;AAAA,uEAAiF;AAAxE,yIAAA,OAAO,OAAsB"}