@module-federation/utilities 0.0.0-feat-node-support-1702694175668

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 (40) hide show
  1. package/package.json +36 -0
  2. package/src/Logger.d.ts +7 -0
  3. package/src/Logger.js +15 -0
  4. package/src/Logger.js.map +1 -0
  5. package/src/components/ErrorBoundary.d.ts +19 -0
  6. package/src/components/ErrorBoundary.js +33 -0
  7. package/src/components/ErrorBoundary.js.map +1 -0
  8. package/src/components/FederationBoundary.d.ts +14 -0
  9. package/src/components/FederationBoundary.js +71 -0
  10. package/src/components/FederationBoundary.js.map +1 -0
  11. package/src/index.d.ts +9 -0
  12. package/src/index.js +35 -0
  13. package/src/index.js.map +1 -0
  14. package/src/plugins/DelegateModulesPlugin.d.ts +18 -0
  15. package/src/plugins/DelegateModulesPlugin.js +84 -0
  16. package/src/plugins/DelegateModulesPlugin.js.map +1 -0
  17. package/src/types/index.d.ts +76 -0
  18. package/src/types/index.js +5 -0
  19. package/src/types/index.js.map +1 -0
  20. package/src/utils/common.d.ts +41 -0
  21. package/src/utils/common.js +168 -0
  22. package/src/utils/common.js.map +1 -0
  23. package/src/utils/getRuntimeRemotes.d.ts +2 -0
  24. package/src/utils/getRuntimeRemotes.js +49 -0
  25. package/src/utils/getRuntimeRemotes.js.map +1 -0
  26. package/src/utils/importDelegatedModule.d.ts +2 -0
  27. package/src/utils/importDelegatedModule.js +87 -0
  28. package/src/utils/importDelegatedModule.js.map +1 -0
  29. package/src/utils/importRemote.d.ts +31 -0
  30. package/src/utils/importRemote.js +119 -0
  31. package/src/utils/importRemote.js.map +1 -0
  32. package/src/utils/isEmpty.d.ts +1 -0
  33. package/src/utils/isEmpty.js +11 -0
  34. package/src/utils/isEmpty.js.map +1 -0
  35. package/src/utils/pure.d.ts +5 -0
  36. package/src/utils/pure.js +150 -0
  37. package/src/utils/pure.js.map +1 -0
  38. package/src/utils/react.d.ts +1 -0
  39. package/src/utils/react.js +9 -0
  40. package/src/utils/react.js.map +1 -0
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@module-federation/utilities",
3
+ "version": "0.0.0-feat-node-support-1702694175668",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "src/index.d.ts",
7
+ "license": "MIT",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "repository": "https://github.com/module-federation/universe/tree/main/packages/utilities",
12
+ "devDependencies": {
13
+ "next": "13.5.6",
14
+ "react": "18.2.0"
15
+ },
16
+ "peerDependencies": {
17
+ "next": "^12 || ^13",
18
+ "react": "^16 || ^17 || ^18",
19
+ "react-dom": "^16 || ^17 || ^18",
20
+ "webpack": "^5.40.0"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "next": {
24
+ "optional": true
25
+ },
26
+ "react": {
27
+ "optional": true
28
+ },
29
+ "react-dom": {
30
+ "optional": true
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "webpack-sources": "3.2.3"
35
+ }
36
+ }
@@ -0,0 +1,7 @@
1
+ import { Compilation } from 'webpack';
2
+ export type LoggerInstance = Compilation['logger'] | Console;
3
+ export declare class Logger {
4
+ private static loggerInstance;
5
+ static getLogger(): LoggerInstance;
6
+ static setLogger(logger: Compilation['logger']): LoggerInstance;
7
+ }
package/src/Logger.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Logger = void 0;
4
+ class Logger {
5
+ static getLogger() {
6
+ return this.loggerInstance;
7
+ }
8
+ static setLogger(logger) {
9
+ this.loggerInstance = logger || console;
10
+ return logger;
11
+ }
12
+ }
13
+ exports.Logger = Logger;
14
+ Logger.loggerInstance = console;
15
+ //# sourceMappingURL=Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../../../packages/utilities/src/Logger.ts"],"names":[],"mappings":";;;AAIA,MAAa,MAAM;IAGjB,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAA6B;QAC5C,IAAI,CAAC,cAAc,GAAG,MAAM,IAAI,OAAO,CAAC;QACxC,OAAO,MAAM,CAAC;IAChB,CAAC;;AAVH,wBAWC;AAVgB,qBAAc,GAAmB,OAAO,CAAC"}
@@ -0,0 +1,19 @@
1
+ import React, { type ErrorInfo } from 'react';
2
+ export interface ErrorBoundaryProps {
3
+ children: React.ReactNode;
4
+ }
5
+ export interface ErrorBoundaryState {
6
+ hasError: boolean;
7
+ }
8
+ /**
9
+ * Generic error boundary component.
10
+ */
11
+ declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
12
+ constructor(props: ErrorBoundaryProps);
13
+ static getDerivedStateFromError(): {
14
+ hasError: boolean;
15
+ };
16
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
17
+ render(): React.ReactNode;
18
+ }
19
+ export default ErrorBoundary;
@@ -0,0 +1,33 @@
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
+ const react_1 = __importDefault(require("react"));
7
+ /**
8
+ * Generic error boundary component.
9
+ */
10
+ class ErrorBoundary extends react_1.default.Component {
11
+ constructor(props) {
12
+ super(props);
13
+ this.state = {
14
+ hasError: false,
15
+ };
16
+ }
17
+ static getDerivedStateFromError( /*error: Error*/) {
18
+ return {
19
+ hasError: true,
20
+ };
21
+ }
22
+ componentDidCatch(error, errorInfo) {
23
+ console.error(error, errorInfo);
24
+ }
25
+ render() {
26
+ if (this.state.hasError) {
27
+ return 'An error has occurred.';
28
+ }
29
+ return this.props.children;
30
+ }
31
+ }
32
+ exports.default = ErrorBoundary;
33
+ //# sourceMappingURL=ErrorBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/components/ErrorBoundary.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA8C;AAU9C;;GAEG;AACH,MAAM,aAAc,SAAQ,eAAK,CAAC,SAGjC;IACC,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACX,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,wBAAwB,EAAC,gBAAgB;QAC9C,OAAO;YACL,QAAQ,EAAE,IAAI;SACf,CAAC;IACJ,CAAC;IAEQ,iBAAiB,CAAC,KAAY,EAAE,SAAoB;QAC3D,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAEQ,MAAM;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;YACvB,OAAO,wBAAwB,CAAC;SACjC;QAED,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { ComponentClass, ComponentType, PropsWithChildren } from 'react';
3
+ export interface FederationBoundaryProps {
4
+ dynamicImporter: () => Promise<ComponentType<any>>;
5
+ fallback?: () => Promise<ComponentType<any>>;
6
+ customBoundary?: ComponentClass<PropsWithChildren<any>>;
7
+ [props: string]: any;
8
+ }
9
+ /**
10
+ * Wrapper around dynamic import.
11
+ * Adds error boundaries and fallback options.
12
+ */
13
+ declare const FederationBoundary: React.FC<FederationBoundaryProps>;
14
+ export default FederationBoundary;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ const react_1 = __importStar(require("react"));
41
+ const ErrorBoundary_1 = __importDefault(require("./ErrorBoundary"));
42
+ /**
43
+ * A fallback component that renders nothing.
44
+ */
45
+ const FallbackComponent = () => {
46
+ return null;
47
+ };
48
+ /**
49
+ * Wrapper around dynamic import.
50
+ * Adds error boundaries and fallback options.
51
+ */
52
+ const FederationBoundary = (_a) => {
53
+ var { dynamicImporter, fallback = () => Promise.resolve(FallbackComponent), customBoundary: CustomBoundary = ErrorBoundary_1.default } = _a, rest = __rest(_a, ["dynamicImporter", "fallback", "customBoundary"]);
54
+ const ImportResult = (0, react_1.useMemo)(() => {
55
+ return (0, react_1.lazy)(() => dynamicImporter()
56
+ .catch((e) => {
57
+ console.error(e);
58
+ return fallback();
59
+ })
60
+ .then((m) => {
61
+ return {
62
+ //@ts-ignore
63
+ default: m.default || m,
64
+ };
65
+ }));
66
+ }, [dynamicImporter, fallback]);
67
+ return (react_1.default.createElement(CustomBoundary, null,
68
+ react_1.default.createElement(ImportResult, Object.assign({}, rest))));
69
+ };
70
+ exports.default = FederationBoundary;
71
+ //# sourceMappingURL=FederationBoundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FederationBoundary.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/components/FederationBoundary.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA6C;AAE7C,oEAA4C;AAE5C;;GAEG;AACH,MAAM,iBAAiB,GAAa,GAAG,EAAE;IACvC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAaF;;;GAGG;AACH,MAAM,kBAAkB,GAAsC,CAAC,EAK9D,EAAE,EAAE;QAL0D,EAC7D,eAAe,EACf,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EACnD,cAAc,EAAE,cAAc,GAAG,uBAAa,OAE/C,EADI,IAAI,cAJsD,iDAK9D,CADQ;IAEP,MAAM,YAAY,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,OAAO,IAAA,YAAI,EAAC,GAAG,EAAE,CACf,eAAe,EAAE;aACd,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE;YAClB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,QAAQ,EAAE,CAAC;QACpB,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACV,OAAO;gBACL,YAAY;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC;aACxB,CAAC;QACJ,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEhC,OAAO,CACL,8BAAC,cAAc;QACb,8BAAC,YAAY,oBAAK,IAAI,EAAI,CACX,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ export * from './types';
2
+ export type { ImportRemoteOptions } from './utils/importRemote';
3
+ export type { LoggerInstance } from './Logger';
4
+ export { createDelegatedModule, createRuntimeVariables, getContainer, injectScript, getModule, } from './utils/common';
5
+ export { isObjectEmpty } from './utils/isEmpty';
6
+ export { importRemote } from './utils/importRemote';
7
+ export { Logger } from './Logger';
8
+ export { getRuntimeRemotes } from './utils/getRuntimeRemotes';
9
+ export { importDelegatedModule } from './utils/importDelegatedModule';
package/src/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.importDelegatedModule = exports.getRuntimeRemotes = exports.Logger = exports.importRemote = exports.isObjectEmpty = exports.getModule = exports.injectScript = exports.getContainer = exports.createRuntimeVariables = exports.createDelegatedModule = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var common_1 = require("./utils/common");
20
+ Object.defineProperty(exports, "createDelegatedModule", { enumerable: true, get: function () { return common_1.createDelegatedModule; } });
21
+ Object.defineProperty(exports, "createRuntimeVariables", { enumerable: true, get: function () { return common_1.createRuntimeVariables; } });
22
+ Object.defineProperty(exports, "getContainer", { enumerable: true, get: function () { return common_1.getContainer; } });
23
+ Object.defineProperty(exports, "injectScript", { enumerable: true, get: function () { return common_1.injectScript; } });
24
+ Object.defineProperty(exports, "getModule", { enumerable: true, get: function () { return common_1.getModule; } });
25
+ var isEmpty_1 = require("./utils/isEmpty");
26
+ Object.defineProperty(exports, "isObjectEmpty", { enumerable: true, get: function () { return isEmpty_1.isObjectEmpty; } });
27
+ var importRemote_1 = require("./utils/importRemote");
28
+ Object.defineProperty(exports, "importRemote", { enumerable: true, get: function () { return importRemote_1.importRemote; } });
29
+ var Logger_1 = require("./Logger");
30
+ Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
31
+ var getRuntimeRemotes_1 = require("./utils/getRuntimeRemotes");
32
+ Object.defineProperty(exports, "getRuntimeRemotes", { enumerable: true, get: function () { return getRuntimeRemotes_1.getRuntimeRemotes; } });
33
+ var importDelegatedModule_1 = require("./utils/importDelegatedModule");
34
+ Object.defineProperty(exports, "importDelegatedModule", { enumerable: true, get: function () { return importDelegatedModule_1.importDelegatedModule; } });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/utilities/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AAIxB,yCAMwB;AALtB,+GAAA,qBAAqB,OAAA;AACrB,gHAAA,sBAAsB,OAAA;AACtB,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA;AACZ,mGAAA,SAAS,OAAA;AAEX,2CAAgD;AAAvC,wGAAA,aAAa,OAAA;AACtB,qDAAoD;AAA3C,4GAAA,YAAY,OAAA;AACrB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,uEAAsE;AAA7D,8HAAA,qBAAqB,OAAA"}
@@ -0,0 +1,18 @@
1
+ import type { Compiler, Compilation, Chunk, NormalModule } from 'webpack';
2
+ declare class DelegateModulesPlugin {
3
+ options: {
4
+ debug: boolean;
5
+ [key: string]: any;
6
+ };
7
+ _delegateModules: Map<string, NormalModule>;
8
+ constructor(options: {
9
+ debug?: boolean;
10
+ [key: string]: any;
11
+ });
12
+ getChunkByName(chunks: Iterable<Chunk>, name: string): Chunk | undefined;
13
+ private addDelegatesToChunks;
14
+ private addModuleAndDependenciesToChunk;
15
+ removeDelegatesNonRuntimeChunks(compilation: Compilation, chunks: Iterable<Chunk>): void;
16
+ apply(compiler: Compiler): void;
17
+ }
18
+ export default DelegateModulesPlugin;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class DelegateModulesPlugin {
4
+ constructor(options) {
5
+ this.options = Object.assign({ debug: false }, options);
6
+ this._delegateModules = new Map();
7
+ }
8
+ getChunkByName(chunks, name) {
9
+ for (const chunk of chunks) {
10
+ if (chunk.name === name) {
11
+ return chunk;
12
+ }
13
+ }
14
+ return undefined;
15
+ }
16
+ addDelegatesToChunks(compilation, chunks) {
17
+ for (const chunk of chunks) {
18
+ this._delegateModules.forEach((module) => {
19
+ this.addModuleAndDependenciesToChunk(module, chunk, compilation);
20
+ });
21
+ }
22
+ }
23
+ addModuleAndDependenciesToChunk(module, chunk, compilation) {
24
+ if (!compilation.chunkGraph.isModuleInChunk(module, chunk)) {
25
+ if (this.options.debug) {
26
+ console.log('adding ', module.identifier(), ' to chunk', chunk.name);
27
+ }
28
+ compilation.chunkGraph.connectChunkAndModule(chunk, module);
29
+ }
30
+ }
31
+ removeDelegatesNonRuntimeChunks(compilation, chunks) {
32
+ for (const chunk of chunks) {
33
+ if (!chunk.hasRuntime()) {
34
+ this.options.debug &&
35
+ console.log('non-runtime chunk:', chunk.debugId, chunk.id, chunk.name);
36
+ for (const [id, module] of this._delegateModules) {
37
+ compilation.chunkGraph.disconnectChunkAndModule(chunk, module);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ apply(compiler) {
43
+ compiler.hooks.thisCompilation.tap('DelegateModulesPlugin', (compilation) => {
44
+ compilation.hooks.finishModules.tapAsync('DelegateModulesPlugin', (modules, callback) => {
45
+ var _a;
46
+ const { remotes } = this.options;
47
+ const knownDelegates = new Set(remotes
48
+ ? Object.values(remotes).map((remote) => remote.replace('internal ', ''))
49
+ : []);
50
+ for (const module of modules) {
51
+ const normalModule = module;
52
+ if (normalModule) {
53
+ const mid = normalModule.identifier();
54
+ if ((_a = normalModule === null || normalModule === void 0 ? void 0 : normalModule.userRequest) === null || _a === void 0 ? void 0 : _a.startsWith('webpack/container/reference')) {
55
+ this._delegateModules.set(mid, normalModule);
56
+ }
57
+ }
58
+ if (normalModule.resource &&
59
+ knownDelegates.has(normalModule.resource)) {
60
+ this._delegateModules.set(normalModule.resource, normalModule);
61
+ }
62
+ }
63
+ callback();
64
+ });
65
+ compilation.hooks.optimizeChunks.tap('DelegateModulesPlugin', (chunks) => {
66
+ const { runtime, container } = this.options;
67
+ const runtimeChunk = this.getChunkByName(chunks, runtime);
68
+ if (!runtimeChunk || !runtimeChunk.hasRuntime()) {
69
+ return;
70
+ }
71
+ // Get the container chunk if specified
72
+ const remoteContainer = container
73
+ ? this.getChunkByName(chunks, container)
74
+ : null;
75
+ this.options.debug &&
76
+ console.log(remoteContainer === null || remoteContainer === void 0 ? void 0 : remoteContainer.name, runtimeChunk.name, this._delegateModules.size);
77
+ this.addDelegatesToChunks(compilation, [remoteContainer, runtimeChunk].filter(Boolean));
78
+ this.removeDelegatesNonRuntimeChunks(compilation, chunks);
79
+ });
80
+ });
81
+ }
82
+ }
83
+ exports.default = DelegateModulesPlugin;
84
+ //# sourceMappingURL=DelegateModulesPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DelegateModulesPlugin.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/plugins/DelegateModulesPlugin.ts"],"names":[],"mappings":";;AAEA,MAAM,qBAAqB;IAIzB,YAAY,OAAgD;QAC1D,IAAI,CAAC,OAAO,mBAAK,KAAK,EAAE,KAAK,IAAK,OAAO,CAAE,CAAC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;IACpC,CAAC;IAED,cAAc,CAAC,MAAuB,EAAE,IAAY;QAClD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACvB,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,oBAAoB,CAC1B,WAAwB,EACxB,MAAuB;QAEvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;YAC1B,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACvC,IAAI,CAAC,+BAA+B,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;IAEO,+BAA+B,CACrC,MAAoB,EACpB,KAAY,EACZ,WAAwB;QAExB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;YAC1D,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBACtB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;aACtE;YACD,WAAW,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;SAC7D;IACH,CAAC;IAED,+BAA+B,CAC7B,WAAwB,EACxB,MAAuB;QAEvB,KAAK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AAED,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,76 @@
1
+ /// <reference types="webpack/module" />
2
+ import type { container, WebpackOptionsNormalized } from 'webpack';
3
+ export type ModuleFederationPluginOptions = ConstructorParameters<typeof container.ModuleFederationPlugin>['0'];
4
+ export type WebpackRequire = {
5
+ l: (url: string | undefined, cb: (event: any) => void, id: string | number) => Record<string, unknown>;
6
+ };
7
+ export type WebpackShareScopes = Record<string, Record<string, {
8
+ loaded?: 1;
9
+ get: () => Promise<unknown>;
10
+ from: string;
11
+ eager: boolean;
12
+ }>> & {
13
+ default?: string;
14
+ };
15
+ export type GlobalScopeType = {
16
+ [K: string]: any;
17
+ _config?: Record<string | number, any>;
18
+ _medusa?: Record<string, any> | undefined;
19
+ remoteLoading?: Record<string, Promise<AsyncContainer>>;
20
+ };
21
+ export declare const __webpack_init_sharing__: (parameter: string) => Promise<void>;
22
+ export interface NextFederationPluginExtraOptions {
23
+ enableImageLoaderFix?: boolean;
24
+ enableUrlLoaderFix?: boolean;
25
+ exposePages?: boolean;
26
+ skipSharingNextInternals?: boolean;
27
+ automaticPageStitching?: boolean;
28
+ debug?: boolean;
29
+ }
30
+ export interface NextFederationPluginOptions extends ModuleFederationPluginOptions {
31
+ extraOptions: NextFederationPluginExtraOptions;
32
+ }
33
+ export type Shared = ModuleFederationPluginOptions['shared'];
34
+ export type Remotes = ModuleFederationPluginOptions['remotes'];
35
+ export type SharedObject = Extract<Shared, ModuleFederationPluginOptions>;
36
+ export type SharedConfig = Extract<SharedObject[keyof SharedObject], {
37
+ eager?: boolean;
38
+ }>;
39
+ export type ExternalsType = Required<ModuleFederationPluginOptions['remoteType']>;
40
+ type ModulePath = string;
41
+ export type WebpackRemoteContainer = {
42
+ __initialized?: boolean;
43
+ get(modulePath: ModulePath): () => any;
44
+ init: (obj?: typeof __webpack_share_scopes__) => void;
45
+ };
46
+ export type AsyncContainer = Promise<WebpackRemoteContainer>;
47
+ export type RemoteData = {
48
+ global: string;
49
+ url: string;
50
+ uniqueKey?: string;
51
+ };
52
+ export type RuntimeRemote = Partial<RemoteData> & {
53
+ asyncContainer?: AsyncContainer;
54
+ global?: string;
55
+ url?: string;
56
+ };
57
+ export type RuntimeRemotesMap = Record<string, RuntimeRemote>;
58
+ type Module = WebpackOptionsNormalized['module'];
59
+ type Rules = Module['rules'];
60
+ export type RuleSetRuleUnion = Rules[0];
61
+ type RuleSetRule = Extract<RuleSetRuleUnion, {
62
+ loader?: string;
63
+ }>;
64
+ export type Loader = Extract<RuleSetRule['use'], {
65
+ loader?: string;
66
+ }>;
67
+ export type EventTypes = 'loadStart' | 'loadComplete' | 'loadError';
68
+ type NextRoute = string;
69
+ export type PageMap = Record<NextRoute, ModulePath>;
70
+ export type GetModuleOptions = {
71
+ modulePath: string;
72
+ exportName?: string;
73
+ remoteContainer: string | RemoteData;
74
+ };
75
+ export type RemoteVars = Record<string, Promise<WebpackRemoteContainer> | string | (() => Promise<WebpackRemoteContainer>)>;
76
+ export {};
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
3
+ /// <reference path="../../../../node_modules/webpack/module.d.ts" />
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/types/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE"}
@@ -0,0 +1,41 @@
1
+ import type { GetModuleOptions, RemoteData, Remotes, RuntimeRemote, WebpackRemoteContainer } from '../types';
2
+ /**
3
+ * Creates a module that can be shared across different builds.
4
+ * @param {string} delegate - The delegate string.
5
+ * @param {Object} params - The parameters for the module.
6
+ * @returns {string} - The created module.
7
+ * @throws Will throw an error if the params are an array or object.
8
+ */
9
+ export declare const createDelegatedModule: (delegate: string, params: {
10
+ [key: string]: any;
11
+ }) => string;
12
+ /**
13
+ * Return initialized remote container by remote's key or its runtime remote item data.
14
+ *
15
+ * `runtimeRemoteItem` might be
16
+ * { global, url } - values obtained from webpack remotes option `global@url`
17
+ * or
18
+ * { asyncContainer } - async container is a promise that resolves to the remote container
19
+ */
20
+ export declare const injectScript: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => Promise<WebpackRemoteContainer>;
21
+ /**
22
+ * Creates runtime variables from the provided remotes.
23
+ * If the value of a remote starts with 'promise ' or 'external ', it is transformed into a function that returns the promise call.
24
+ * Otherwise, the value is stringified.
25
+ * @param {Remotes} remotes - The remotes to create runtime variables from.
26
+ * @returns {Record<string, string>} - The created runtime variables.
27
+ */
28
+ export declare const createRuntimeVariables: (remotes: Remotes) => Record<string, string>;
29
+ /**
30
+ * Returns initialized webpack RemoteContainer.
31
+ * If its' script does not loaded - then load & init it firstly.
32
+ */
33
+ export declare const getContainer: (remoteContainer: string | RemoteData) => Promise<WebpackRemoteContainer | undefined>;
34
+ /**
35
+ * Return remote module from container.
36
+ * If you provide `exportName` it automatically return exact property value from module.
37
+ *
38
+ * @example
39
+ * remote.getModule('./pages/index', 'default')
40
+ */
41
+ export declare const getModule: ({ remoteContainer, modulePath, exportName, }: GetModuleOptions) => Promise<any>;
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.getModule = exports.getContainer = exports.createRuntimeVariables = exports.injectScript = exports.createDelegatedModule = void 0;
14
+ const pure_1 = require("./pure");
15
+ /**
16
+ * Creates a module that can be shared across different builds.
17
+ * @param {string} delegate - The delegate string.
18
+ * @param {Object} params - The parameters for the module.
19
+ * @returns {string} - The created module.
20
+ * @throws Will throw an error if the params are an array or object.
21
+ */
22
+ const createDelegatedModule = (delegate, params) => {
23
+ const queries = [];
24
+ const processParam = (key, value) => {
25
+ if (Array.isArray(value)) {
26
+ value.forEach((v, i) => processParam(`${key}[${i}]`, v));
27
+ }
28
+ else if (typeof value === 'object' && value !== null) {
29
+ Object.entries(value).forEach(([k, v]) => processParam(`${key}.${k}`, v));
30
+ }
31
+ else {
32
+ queries.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
33
+ }
34
+ };
35
+ Object.entries(params).forEach(([key, value]) => processParam(key, value));
36
+ return queries.length === 0
37
+ ? `internal ${delegate}`
38
+ : `internal ${delegate}?${queries.join('&')}`;
39
+ };
40
+ exports.createDelegatedModule = createDelegatedModule;
41
+ const createContainerSharingScope = (asyncContainer) => {
42
+ // @ts-ignore
43
+ return asyncContainer
44
+ .then(function (container) {
45
+ if (!__webpack_share_scopes__['default']) {
46
+ // not always a promise, so we wrap it in a resolve
47
+ return Promise.resolve(__webpack_init_sharing__('default')).then(function () {
48
+ return container;
49
+ });
50
+ }
51
+ else {
52
+ return container;
53
+ }
54
+ })
55
+ .then(function (container) {
56
+ try {
57
+ // WARNING: here might be a potential BUG.
58
+ // `container.init` does not return a Promise, and here we do not call `then` on it.
59
+ // But according to [docs](https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers)
60
+ // it must be async.
61
+ // The problem may be in Proxy in NextFederationPlugin.js.
62
+ // or maybe a bug in the webpack itself - instead of returning rejected promise it just throws an error.
63
+ // But now everything works properly and we keep this code as is.
64
+ container.init(__webpack_share_scopes__['default']);
65
+ }
66
+ catch (e) {
67
+ // maybe container already initialized so nothing to throw
68
+ }
69
+ return container;
70
+ });
71
+ };
72
+ /**
73
+ * Return initialized remote container by remote's key or its runtime remote item data.
74
+ *
75
+ * `runtimeRemoteItem` might be
76
+ * { global, url } - values obtained from webpack remotes option `global@url`
77
+ * or
78
+ * { asyncContainer } - async container is a promise that resolves to the remote container
79
+ */
80
+ const injectScript = (keyOrRuntimeRemoteItem) => __awaiter(void 0, void 0, void 0, function* () {
81
+ const asyncContainer = (0, pure_1.loadScript)(keyOrRuntimeRemoteItem);
82
+ return createContainerSharingScope(asyncContainer);
83
+ });
84
+ exports.injectScript = injectScript;
85
+ /**
86
+ * Creates runtime variables from the provided remotes.
87
+ * If the value of a remote starts with 'promise ' or 'external ', it is transformed into a function that returns the promise call.
88
+ * Otherwise, the value is stringified.
89
+ * @param {Remotes} remotes - The remotes to create runtime variables from.
90
+ * @returns {Record<string, string>} - The created runtime variables.
91
+ */
92
+ const createRuntimeVariables = (remotes) => {
93
+ if (!remotes) {
94
+ return {};
95
+ }
96
+ return Object.entries(remotes).reduce((acc, [key, value]) => {
97
+ if (value.startsWith('promise ') || value.startsWith('external ')) {
98
+ const promiseCall = value.split(' ')[1];
99
+ acc[key] = `function() {
100
+ return ${promiseCall}
101
+ }`;
102
+ }
103
+ else {
104
+ acc[key] = JSON.stringify(value);
105
+ }
106
+ return acc;
107
+ }, {});
108
+ };
109
+ exports.createRuntimeVariables = createRuntimeVariables;
110
+ /**
111
+ * Returns initialized webpack RemoteContainer.
112
+ * If its' script does not loaded - then load & init it firstly.
113
+ */
114
+ const getContainer = (remoteContainer) => __awaiter(void 0, void 0, void 0, function* () {
115
+ if (!remoteContainer) {
116
+ throw Error(`Remote container options is empty`);
117
+ }
118
+ const containerScope = typeof window !== 'undefined'
119
+ ? window
120
+ : globalThis.__remote_scope__;
121
+ let containerKey;
122
+ if (typeof remoteContainer === 'string') {
123
+ containerKey = remoteContainer;
124
+ }
125
+ else {
126
+ containerKey = remoteContainer.uniqueKey;
127
+ if (!containerScope[containerKey]) {
128
+ const container = yield (0, exports.injectScript)({
129
+ global: remoteContainer.global,
130
+ url: remoteContainer.url,
131
+ });
132
+ if (!container) {
133
+ throw Error(`Remote container ${remoteContainer.url} is empty`);
134
+ }
135
+ }
136
+ }
137
+ return containerScope[containerKey];
138
+ });
139
+ exports.getContainer = getContainer;
140
+ /**
141
+ * Return remote module from container.
142
+ * If you provide `exportName` it automatically return exact property value from module.
143
+ *
144
+ * @example
145
+ * remote.getModule('./pages/index', 'default')
146
+ */
147
+ const getModule = ({ remoteContainer, modulePath, exportName, }) => __awaiter(void 0, void 0, void 0, function* () {
148
+ const container = yield (0, exports.getContainer)(remoteContainer);
149
+ try {
150
+ const modFactory = yield (container === null || container === void 0 ? void 0 : container.get(modulePath));
151
+ if (!modFactory) {
152
+ return undefined;
153
+ }
154
+ const mod = modFactory();
155
+ if (exportName) {
156
+ return mod && typeof mod === 'object' ? mod[exportName] : undefined;
157
+ }
158
+ else {
159
+ return mod;
160
+ }
161
+ }
162
+ catch (error) {
163
+ console.error(error);
164
+ return undefined;
165
+ }
166
+ });
167
+ exports.getModule = getModule;
168
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/common.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;;;;;;;;;;AAUtD,iCAAoC;AAEpC;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,CACnC,QAAgB,EAChB,MAA8B,EAC9B,EAAE;IACF,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;SAC1D;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI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YACL,OAAO,GAAG,CAAC;SACZ;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,SAAS,CAAC;KAClB;AACH,CAAC,CAAA,CAAC;AArBW,QAAA,SAAS,aAqBpB"}
@@ -0,0 +1,2 @@
1
+ import { RuntimeRemotesMap } from '../types';
2
+ export declare const getRuntimeRemotes: () => RuntimeRemotesMap;
@@ -0,0 +1,49 @@
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
@@ -0,0 +1 @@
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,UAAU,GAAG,EAAE,IAAI;YAC1D,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,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC9D,IAAI,YAAY,EAAE;wBAChB,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,0BAAmB,EAAC,YAAY,CAAC,CAAC;wBACxD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;qBAC5B;iBACF;aACF;YACD,oCAAoC;iBAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBAClC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,0BAAmB,EAAC,KAAK,CAAC,CAAC;gBACjD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;aAC5B;YACD,8CAA8C;iBACzC;gBACH,YAAY;gBACZ,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,EAAE,EAAuB,CAAC,CAAC;KAC7B;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,CAAC,CAAC;KAC3D;IAED,OAAO,EAAuB,CAAC;AACjC,CAAC,CAAC;AA5CW,QAAA,iBAAiB,qBA4C5B"}
@@ -0,0 +1,2 @@
1
+ import { RuntimeRemote } from '../types';
2
+ export declare const importDelegatedModule: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => Promise<any>;
@@ -0,0 +1,87 @@
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
@@ -0,0 +1 @@
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,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,sBAAsB,EAAE,YAAY,CAAC,EAAE;gBACrE,OAAO,cAAc,CAAC;aACvB;YAED,yBAAyB;YAEzB,2DAA2D;YAC3D,OAAO;gBACL,GAAG,EAAE,UAAU,GAAW;oBACxB,YAAY;oBACZ,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBACxC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;wBACd,MAAM,MAAM,GAAG;4BACb,UAAU,EAAE,CAAC,CAAC,UAAU;yBACzB,CAAC;wBACF,KAAK,MAAM,IAAI,IAAI,CAAC,EAAE;4BACpB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;gCACjC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE;oCAClC,GAAG,EAAE;wCACH,OAAO;4CACL,YAAY;4CACZ,IAAI,UAAU,CAAC,UAAU,EAAE;gDACzB,YAAY;gDACZ,UAAU,CAAC,UAAU,CAAC,GAAG;gDACvB,YAAY;gDACZ,GAAG,sBAAsB,CAAC,MAAM,KAAK,GAAG,EAAE,CAC3C,CAAC;6CACH;4CACD,6CAA6C;4CAC7C,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;wCAC/B,CAAC,CAAC;oCACJ,CAAC;oCACD,UAAU,EAAE,IAAI;iCACjB,CAAC,CAAC;6BACJ;iCAAM;gCACL,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE;oCAClC,GAAG,EAAE,GAAG,EAAE;wCACR,YAAY;wCACZ,IAAI,UAAU,CAAC,UAAU,EAAE;4CACzB,YAAY;4CACZ,UAAU,CAAC,UAAU,CAAC,GAAG;4CACvB,YAAY;4CACZ,GAAG,sBAAsB,CAAC,MAAM,KAAK,GAAG,EAAE,CAC3C,CAAC;yCACH;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"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Type definition for RemoteUrl
3
+ * @typedef {string | function} RemoteUrl
4
+ */
5
+ type RemoteUrl = string | (() => Promise<string>);
6
+ /**
7
+ * Interface for ImportRemoteOptions
8
+ * @interface
9
+ * @property {RemoteUrl} url - The url of the remote module
10
+ * @property {string} scope - The scope of the remote module
11
+ * @property {string} module - The module to import
12
+ * @property {string} [remoteEntryFileName] - The filename of the remote entry
13
+ * @property {boolean} [bustRemoteEntryCache] - Flag to bust the remote entry cache
14
+ */
15
+ export interface ImportRemoteOptions {
16
+ url: RemoteUrl;
17
+ scope: string;
18
+ module: string;
19
+ remoteEntryFileName?: string;
20
+ bustRemoteEntryCache?: boolean;
21
+ esm?: boolean;
22
+ }
23
+ /**
24
+ * Function to import remote
25
+ * @async
26
+ * @function
27
+ * @param {ImportRemoteOptions} options - The options for importing the remote
28
+ * @returns {Promise<T>} A promise that resolves with the imported module
29
+ */
30
+ export declare const importRemote: <T>({ url, scope, module, remoteEntryFileName, bustRemoteEntryCache, esm, }: ImportRemoteOptions) => Promise<T>;
31
+ export {};
@@ -0,0 +1,119 @@
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
+ const loadEsmRemote = (url, scope) => __awaiter(void 0, void 0, void 0, function* () {
43
+ const module = yield import(/* webpackIgnore: true */ url);
44
+ if (!module) {
45
+ throw new Error(`Unable to load requested remote from ${url} with scope ${scope}`);
46
+ }
47
+ window[scope] = Object.assign(Object.assign({}, module), { __initializing: false, __initialized: false });
48
+ });
49
+ /**
50
+ * Function to initialize sharing
51
+ * @async
52
+ * @function
53
+ */
54
+ const initSharing = () => __awaiter(void 0, void 0, void 0, function* () {
55
+ const webpackShareScopes = __webpack_share_scopes__;
56
+ if (!(webpackShareScopes === null || webpackShareScopes === void 0 ? void 0 : webpackShareScopes.default)) {
57
+ yield __webpack_init_sharing__('default');
58
+ }
59
+ });
60
+ /**
61
+ * Function to initialize container
62
+ * @async
63
+ * @function
64
+ * @param {WebpackRemoteContainer} containerScope - The container scope
65
+ */
66
+ const initContainer = (containerScope) => __awaiter(void 0, void 0, void 0, function* () {
67
+ try {
68
+ const webpackShareScopes = __webpack_share_scopes__;
69
+ if (!containerScope.__initialized && !containerScope.__initializing) {
70
+ containerScope.__initializing = true;
71
+ yield containerScope.init(webpackShareScopes.default);
72
+ containerScope.__initialized = true;
73
+ delete containerScope.__initializing;
74
+ }
75
+ }
76
+ catch (error) {
77
+ console.error(error);
78
+ }
79
+ });
80
+ /**
81
+ * Function to import remote
82
+ * @async
83
+ * @function
84
+ * @param {ImportRemoteOptions} options - The options for importing the remote
85
+ * @returns {Promise<T>} A promise that resolves with the imported module
86
+ */
87
+ const importRemote = ({ url, scope, module, remoteEntryFileName = REMOTE_ENTRY_FILE, bustRemoteEntryCache = true, esm = false, }) => __awaiter(void 0, void 0, void 0, function* () {
88
+ const remoteScope = scope;
89
+ if (!window[remoteScope]) {
90
+ let remoteUrl = '';
91
+ if (typeof url === 'string') {
92
+ remoteUrl = url;
93
+ }
94
+ else {
95
+ remoteUrl = yield url();
96
+ }
97
+ const remoteUrlWithEntryFile = `${remoteUrl}/${remoteEntryFileName}`;
98
+ const asyncContainer = !esm
99
+ ? loadRemote(remoteUrlWithEntryFile, scope, bustRemoteEntryCache)
100
+ : loadEsmRemote(remoteUrlWithEntryFile, scope);
101
+ // Load the remote and initialize the share scope if it's empty
102
+ yield Promise.all([asyncContainer, initSharing()]);
103
+ if (!window[remoteScope]) {
104
+ throw new Error(`Remote loaded successfully but ${scope} could not be found! Verify that the name is correct in the Webpack configuration!`);
105
+ }
106
+ // Initialize the container to get shared modules and get the module factory:
107
+ const [, moduleFactory] = yield Promise.all([
108
+ initContainer(window[remoteScope]),
109
+ window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`),
110
+ ]);
111
+ return moduleFactory();
112
+ }
113
+ else {
114
+ const moduleFactory = yield window[remoteScope].get(module === '.' || module.startsWith('./') ? module : `./${module}`);
115
+ return moduleFactory();
116
+ }
117
+ });
118
+ exports.importRemote = importRemote;
119
+ //# sourceMappingURL=importRemote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importRemote.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/importRemote.ts"],"names":[],"mappings":";;;;;;;;;;;;AA+BA;;;GAGG;AACH,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,CACjB,GAA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AErE,MAAM,cAAc,GAAG,CAAC,GAAG;YACzB,CAAC,CAAC,UAAU,CAAC,sBAAsB,EAAE,KAAK,EAAE,oBAAoB,CAAC;YACjE,CAAC,CAAC,aAAa,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;QAEjD,+DAA+D;QAC/D,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CACb,kCAAkC,KAAK,oFAAoF,CAC5H,CAAC;SACH;QACD,6EAA6E;QAC7E,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1C,aAAa,CAAC,MAAM,CAAC,WAAW,CAAQ,CAAC;YACxC,MAAM,CAAC,WAAW,CAAuC,CAAC,GAAG,CAC5D,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CACnE;SACF,CAAC,CAAC;QACH,OAAO,aAAa,EAAE,CAAC;KACxB;SAAM;QACL,MAAM,aAAa,GAAG,MACpB,MAAM,CAAC,WAAW,CACnB,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;QAC1E,OAAO,aAAa,EAAE,CAAC;KACxB;AACH,CAAC,CAAA,CAAC;AA7CW,QAAA,YAAY,gBA6CvB"}
@@ -0,0 +1 @@
1
+ export declare const isObjectEmpty: <T extends object>(obj: T) => boolean;
@@ -0,0 +1,11 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
1
+ import { RemoteVars, RuntimeRemote, RuntimeRemotesMap } from '../types/index';
2
+ export declare const remoteVars: RemoteVars;
3
+ export declare const extractUrlAndGlobal: (urlAndGlobal: string) => [string, string];
4
+ export declare const loadScript: (keyOrRuntimeRemoteItem: string | RuntimeRemote) => any;
5
+ export declare const getRuntimeRemotes: () => RuntimeRemotesMap;
@@ -0,0 +1,150 @@
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'
19
+ ? runtimeRemotes[keyOrRuntimeRemoteItem]
20
+ : keyOrRuntimeRemoteItem;
21
+ if (reference.asyncContainer) {
22
+ asyncContainer =
23
+ typeof reference.asyncContainer.then === 'function'
24
+ ? reference.asyncContainer
25
+ : // @ts-ignore
26
+ reference.asyncContainer();
27
+ }
28
+ else {
29
+ // This casting is just to satisfy typescript,
30
+ // In reality remoteGlobal will always be a string;
31
+ const remoteGlobal = reference.global;
32
+ // Check if theres an override for container key if not use remote global
33
+ const containerKey = reference.uniqueKey
34
+ ? reference.uniqueKey
35
+ : remoteGlobal;
36
+ const __webpack_error__ = new Error();
37
+ // @ts-ignore
38
+ const globalScope =
39
+ // @ts-ignore
40
+ typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
41
+ if (typeof window === 'undefined') {
42
+ //@ts-ignore
43
+ globalScope['_config'][containerKey] = reference.url;
44
+ }
45
+ else {
46
+ // to match promise template system, can be removed once promise template is gone
47
+ //@ts-ignore
48
+ if (!globalScope['remoteLoading']) {
49
+ //@ts-ignore
50
+ globalScope['remoteLoading'] = {};
51
+ }
52
+ //@ts-ignore
53
+ if (globalScope['remoteLoading'][containerKey]) {
54
+ //@ts-ignore
55
+ return globalScope['remoteLoading'][containerKey];
56
+ }
57
+ }
58
+ // @ts-ignore
59
+ asyncContainer = new Promise(function (resolve, reject) {
60
+ function resolveRemoteGlobal() {
61
+ //@ts-ignore
62
+ const asyncContainer = globalScope[remoteGlobal];
63
+ return resolve(asyncContainer);
64
+ }
65
+ //@ts-ignore
66
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
67
+ return resolveRemoteGlobal();
68
+ }
69
+ __webpack_require__.l(reference.url, function (event) {
70
+ //@ts-ignore
71
+ if (typeof globalScope[remoteGlobal] !== 'undefined') {
72
+ return resolveRemoteGlobal();
73
+ }
74
+ const errorType = event && (event.type === 'load' ? 'missing' : event.type);
75
+ const realSrc = event && event.target && event.target.src;
76
+ __webpack_error__.message =
77
+ 'Loading script failed.\n(' +
78
+ errorType +
79
+ ': ' +
80
+ realSrc +
81
+ ' or global var ' +
82
+ remoteGlobal +
83
+ ')';
84
+ __webpack_error__.name = 'ScriptExternalLoadError';
85
+ __webpack_error__.type = errorType;
86
+ __webpack_error__.request = realSrc;
87
+ reject(__webpack_error__);
88
+ }, containerKey);
89
+ }).catch(function (err) {
90
+ console.error('container is offline, returning fake remote');
91
+ console.error(err);
92
+ return {
93
+ fake: true,
94
+ // @ts-ignore
95
+ get: (arg) => {
96
+ console.warn('faking', arg, 'module on, its offline');
97
+ return Promise.resolve(() => {
98
+ return {
99
+ __esModule: true,
100
+ default: () => {
101
+ return null;
102
+ },
103
+ };
104
+ });
105
+ },
106
+ //eslint-disable-next-line
107
+ init: () => { },
108
+ };
109
+ });
110
+ if (typeof window !== 'undefined') {
111
+ //@ts-ignore
112
+ globalScope['remoteLoading'][containerKey] = asyncContainer;
113
+ }
114
+ }
115
+ return asyncContainer;
116
+ };
117
+ exports.loadScript = loadScript;
118
+ const getRuntimeRemotes = () => {
119
+ return Object.entries(exports.remoteVars).reduce((acc, [key, value]) => {
120
+ if (typeof value === 'object' && typeof value.then === 'function') {
121
+ acc[key] = { asyncContainer: value };
122
+ }
123
+ else if (typeof value === 'function') {
124
+ acc[key] = { asyncContainer: Promise.resolve(value()) };
125
+ }
126
+ else if (typeof value === 'string') {
127
+ if (value.startsWith('internal ')) {
128
+ const [request, query] = value.replace('internal ', '').split('?');
129
+ if (query) {
130
+ const remoteSyntax = new URLSearchParams(query).get('remote');
131
+ if (remoteSyntax) {
132
+ const [url, global] = (0, exports.extractUrlAndGlobal)(remoteSyntax);
133
+ acc[key] = { global, url };
134
+ }
135
+ }
136
+ }
137
+ else {
138
+ const [url, global] = (0, exports.extractUrlAndGlobal)(value);
139
+ acc[key] = { global, url };
140
+ }
141
+ }
142
+ else {
143
+ console.warn('remotes process', process.env['REMOTES']);
144
+ throw new Error(`[mf] Invalid value received for runtime_remote "${key}"`);
145
+ }
146
+ return acc;
147
+ }, {});
148
+ };
149
+ exports.getRuntimeRemotes = getRuntimeRemotes;
150
+ //# sourceMappingURL=pure.js.map
@@ -0,0 +1 @@
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,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,QAAA,UAAU,GAAG,IAAkB,CAAC;AAEtC,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAoB,EAAE;IAC5E,MAAM,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,oBAAoB,YAAY,GAAG,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;AAEK,MAAM,UAAU,GAAG,CAAC,sBAA8C,EAAE,EAAE;IAC3E,MAAM,cAAc,GAAG,IAAA,yBAAiB,GAAE,CAAC;IAE3C,qCAAqC;IACrC,IAAI,cAA+C,CAAC;IACpD,MAAM,SAAS,GACb,OAAO,sBAAsB,KAAK,QAAQ;QACxC,CAAC,CAAC,cAAc,CAAC,sBAAsB,CAAC;QACxC,CAAC,CAAC,sBAAsB,CAAC;IAE7B,IAAI,SAAS,CAAC,cAAc,EAAE;QAC5B,cAAc;YACZ,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,KAAK,UAAU;gBACjD,CAAC,CAAC,SAAS,CAAC,cAAc;gBAC1B,CAAC,C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,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,2BAAmB,EAAC,YAAY,CAAC,CAAC;wBACxD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;qBAC5B;iBACF;aACF;iBAAM;gBACL,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,2BAAmB,EAAC,KAAK,CAAC,CAAC;gBACjD,GAAG,CAAC,GAAG,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,CACb,mDAAmD,GAAG,GAAG,CAC1D,CAAC;SACH;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAuB,CAAC,CAAC;AAC9B,CAAC,CAAC;AA5BW,QAAA,iBAAiB,qBA4B5B"}
@@ -0,0 +1 @@
1
+ export { default as FederationBoundary } from '../components/FederationBoundary';
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/react.tsx"],"names":[],"mappings":";;;;;;AAAA,uEAAiF;AAAxE,yIAAA,OAAO,OAAsB"}