@nx/react 0.0.0-pr-29114-4447aa0 → 0.0.0-pr-29156-41ae81c
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 +6 -6
- package/src/generators/application/application.js +4 -0
- package/src/generators/application/lib/add-e2e.js +0 -2
- package/src/generators/application/lib/add-project-root-to-rspack-plugin-excludes.d.ts +2 -0
- package/src/generators/application/lib/add-project-root-to-rspack-plugin-excludes.js +31 -0
- package/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +1 -1
- package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +1 -1
- package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +0 -3
- package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +2 -2
- package/src/utils/build-static.remotes.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29156-41ae81c",
|
|
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": "0.0.0-pr-
|
|
42
|
-
"@nx/js": "0.0.0-pr-
|
|
43
|
-
"@nx/eslint": "0.0.0-pr-
|
|
44
|
-
"@nx/web": "0.0.0-pr-
|
|
45
|
-
"@nx/module-federation": "0.0.0-pr-
|
|
41
|
+
"@nx/devkit": "0.0.0-pr-29156-41ae81c",
|
|
42
|
+
"@nx/js": "0.0.0-pr-29156-41ae81c",
|
|
43
|
+
"@nx/eslint": "0.0.0-pr-29156-41ae81c",
|
|
44
|
+
"@nx/web": "0.0.0-pr-29156-41ae81c",
|
|
45
|
+
"@nx/module-federation": "0.0.0-pr-29156-41ae81c",
|
|
46
46
|
"express": "^4.19.2",
|
|
47
47
|
"http-proxy-middleware": "^3.0.3"
|
|
48
48
|
},
|
|
@@ -27,6 +27,7 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
|
27
27
|
const setup_tailwind_1 = require("../setup-tailwind/setup-tailwind");
|
|
28
28
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
29
29
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
30
|
+
const add_project_root_to_rspack_plugin_excludes_1 = require("./lib/add-project-root-to-rspack-plugin-excludes");
|
|
30
31
|
async function addLinting(host, options) {
|
|
31
32
|
const tasks = [];
|
|
32
33
|
if (options.linter === eslint_1.Linter.EsLint) {
|
|
@@ -170,6 +171,9 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
170
171
|
plugins: ['react()'],
|
|
171
172
|
}, false);
|
|
172
173
|
}
|
|
174
|
+
else if (options.bundler === 'rspack') {
|
|
175
|
+
(0, add_project_root_to_rspack_plugin_excludes_1.addProjectRootToRspackPluginExcludesIfExists)(host, options.appProjectRoot);
|
|
176
|
+
}
|
|
173
177
|
if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') {
|
|
174
178
|
const { createOrEditViteConfig, vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
175
179
|
const vitestTask = await vitestGenerator(host, {
|
|
@@ -6,12 +6,10 @@ const web_1 = require("@nx/web");
|
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
7
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
8
8
|
const has_vite_plugin_1 = require("../../../utils/has-vite-plugin");
|
|
9
|
-
const has_rspack_plugin_1 = require("../../../utils/has-rspack-plugin");
|
|
10
9
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
11
10
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
12
11
|
async function addE2e(tree, options) {
|
|
13
12
|
const hasNxBuildPlugin = (options.bundler === 'webpack' && (0, has_webpack_plugin_1.hasWebpackPlugin)(tree)) ||
|
|
14
|
-
(options.bundler === 'rspack' && (0, has_rspack_plugin_1.hasRspackPlugin)(tree)) ||
|
|
15
13
|
(options.bundler === 'vite' && (0, has_vite_plugin_1.hasVitePlugin)(tree));
|
|
16
14
|
let e2eWebServerInfo = {
|
|
17
15
|
e2eWebServerAddress: `http://localhost:${options.devServerPort ?? 4200}`,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addProjectRootToRspackPluginExcludesIfExists = addProjectRootToRspackPluginExcludesIfExists;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const devkit_2 = require("@nx/devkit");
|
|
6
|
+
function addProjectRootToRspackPluginExcludesIfExists(tree, projectRoot) {
|
|
7
|
+
const excludeProjectGlob = (0, devkit_1.joinPathFragments)(projectRoot, '/**');
|
|
8
|
+
const nxJson = (0, devkit_2.readNxJson)(tree);
|
|
9
|
+
if (!nxJson.plugins?.length) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (let i = 0; i < nxJson.plugins.length; i++) {
|
|
13
|
+
let plugin = nxJson.plugins[i];
|
|
14
|
+
const isRspackPlugin = typeof plugin === 'string'
|
|
15
|
+
? plugin === '@nx/rspack/plugin'
|
|
16
|
+
: plugin.plugin === '@nx/rspack/plugin';
|
|
17
|
+
if (isRspackPlugin) {
|
|
18
|
+
if (typeof plugin === 'string') {
|
|
19
|
+
plugin = {
|
|
20
|
+
plugin: plugin,
|
|
21
|
+
exclude: [excludeProjectGlob],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
plugin.exclude = [...(plugin.exclude ?? []), excludeProjectGlob];
|
|
26
|
+
}
|
|
27
|
+
nxJson.plugins[i] = plugin;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
31
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
2
|
-
const { withModuleFederation } = require('@nx/module-federation
|
|
2
|
+
const { withModuleFederation } = require('@nx/rspack/module-federation');
|
|
3
3
|
|
|
4
4
|
const baseConfig = require('./module-federation.config');
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
2
|
-
const { withModuleFederation } = require('@nx/module-federation
|
|
2
|
+
const { withModuleFederation } = require('@nx/rspack/module-federation');
|
|
3
3
|
|
|
4
4
|
const baseConfig = require('./module-federation.config');
|
|
5
5
|
|
package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const {composePlugins, withNx, withReact} = require('@nx/rspack');
|
|
2
|
-
const {withModuleFederationForSSR} = require('@nx/module-federation
|
|
2
|
+
const {withModuleFederationForSSR} = require('@nx/rspack/module-federation');
|
|
3
3
|
|
|
4
4
|
const baseConfig = require('./module-federation.config');
|
|
5
5
|
|
package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {composePlugins, withNx, withReact} from '@nx/rspack';
|
|
2
|
-
import {withModuleFederationForSSR} from '@nx/module-federation
|
|
2
|
+
import {withModuleFederationForSSR} from '@nx/rspack/module-federation';
|
|
3
3
|
|
|
4
4
|
import baseConfig from './module-federation.config';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { composePlugins, withNx, withReact } from '@nx/rspack';
|
|
2
|
-
import { withModuleFederation } from '@nx/module-federation
|
|
2
|
+
import { withModuleFederation } from '@nx/rspack/module-federation';
|
|
3
3
|
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
4
4
|
|
|
5
5
|
import baseConfig from './module-federation.config';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {composePlugins, withNx, withReact} from '@nx/rspack';
|
|
2
|
-
import { withModuleFederation } from '@nx/module-federation
|
|
2
|
+
import { withModuleFederation } from '@nx/rspack/module-federation';
|
|
3
3
|
import { ModuleFederationConfig } from '@nx/module-federation';
|
|
4
4
|
|
|
5
5
|
import baseConfig from './module-federation.config';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { composePlugins, withNx, withReact } = require('@nx/rspack');
|
|
2
|
-
const { withModuleFederation } = require('@nx/module-federation
|
|
2
|
+
const { withModuleFederation } = require('@nx/rspack/module-federation');
|
|
3
3
|
|
|
4
4
|
const baseConfig = require('./module-federation.config');
|
|
5
5
|
|
package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const {composePlugins, withNx, withReact} = require('@nx/rspack');
|
|
2
|
-
const {withModuleFederationForSSR} = require('@nx/module-federation
|
|
2
|
+
const {withModuleFederationForSSR} = require('@nx/rspack/module-federation');
|
|
3
3
|
|
|
4
4
|
const baseConfig = require("./module-federation.server.config");
|
|
5
5
|
|
package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {composePlugins, withNx, withReact} from '@nx/rspack';
|
|
2
|
-
import {withModuleFederationForSSR} from '@nx/module-federation
|
|
2
|
+
import {withModuleFederationForSSR} from '@nx/rspack/module-federation';
|
|
3
3
|
|
|
4
4
|
import baseConfig from "./module-federation.server.config";
|
|
5
5
|
|
|
@@ -14,9 +14,6 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
14
14
|
const rootsToCheck = new Set();
|
|
15
15
|
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
16
16
|
for (const [project, dependencies] of Object.entries(graph.dependencies)) {
|
|
17
|
-
if (!graph.nodes[project]) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
17
|
const usesNxWebpackOrRspack = dependencies.some((dep) => dep.target === 'npm:@nx/webpack' || dep.target === 'npm:@nx/rspack');
|
|
21
18
|
if (usesNxWebpackOrRspack) {
|
|
22
19
|
const root = graph.nodes[project].data.root;
|
|
@@ -4,7 +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
|
|
7
|
+
const NX_ANGULAR_MODULE_FEDERATION_IMPORT_SELECTOR = 'ImportDeclaration > StringLiteral[value=@nx/react/module-federation], VariableStatement CallExpression:has(Identifier[name=require]) > StringLiteral[value=@nx/react/module-federation]';
|
|
8
8
|
const NEW_IMPORT_PATH = `'@nx/module-federation/webpack'`;
|
|
9
9
|
async function migrateWithMfImport(tree) {
|
|
10
10
|
const projects = new Set();
|
|
@@ -22,7 +22,7 @@ async function migrateWithMfImport(tree) {
|
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
const ast = tsquery_1.tsquery.ast(contents);
|
|
25
|
-
const importNodes = (0, tsquery_1.tsquery)(ast,
|
|
25
|
+
const importNodes = (0, tsquery_1.tsquery)(ast, NX_ANGULAR_MODULE_FEDERATION_IMPORT_SELECTOR);
|
|
26
26
|
if (importNodes.length === 0) {
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StaticRemotesConfig } from '@nx/module-federation/
|
|
1
|
+
import type { StaticRemotesConfig } from '@nx/webpack/src/utils/module-federation/parse-static-remotes-config';
|
|
2
2
|
import { ExecutorContext } from '@nx/devkit';
|
|
3
3
|
import { ModuleFederationDevServerOptions } from '../executors/module-federation-dev-server/schema';
|
|
4
4
|
export declare function buildStaticRemotes(staticRemotesConfig: StaticRemotesConfig, nxBin: any, context: ExecutorContext, options: ModuleFederationDevServerOptions): Promise<Record<string, string>>;
|