@nx/module-federation 22.3.0-beta.0 → 22.3.0-beta.1
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.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/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/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.3.0-beta.
|
|
4
|
+
"version": "22.3.0-beta.1",
|
|
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.3.0-beta.
|
|
31
|
-
"@nx/js": "22.3.0-beta.
|
|
32
|
-
"@nx/web": "22.3.0-beta.
|
|
30
|
+
"@nx/devkit": "22.3.0-beta.1",
|
|
31
|
+
"@nx/js": "22.3.0-beta.1",
|
|
32
|
+
"@nx/web": "22.3.0-beta.1",
|
|
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.3.0-beta.
|
|
41
|
+
"nx": "22.3.0-beta.1"
|
|
42
42
|
},
|
|
43
43
|
"nx-migrations": {
|
|
44
44
|
"migrations": "./migrations.json"
|
|
@@ -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
|
}
|
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
|
}
|