@nx/module-federation 0.0.0-pr-11-e92ae29 → 0.0.0-pr-29464-ce29f31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +19 -0
- package/package.json +7 -7
- package/src/plugins/models/index.d.ts +5 -0
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-plugin.js +0 -1
- package/src/plugins/utils/get-static-remotes.d.ts +2 -1
- package/src/plugins/utils/get-static-remotes.js +3 -3
- package/src/plugins/utils/parse-remotes-config.js +13 -2
- package/src/utils/parse-static-remotes-config.js +12 -7
package/migrations.json
CHANGED
|
@@ -20,6 +20,25 @@
|
|
|
20
20
|
"alwaysAddToPackageJson": false
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
},
|
|
24
|
+
"20.5.0": {
|
|
25
|
+
"version": "20.5.0-beta.5",
|
|
26
|
+
"@module-federation/enhanced": {
|
|
27
|
+
"version": "^0.9.0",
|
|
28
|
+
"alwaysAddToPackageJson": false
|
|
29
|
+
},
|
|
30
|
+
"@module-federation/runtime": {
|
|
31
|
+
"version": "^0.9.0",
|
|
32
|
+
"alwaysAddToPackageJson": false
|
|
33
|
+
},
|
|
34
|
+
"@module-federation/sdk": {
|
|
35
|
+
"version": "^0.9.0",
|
|
36
|
+
"alwaysAddToPackageJson": false
|
|
37
|
+
},
|
|
38
|
+
"@module-federation/node": {
|
|
39
|
+
"version": "^2.6.26",
|
|
40
|
+
"alwaysAddToPackageJson": false
|
|
41
|
+
}
|
|
23
42
|
}
|
|
24
43
|
}
|
|
25
44
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/module-federation",
|
|
3
3
|
"description": "The Nx Plugin for Module Federation contains executors and utilities that support building applications using Module Federation.",
|
|
4
|
-
"version": "0.0.0-pr-
|
|
4
|
+
"version": "0.0.0-pr-29464-ce29f31",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.3.0",
|
|
28
|
-
"@nx/devkit": "0.0.0-pr-
|
|
29
|
-
"@nx/js": "0.0.0-pr-
|
|
30
|
-
"@nx/web": "0.0.0-pr-
|
|
28
|
+
"@nx/devkit": "0.0.0-pr-29464-ce29f31",
|
|
29
|
+
"@nx/js": "0.0.0-pr-29464-ce29f31",
|
|
30
|
+
"@nx/web": "0.0.0-pr-29464-ce29f31",
|
|
31
31
|
"picocolors": "^1.1.0",
|
|
32
32
|
"webpack": "^5.88.0",
|
|
33
|
-
"@module-federation/enhanced": "^0.
|
|
34
|
-
"@module-federation/node": "^2.6.
|
|
35
|
-
"@module-federation/sdk": "^0.
|
|
33
|
+
"@module-federation/enhanced": "^0.9.0",
|
|
34
|
+
"@module-federation/node": "^2.6.26",
|
|
35
|
+
"@module-federation/sdk": "^0.9.0",
|
|
36
36
|
"express": "^4.21.2",
|
|
37
37
|
"http-proxy-middleware": "^3.0.3"
|
|
38
38
|
},
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { StaticRemoteConfig } from '../../utils';
|
|
2
|
-
|
|
2
|
+
import { DevRemoteFindOptions } from '../models';
|
|
3
|
+
export declare function getStaticRemotes(remotesConfig: Record<string, StaticRemoteConfig>, devRemoteFindOptions?: DevRemoteFindOptions): Promise<Record<string, StaticRemoteConfig>>;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getStaticRemotes = getStaticRemotes;
|
|
4
4
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
5
|
-
async function getStaticRemotes(remotesConfig) {
|
|
5
|
+
async function getStaticRemotes(remotesConfig, devRemoteFindOptions) {
|
|
6
6
|
const remotes = Object.keys(remotesConfig);
|
|
7
7
|
const findStaticRemotesPromises = [];
|
|
8
8
|
for (const remote of remotes) {
|
|
9
9
|
findStaticRemotesPromises.push(new Promise((resolve, reject) => {
|
|
10
10
|
(0, wait_for_port_open_1.waitForPortOpen)(remotesConfig[remote].port, {
|
|
11
|
-
retries:
|
|
12
|
-
retryDelay: 1000,
|
|
11
|
+
retries: devRemoteFindOptions?.retries ?? 3,
|
|
12
|
+
retryDelay: devRemoteFindOptions?.retryDelay ?? 1000,
|
|
13
13
|
}).then((res) => {
|
|
14
14
|
resolve(undefined);
|
|
15
15
|
}, (rej) => {
|
|
@@ -2,14 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseRemotesConfig = parseRemotesConfig;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
+
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
7
|
function parseRemotesConfig(remotes, workspaceRoot, projectGraph) {
|
|
6
8
|
if (!remotes?.length) {
|
|
7
9
|
return { remotes: [], config: undefined };
|
|
8
10
|
}
|
|
9
11
|
const config = {};
|
|
10
12
|
for (const app of remotes) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
+
const projectRoot = projectGraph.nodes[app].data.root;
|
|
14
|
+
let outputPath = (0, devkit_internals_1.interpolate)(projectGraph.nodes[app].data.targets?.['build']?.options?.outputPath ??
|
|
15
|
+
projectGraph.nodes[app].data.targets?.['build']?.outputs?.[0] ??
|
|
16
|
+
`${workspaceRoot ? `${workspaceRoot}/` : ''}${projectGraph.nodes[app].data.root}/dist`, {
|
|
17
|
+
projectName: projectGraph.nodes[app].data.name,
|
|
18
|
+
projectRoot,
|
|
19
|
+
workspaceRoot,
|
|
20
|
+
});
|
|
21
|
+
if (outputPath.startsWith(projectRoot)) {
|
|
22
|
+
outputPath = (0, devkit_1.joinPathFragments)(workspaceRoot, outputPath);
|
|
23
|
+
}
|
|
13
24
|
const basePath = (0, path_1.dirname)(outputPath);
|
|
14
25
|
const urlSegment = app;
|
|
15
26
|
const port = projectGraph.nodes[app].data.targets?.['serve']?.options.port;
|
|
@@ -9,9 +9,11 @@ function parseStaticRemotesConfig(staticRemotes, context) {
|
|
|
9
9
|
}
|
|
10
10
|
const config = {};
|
|
11
11
|
for (const app of staticRemotes) {
|
|
12
|
-
const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath;
|
|
13
|
-
const basePath = (0, path_1.dirname)(outputPath)
|
|
14
|
-
|
|
12
|
+
const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath; // dist || dist/checkout
|
|
13
|
+
const basePath = ['', '/', '.'].some((p) => (0, path_1.dirname)(outputPath) === p)
|
|
14
|
+
? outputPath
|
|
15
|
+
: (0, path_1.dirname)(outputPath); // dist || dist/checkout -> dist
|
|
16
|
+
const urlSegment = app;
|
|
15
17
|
const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
|
|
16
18
|
config[app] = { basePath, outputPath, urlSegment, port };
|
|
17
19
|
}
|
|
@@ -23,10 +25,13 @@ function parseStaticSsrRemotesConfig(staticRemotes, context) {
|
|
|
23
25
|
}
|
|
24
26
|
const config = {};
|
|
25
27
|
for (const app of staticRemotes) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
28
|
+
let outputPath = context.projectGraph.nodes[app].data.targets['build']
|
|
29
|
+
.options.outputPath;
|
|
30
|
+
outputPath = (0, path_1.dirname)(outputPath); // dist/browser => dist || dist/checkout/browser -> checkout
|
|
31
|
+
const basePath = ['', '/', '.'].some((p) => (0, path_1.dirname)(outputPath) === p)
|
|
32
|
+
? outputPath
|
|
33
|
+
: (0, path_1.dirname)(outputPath); // dist || dist/checkout -> dist
|
|
34
|
+
const urlSegment = app;
|
|
30
35
|
const port = context.projectGraph.nodes[app].data.targets['serve'].options.port;
|
|
31
36
|
config[app] = { basePath, outputPath, urlSegment, port };
|
|
32
37
|
}
|