@nx/angular 19.5.1 → 19.5.3
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/mf/mf.mjs +5 -2
- package/fesm2022/nx-angular-mf.mjs +4 -1
- package/fesm2022/nx-angular-mf.mjs.map +1 -1
- package/mf/mf.d.ts +1 -0
- package/ng-package.json +3 -0
- package/package.json +8 -14
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.d.ts +2 -2
- package/src/executors/module-federation-dev-server/lib/build-static-remotes.js +11 -4
- package/src/executors/module-federation-dev-server/lib/index.d.ts +0 -1
- package/src/executors/module-federation-dev-server/lib/index.js +0 -1
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.d.ts +1 -1
- package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.js +5 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +9 -21
- package/src/generators/setup-ssr/files/server/server-builder/v17+/__serverFileName__ +7 -5
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
- package/src/executors/module-federation-dev-server/lib/parse-static-remotes-config.d.ts +0 -11
- package/src/executors/module-federation-dev-server/lib/parse-static-remotes-config.js +0 -17
package/esm2022/mf/mf.mjs
CHANGED
@@ -2,10 +2,13 @@ let resolveRemoteUrl;
|
|
2
2
|
export function setRemoteUrlResolver(_resolveRemoteUrl) {
|
3
3
|
resolveRemoteUrl = _resolveRemoteUrl;
|
4
4
|
}
|
5
|
-
let remoteUrlDefinitions;
|
5
|
+
let remoteUrlDefinitions = {};
|
6
6
|
export function setRemoteDefinitions(definitions) {
|
7
7
|
remoteUrlDefinitions = definitions;
|
8
8
|
}
|
9
|
+
export function setRemoteDefinition(remoteName, remoteUrl) {
|
10
|
+
remoteUrlDefinitions[remoteName] = remoteUrl;
|
11
|
+
}
|
9
12
|
let remoteModuleMap = new Map();
|
10
13
|
let remoteContainerMap = new Map();
|
11
14
|
export async function loadRemoteModule(remoteName, moduleName) {
|
@@ -45,4 +48,4 @@ async function loadRemoteContainer(remoteName) {
|
|
45
48
|
remoteContainerMap.set(remoteName, container);
|
46
49
|
return container;
|
47
50
|
}
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
51
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWYuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9hbmd1bGFyL21mL21mLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9BLElBQUksZ0JBQTBDLENBQUM7QUFDL0MsTUFBTSxVQUFVLG9CQUFvQixDQUNsQyxpQkFBMkM7SUFFM0MsZ0JBQWdCLEdBQUcsaUJBQWlCLENBQUM7QUFDdkMsQ0FBQztBQUVELElBQUksb0JBQW9CLEdBQTJCLEVBQUUsQ0FBQztBQUN0RCxNQUFNLFVBQVUsb0JBQW9CLENBQUMsV0FBbUM7SUFDdEUsb0JBQW9CLEdBQUcsV0FBVyxDQUFDO0FBQ3JDLENBQUM7QUFFRCxNQUFNLFVBQVUsbUJBQW1CLENBQUMsVUFBa0IsRUFBRSxTQUFpQjtJQUN2RSxvQkFBb0IsQ0FBQyxVQUFVLENBQUMsR0FBRyxTQUFTLENBQUM7QUFDL0MsQ0FBQztBQUVELElBQUksZUFBZSxHQUFHLElBQUksR0FBRyxFQUFtQixDQUFDO0FBQ2pELElBQUksa0JBQWtCLEdBQUcsSUFBSSxHQUFHLEVBQW1CLENBQUM7QUFDcEQsTUFBTSxDQUFDLEtBQUssVUFBVSxnQkFBZ0IsQ0FBQyxVQUFrQixFQUFFLFVBQWtCO0lBQzNFLE1BQU0sZUFBZSxHQUFHLEdBQUcsVUFBVSxJQUFJLFVBQVUsRUFBRSxDQUFDO0lBQ3RELElBQUksZUFBZSxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsRUFBRSxDQUFDO1FBQ3pDLE9BQU8sZUFBZSxDQUFDLEdBQUcsQ0FBQyxlQUFlLENBQUMsQ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WZhdWx0Jyk7XG4gIH1cblxuICBjb25zdCByZW1vdGVVcmwgPSByZW1vdGVVcmxEZWZpbml0aW9uc1xuICAgID8gcmVtb3RlVXJsRGVmaW5pdGlvbnNbcmVtb3RlTmFtZV1cbiAgICA6IGF3YWl0IHJlc29sdmVSZW1vdGVVcmwocmVtb3RlTmFtZSk7XG5cbiAgbGV0IGNvbnRhaW5lclVybCA9IHJlbW90ZVVybDtcbiAgaWYgKCFyZW1vdGVVcmwuZW5kc1dpdGgoJy5tanMnKSAmJiAhcmVtb3RlVXJsLmVuZHNXaXRoKCcuanMnKSkge1xuICAgIGNvbnRhaW5lclVybCA9IGAke3JlbW90ZVVybH0ke1xuICAgICAgcmVtb3RlVXJsLmVuZHNXaXRoKCcvJykgPyAnJyA6ICcvJ1xuICAgIH1yZW1vdGVFbnRyeS5tanNgO1xuICB9XG5cbiAgY29uc3QgY29udGFpbmVyID0gYXdhaXQgbG9hZE1vZHVsZShjb250YWluZXJVcmwpO1xuICBhd2FpdCBjb250YWluZXIuaW5pdChfX3dlYnBhY2tfc2hhcmVfc2NvcGVzX18uZGVmYXVsdCk7XG5cbiAgcmVtb3RlQ29udGFpbmVyTWFwLnNldChyZW1vdGVOYW1lLCBjb250YWluZXIpO1xuICByZXR1cm4gY29udGFpbmVyO1xufVxuIl19
|
@@ -2,10 +2,13 @@ let resolveRemoteUrl;
|
|
2
2
|
function setRemoteUrlResolver(_resolveRemoteUrl) {
|
3
3
|
resolveRemoteUrl = _resolveRemoteUrl;
|
4
4
|
}
|
5
|
-
let remoteUrlDefinitions;
|
5
|
+
let remoteUrlDefinitions = {};
|
6
6
|
function setRemoteDefinitions(definitions) {
|
7
7
|
remoteUrlDefinitions = definitions;
|
8
8
|
}
|
9
|
+
function setRemoteDefinition(remoteName, remoteUrl) {
|
10
|
+
remoteUrlDefinitions[remoteName] = remoteUrl;
|
11
|
+
}
|
9
12
|
let remoteModuleMap = new Map();
|
10
13
|
let remoteContainerMap = new Map();
|
11
14
|
async function loadRemoteModule(remoteName, moduleName) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nx-angular-mf.mjs","sources":["../../../../packages/angular/mf/mf.ts","../../../../packages/angular/mf/nx-angular-mf.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string
|
1
|
+
{"version":3,"file":"nx-angular-mf.mjs","sources":["../../../../packages/angular/mf/mf.ts","../../../../packages/angular/mf/nx-angular-mf.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string> = {};\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\nexport function setRemoteDefinition(remoteName: string, remoteUrl: string) {\n remoteUrlDefinitions[remoteName] = remoteUrl;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n let containerUrl = remoteUrl;\n if (!remoteUrl.endsWith('.mjs') && !remoteUrl.endsWith('.js')) {\n containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n }\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAOA,IAAI,gBAA0C,CAAC;AACzC,SAAU,oBAAoB,CAClC,iBAA2C,EAAA;IAE3C,gBAAgB,GAAG,iBAAiB,CAAC;AACvC,CAAC;AAED,IAAI,oBAAoB,GAA2B,EAAE,CAAC;AAChD,SAAU,oBAAoB,CAAC,WAAmC,EAAA;IACtE,oBAAoB,GAAG,WAAW,CAAC;AACrC,CAAC;AAEe,SAAA,mBAAmB,CAAC,UAAkB,EAAE,SAAiB,EAAA;AACvE,IAAA,oBAAoB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;AAC/C,CAAC;AAED,IAAI,eAAe,GAAG,IAAI,GAAG,EAAmB,CAAC;AACjD,IAAI,kBAAkB,GAAG,IAAI,GAAG,EAAmB,CAAC;AAC7C,eAAe,gBAAgB,CAAC,UAAkB,EAAE,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AC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC7D,QAAA,YAAY,GAAG,CAAG,EAAA,SAAS,GACzB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB,CAAC;KACnB;AAED,IAAA,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEvD,IAAA,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC9C,IAAA,OAAO,SAAS,CAAC;AACnB;;AC5EA;;AAEG;;;;"}
|
package/mf/mf.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
export type ResolveRemoteUrlFunction = (remoteName: string) => string | Promise<string>;
|
2
2
|
export declare function setRemoteUrlResolver(_resolveRemoteUrl: ResolveRemoteUrlFunction): void;
|
3
3
|
export declare function setRemoteDefinitions(definitions: Record<string, string>): void;
|
4
|
+
export declare function setRemoteDefinition(remoteName: string, remoteUrl: string): void;
|
4
5
|
export declare function loadRemoteModule(remoteName: string, moduleName: string): Promise<any>;
|
package/ng-package.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "19.5.
|
3
|
+
"version": "19.5.3",
|
4
4
|
"private": false,
|
5
5
|
"description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
|
6
6
|
"repository": {
|
@@ -80,28 +80,22 @@
|
|
80
80
|
"webpack-merge": "^5.8.0",
|
81
81
|
"webpack": "^5.88.0",
|
82
82
|
"@module-federation/enhanced": "~0.2.3",
|
83
|
-
"@nx/devkit": "19.5.
|
84
|
-
"@nx/js": "19.5.
|
85
|
-
"@nx/eslint": "19.5.
|
86
|
-
"@nx/webpack": "19.5.
|
87
|
-
"@nx/web": "19.5.
|
88
|
-
"@nx/workspace": "19.5.
|
83
|
+
"@nx/devkit": "19.5.3",
|
84
|
+
"@nx/js": "19.5.3",
|
85
|
+
"@nx/eslint": "19.5.3",
|
86
|
+
"@nx/webpack": "19.5.3",
|
87
|
+
"@nx/web": "19.5.3",
|
88
|
+
"@nx/workspace": "19.5.3",
|
89
89
|
"piscina": "^4.4.0",
|
90
|
-
"@nrwl/angular": "19.5.
|
90
|
+
"@nrwl/angular": "19.5.3"
|
91
91
|
},
|
92
92
|
"peerDependencies": {
|
93
93
|
"@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
|
94
94
|
"@angular-devkit/core": ">= 16.0.0 < 19.0.0",
|
95
95
|
"@angular-devkit/schematics": ">= 16.0.0 < 19.0.0",
|
96
96
|
"@schematics/angular": ">= 16.0.0 < 19.0.0",
|
97
|
-
"esbuild": "^0.19.2",
|
98
97
|
"rxjs": "^6.5.3 || ^7.5.0"
|
99
98
|
},
|
100
|
-
"peerDependenciesMeta": {
|
101
|
-
"esbuild": {
|
102
|
-
"optional": true
|
103
|
-
}
|
104
|
-
},
|
105
99
|
"publishConfig": {
|
106
100
|
"access": "public"
|
107
101
|
},
|
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type Schema } from '../schema';
|
2
2
|
import { type ExecutorContext } from '@nx/devkit';
|
3
|
-
import type { StaticRemotesConfig } from '
|
4
|
-
export declare function buildStaticRemotes(staticRemotesConfig: StaticRemotesConfig, nxBin: any, context: ExecutorContext, options: Schema): Promise<
|
3
|
+
import type { StaticRemotesConfig } from '@nx/webpack/src/utils/module-federation/parse-static-remotes-config';
|
4
|
+
export declare function buildStaticRemotes(staticRemotesConfig: StaticRemotesConfig, nxBin: any, context: ExecutorContext, options: Schema): Promise<Record<string, string>>;
|
@@ -14,8 +14,7 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
14
14
|
for (const app of staticRemotesConfig.remotes) {
|
15
15
|
mappedLocationOfRemotes[app] = `http${options.ssl ? 's' : ''}://${options.host}:${options.staticRemotesPort}/${staticRemotesConfig.config[app].urlSegment}`;
|
16
16
|
}
|
17
|
-
|
18
|
-
await new Promise((res) => {
|
17
|
+
await new Promise((res, rej) => {
|
19
18
|
devkit_1.logger.info(`NX Building ${staticRemotesConfig.remotes.length} static remotes...`);
|
20
19
|
const staticProcess = (0, node_child_process_1.fork)(nxBin, [
|
21
20
|
'run-many',
|
@@ -36,6 +35,11 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
36
35
|
const ANSII_CODE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
37
36
|
const stdoutString = data.toString().replace(ANSII_CODE_REGEX, '');
|
38
37
|
stdoutStream.write(stdoutString);
|
38
|
+
// in addition to writing into the stdout stream, also show error directly in console
|
39
|
+
// so the error is easily discoverable. 'ERROR in' is the key word to search in webpack output.
|
40
|
+
if (stdoutString.includes('ERROR in')) {
|
41
|
+
devkit_1.logger.log(stdoutString);
|
42
|
+
}
|
39
43
|
if (stdoutString.includes('Successfully ran target build')) {
|
40
44
|
staticProcess.stdout.removeAllListeners('data');
|
41
45
|
devkit_1.logger.info(`NX Built ${staticRemotesConfig.remotes.length} static remotes`);
|
@@ -48,11 +52,14 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
48
52
|
staticProcess.stdout.removeAllListeners('data');
|
49
53
|
staticProcess.stderr.removeAllListeners('data');
|
50
54
|
if (code !== 0) {
|
51
|
-
|
55
|
+
rej(`Remote failed to start. A complete log can be found in: ${remoteBuildLogFile}`);
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
res();
|
52
59
|
}
|
53
|
-
res();
|
54
60
|
});
|
55
61
|
process.on('SIGTERM', () => staticProcess.kill('SIGTERM'));
|
56
62
|
process.on('exit', () => staticProcess.kill('SIGTERM'));
|
57
63
|
});
|
64
|
+
return mappedLocationOfRemotes;
|
58
65
|
}
|
@@ -3,6 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
4
4
|
tslib_1.__exportStar(require("./build-static-remotes"), exports);
|
5
5
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
6
|
-
tslib_1.__exportStar(require("./parse-static-remotes-config"), exports);
|
7
6
|
tslib_1.__exportStar(require("./start-dev-remotes"), exports);
|
8
7
|
tslib_1.__exportStar(require("./start-static-remotes-file-server"), exports);
|
package/src/executors/module-federation-dev-server/lib/start-static-remotes-file-server.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type ExecutorContext } from '@nx/devkit';
|
2
2
|
import { type Schema } from '../schema';
|
3
|
-
import type { StaticRemotesConfig } from '
|
3
|
+
import type { StaticRemotesConfig } from '@nx/webpack/src/utils/module-federation/parse-static-remotes-config';
|
4
4
|
export declare function startStaticRemotesFileServer(staticRemotesConfig: StaticRemotesConfig, context: ExecutorContext, options: Schema): AsyncGenerator<{
|
5
5
|
success: boolean;
|
6
6
|
baseUrl: string;
|
@@ -7,6 +7,10 @@ const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executor
|
|
7
7
|
const path_1 = require("path");
|
8
8
|
const fs_1 = require("fs");
|
9
9
|
function startStaticRemotesFileServer(staticRemotesConfig, context, options) {
|
10
|
+
if (!staticRemotesConfig.remotes ||
|
11
|
+
staticRemotesConfig.remotes.length === 0) {
|
12
|
+
return;
|
13
|
+
}
|
10
14
|
let shouldMoveToCommonLocation = false;
|
11
15
|
let commonOutputDirectory;
|
12
16
|
for (const app of staticRemotesConfig.remotes) {
|
@@ -41,6 +45,7 @@ function startStaticRemotesFileServer(staticRemotesConfig, context, options) {
|
|
41
45
|
ssl: options.ssl,
|
42
46
|
sslCert: options.sslCert,
|
43
47
|
sslKey: options.sslKey,
|
48
|
+
cacheSeconds: -1,
|
44
49
|
}, context);
|
45
50
|
return staticRemotesIter;
|
46
51
|
}
|
@@ -14,11 +14,12 @@ const dev_server_impl_1 = require("../../builders/dev-server/dev-server.impl");
|
|
14
14
|
const module_federation_2 = require("../../builders/utilities/module-federation");
|
15
15
|
const path_1 = require("path");
|
16
16
|
const fs_1 = require("fs");
|
17
|
+
const start_remote_proxies_1 = require("@nx/webpack/src/utils/module-federation/start-remote-proxies");
|
18
|
+
const parse_static_remotes_config_1 = require("@nx/webpack/src/utils/module-federation/parse-static-remotes-config");
|
17
19
|
async function* moduleFederationDevServerExecutor(schema, context) {
|
18
20
|
// Force Node to resolve to look for the nx binary that is inside node_modules
|
19
21
|
const nxBin = require.resolve('nx/bin/nx');
|
20
22
|
const options = (0, lib_1.normalizeOptions)(schema);
|
21
|
-
options.staticRemotesPort ??= options.port + 1;
|
22
23
|
const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
|
23
24
|
const project = workspaceProjects[context.projectName];
|
24
25
|
const currIter = options.static
|
@@ -31,6 +32,7 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
31
32
|
spa: false,
|
32
33
|
withDeps: false,
|
33
34
|
cors: true,
|
35
|
+
cacheSeconds: -1,
|
34
36
|
}, context)
|
35
37
|
: (0, rxjs_for_await_1.eachValueFrom)((0, dev_server_impl_1.executeDevServerBuilder)(options, await (0, ngcli_adapter_1.createBuilderContext)({
|
36
38
|
builderName: '@nx/angular:webpack-browser',
|
@@ -62,33 +64,19 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
62
64
|
projectGraph: context.projectGraph,
|
63
65
|
root: context.root,
|
64
66
|
}, pathToManifestFile);
|
67
|
+
options.staticRemotesPort ??= remotes.staticRemotePort;
|
65
68
|
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
66
69
|
process.env.NX_MF_DEV_REMOTES = JSON.stringify(remotes.devRemotes.map((r) => (typeof r === 'string' ? r : r.remoteName)));
|
67
|
-
|
68
|
-
|
69
|
-
const remoteName = typeof r === 'string' ? r : r.remoteName;
|
70
|
-
const remotePort = context.projectGraph.nodes[remoteName].data.targets['serve'].options
|
71
|
-
.port;
|
72
|
-
if (remotePort >= portToUse) {
|
73
|
-
return remotePort + 1;
|
74
|
-
}
|
75
|
-
else {
|
76
|
-
return portToUse;
|
77
|
-
}
|
78
|
-
}, options.staticRemotesPort);
|
79
|
-
}
|
80
|
-
const staticRemotesConfig = (0, lib_1.parseStaticRemotesConfig)(remotes.staticRemotes, context);
|
81
|
-
await (0, lib_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
|
70
|
+
const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
71
|
+
const mappedLocationsOfStaticRemotes = await (0, lib_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
|
82
72
|
const devRemoteIters = await (0, lib_1.startRemotes)(remotes.devRemotes, workspaceProjects, options, context, 'serve');
|
83
|
-
const
|
84
|
-
|
85
|
-
? (0, lib_1.startStaticRemotesFileServer)(staticRemotesConfig, context, options)
|
86
|
-
: undefined;
|
73
|
+
const staticRemotesIter = (0, lib_1.startStaticRemotesFileServer)(staticRemotesConfig, context, options);
|
74
|
+
(0, start_remote_proxies_1.startRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes);
|
87
75
|
const removeBaseUrlEmission = (iter) => (0, async_iterable_1.mapAsyncIterable)(iter, (v) => ({
|
88
76
|
...v,
|
89
77
|
baseUrl: undefined,
|
90
78
|
}));
|
91
|
-
return yield* (0, async_iterable_1.combineAsyncIterables)(removeBaseUrlEmission(currIter), ...devRemoteIters.map(removeBaseUrlEmission), ...
|
79
|
+
return yield* (0, async_iterable_1.combineAsyncIterables)(removeBaseUrlEmission(currIter), ...devRemoteIters.map(removeBaseUrlEmission), ...(staticRemotesIter ? [removeBaseUrlEmission(staticRemotesIter)] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
92
80
|
if (!options.isInitialHost) {
|
93
81
|
done();
|
94
82
|
return;
|
@@ -23,13 +23,15 @@ export function app(): express.Express {
|
|
23
23
|
// Example Express Rest API endpoints
|
24
24
|
// server.get('/api/**', (req, res) => { });
|
25
25
|
// Serve static files from /browser
|
26
|
-
server.get(
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
server.get(
|
27
|
+
'*.*',
|
28
|
+
express.static(distFolder, {
|
29
|
+
maxAge: '1y',
|
30
|
+
})
|
31
|
+
);
|
30
32
|
|
31
33
|
// All regular routes use the Angular engine
|
32
|
-
server.get('
|
34
|
+
server.get('*', (req, res, next) => {
|
33
35
|
const { protocol, originalUrl, baseUrl, headers } = req;
|
34
36
|
|
35
37
|
commonEngine
|
package/src/utils/versions.d.ts
CHANGED
@@ -12,7 +12,7 @@ export declare const typesCorsVersion = "~2.8.5";
|
|
12
12
|
export declare const expressVersion = "~4.18.2";
|
13
13
|
export declare const typesExpressVersion = "4.17.14";
|
14
14
|
export declare const browserSyncVersion = "^3.0.0";
|
15
|
-
export declare const moduleFederationNodeVersion = "
|
15
|
+
export declare const moduleFederationNodeVersion = "~2.4.0";
|
16
16
|
export declare const moduleFederationEnhancedVersion = "~0.2.3";
|
17
17
|
export declare const angularEslintVersion = "^18.0.1";
|
18
18
|
export declare const typescriptEslintVersion = "^7.16.0";
|
package/src/utils/versions.js
CHANGED
@@ -15,7 +15,7 @@ exports.typesCorsVersion = '~2.8.5';
|
|
15
15
|
exports.expressVersion = '~4.18.2';
|
16
16
|
exports.typesExpressVersion = '4.17.14';
|
17
17
|
exports.browserSyncVersion = '^3.0.0';
|
18
|
-
exports.moduleFederationNodeVersion = '
|
18
|
+
exports.moduleFederationNodeVersion = '~2.4.0';
|
19
19
|
exports.moduleFederationEnhancedVersion = '~0.2.3';
|
20
20
|
exports.angularEslintVersion = '^18.0.1';
|
21
21
|
exports.typescriptEslintVersion = '^7.16.0';
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { ExecutorContext } from '@nx/devkit';
|
2
|
-
export type StaticRemoteConfig = {
|
3
|
-
basePath: string;
|
4
|
-
outputPath: string;
|
5
|
-
urlSegment: string;
|
6
|
-
};
|
7
|
-
export type StaticRemotesConfig = {
|
8
|
-
remotes: string[];
|
9
|
-
config: Record<string, StaticRemoteConfig> | undefined;
|
10
|
-
};
|
11
|
-
export declare function parseStaticRemotesConfig(staticRemotes: string[] | undefined, context: ExecutorContext): StaticRemotesConfig;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.parseStaticRemotesConfig = parseStaticRemotesConfig;
|
4
|
-
const path_1 = require("path");
|
5
|
-
function parseStaticRemotesConfig(staticRemotes, context) {
|
6
|
-
if (!staticRemotes?.length) {
|
7
|
-
return { remotes: [], config: undefined };
|
8
|
-
}
|
9
|
-
const config = {};
|
10
|
-
for (const app of staticRemotes) {
|
11
|
-
const outputPath = context.projectGraph.nodes[app].data.targets['build'].options.outputPath;
|
12
|
-
const basePath = (0, path_1.dirname)(outputPath);
|
13
|
-
const urlSegment = (0, path_1.basename)(outputPath);
|
14
|
-
config[app] = { basePath, outputPath, urlSegment };
|
15
|
-
}
|
16
|
-
return { remotes: staticRemotes, config };
|
17
|
-
}
|