@nx/module-federation 22.2.3 → 22.2.5
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/package.json +5 -5
- package/src/executors/utils/start-remote-iterators.d.ts +1 -1
- package/src/executors/utils/start-remote-iterators.d.ts.map +1 -1
- package/src/executors/utils/start-remote-iterators.js +4 -4
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.d.ts.map +1 -1
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.js +2 -2
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.d.ts.map +1 -1
- package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.js +2 -2
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.d.ts.map +1 -1
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.js +2 -2
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.d.ts.map +1 -1
- package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.js +2 -2
- package/src/plugins/utils/start-remote-proxies.d.ts +1 -1
- package/src/plugins/utils/start-remote-proxies.d.ts.map +1 -1
- package/src/plugins/utils/start-remote-proxies.js +18 -2
- package/src/utils/get-remotes-for-host.d.ts +1 -1
- package/src/utils/get-remotes-for-host.d.ts.map +1 -1
- package/src/utils/get-remotes-for-host.js +26 -16
- package/src/utils/index.d.ts +1 -0
- package/src/utils/index.d.ts.map +1 -1
- package/src/utils/index.js +1 -0
- package/src/utils/port-utils.d.ts +6 -0
- package/src/utils/port-utils.d.ts.map +1 -0
- package/src/utils/port-utils.js +17 -0
- package/src/utils/start-remote-proxies.d.ts +1 -1
- package/src/utils/start-remote-proxies.d.ts.map +1 -1
- package/src/utils/start-remote-proxies.js +20 -3
- package/src/utils/start-ssr-remote-proxies.d.ts +1 -1
- package/src/utils/start-ssr-remote-proxies.d.ts.map +1 -1
- package/src/utils/start-ssr-remote-proxies.js +20 -3
- package/src/utils/typescript.js +8 -8
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": "22.2.
|
|
4
|
+
"version": "22.2.5",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@module-federation/enhanced": "^0.21.2",
|
|
28
28
|
"@module-federation/node": "^2.7.21",
|
|
29
29
|
"@module-federation/sdk": "^0.21.2",
|
|
30
|
-
"@nx/devkit": "22.2.
|
|
31
|
-
"@nx/js": "22.2.
|
|
32
|
-
"@nx/web": "22.2.
|
|
30
|
+
"@nx/devkit": "22.2.5",
|
|
31
|
+
"@nx/js": "22.2.5",
|
|
32
|
+
"@nx/web": "22.2.5",
|
|
33
33
|
"@rspack/core": "^1.5.2",
|
|
34
34
|
"express": "^4.21.2",
|
|
35
35
|
"http-proxy-middleware": "^3.0.5",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"webpack": "^5.101.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"nx": "22.2.
|
|
41
|
+
"nx": "22.2.5"
|
|
42
42
|
},
|
|
43
43
|
"nx-migrations": {
|
|
44
44
|
"migrations": "./migrations.json"
|
|
@@ -5,7 +5,7 @@ export declare function startRemoteIterators(options: StartRemoteIteratorsOption
|
|
|
5
5
|
staticRemotes: string[];
|
|
6
6
|
devRemotes: any[];
|
|
7
7
|
dynamicRemotes: any[];
|
|
8
|
-
remotePorts:
|
|
8
|
+
remotePorts: number[];
|
|
9
9
|
staticRemotePort: number;
|
|
10
10
|
};
|
|
11
11
|
devRemoteIters: AsyncIterable<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-remote-iterators.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/executors/utils/start-remote-iterators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAgB3E,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,YAAY,CAAC;AAEpB,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,EACxB,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,UAAU,GAAE,OAAO,GAAG,SAAmB,EACzC,QAAQ,UAAQ;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"start-remote-iterators.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/executors/utils/start-remote-iterators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAgB3E,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,YAAY,CAAC;AAEpB,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,EACpC,OAAO,EAAE,eAAe,EACxB,aAAa,EAAE,aAAa,EAC5B,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,UAAU,GAAE,OAAO,GAAG,SAAmB,EACzC,QAAQ,UAAQ;;;;;;;;;;;;;;;;;;;;;;GAuGjB"}
|
|
@@ -32,18 +32,18 @@ async function startRemoteIterators(options, context, startRemoteFn, pathToManif
|
|
|
32
32
|
? (0, start_static_remotes_file_server_1.startSsrStaticRemotesFileServer)(staticRemotesConfig, context, options)
|
|
33
33
|
: (0, start_static_remotes_file_server_1.startStaticRemotesFileServer)(staticRemotesConfig, context, options);
|
|
34
34
|
isServer
|
|
35
|
-
? (0, utils_1.startSsrRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
|
|
35
|
+
? await (0, utils_1.startSsrRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
|
|
36
36
|
? {
|
|
37
37
|
pathToCert: options.sslCert,
|
|
38
38
|
pathToKey: options.sslKey,
|
|
39
39
|
}
|
|
40
|
-
: undefined)
|
|
41
|
-
: (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
|
|
40
|
+
: undefined, options.host)
|
|
41
|
+
: await (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
|
|
42
42
|
? {
|
|
43
43
|
pathToCert: options.sslCert,
|
|
44
44
|
pathToKey: options.sslKey,
|
|
45
45
|
}
|
|
46
|
-
: undefined);
|
|
46
|
+
: undefined, options.host);
|
|
47
47
|
return {
|
|
48
48
|
remotes,
|
|
49
49
|
devRemoteIters,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-module-federation-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAIjE,qBAAa,iCAAkC,YAAW,oBAAoB;IAI1E,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"nx-module-federation-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAIjE,qBAAa,iCAAkC,YAAW,oBAAoB;IAI1E,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAoDV,KAAK;CAyDpB"}
|
package/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-dev-server-plugin.js
CHANGED
|
@@ -27,10 +27,10 @@ class NxModuleFederationDevServerPlugin {
|
|
|
27
27
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${pc.bold(this._options.config.name)} with ${Object.keys(staticRemotesConfig).length} remotes`);
|
|
28
28
|
const mappedLocationOfRemotes = await (0, utils_1.buildStaticRemotes)(staticRemotesConfig, this._options.devServerConfig, this.nxBin);
|
|
29
29
|
(0, utils_1.startStaticRemotesFileServer)(staticRemotesConfig, devkit_1.workspaceRoot, this._options.devServerConfig.staticRemotesPort);
|
|
30
|
-
(0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
30
|
+
await (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
31
31
|
pathToCert: this._options.devServerConfig.sslCert,
|
|
32
32
|
pathToKey: this._options.devServerConfig.sslCert,
|
|
33
|
-
});
|
|
33
|
+
}, false, this._options.devServerConfig.host);
|
|
34
34
|
new core_1.DefinePlugin({
|
|
35
35
|
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
36
36
|
}).apply(compiler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-module-federation-ssr-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAKjE,qBAAa,oCACX,YAAW,oBAAoB;IAM7B,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"nx-module-federation-ssr-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/angular/nx-module-federation-ssr-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAKjE,qBAAa,oCACX,YAAW,oBAAoB;IAM7B,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAsDV,WAAW;YAuCX,KAAK;CAmDpB"}
|
|
@@ -28,10 +28,10 @@ class NxModuleFederationSSRDevServerPlugin {
|
|
|
28
28
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${pc.bold(this._options.config.name)} with ${Object.keys(staticRemotesConfig).length} remotes`);
|
|
29
29
|
const mappedLocationOfRemotes = await (0, utils_1.buildStaticRemotes)(staticRemotesConfig, this._options.devServerConfig, this.nxBin);
|
|
30
30
|
(0, utils_1.startStaticRemotesFileServer)(staticRemotesConfig, devkit_1.workspaceRoot, this._options.devServerConfig.staticRemotesPort);
|
|
31
|
-
(0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
31
|
+
await (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
32
32
|
pathToCert: this._options.devServerConfig.sslCert,
|
|
33
33
|
pathToKey: this._options.devServerConfig.sslCert,
|
|
34
|
-
}, true);
|
|
34
|
+
}, true, this._options.devServerConfig.host);
|
|
35
35
|
new core_1.DefinePlugin({
|
|
36
36
|
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
37
37
|
}).apply(compiler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-module-federation-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAIjE,qBAAa,iCAAkC,YAAW,oBAAoB;IAI1E,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"nx-module-federation-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAIjE,qBAAa,iCAAkC,YAAW,oBAAoB;IAI1E,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAoDV,KAAK;CAyDpB"}
|
package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-dev-server-plugin.js
CHANGED
|
@@ -27,10 +27,10 @@ class NxModuleFederationDevServerPlugin {
|
|
|
27
27
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${pc.bold(this._options.config.name)} with ${Object.keys(staticRemotesConfig).length} remotes`);
|
|
28
28
|
const mappedLocationOfRemotes = await (0, utils_1.buildStaticRemotes)(staticRemotesConfig, this._options.devServerConfig, this.nxBin);
|
|
29
29
|
(0, utils_1.startStaticRemotesFileServer)(staticRemotesConfig, devkit_1.workspaceRoot, this._options.devServerConfig.staticRemotesPort);
|
|
30
|
-
(0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
30
|
+
await (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
31
31
|
pathToCert: this._options.devServerConfig.sslCert,
|
|
32
32
|
pathToKey: this._options.devServerConfig.sslCert,
|
|
33
|
-
});
|
|
33
|
+
}, false, this._options.devServerConfig.host);
|
|
34
34
|
new core_1.DefinePlugin({
|
|
35
35
|
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
36
36
|
}).apply(compiler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx-module-federation-ssr-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAKjE,qBAAa,oCACX,YAAW,oBAAoB;IAM7B,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;
|
|
1
|
+
{"version":3,"file":"nx-module-federation-ssr-dev-server-plugin.d.ts","sourceRoot":"","sources":["../../../../../../../packages/module-federation/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAER,oBAAoB,EACrB,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAY/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAKjE,qBAAa,oCACX,YAAW,oBAAoB;IAM7B,OAAO,CAAC,QAAQ;IAJlB,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,KAAK,CAAgC;gBAGnC,QAAQ,EAAE;QAChB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,eAAe,CAAC,EAAE,iCAAiC,CAAC;KACrD;IAOH,KAAK,CAAC,QAAQ,EAAE,QAAQ;YAsDV,WAAW;YAuCX,KAAK;CAmDpB"}
|
package/src/plugins/nx-module-federation-plugin/rspack/nx-module-federation-ssr-dev-server-plugin.js
CHANGED
|
@@ -28,10 +28,10 @@ class NxModuleFederationSSRDevServerPlugin {
|
|
|
28
28
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${pc.bold(this._options.config.name)} with ${Object.keys(staticRemotesConfig).length} remotes`);
|
|
29
29
|
const mappedLocationOfRemotes = await (0, utils_1.buildStaticRemotes)(staticRemotesConfig, this._options.devServerConfig, this.nxBin);
|
|
30
30
|
(0, utils_1.startStaticRemotesFileServer)(staticRemotesConfig, devkit_1.workspaceRoot, this._options.devServerConfig.staticRemotesPort);
|
|
31
|
-
(0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
31
|
+
await (0, utils_1.startRemoteProxies)(staticRemotesConfig, mappedLocationOfRemotes, {
|
|
32
32
|
pathToCert: this._options.devServerConfig.sslCert,
|
|
33
33
|
pathToKey: this._options.devServerConfig.sslCert,
|
|
34
|
-
}, true);
|
|
34
|
+
}, true, this._options.devServerConfig.host);
|
|
35
35
|
new core_1.DefinePlugin({
|
|
36
36
|
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
37
37
|
}).apply(compiler);
|
|
@@ -2,5 +2,5 @@ import { StaticRemoteConfig } from '../../utils';
|
|
|
2
2
|
export declare function startRemoteProxies(staticRemotesConfig: Record<string, StaticRemoteConfig>, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
3
3
|
pathToCert: string;
|
|
4
4
|
pathToKey: string;
|
|
5
|
-
}, isServer?: boolean): void
|
|
5
|
+
}, isServer?: boolean, host?: string): Promise<void>;
|
|
6
6
|
//# sourceMappingURL=start-remote-proxies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/plugins/utils/start-remote-proxies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"start-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../../packages/module-federation/src/plugins/utils/start-remote-proxies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAe,MAAM,aAAa,CAAC;AAI9D,wBAAsB,kBAAkB,CACtC,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACvD,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,UAAU,CAAC,EAAE;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,EACD,QAAQ,CAAC,EAAE,OAAO,EAClB,IAAI,GAAE,MAAoB,iBAwE3B"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.startRemoteProxies = startRemoteProxies;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
|
-
function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, isServer) {
|
|
6
|
+
async function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, isServer, host = '127.0.0.1') {
|
|
6
7
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
7
8
|
const express = require('express');
|
|
8
9
|
let sslCert;
|
|
@@ -21,8 +22,17 @@ function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOp
|
|
|
21
22
|
const https = require('https');
|
|
22
23
|
const remotes = Object.keys(staticRemotesConfig);
|
|
23
24
|
console.log(`NX Starting static remotes proxies...`);
|
|
25
|
+
let startedProxies = 0;
|
|
26
|
+
let skippedProxies = 0;
|
|
24
27
|
for (const app of remotes) {
|
|
25
28
|
const appConfig = staticRemotesConfig[app];
|
|
29
|
+
// Check if the port is already in use (another MF dev server may have already started a proxy)
|
|
30
|
+
const portInUse = await (0, utils_1.isPortInUse)(appConfig.port, host);
|
|
31
|
+
if (portInUse) {
|
|
32
|
+
console.log(`NX Skipping proxy for ${app} on port ${appConfig.port} - port already in use (likely served by another process)`);
|
|
33
|
+
skippedProxies++;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
26
36
|
const expressProxy = express();
|
|
27
37
|
expressProxy.use(createProxyMiddleware({
|
|
28
38
|
target: mappedLocationsOfRemotes[app],
|
|
@@ -44,6 +54,12 @@ function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOp
|
|
|
44
54
|
.listen(appConfig.port);
|
|
45
55
|
process.on('SIGTERM', () => proxyServer.close());
|
|
46
56
|
process.on('exit', () => proxyServer.close());
|
|
57
|
+
startedProxies++;
|
|
58
|
+
}
|
|
59
|
+
if (skippedProxies > 0) {
|
|
60
|
+
console.info(`NX Static remotes proxies: started ${startedProxies}, skipped ${skippedProxies} (already running)`);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
console.info(`NX Static remotes proxies started successfully`);
|
|
47
64
|
}
|
|
48
|
-
console.info(`NX Static remotes proxies started successfully`);
|
|
49
65
|
}
|
|
@@ -10,7 +10,7 @@ export declare function getRemotes(devRemotes: string[], skipRemotes: string[],
|
|
|
10
10
|
staticRemotes: string[];
|
|
11
11
|
devRemotes: any[];
|
|
12
12
|
dynamicRemotes: any[];
|
|
13
|
-
remotePorts:
|
|
13
|
+
remotePorts: number[];
|
|
14
14
|
staticRemotePort: number;
|
|
15
15
|
};
|
|
16
16
|
export declare function getModuleFederationConfig(tsconfigPath: string | undefined, workspaceRoot: string, projectRoot: string, pluginName?: 'react' | 'angular'): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-remotes-for-host.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/get-remotes-for-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,UAAU,+BAA+B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"get-remotes-for-host.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/get-remotes-for-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAElD,UAAU,+BAA+B;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAsCD,wBAAgB,iCAAiC,CAC/C,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,YAAY,UA0B3B;AAoCD,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,EAAE,EACpB,WAAW,EAAE,MAAM,EAAE,EACrB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,EAAE,+BAA+B,EACxC,kBAAkB,CAAC,EAAE,MAAM;;;;;;EA0F5B;AAED,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,OAAO,GAAG,SAAmB,OAkD1C"}
|
|
@@ -24,8 +24,10 @@ function extractRemoteProjectsFromConfig(config, pathToManifestFile) {
|
|
|
24
24
|
* But users might have their own, enforce only that the key is the remote name
|
|
25
25
|
*/
|
|
26
26
|
const parsedManifest = JSON.parse(moduleFederationManifestJson);
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// Get keys once instead of calling Object.keys twice
|
|
28
|
+
const manifestKeys = Object.keys(parsedManifest);
|
|
29
|
+
if (manifestKeys.every((key) => typeof key === 'string')) {
|
|
30
|
+
dynamicRemotes.push(...manifestKeys);
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
}
|
|
@@ -77,30 +79,38 @@ function getRemotes(devRemotes, skipRemotes, config, context, pathToManifestFile
|
|
|
77
79
|
// With dynamic remotes, the manifest file may contain the names with `_` due to MF limitations on naming
|
|
78
80
|
// The project graph might contain these names with `-` rather than `_`. Check for both.
|
|
79
81
|
// This can occur after migration of existing remotes past Nx 19.8
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return r;
|
|
82
|
+
const normalizedDynamicRemotes = dynamicRemotes.map((r) => {
|
|
83
|
+
// Compute replacement once instead of twice
|
|
84
|
+
const normalizedName = r.replace(/_/g, '-');
|
|
85
|
+
return context.projectGraph.nodes[normalizedName] ? normalizedName : r;
|
|
85
86
|
});
|
|
86
87
|
const knownDynamicRemotes = normalizedDynamicRemotes.filter((r) => !remotesToSkip.has(r) && context.projectGraph.nodes[r]);
|
|
87
88
|
devkit_1.logger.info(`NX Starting module federation dev-server for ${pc.bold(context.projectName)} with ${[...knownRemotes, ...knownDynamicRemotes].length} remotes`);
|
|
89
|
+
// Normalize devRemotes to array and call findMatchingProjects once
|
|
88
90
|
const devServeApps = new Set(!devRemotes
|
|
89
91
|
? []
|
|
90
|
-
: Array.isArray(devRemotes)
|
|
91
|
-
? (0, find_matching_projects_1.findMatchingProjects)(devRemotes, context.projectGraph.nodes)
|
|
92
|
-
: (0, find_matching_projects_1.findMatchingProjects)([devRemotes], context.projectGraph.nodes));
|
|
92
|
+
: (0, find_matching_projects_1.findMatchingProjects)(Array.isArray(devRemotes) ? devRemotes : [devRemotes], context.projectGraph.nodes));
|
|
93
93
|
const staticRemotes = knownRemotes.filter((r) => !devServeApps.has(r));
|
|
94
94
|
const devServeRemotes = [...knownRemotes, ...knownDynamicRemotes].filter((r) => devServeApps.has(r));
|
|
95
95
|
const staticDynamicRemotes = knownDynamicRemotes.filter((r) => !devServeApps.has(r));
|
|
96
|
-
|
|
96
|
+
// Helper to get port from remote project
|
|
97
|
+
const getRemotePort = (r) => context.projectGraph.nodes[r].data.targets['serve'].options.port;
|
|
98
|
+
// Collect ports for dev-served remotes (used in return value)
|
|
99
|
+
const remotePorts = [...devServeRemotes, ...staticDynamicRemotes].map(getRemotePort);
|
|
100
|
+
// Calculate max port in a single pass instead of creating intermediate arrays
|
|
101
|
+
let maxPort = -Infinity;
|
|
102
|
+
for (const port of remotePorts) {
|
|
103
|
+
if (port > maxPort)
|
|
104
|
+
maxPort = port;
|
|
105
|
+
}
|
|
106
|
+
for (const r of staticRemotes) {
|
|
107
|
+
const port = getRemotePort(r);
|
|
108
|
+
if (port > maxPort)
|
|
109
|
+
maxPort = port;
|
|
110
|
+
}
|
|
97
111
|
const staticRemotePort = staticRemotes.length === 0 && remotePorts.length === 0
|
|
98
112
|
? undefined
|
|
99
|
-
:
|
|
100
|
-
...remotePorts,
|
|
101
|
-
...staticRemotes.map((r) => context.projectGraph.nodes[r].data.targets['serve'].options.port),
|
|
102
|
-
]) +
|
|
103
|
-
(remotesToSkip.size + 1);
|
|
113
|
+
: maxPort + (remotesToSkip.size + 1);
|
|
104
114
|
return {
|
|
105
115
|
staticRemotes,
|
|
106
116
|
devRemotes: devServeRemotes,
|
package/src/utils/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './models';
|
|
|
6
6
|
export * from './normalize-project-name';
|
|
7
7
|
export * from './get-remotes-for-host';
|
|
8
8
|
export * from './parse-static-remotes-config';
|
|
9
|
+
export * from './port-utils';
|
|
9
10
|
export * from './start-remote-proxies';
|
|
10
11
|
export * from './start-ssr-remote-proxies';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/src/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
|
package/src/utils/index.js
CHANGED
|
@@ -9,5 +9,6 @@ tslib_1.__exportStar(require("./models"), exports);
|
|
|
9
9
|
tslib_1.__exportStar(require("./normalize-project-name"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./get-remotes-for-host"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./parse-static-remotes-config"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./port-utils"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./start-remote-proxies"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./start-ssr-remote-proxies"), exports);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a port is already in use by attempting to connect to it.
|
|
3
|
+
* Uses waitForPortOpen with retries: 0 for an immediate check.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isPortInUse(port: number, host?: string): Promise<boolean>;
|
|
6
|
+
//# sourceMappingURL=port-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"port-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/port-utils.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAoB,GACzB,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPortInUse = isPortInUse;
|
|
4
|
+
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
5
|
+
/**
|
|
6
|
+
* Check if a port is already in use by attempting to connect to it.
|
|
7
|
+
* Uses waitForPortOpen with retries: 0 for an immediate check.
|
|
8
|
+
*/
|
|
9
|
+
async function isPortInUse(port, host = '127.0.0.1') {
|
|
10
|
+
try {
|
|
11
|
+
await (0, wait_for_port_open_1.waitForPortOpen)(port, { retries: 0, host });
|
|
12
|
+
return true; // Port is open/in use
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false; // Port is not in use
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -2,5 +2,5 @@ import { StaticRemotesConfig } from './parse-static-remotes-config';
|
|
|
2
2
|
export declare function startRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
3
3
|
pathToCert: string;
|
|
4
4
|
pathToKey: string;
|
|
5
|
-
}): void
|
|
5
|
+
}, host?: string): Promise<void>;
|
|
6
6
|
//# sourceMappingURL=start-remote-proxies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/start-remote-proxies.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"start-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/start-remote-proxies.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,wBAAsB,kBAAkB,CACtC,mBAAmB,EAAE,mBAAmB,EACxC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,UAAU,CAAC,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACtD,IAAI,GAAE,MAAoB,iBA8D3B"}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startRemoteProxies = startRemoteProxies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
|
|
6
|
+
const port_utils_1 = require("./port-utils");
|
|
7
|
+
async function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, host = '127.0.0.1') {
|
|
7
8
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
8
9
|
const express = require('express');
|
|
9
10
|
let sslCert;
|
|
@@ -21,7 +22,17 @@ function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOp
|
|
|
21
22
|
const http = require('http');
|
|
22
23
|
const https = require('https');
|
|
23
24
|
devkit_1.logger.info(`NX Starting static remotes proxies...`);
|
|
25
|
+
let startedProxies = 0;
|
|
26
|
+
let skippedProxies = 0;
|
|
24
27
|
for (const app of staticRemotesConfig.remotes) {
|
|
28
|
+
const port = staticRemotesConfig.config[app].port;
|
|
29
|
+
// Check if the port is already in use (another MF dev server may have already started a proxy)
|
|
30
|
+
const portInUse = await (0, port_utils_1.isPortInUse)(port, host);
|
|
31
|
+
if (portInUse) {
|
|
32
|
+
devkit_1.logger.info(`NX Skipping proxy for ${app} on port ${port} - port already in use (likely served by another process)`);
|
|
33
|
+
skippedProxies++;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
25
36
|
const expressProxy = express();
|
|
26
37
|
expressProxy.use(createProxyMiddleware({
|
|
27
38
|
target: mappedLocationsOfRemotes[app],
|
|
@@ -30,9 +41,15 @@ function startRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOp
|
|
|
30
41
|
}));
|
|
31
42
|
const proxyServer = (sslCert ? https : http)
|
|
32
43
|
.createServer({ cert: sslCert, key: sslKey }, expressProxy)
|
|
33
|
-
.listen(
|
|
44
|
+
.listen(port);
|
|
34
45
|
process.on('SIGTERM', () => proxyServer.close());
|
|
35
46
|
process.on('exit', () => proxyServer.close());
|
|
47
|
+
startedProxies++;
|
|
48
|
+
}
|
|
49
|
+
if (skippedProxies > 0) {
|
|
50
|
+
devkit_1.logger.info(`NX Static remotes proxies: started ${startedProxies}, skipped ${skippedProxies} (already running)`);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
devkit_1.logger.info(`NX Static remotes proxies started successfully`);
|
|
36
54
|
}
|
|
37
|
-
devkit_1.logger.info(`NX Static remotes proxies started successfully`);
|
|
38
55
|
}
|
|
@@ -2,5 +2,5 @@ import type { StaticRemotesConfig } from './parse-static-remotes-config';
|
|
|
2
2
|
export declare function startSsrRemoteProxies(staticRemotesConfig: StaticRemotesConfig, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
3
3
|
pathToCert: string;
|
|
4
4
|
pathToKey: string;
|
|
5
|
-
}): void
|
|
5
|
+
}, host?: string): Promise<void>;
|
|
6
6
|
//# sourceMappingURL=start-ssr-remote-proxies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-ssr-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/start-ssr-remote-proxies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"start-ssr-remote-proxies.d.ts","sourceRoot":"","sources":["../../../../../packages/module-federation/src/utils/start-ssr-remote-proxies.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIzE,wBAAsB,qBAAqB,CACzC,mBAAmB,EAAE,mBAAmB,EACxC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChD,UAAU,CAAC,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EACtD,IAAI,GAAE,MAAoB,iBA+E3B"}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startSsrRemoteProxies = startSsrRemoteProxies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
|
-
|
|
6
|
+
const port_utils_1 = require("./port-utils");
|
|
7
|
+
async function startSsrRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, sslOptions, host = '127.0.0.1') {
|
|
7
8
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
|
8
9
|
const express = require('express');
|
|
9
10
|
let sslCert;
|
|
@@ -21,7 +22,17 @@ function startSsrRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, ss
|
|
|
21
22
|
const http = require('http');
|
|
22
23
|
const https = require('https');
|
|
23
24
|
devkit_1.logger.info(`NX Starting static remotes proxies...`);
|
|
25
|
+
let startedProxies = 0;
|
|
26
|
+
let skippedProxies = 0;
|
|
24
27
|
for (const app of staticRemotesConfig.remotes) {
|
|
28
|
+
const port = staticRemotesConfig.config[app].port;
|
|
29
|
+
// Check if the port is already in use (another MF dev server may have already started a proxy)
|
|
30
|
+
const portInUse = await (0, port_utils_1.isPortInUse)(port, host);
|
|
31
|
+
if (portInUse) {
|
|
32
|
+
devkit_1.logger.info(`NX Skipping proxy for ${app} on port ${port} - port already in use (likely served by another process)`);
|
|
33
|
+
skippedProxies++;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
25
36
|
const expressProxy = express();
|
|
26
37
|
/**
|
|
27
38
|
* SSR remotes have two output paths: one for the browser and one for the server.
|
|
@@ -44,9 +55,15 @@ function startSsrRemoteProxies(staticRemotesConfig, mappedLocationsOfRemotes, ss
|
|
|
44
55
|
}));
|
|
45
56
|
const proxyServer = (sslCert ? https : http)
|
|
46
57
|
.createServer({ cert: sslCert, key: sslKey }, expressProxy)
|
|
47
|
-
.listen(
|
|
58
|
+
.listen(port);
|
|
48
59
|
process.on('SIGTERM', () => proxyServer.close());
|
|
49
60
|
process.on('exit', () => proxyServer.close());
|
|
61
|
+
startedProxies++;
|
|
62
|
+
}
|
|
63
|
+
if (skippedProxies > 0) {
|
|
64
|
+
devkit_1.logger.info(`NX SSR Static remotes proxies: started ${startedProxies}, skipped ${skippedProxies} (already running)`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
devkit_1.logger.info(`Nx SSR Static remotes proxies started successfully`);
|
|
50
68
|
}
|
|
51
|
-
devkit_1.logger.info(`Nx SSR Static remotes proxies started successfully`);
|
|
52
69
|
}
|
package/src/utils/typescript.js
CHANGED
|
@@ -15,14 +15,14 @@ function readTsPathMappings(tsConfigPath = process.env.NX_TSCONFIG_PATH ?? getRo
|
|
|
15
15
|
if (!tsConfig.has(tsConfigPath)) {
|
|
16
16
|
tsConfig.set(tsConfigPath, readTsConfiguration(tsConfigPath));
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return
|
|
18
|
+
// Build the processed paths object in a single pass instead of
|
|
19
|
+
// spreading on each iteration, which was O(n²) for n path aliases
|
|
20
|
+
const processedPaths = {};
|
|
21
|
+
for (const [alias, aliasPaths] of Object.entries(tsConfig.get(tsConfigPath).options?.paths ?? {})) {
|
|
22
|
+
processedPaths[alias] = aliasPaths.map((path) => path.replace(/^\.\//, ''));
|
|
23
|
+
}
|
|
24
|
+
tsPathMappings.set(tsConfigPath, processedPaths);
|
|
25
|
+
return processedPaths;
|
|
26
26
|
}
|
|
27
27
|
function readTsConfiguration(tsConfigPath) {
|
|
28
28
|
if (!(0, fs_1.existsSync)(tsConfigPath)) {
|