@nx/react 21.2.0 → 21.2.2
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/mf/dynamic-federation.js +2 -10
- package/package.json +6 -6
- package/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -1
- package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -1
- package/src/generators/application/lib/add-e2e.js +7 -3
- package/src/generators/application/lib/add-project.js +2 -2
- package/src/generators/application/lib/bundlers/add-vite.js +3 -0
- package/src/generators/application/lib/create-application-files.d.ts +1 -0
- package/src/generators/application/lib/create-application-files.js +1 -0
- package/src/generators/application/lib/normalize-options.js +1 -1
- package/src/generators/application/schema.d.ts +1 -0
- package/src/generators/application/schema.json +10 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +3 -3
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +3 -3
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +3 -3
- package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +1 -1
- package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +3 -3
- package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +3 -3
- package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +1 -1
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
package/mf/dynamic-federation.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.setRemoteUrlResolver = setRemoteUrlResolver;
|
|
|
4
4
|
exports.setRemoteDefinitions = setRemoteDefinitions;
|
|
5
5
|
exports.setRemoteDefinition = setRemoteDefinition;
|
|
6
6
|
exports.loadRemoteModule = loadRemoteModule;
|
|
7
|
-
const
|
|
7
|
+
const url_helpers_1 = require("@nx/module-federation/url-helpers");
|
|
8
8
|
let remoteUrlDefinitions = {};
|
|
9
9
|
let resolveRemoteUrl;
|
|
10
10
|
const remoteModuleMap = new Map();
|
|
@@ -132,15 +132,7 @@ async function loadRemoteContainer(remoteName) {
|
|
|
132
132
|
const remoteUrl = remoteUrlDefinitions
|
|
133
133
|
? remoteUrlDefinitions[remoteName]
|
|
134
134
|
: await resolveRemoteUrl(remoteName);
|
|
135
|
-
const
|
|
136
|
-
const ext = (0, node_path_1.extname)(url.pathname);
|
|
137
|
-
const needsRemoteEntry = !['.js', '.mjs', '.json'].includes(ext);
|
|
138
|
-
if (needsRemoteEntry) {
|
|
139
|
-
url.pathname = url.pathname.endsWith('/')
|
|
140
|
-
? `${url.pathname}remoteEntry.mjs`
|
|
141
|
-
: `${url.pathname}/remoteEntry.mjs`;
|
|
142
|
-
}
|
|
143
|
-
const containerUrl = url.href;
|
|
135
|
+
const containerUrl = (0, url_helpers_1.processRuntimeRemoteUrl)(remoteUrl, 'mjs');
|
|
144
136
|
const container = await fetchRemoteModule(containerUrl, remoteName);
|
|
145
137
|
await container.init(__webpack_share_scopes__.default);
|
|
146
138
|
remoteContainerMap.set(remoteName, container);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "21.2.
|
|
3
|
+
"version": "21.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"minimatch": "9.0.3",
|
|
39
39
|
"picocolors": "^1.1.0",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
|
-
"@nx/devkit": "21.2.
|
|
42
|
-
"@nx/js": "21.2.
|
|
43
|
-
"@nx/eslint": "21.2.
|
|
44
|
-
"@nx/web": "21.2.
|
|
45
|
-
"@nx/module-federation": "21.2.
|
|
41
|
+
"@nx/devkit": "21.2.2",
|
|
42
|
+
"@nx/js": "21.2.2",
|
|
43
|
+
"@nx/eslint": "21.2.2",
|
|
44
|
+
"@nx/web": "21.2.2",
|
|
45
|
+
"@nx/module-federation": "21.2.2",
|
|
46
46
|
"express": "^4.21.2",
|
|
47
47
|
"http-proxy-middleware": "^3.0.3",
|
|
48
48
|
"semver": "^7.6.3"
|
|
@@ -18,7 +18,7 @@ async function addE2e(tree, options) {
|
|
|
18
18
|
e2eWebServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
|
|
19
19
|
e2eWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve`,
|
|
20
20
|
e2eCiWebServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx run ${options.projectName}:serve-static`,
|
|
21
|
-
e2eCiBaseUrl: `http://localhost
|
|
21
|
+
e2eCiBaseUrl: `http://localhost:${options.port ?? 4300}`,
|
|
22
22
|
e2eDevServerTarget: `${options.projectName}:serve`,
|
|
23
23
|
};
|
|
24
24
|
if (options.bundler === 'webpack') {
|
|
@@ -32,8 +32,12 @@ async function addE2e(tree, options) {
|
|
|
32
32
|
else if (options.bundler === 'vite') {
|
|
33
33
|
const { getViteE2EWebServerInfo, getReactRouterE2EWebServerInfo } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
34
34
|
e2eWebServerInfo = options.useReactRouter
|
|
35
|
-
? await getReactRouterE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200
|
|
36
|
-
|
|
35
|
+
? await getReactRouterE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200,
|
|
36
|
+
// If the user manually sets the port, then use it for dev and preview
|
|
37
|
+
options.port)
|
|
38
|
+
: await getViteE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, `vite.config.${options.js ? 'js' : 'ts'}`), options.addPlugin, options.devServerPort ?? 4200,
|
|
39
|
+
// If the user manually sets the port, then use it for dev and preview
|
|
40
|
+
options.port);
|
|
37
41
|
}
|
|
38
42
|
else if (options.bundler === 'rsbuild') {
|
|
39
43
|
(0, devkit_1.ensurePackage)('@nx/rsbuild', versions_1.nxVersion);
|
|
@@ -89,7 +89,7 @@ function createRspackBuildTarget(options) {
|
|
|
89
89
|
styles: options.styledModule || !options.hasStyles
|
|
90
90
|
? []
|
|
91
91
|
: [
|
|
92
|
-
(0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/styles.${options.style}`),
|
|
92
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/styles.${options.style === 'tailwind' ? 'css' : options.style}`),
|
|
93
93
|
],
|
|
94
94
|
scripts: [],
|
|
95
95
|
configurations: {
|
|
@@ -151,7 +151,7 @@ function createBuildTarget(options) {
|
|
|
151
151
|
styles: options.styledModule || !options.hasStyles
|
|
152
152
|
? []
|
|
153
153
|
: [
|
|
154
|
-
(0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/styles.${options.style}`),
|
|
154
|
+
(0, devkit_1.joinPathFragments)(options.appProjectRoot, `src/styles.${options.style === 'tailwind' ? 'css' : options.style}`),
|
|
155
155
|
],
|
|
156
156
|
scripts: [],
|
|
157
157
|
webpackConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'webpack.config.js'),
|
|
@@ -33,6 +33,7 @@ async function setupViteConfiguration(tree, options, tasks) {
|
|
|
33
33
|
skipFormat: true,
|
|
34
34
|
addPlugin: options.addPlugin,
|
|
35
35
|
projectType: 'application',
|
|
36
|
+
port: options.port,
|
|
36
37
|
});
|
|
37
38
|
tasks.push(viteTask);
|
|
38
39
|
createOrEditViteConfig(tree, {
|
|
@@ -41,6 +42,8 @@ async function setupViteConfiguration(tree, options, tasks) {
|
|
|
41
42
|
includeVitest: options.unitTestRunner === 'vitest',
|
|
42
43
|
inSourceTests: options.inSourceTests,
|
|
43
44
|
rollupOptionsExternal: ["'react'", "'react-dom'", "'react/jsx-runtime'"],
|
|
45
|
+
port: options.port,
|
|
46
|
+
previewPort: options.port,
|
|
44
47
|
...(options.useReactRouter
|
|
45
48
|
? reactRouterFrameworkConfig
|
|
46
49
|
: baseReactConfig),
|
|
@@ -18,6 +18,7 @@ export declare function getDefaultTemplateVariables(host: Tree, options: Normali
|
|
|
18
18
|
style: "none" | "styled-components" | "@emotion/styled" | "styled-jsx" | "css" | "scss" | "less";
|
|
19
19
|
hasStyleFile: boolean;
|
|
20
20
|
isUsingTsSolutionSetup: boolean;
|
|
21
|
+
port: number;
|
|
21
22
|
projectName: string;
|
|
22
23
|
appProjectRoot: string;
|
|
23
24
|
e2eProjectName: string;
|
|
@@ -36,6 +36,7 @@ function getDefaultTemplateVariables(host, options) {
|
|
|
36
36
|
style: options.style === 'tailwind' ? 'css' : options.style,
|
|
37
37
|
hasStyleFile,
|
|
38
38
|
isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
39
|
+
port: options.port ?? 4200,
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
function createNxRspackPluginOptions(options, rootOffset, tsx = true) {
|
|
@@ -60,7 +60,7 @@ async function normalizeOptions(host, options) {
|
|
|
60
60
|
normalized.unitTestRunner = normalized.unitTestRunner ?? 'jest';
|
|
61
61
|
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
|
62
62
|
normalized.inSourceTests = normalized.minimal || normalized.inSourceTests;
|
|
63
|
-
normalized.devServerPort ??= (0, find_free_port_1.findFreePort)(host);
|
|
63
|
+
normalized.devServerPort ??= options.port ?? (0, find_free_port_1.findFreePort)(host);
|
|
64
64
|
normalized.minimal = normalized.minimal ?? false;
|
|
65
65
|
return normalized;
|
|
66
66
|
}
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
{
|
|
17
17
|
"command": "nx g app apps/myapp --routing",
|
|
18
18
|
"description": "Set up React Router"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"command": "nx g app apps/myapp --port=3000",
|
|
22
|
+
"description": "Set up the dev server to use port 3000"
|
|
19
23
|
}
|
|
20
24
|
],
|
|
21
25
|
"type": "object",
|
|
@@ -196,6 +200,12 @@
|
|
|
196
200
|
"useProjectJson": {
|
|
197
201
|
"type": "boolean",
|
|
198
202
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
203
|
+
},
|
|
204
|
+
"port": {
|
|
205
|
+
"type": "number",
|
|
206
|
+
"description": "The port to use for the development server",
|
|
207
|
+
"x-prompt": "Which port would you like to use for the dev server?",
|
|
208
|
+
"default": 4200
|
|
199
209
|
}
|
|
200
210
|
},
|
|
201
211
|
"required": ["directory"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack';
|
|
1
|
+
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
+
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack.js';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import browserMfConfig from './module-federation.config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
|
|
1
|
+
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
+
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack.js';
|
|
4
4
|
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
|
|
1
|
+
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
+
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack.js';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import config from './module-federation.config';
|
package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederationForSSR} from '@nx/module-federation/webpack';
|
|
3
|
+
import {withModuleFederationForSSR} from '@nx/module-federation/webpack.js';
|
|
4
4
|
|
|
5
5
|
import baseConfig from './module-federation.config';
|
|
6
6
|
|
package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { composePlugins, withNx } from '@nx/webpack';
|
|
2
2
|
import { withReact } from '@nx/react';
|
|
3
|
-
import { withModuleFederation } from '@nx/module-federation/webpack';
|
|
3
|
+
import { withModuleFederation } from '@nx/module-federation/webpack.js';
|
|
4
4
|
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
|
|
6
6
|
import baseConfig from './module-federation.config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederation} from '@nx/module-federation/webpack';
|
|
3
|
+
import {withModuleFederation} from '@nx/module-federation/webpack.js';
|
|
4
4
|
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
5
5
|
|
|
6
6
|
import baseConfig from './module-federation.config';
|
package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack';
|
|
1
|
+
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
+
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationSSRDevServerPlugin } from '@nx/module-federation/rspack.js';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import browserMfConfig from './module-federation.config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
|
|
2
|
-
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
|
|
3
|
-
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
|
|
1
|
+
import { NxAppRspackPlugin } from '@nx/rspack/app-plugin.js';
|
|
2
|
+
import { NxReactRspackPlugin } from '@nx/rspack/react-plugin.js';
|
|
3
|
+
import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack.js';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
6
|
import config from './module-federation.config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederationForSSR} from '@nx/module-federation/webpack';
|
|
3
|
+
import {withModuleFederationForSSR} from '@nx/module-federation/webpack.js';
|
|
4
4
|
|
|
5
5
|
import baseConfig from "./module-federation.server.config";
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {composePlugins, withNx} from '@nx/webpack';
|
|
2
2
|
import {withReact} from '@nx/react';
|
|
3
|
-
import {withModuleFederation} from '@nx/module-federation/webpack';
|
|
3
|
+
import {withModuleFederation} from '@nx/module-federation/webpack.js';
|
|
4
4
|
|
|
5
5
|
import baseConfig from './module-federation.config';
|
|
6
6
|
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare const isbotVersion = "^3.6.5";
|
|
|
45
45
|
export declare const corsVersion = "~2.8.5";
|
|
46
46
|
export declare const typesCorsVersion = "~2.8.12";
|
|
47
47
|
export declare const moduleFederationNodeVersion = "^2.6.26";
|
|
48
|
-
export declare const moduleFederationEnhancedVersion = "^0.
|
|
48
|
+
export declare const moduleFederationEnhancedVersion = "^0.15.0";
|
|
49
49
|
export declare const lessVersion = "3.12.2";
|
|
50
50
|
export declare const sassVersion = "^1.55.0";
|
|
51
51
|
export declare const rollupPluginUrlVersion = "^8.0.2";
|
package/src/utils/versions.js
CHANGED
|
@@ -52,7 +52,7 @@ exports.isbotVersion = '^3.6.5';
|
|
|
52
52
|
exports.corsVersion = '~2.8.5';
|
|
53
53
|
exports.typesCorsVersion = '~2.8.12';
|
|
54
54
|
exports.moduleFederationNodeVersion = '^2.6.26';
|
|
55
|
-
exports.moduleFederationEnhancedVersion = '^0.
|
|
55
|
+
exports.moduleFederationEnhancedVersion = '^0.15.0';
|
|
56
56
|
// style preprocessors
|
|
57
57
|
exports.lessVersion = '3.12.2';
|
|
58
58
|
exports.sassVersion = '^1.55.0';
|