@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
package/README.md DELETED
@@ -1,131 +0,0 @@
1
- # utils
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- ## Building
6
-
7
- Run `nx build utils` to build the library.
8
-
9
- ## Running unit tests
10
-
11
- Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io).
12
-
13
- ## React utilities
14
-
15
- ---
16
-
17
- `FederatedBoundary`
18
-
19
- A component wrapper that provides a fallback for safe imports if something were to fail when grabbing a module off of a remote host.
20
-
21
- This wrapper also exposes an optional property for a custom react error boundary component.
22
-
23
- Any extra props will be passed directly to the imported module.
24
-
25
- Usage looks something like this:
26
-
27
- ```js
28
- import { FederationBoundary } from '@module-federation/utilities/src/utils/react';
29
-
30
- // defining dynamicImport and fallback outside the Component to keep the component identity
31
- // another alternative would be to use useMemo
32
- const dynamicImport = () => import('some_remote_host_name').then((m) => m.Component);
33
- const fallback = () => import('@npm/backup').then((m) => m.Component);
34
-
35
- const MyPage = () => {
36
- return <FederationBoundary dynamicImporter={dynamicImport} fallback={fallback} customBoundary={CustomErrorBoundary} />;
37
- };
38
- ```
39
-
40
- ---
41
-
42
- `ImportRemote`
43
-
44
- 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>.
45
-
46
- This function will allow you to provide a static url or an async method to retrieve a url from a configuration service.
47
-
48
- Usage looks something like this:
49
-
50
- ```js
51
- import { importRemote } from '@module-federation/utilities';
52
-
53
- // If it's a regular js module:
54
- importRemote({
55
- url: 'http://localhost:3001',
56
- scope: 'Foo',
57
- module: 'Bar',
58
- }).then(
59
- (
60
- {
61
- /* list of Bar exports */
62
- }
63
- ) => {
64
- // Use Bar exports
65
- }
66
- );
67
-
68
- // If Bar is a React component you can use it with lazy and Suspense just like a dynamic import:
69
- const Bar = lazy(() => importRemote({ url: 'http://localhost:3001', scope: 'Foo', module: 'Bar' }));
70
-
71
- return (
72
- <Suspense fallback={<div>Loading Bar...</div>}>
73
- <Bar />
74
- </Suspense>
75
- );
76
- ```
77
-
78
- ```js
79
- import { importRemote } from '@module-federation/utilities';
80
-
81
- // If it's a regular js module:
82
- importRemote({
83
- url: () => MyAsyncMethod('remote_name'),
84
- scope: 'Foo',
85
- module: 'Bar',
86
- }).then(
87
- (
88
- {
89
- /* list of Bar exports */
90
- }
91
- ) => {
92
- // Use Bar exports
93
- }
94
- );
95
-
96
- // If Bar is a React component you can use it with lazy and Suspense just like a dynamic import:
97
- const Bar = lazy(() =>
98
- importRemote({
99
- url: () => MyAsyncMethod('remote_name'),
100
- scope: 'Foo',
101
- module: 'Bar',
102
- })
103
- );
104
-
105
- return (
106
- <Suspense fallback={<div>Loading Bar...</div>}>
107
- <Bar />
108
- </Suspense>
109
- );
110
- ```
111
-
112
- ```js
113
- // You can also combine importRemote and FederationBoundary to have a dynamic remote URL and a fallback when there is an error on the remote
114
-
115
- const dynamicImporter = () =>
116
- importRemote({
117
- url: 'http://localhost:3001',
118
- scope: 'Foo',
119
- module: 'Bar',
120
- });
121
- const fallback = () => import('@npm/backup').then((m) => m.Component);
122
-
123
- const Bar = () => {
124
- return <FederationBoundary dynamicImporter={dynamicImporter} fallback={fallback} />;
125
- };
126
- ```
127
-
128
- Apart from **url**, **scope** and **module** you can also pass additional options to the **importRemote()** function:
129
-
130
- - **remoteEntryFileName**: The name of the remote entry file. Defaults to "remoteEntry.js".
131
- - **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.
package/src/Logger.js DELETED
@@ -1,15 +0,0 @@
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
package/src/Logger.js.map DELETED
@@ -1 +0,0 @@
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"}
@@ -1,33 +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
- 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
@@ -1 +0,0 @@
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"}
@@ -1,71 +0,0 @@
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
@@ -1 +0,0 @@
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.js DELETED
@@ -1,37 +0,0 @@
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.correctImportPath = 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 correctImportPath_1 = require("./utils/correctImportPath");
30
- Object.defineProperty(exports, "correctImportPath", { enumerable: true, get: function () { return correctImportPath_1.correctImportPath; } });
31
- var Logger_1 = require("./Logger");
32
- Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
33
- var getRuntimeRemotes_1 = require("./utils/getRuntimeRemotes");
34
- Object.defineProperty(exports, "getRuntimeRemotes", { enumerable: true, get: function () { return getRuntimeRemotes_1.getRuntimeRemotes; } });
35
- var importDelegatedModule_1 = require("./utils/importDelegatedModule");
36
- Object.defineProperty(exports, "importDelegatedModule", { enumerable: true, get: function () { return importDelegatedModule_1.importDelegatedModule; } });
37
- //# sourceMappingURL=index.js.map
package/src/index.js.map DELETED
@@ -1 +0,0 @@
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,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,uEAAsE;AAA7D,8HAAA,qBAAqB,OAAA"}
@@ -1,86 +0,0 @@
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
- if (module.buildMeta) {
29
- module.buildMeta['eager'] = true;
30
- }
31
- compilation.chunkGraph.connectChunkAndModule(chunk, module);
32
- }
33
- module.dependencies.forEach(dependency => {
34
- const dependencyModule = compilation.moduleGraph.getModule(dependency);
35
- if (dependencyModule &&
36
- !compilation.chunkGraph.isModuleInChunk(dependencyModule, chunk)) {
37
- this.addModuleAndDependenciesToChunk(dependencyModule, chunk, compilation);
38
- }
39
- });
40
- }
41
- removeDelegatesNonRuntimeChunks(compilation, chunks) {
42
- for (const chunk of chunks) {
43
- if (!chunk.hasRuntime()) {
44
- this.options.debug &&
45
- console.log('non-runtime chunk:', chunk.debugId, chunk.id, chunk.name);
46
- this._delegateModules.forEach((module) => {
47
- compilation.chunkGraph.disconnectChunkAndModule(chunk, module);
48
- });
49
- }
50
- }
51
- }
52
- apply(compiler) {
53
- compiler.hooks.thisCompilation.tap('DelegateModulesPlugin', (compilation) => {
54
- compilation.hooks.finishModules.tapAsync('DelegateModulesPlugin', (modules, callback) => {
55
- const { remotes } = this.options;
56
- const knownDelegates = new Set(remotes
57
- ? Object.values(remotes).map((remote) => remote.replace('internal ', ''))
58
- : []);
59
- for (const module of modules) {
60
- const normalModule = module;
61
- if (normalModule.resource && knownDelegates.has(normalModule.resource)) {
62
- this._delegateModules.set(normalModule.resource, normalModule);
63
- }
64
- }
65
- callback();
66
- });
67
- compilation.hooks.optimizeChunks.tap('DelegateModulesPlugin', (chunks) => {
68
- const { runtime, container } = this.options;
69
- const runtimeChunk = this.getChunkByName(chunks, runtime);
70
- if (!runtimeChunk || !runtimeChunk.hasRuntime()) {
71
- return;
72
- }
73
- // Get the container chunk if specified
74
- const remoteContainer = container
75
- ? this.getChunkByName(chunks, container)
76
- : null;
77
- this.options.debug &&
78
- console.log(remoteContainer === null || remoteContainer === void 0 ? void 0 : remoteContainer.name, runtimeChunk.name, this._delegateModules.size);
79
- this.addDelegatesToChunks(compilation, [remoteContainer, runtimeChunk].filter(Boolean));
80
- this.removeDelegatesNonRuntimeChunks(compilation, chunks);
81
- });
82
- });
83
- }
84
- }
85
- exports.default = DelegateModulesPlugin;
86
- //# sourceMappingURL=DelegateModulesPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DelegateModulesPlugin.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/plugins/DelegateModulesPlugin.ts"],"names":[],"mappings":";;AAEA,MAAM,qBAAqB;IAIzB,YAAY,OAAgD;QA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;CACF;AAED,kBAAe,qBAAqB,CAAC"}
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/types/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,qEAAqE"}
@@ -1,164 +0,0 @@
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 ? `internal ${delegate}` : `internal ${delegate}?${queries.join('&')}`;
37
- };
38
- exports.createDelegatedModule = createDelegatedModule;
39
- const createContainerSharingScope = (asyncContainer) => {
40
- // @ts-ignore
41
- return asyncContainer
42
- .then(function (container) {
43
- if (!__webpack_share_scopes__['default']) {
44
- // not always a promise, so we wrap it in a resolve
45
- return Promise.resolve(__webpack_init_sharing__('default')).then(function () {
46
- return container;
47
- });
48
- }
49
- else {
50
- return container;
51
- }
52
- })
53
- .then(function (container) {
54
- try {
55
- // WARNING: here might be a potential BUG.
56
- // `container.init` does not return a Promise, and here we do not call `then` on it.
57
- // But according to [docs](https://webpack.js.org/concepts/module-federation/#dynamic-remote-containers)
58
- // it must be async.
59
- // The problem may be in Proxy in NextFederationPlugin.js.
60
- // or maybe a bug in the webpack itself - instead of returning rejected promise it just throws an error.
61
- // But now everything works properly and we keep this code as is.
62
- container.init(__webpack_share_scopes__['default']);
63
- }
64
- catch (e) {
65
- // maybe container already initialized so nothing to throw
66
- }
67
- return container;
68
- });
69
- };
70
- /**
71
- * Return initialized remote container by remote's key or its runtime remote item data.
72
- *
73
- * `runtimeRemoteItem` might be
74
- * { global, url } - values obtained from webpack remotes option `global@url`
75
- * or
76
- * { asyncContainer } - async container is a promise that resolves to the remote container
77
- */
78
- const injectScript = (keyOrRuntimeRemoteItem) => __awaiter(void 0, void 0, void 0, function* () {
79
- const asyncContainer = (0, pure_1.loadScript)(keyOrRuntimeRemoteItem);
80
- return createContainerSharingScope(asyncContainer);
81
- });
82
- exports.injectScript = injectScript;
83
- /**
84
- * Creates runtime variables from the provided remotes.
85
- * If the value of a remote starts with 'promise ' or 'external ', it is transformed into a function that returns the promise call.
86
- * Otherwise, the value is stringified.
87
- * @param {Remotes} remotes - The remotes to create runtime variables from.
88
- * @returns {Record<string, string>} - The created runtime variables.
89
- */
90
- const createRuntimeVariables = (remotes) => {
91
- if (!remotes) {
92
- return {};
93
- }
94
- return Object.entries(remotes).reduce((acc, [key, value]) => {
95
- if (value.startsWith('promise ') || value.startsWith('external ')) {
96
- const promiseCall = value.split(' ')[1];
97
- acc[key] = `function() {
98
- return ${promiseCall}
99
- }`;
100
- }
101
- else {
102
- acc[key] = JSON.stringify(value);
103
- }
104
- return acc;
105
- }, {});
106
- };
107
- exports.createRuntimeVariables = createRuntimeVariables;
108
- /**
109
- * Returns initialized webpack RemoteContainer.
110
- * If its' script does not loaded - then load & init it firstly.
111
- */
112
- const getContainer = (remoteContainer) => __awaiter(void 0, void 0, void 0, function* () {
113
- if (!remoteContainer) {
114
- throw Error(`Remote container options is empty`);
115
- }
116
- const containerScope = typeof window !== 'undefined' ? window : globalThis.__remote_scope__;
117
- let containerKey;
118
- if (typeof remoteContainer === 'string') {
119
- containerKey = remoteContainer;
120
- }
121
- else {
122
- containerKey = remoteContainer.uniqueKey;
123
- if (!containerScope[containerKey]) {
124
- const container = yield (0, exports.injectScript)({
125
- global: remoteContainer.global,
126
- url: remoteContainer.url,
127
- });
128
- if (!container) {
129
- throw Error(`Remote container ${remoteContainer.url} is empty`);
130
- }
131
- }
132
- }
133
- return containerScope[containerKey];
134
- });
135
- exports.getContainer = getContainer;
136
- /**
137
- * Return remote module from container.
138
- * If you provide `exportName` it automatically return exact property value from module.
139
- *
140
- * @example
141
- * remote.getModule('./pages/index', 'default')
142
- */
143
- const getModule = ({ remoteContainer, modulePath, exportName, }) => __awaiter(void 0, void 0, void 0, function* () {
144
- const container = yield (0, exports.getContainer)(remoteContainer);
145
- try {
146
- const modFactory = yield (container === null || container === void 0 ? void 0 : container.get(modulePath));
147
- if (!modFactory) {
148
- return undefined;
149
- }
150
- const mod = modFactory();
151
- if (exportName) {
152
- return mod && typeof mod === 'object' ? mod[exportName] : undefined;
153
- }
154
- else {
155
- return mod;
156
- }
157
- }
158
- catch (error) {
159
- console.error(error);
160
- return undefined;
161
- }
162
- });
163
- exports.getModule = getModule;
164
- //# source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CAAC;AACtC,CAAC,CAAA,CAAC;AAzBW,QAAA,YAAY,gBAyBvB;AACF;;;;;;GAMG;AACI,MAAM,SAAS,GAAG,CAAO,EAC9B,eAAe,EACf,UAAU,EACV,UAAU,GACO,EAAE,EAAE;IACrB,MAAM,SAAS,GAAG,MAAM,IAAA,oBAAY,EAAC,eAAe,CAAC,CAAC;IACtD,IAAI;QACF,MAAM,UAAU,GAAG,MAAM,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,CAAC,UAAU,CAAC,CAAA,CAAC;QACpD,IAAI,CAAC,UAAU,EAAE;YACf,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;QACzB,IAAI,UAAU,EAAE;YACd,OAAO,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SACrE;aAAM;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"}
@@ -1 +0,0 @@
1
- export declare const correctImportPath: (context: string, entryFile: string) => any;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.correctImportPath = void 0;
4
- const correctImportPath = (context, entryFile) => {
5
- if (typeof process !== 'undefined') {
6
- if ((process === null || process === void 0 ? void 0 : process.platform) !== 'win32') {
7
- return entryFile;
8
- }
9
- if (entryFile.match(/^\.?\.\\/) || !entryFile.match(/^[A-Z]:\\\\/i)) {
10
- return entryFile.replace(/\\/g, '/');
11
- }
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires
13
- const path = require('path');
14
- const joint = path.win32.relative(context, entryFile);
15
- const relative = joint.replace(/\\/g, '/');
16
- if (relative.includes('node_modules/')) {
17
- return relative.split('node_modules/')[1];
18
- }
19
- return `./${relative}`;
20
- }
21
- return null;
22
- };
23
- exports.correctImportPath = correctImportPath;
24
- //# sourceMappingURL=correctImportPath.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"correctImportPath.js","sourceRoot":"","sources":["../../../../../packages/utilities/src/utils/correctImportPath.ts"],"names":[],"mappings":";;;AAAO,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,SAAiB,EAAE,EAAE;IACtE,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;QAClC,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,MAAK,OAAO,EAAE;YACjC,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YACnE,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;SACtC;QAED,8DAA8D;QAC9D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE3C,IAAI,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YACtC,OAAO,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3C;QAED,OAAO,KAAK,QAAQ,EAAE,CAAC;KACxB;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B"}