@nx/angular 19.6.5 → 19.6.7
Sign up to get free protection for your applications and to get access to all the features.
- package/migrations.json +13 -0
- package/package.json +9 -9
- package/src/builders/webpack-server/webpack-server.impl.js +1 -3
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.d.ts +1 -6
- package/src/executors/module-federation-ssr-dev-server/lib/start-static-remotes.js +5 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -1
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +12 -1
- package/src/generators/utils/add-mf-env-to-inputs.js +2 -1
- package/src/utils/mf/with-module-federation-ssr.js +8 -7
- package/src/utils/mf/with-module-federation.js +1 -0
- package/src/utils/versions.d.ts +2 -2
- package/src/utils/versions.js +2 -2
package/migrations.json
CHANGED
@@ -2122,6 +2122,19 @@
|
|
2122
2122
|
"alwaysAddToPackageJson": false
|
2123
2123
|
}
|
2124
2124
|
}
|
2125
|
+
},
|
2126
|
+
"19.7.0": {
|
2127
|
+
"version": "19.7.0-beta.0",
|
2128
|
+
"packages": {
|
2129
|
+
"@module-federation/enhanced": {
|
2130
|
+
"version": "~0.6.0",
|
2131
|
+
"alwaysAddToPackageJson": false
|
2132
|
+
},
|
2133
|
+
"@module-federation/node": {
|
2134
|
+
"version": "~2.5.0",
|
2135
|
+
"alwaysAddToPackageJson": false
|
2136
|
+
}
|
2137
|
+
}
|
2125
2138
|
}
|
2126
2139
|
}
|
2127
2140
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "19.6.
|
3
|
+
"version": "19.6.7",
|
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": {
|
@@ -78,15 +78,15 @@
|
|
78
78
|
"tslib": "^2.3.0",
|
79
79
|
"webpack-merge": "^5.8.0",
|
80
80
|
"webpack": "^5.88.0",
|
81
|
-
"@module-federation/enhanced": "~0.
|
82
|
-
"@nx/devkit": "19.6.
|
83
|
-
"@nx/js": "19.6.
|
84
|
-
"@nx/eslint": "19.6.
|
85
|
-
"@nx/webpack": "19.6.
|
86
|
-
"@nx/web": "19.6.
|
87
|
-
"@nx/workspace": "19.6.
|
81
|
+
"@module-federation/enhanced": "~0.6.0",
|
82
|
+
"@nx/devkit": "19.6.7",
|
83
|
+
"@nx/js": "19.6.7",
|
84
|
+
"@nx/eslint": "19.6.7",
|
85
|
+
"@nx/webpack": "19.6.7",
|
86
|
+
"@nx/web": "19.6.7",
|
87
|
+
"@nx/workspace": "19.6.7",
|
88
88
|
"piscina": "^4.4.0",
|
89
|
-
"@nrwl/angular": "19.6.
|
89
|
+
"@nrwl/angular": "19.6.7"
|
90
90
|
},
|
91
91
|
"peerDependencies": {
|
92
92
|
"@angular-devkit/build-angular": ">= 16.0.0 < 19.0.0",
|
@@ -33,9 +33,7 @@ function buildServerAppWithCustomWebpackConfiguration(options, context, pathToWe
|
|
33
33
|
// Therefore, if the build is an MF Server build, remove the auto-includes from
|
34
34
|
// the base webpack config from Angular
|
35
35
|
let mergedConfig = await (0, webpack_1.mergeCustomWebpackConfig)(baseWebpackConfig, pathToWebpackConfig, options, context.target);
|
36
|
-
if (mergedConfig.
|
37
|
-
.map((p) => p.constructor.name)
|
38
|
-
.includes('UniversalFederationPlugin')) {
|
36
|
+
if (mergedConfig.target === 'async-node') {
|
39
37
|
mergedConfig.entry.main = mergedConfig.entry.main.filter((m) => !m.startsWith('@angular/platform-server/init'));
|
40
38
|
mergedConfig.module.rules = mergedConfig.module.rules.filter((m) => !m.loader
|
41
39
|
? true
|
@@ -1,9 +1,4 @@
|
|
1
1
|
import { type ExecutorContext } from '@nx/devkit';
|
2
2
|
import { type Schema } from '../schema';
|
3
3
|
import type { StaticRemotesConfig } from '@nx/webpack/src/utils/module-federation/parse-static-remotes-config';
|
4
|
-
export declare function startStaticRemotes(ssrStaticRemotesConfig: StaticRemotesConfig, context: ExecutorContext, options: Schema):
|
5
|
-
success: boolean;
|
6
|
-
baseUrl: string;
|
7
|
-
}, {
|
8
|
-
success: boolean;
|
9
|
-
}, unknown>;
|
4
|
+
export declare function startStaticRemotes(ssrStaticRemotesConfig: StaticRemotesConfig, context: ExecutorContext, options: Schema): AsyncIterable<unknown>;
|
@@ -6,9 +6,13 @@ const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executors/file-server/file-server.impl"));
|
7
7
|
const path_1 = require("path");
|
8
8
|
const fs_1 = require("fs");
|
9
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
9
10
|
function startStaticRemotes(ssrStaticRemotesConfig, context, options) {
|
10
11
|
if (ssrStaticRemotesConfig.remotes.length === 0) {
|
11
|
-
return
|
12
|
+
return (0, async_iterable_1.createAsyncIterable)(({ next, done }) => {
|
13
|
+
next({ success: true });
|
14
|
+
done();
|
15
|
+
});
|
12
16
|
}
|
13
17
|
// The directories are usually generated with /browser and /server suffixes so we need to copy them to a common directory
|
14
18
|
const commonOutputDirectory = (0, path_1.join)(devkit_1.workspaceRoot, 'tmp/static-remotes');
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
import { type ExecutorContext } from '@nx/devkit';
|
2
2
|
import type { Schema } from './schema';
|
3
|
-
export declare function moduleFederationSsrDevServerExecutor(schema: Schema, context: ExecutorContext): AsyncGenerator<
|
3
|
+
export declare function moduleFederationSsrDevServerExecutor(schema: Schema, context: ExecutorContext): AsyncGenerator<unknown, any, undefined>;
|
4
4
|
export default moduleFederationSsrDevServerExecutor;
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
@@ -74,7 +74,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
74
74
|
...v,
|
75
75
|
baseUrl: undefined,
|
76
76
|
}));
|
77
|
-
|
77
|
+
const combined = (0, async_iterable_1.combineAsyncIterables)(removeBaseUrlEmission(staticRemotes), ...(devRemotes ? devRemotes.map(removeBaseUrlEmission) : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
|
78
78
|
if (!options.isInitialHost) {
|
79
79
|
done();
|
80
80
|
return;
|
@@ -94,6 +94,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
94
94
|
retryDelay: 2500,
|
95
95
|
host: 'localhost',
|
96
96
|
})));
|
97
|
+
next({ success: true, baseUrl: `http://localhost:${options.port}` });
|
97
98
|
}
|
98
99
|
catch (error) {
|
99
100
|
throw new Error(`Failed to start remotes. Check above for any errors.`, {
|
@@ -104,5 +105,15 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
104
105
|
done();
|
105
106
|
}
|
106
107
|
}));
|
108
|
+
let refs = 2 + (devRemotes?.length ?? 0);
|
109
|
+
for await (const result of combined) {
|
110
|
+
if (result.success === false)
|
111
|
+
throw new Error('Remotes failed to start');
|
112
|
+
if (result.success)
|
113
|
+
refs--;
|
114
|
+
if (refs === 0)
|
115
|
+
break;
|
116
|
+
}
|
117
|
+
return yield* currIter;
|
107
118
|
}
|
108
119
|
exports.default = moduleFederationSsrDevServerExecutor;
|
@@ -22,6 +22,7 @@ function addMfEnvToTargetDefaultInputs(tree) {
|
|
22
22
|
}
|
23
23
|
if (!mfEnvVarExists) {
|
24
24
|
nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
|
25
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
26
25
|
}
|
26
|
+
nxJson.targetDefaults[webpackExecutor].cache = true;
|
27
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
27
28
|
}
|
@@ -12,7 +12,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
12
12
|
return (config) => {
|
13
13
|
const updatedConfig = {
|
14
14
|
...(config ?? {}),
|
15
|
-
target:
|
15
|
+
target: 'async-node',
|
16
16
|
output: {
|
17
17
|
...(config.output ?? {}),
|
18
18
|
uniqueName: options.name,
|
@@ -30,7 +30,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
30
30
|
},
|
31
31
|
plugins: [
|
32
32
|
...(config.plugins ?? []),
|
33
|
-
new (require('@module-federation/
|
33
|
+
new (require('@module-federation/enhanced').ModuleFederationPlugin)({
|
34
34
|
name: options.name,
|
35
35
|
filename: 'remoteEntry.js',
|
36
36
|
exposes: options.exposes,
|
@@ -38,10 +38,6 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
38
38
|
shared: {
|
39
39
|
...sharedDependencies,
|
40
40
|
},
|
41
|
-
library: {
|
42
|
-
type: 'commonjs-module',
|
43
|
-
},
|
44
|
-
isServer: true,
|
45
41
|
/**
|
46
42
|
* Apply user-defined config override
|
47
43
|
*/
|
@@ -50,9 +46,14 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
50
46
|
!options.disableNxRuntimeLibraryControlPlugin
|
51
47
|
? [
|
52
48
|
...(configOverride?.runtimePlugins ?? []),
|
49
|
+
require.resolve('@module-federation/node/runtimePlugin'),
|
53
50
|
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
54
51
|
]
|
55
|
-
:
|
52
|
+
: [
|
53
|
+
...(configOverride?.runtimePlugins ?? []),
|
54
|
+
require.resolve('@module-federation/node/runtimePlugin'),
|
55
|
+
],
|
56
|
+
virtualRuntimeEntry: true,
|
56
57
|
}, {}),
|
57
58
|
sharedLibraries.getReplacementPlugin(),
|
58
59
|
],
|
@@ -55,6 +55,7 @@ async function withModuleFederation(options, configOverride) {
|
|
55
55
|
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
56
56
|
]
|
57
57
|
: configOverride?.runtimePlugins,
|
58
|
+
virtualRuntimeEntry: true,
|
58
59
|
}),
|
59
60
|
sharedLibraries.getReplacementPlugin(),
|
60
61
|
],
|
package/src/utils/versions.d.ts
CHANGED
@@ -12,8 +12,8 @@ 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 = "~2.
|
16
|
-
export declare const moduleFederationEnhancedVersion = "~0.
|
15
|
+
export declare const moduleFederationNodeVersion = "~2.5.0";
|
16
|
+
export declare const moduleFederationEnhancedVersion = "~0.6.0";
|
17
17
|
export declare const angularEslintVersion = "^18.0.1";
|
18
18
|
export declare const typescriptEslintVersion = "^7.16.0";
|
19
19
|
export declare const tailwindVersion = "^3.0.2";
|
package/src/utils/versions.js
CHANGED
@@ -15,8 +15,8 @@ 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 = '~2.
|
19
|
-
exports.moduleFederationEnhancedVersion = '~0.
|
18
|
+
exports.moduleFederationNodeVersion = '~2.5.0';
|
19
|
+
exports.moduleFederationEnhancedVersion = '~0.6.0';
|
20
20
|
exports.angularEslintVersion = '^18.0.1';
|
21
21
|
exports.typescriptEslintVersion = '^7.16.0';
|
22
22
|
exports.tailwindVersion = '^3.0.2';
|