@nx/react 20.3.0-canary.20241219-2eb5243 → 20.3.0-rc.0
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/migrations.json +6 -0
- package/package.json +6 -6
- package/src/generators/application/lib/add-e2e.js +2 -1
- package/src/generators/host/host.js +1 -0
- package/src/generators/remote/remote.js +1 -0
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +6 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts +2 -0
- package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +18 -0
- package/src/utils/has-rsbuild-plugin.d.ts +1 -1
- package/src/utils/has-rsbuild-plugin.js +5 -5
package/migrations.json
CHANGED
@@ -41,6 +41,12 @@
|
|
41
41
|
"version": "20.2.0-beta.2",
|
42
42
|
"description": "Update the withModuleFederation import use @nx/module-federation/webpack.",
|
43
43
|
"factory": "./src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package"
|
44
|
+
},
|
45
|
+
"ensure-nx-module-federation-package": {
|
46
|
+
"cli": "nx",
|
47
|
+
"version": "20.3.0-beta.2",
|
48
|
+
"description": "If workspace includes Module Federation projects, ensure the new @nx/module-federation package is installed.",
|
49
|
+
"factory": "./src/migrations/update-20-3-0/ensure-nx-module-federation-package"
|
44
50
|
}
|
45
51
|
},
|
46
52
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/react",
|
3
|
-
"version": "20.3.0-
|
3
|
+
"version": "20.3.0-rc.0",
|
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": "20.3.0-
|
42
|
-
"@nx/js": "20.3.0-
|
43
|
-
"@nx/eslint": "20.3.0-
|
44
|
-
"@nx/web": "20.3.0-
|
45
|
-
"@nx/module-federation": "20.3.0-
|
41
|
+
"@nx/devkit": "20.3.0-rc.0",
|
42
|
+
"@nx/js": "20.3.0-rc.0",
|
43
|
+
"@nx/eslint": "20.3.0-rc.0",
|
44
|
+
"@nx/web": "20.3.0-rc.0",
|
45
|
+
"@nx/module-federation": "20.3.0-rc.0",
|
46
46
|
"express": "^4.19.2",
|
47
47
|
"http-proxy-middleware": "^3.0.3"
|
48
48
|
},
|
@@ -13,7 +13,8 @@ const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaul
|
|
13
13
|
async function addE2e(tree, options) {
|
14
14
|
const hasNxBuildPlugin = (options.bundler === 'webpack' && (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) ||
|
15
15
|
(options.bundler === 'rspack' && (0, has_rspack_plugin_1.hasRspackPlugin)(tree)) ||
|
16
|
-
(options.bundler === 'rsbuild' &&
|
16
|
+
(options.bundler === 'rsbuild' &&
|
17
|
+
(await (0, has_rsbuild_plugin_1.hasRsbuildPlugin)(tree, options.appProjectRoot))) ||
|
17
18
|
(options.bundler === 'vite' && (0, has_vite_plugin_1.hasVitePlugin)(tree));
|
18
19
|
let e2eWebServerInfo = {
|
19
20
|
e2eWebServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
|
@@ -107,6 +107,7 @@ async function hostGenerator(host, schema) {
|
|
107
107
|
(0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host);
|
108
108
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, { '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion }, {
|
109
109
|
'@nx/web': versions_1.nxVersion,
|
110
|
+
'@nx/module-federation': versions_1.nxVersion,
|
110
111
|
});
|
111
112
|
tasks.push(installTask);
|
112
113
|
if (!options.skipFormat) {
|
@@ -126,6 +126,7 @@ async function remoteGenerator(host, schema) {
|
|
126
126
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
127
127
|
'@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
|
128
128
|
'@nx/web': versions_1.nxVersion,
|
129
|
+
'@nx/module-federation': versions_1.nxVersion,
|
129
130
|
});
|
130
131
|
tasks.push(installTask);
|
131
132
|
if (!options.skipFormat) {
|
@@ -4,6 +4,7 @@ exports.default = migrateWithMfImport;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
7
|
+
const versions_1 = require("../../utils/versions");
|
7
8
|
const NX_RSPACK_MODULE_FEDERATION_IMPORT_SELECTOR = 'ImportDeclaration > StringLiteral[value=@nx/react/module-federation], VariableStatement CallExpression:has(Identifier[name=require]) > StringLiteral[value=@nx/react/module-federation]';
|
8
9
|
const NEW_IMPORT_PATH = `'@nx/module-federation/webpack'`;
|
9
10
|
async function migrateWithMfImport(tree) {
|
@@ -31,5 +32,10 @@ async function migrateWithMfImport(tree) {
|
|
31
32
|
tree.write(filePath, contents);
|
32
33
|
});
|
33
34
|
}
|
35
|
+
if (projects.size !== 0) {
|
36
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
37
|
+
'@nx/module-federation': versions_1.nxVersion,
|
38
|
+
});
|
39
|
+
}
|
34
40
|
await (0, devkit_1.formatFiles)(tree);
|
35
41
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = ensureMfPackage;
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
5
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
6
|
+
const versions_1 = require("../../utils/versions");
|
7
|
+
async function ensureMfPackage(tree) {
|
8
|
+
const projects = new Set();
|
9
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/react:module-federation-dev-server', (options, project, target) => {
|
10
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, project);
|
11
|
+
projects.add(projectConfig.root);
|
12
|
+
});
|
13
|
+
if (projects.size !== 0) {
|
14
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
15
|
+
'@nx/module-federation': versions_1.nxVersion,
|
16
|
+
});
|
17
|
+
}
|
18
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
2
|
-
export declare function hasRsbuildPlugin(tree: Tree): boolean
|
2
|
+
export declare function hasRsbuildPlugin(tree: Tree, projectPath?: string): Promise<boolean>;
|
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.hasRsbuildPlugin = hasRsbuildPlugin;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
const versions_1 = require("./versions");
|
6
|
+
async function hasRsbuildPlugin(tree, projectPath) {
|
7
|
+
(0, devkit_1.ensurePackage)('@nx/rsbuild', versions_1.nxVersion);
|
8
|
+
const { hasRsbuildPlugin } = await Promise.resolve().then(() => require('@nx/rsbuild/config-utils'));
|
9
|
+
return hasRsbuildPlugin(tree, projectPath);
|
10
10
|
}
|