@nx/react 23.2.0-beta.4 → 23.2.0-beta.5
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/dist/internal.d.ts +1 -0
- package/dist/internal.js +3 -1
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +11 -7
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +10 -6
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +2 -2
- package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +14 -9
- package/dist/src/generators/application/lib/create-application-files.js +3 -3
- package/dist/src/generators/application/lib/find-free-port.d.ts +1 -1
- package/dist/src/generators/cypress-component-configuration/lib/add-files.js +3 -3
- package/dist/src/generators/host/host.js +8 -0
- package/dist/src/generators/library/lib/add-linting.d.ts +1 -2
- package/dist/src/generators/library/lib/add-linting.js +1 -2
- package/dist/src/generators/library/lib/add-rollup-build-target.d.ts +1 -2
- package/dist/src/generators/library/lib/determine-entry-fields.d.ts +1 -1
- package/dist/src/generators/remote/lib/setup-tspath-for-remote.js +3 -2
- package/dist/src/generators/remote/remote.js +8 -0
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.d.ts +2 -0
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.js +61 -0
- package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.md +37 -0
- package/dist/src/migrations/update-23-2-0/add-svgr-webpack-if-used.d.ts +2 -0
- package/dist/src/migrations/update-23-2-0/add-svgr-webpack-if-used.js +55 -0
- package/dist/src/migrations/update-23-2-0/add-svgr-webpack-if-used.md +28 -0
- package/dist/src/plugins/router-plugin.js +2 -4
- package/dist/src/utils/assert-package.d.ts +1 -0
- package/dist/src/utils/assert-package.js +17 -0
- package/dist/src/utils/create-ts-config.d.ts +1 -1
- package/dist/src/utils/create-ts-config.js +5 -5
- package/dist/src/utils/versions.d.ts +2 -0
- package/dist/src/utils/versions.js +3 -1
- package/migrations.json +12 -0
- package/package.json +32 -20
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { addE2e } from './src/generators/application/lib/add-e2e';
|
|
2
2
|
export { addRollupBuildTarget } from './src/generators/library/lib/add-rollup-build-target';
|
|
3
|
+
export { assertPackageIsInstalled } from './src/utils/assert-package';
|
|
3
4
|
export { isComponent } from './src/utils/ct-utils';
|
|
4
5
|
export { suppressReactComposeHelperWarnings } from './src/utils/deprecation';
|
|
5
6
|
export { hasWebpackPlugin } from './src/utils/has-webpack-plugin';
|
package/dist/internal.js
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
// internal consumers and may change without semver protection. Mirrors
|
|
6
6
|
// `@nx/devkit/internal`.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.babelPresetReactVersion = exports.babelCoreVersion = exports.testingLibraryReactVersion = exports.testingLibraryDomVersion = exports.isReact18 = exports.getReactDependenciesVersionsToInstall = exports.hasWebpackPlugin = exports.suppressReactComposeHelperWarnings = exports.isComponent = exports.addRollupBuildTarget = exports.addE2e = void 0;
|
|
8
|
+
exports.babelPresetReactVersion = exports.babelCoreVersion = exports.testingLibraryReactVersion = exports.testingLibraryDomVersion = exports.isReact18 = exports.getReactDependenciesVersionsToInstall = exports.hasWebpackPlugin = exports.suppressReactComposeHelperWarnings = exports.isComponent = exports.assertPackageIsInstalled = exports.addRollupBuildTarget = exports.addE2e = void 0;
|
|
9
9
|
var add_e2e_1 = require("./src/generators/application/lib/add-e2e");
|
|
10
10
|
Object.defineProperty(exports, "addE2e", { enumerable: true, get: function () { return add_e2e_1.addE2e; } });
|
|
11
11
|
var add_rollup_build_target_1 = require("./src/generators/library/lib/add-rollup-build-target");
|
|
12
12
|
Object.defineProperty(exports, "addRollupBuildTarget", { enumerable: true, get: function () { return add_rollup_build_target_1.addRollupBuildTarget; } });
|
|
13
|
+
var assert_package_1 = require("./src/utils/assert-package");
|
|
14
|
+
Object.defineProperty(exports, "assertPackageIsInstalled", { enumerable: true, get: function () { return assert_package_1.assertPackageIsInstalled; } });
|
|
13
15
|
var ct_utils_1 = require("./src/utils/ct-utils");
|
|
14
16
|
Object.defineProperty(exports, "isComponent", { enumerable: true, get: function () { return ct_utils_1.isComponent; } });
|
|
15
17
|
var deprecation_1 = require("./src/utils/deprecation");
|
package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js
CHANGED
|
@@ -4,18 +4,22 @@ exports.default = moduleFederationDevServer;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const internal_2 = require("@nx/js/internal");
|
|
7
|
-
const internal_3 = require("@nx/
|
|
8
|
-
const internal_4 = require("@nx/web/internal");
|
|
9
|
-
const webpack_1 = require("@nx/webpack");
|
|
7
|
+
const internal_3 = require("@nx/web/internal");
|
|
10
8
|
const fs_1 = require("fs");
|
|
11
9
|
const path_1 = require("path");
|
|
12
10
|
const lib_1 = require("./lib");
|
|
11
|
+
const assert_package_1 = require("../../utils/assert-package");
|
|
13
12
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
13
|
+
const executorName = '@nx/react:module-federation-dev-server';
|
|
14
14
|
async function* moduleFederationDevServer(schema, context) {
|
|
15
|
+
(0, assert_package_1.assertPackageIsInstalled)('@nx/module-federation', executorName);
|
|
16
|
+
(0, assert_package_1.assertPackageIsInstalled)('@nx/webpack', executorName);
|
|
17
|
+
const { startRemoteIterators } = await import('@nx/module-federation/internal');
|
|
18
|
+
const { devServerExecutor } = await import('@nx/webpack');
|
|
15
19
|
(0, module_federation_deprecation_1.warnReactMfDevServerExecutorDeprecation)();
|
|
16
20
|
const options = (0, lib_1.normalizeOptions)(schema);
|
|
17
21
|
const currIter = options.static
|
|
18
|
-
? (0,
|
|
22
|
+
? (0, internal_3.fileServerExecutor)({
|
|
19
23
|
...options,
|
|
20
24
|
parallel: false,
|
|
21
25
|
withDeps: false,
|
|
@@ -24,7 +28,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
|
24
28
|
cacheSeconds: -1,
|
|
25
29
|
}, context)
|
|
26
30
|
: // TODO(JamesHenry): remove type assertion once the nx repo is updated to use https://github.com/nrwl/nx/pull/33095
|
|
27
|
-
|
|
31
|
+
devServerExecutor(options, context);
|
|
28
32
|
const p = context.projectsConfigurations.projects[context.projectName];
|
|
29
33
|
let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(p), 'assets/module-federation.manifest.json');
|
|
30
34
|
if (options.pathToManifestFile) {
|
|
@@ -40,7 +44,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
|
40
44
|
if (!options.isInitialHost) {
|
|
41
45
|
return yield* currIter;
|
|
42
46
|
}
|
|
43
|
-
const { staticRemotesIter, devRemoteIters, remotes } = await
|
|
47
|
+
const { staticRemotesIter, devRemoteIters, remotes } = await startRemoteIterators(options, context, lib_1.startRemotes, pathToManifestFile, 'react');
|
|
44
48
|
return yield* (0, internal_1.combineAsyncIterables)(currIter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
|
|
45
49
|
if (!options.isInitialHost) {
|
|
46
50
|
done();
|
|
@@ -56,7 +60,7 @@ async function* moduleFederationDevServer(schema, context) {
|
|
|
56
60
|
const portsToWaitFor = staticRemotesIter && options.staticRemotesPort
|
|
57
61
|
? [options.staticRemotesPort, ...remotes.remotePorts]
|
|
58
62
|
: [...remotes.remotePorts];
|
|
59
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
63
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_3.waitForPortOpen)(port, {
|
|
60
64
|
retries: 480,
|
|
61
65
|
retryDelay: 2500,
|
|
62
66
|
host: host,
|
package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -4,18 +4,22 @@ exports.default = moduleFederationSsrDevServer;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const internal_2 = require("@nx/js/internal");
|
|
7
|
-
const internal_3 = require("@nx/
|
|
8
|
-
const internal_4 = require("@nx/web/internal");
|
|
9
|
-
const internal_5 = require("@nx/webpack/internal");
|
|
7
|
+
const internal_3 = require("@nx/web/internal");
|
|
10
8
|
const fs_1 = require("fs");
|
|
11
9
|
const path_1 = require("path");
|
|
12
10
|
const lib_1 = require("./lib");
|
|
11
|
+
const assert_package_1 = require("../../utils/assert-package");
|
|
13
12
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
13
|
+
const executorName = '@nx/react:module-federation-ssr-dev-server';
|
|
14
14
|
async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
15
|
+
(0, assert_package_1.assertPackageIsInstalled)('@nx/module-federation', executorName);
|
|
16
|
+
(0, assert_package_1.assertPackageIsInstalled)('@nx/webpack', executorName);
|
|
17
|
+
const { startRemoteIterators } = await import('@nx/module-federation/internal');
|
|
18
|
+
const { ssrDevServerExecutor } = await import('@nx/webpack/internal');
|
|
15
19
|
(0, module_federation_deprecation_1.warnReactMfSsrDevServerExecutorDeprecation)();
|
|
16
20
|
const options = (0, lib_1.normalizeOptions)(ssrDevServerOptions);
|
|
17
21
|
// TODO(JamesHenry): remove type assertion once the nx repo is updated to use https://github.com/nrwl/nx/pull/33095
|
|
18
|
-
let iter =
|
|
22
|
+
let iter = ssrDevServerExecutor(options, context);
|
|
19
23
|
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
20
24
|
let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(projectConfig), 'assets/module-federation.manifest.json');
|
|
21
25
|
if (options.pathToManifestFile) {
|
|
@@ -31,7 +35,7 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
31
35
|
if (!options.isInitialHost) {
|
|
32
36
|
return yield* iter;
|
|
33
37
|
}
|
|
34
|
-
const { staticRemotesIter, devRemoteIters, remotes } = await
|
|
38
|
+
const { staticRemotesIter, devRemoteIters, remotes } = await startRemoteIterators(options, context, lib_1.startRemotes, pathToManifestFile, 'react', true);
|
|
35
39
|
const combined = (0, internal_1.combineAsyncIterables)(staticRemotesIter, ...devRemoteIters);
|
|
36
40
|
let refs = 1 + (devRemoteIters?.length ?? 0);
|
|
37
41
|
for await (const result of combined) {
|
|
@@ -59,7 +63,7 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
|
59
63
|
const portsToWaitFor = staticRemotesIter && options.staticRemotesPort
|
|
60
64
|
? [options.staticRemotesPort, ...remotes.remotePorts]
|
|
61
65
|
: [...remotes.remotePorts];
|
|
62
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
66
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_3.waitForPortOpen)(port, {
|
|
63
67
|
retries: 480,
|
|
64
68
|
retryDelay: 2500,
|
|
65
69
|
host,
|
package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import type { StaticRemotesConfig } from '@nx/module-federation/internal';
|
|
3
3
|
import { ModuleFederationDevServerOptions } from '../module-federation-dev-server/schema';
|
|
4
4
|
import { ModuleFederationStaticServerSchema } from './schema';
|
|
5
5
|
export declare function startProxies(staticRemotesConfig: StaticRemotesConfig, hostServeOptions: ModuleFederationDevServerOptions, mappedLocationOfHost: string, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js
CHANGED
|
@@ -5,8 +5,8 @@ exports.default = moduleFederationStaticServer;
|
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const internal_2 = require("@nx/js/internal");
|
|
8
|
-
const internal_3 = require("@nx/
|
|
9
|
-
const
|
|
8
|
+
const internal_3 = require("@nx/web/internal");
|
|
9
|
+
const assert_package_1 = require("../../utils/assert-package");
|
|
10
10
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const fs_1 = require("fs");
|
|
@@ -157,21 +157,26 @@ function startProxies(staticRemotesConfig, hostServeOptions, mappedLocationOfHos
|
|
|
157
157
|
devkit_1.logger.info('NX Static Consumer (host) proxy started successfully');
|
|
158
158
|
}
|
|
159
159
|
async function* moduleFederationStaticServer(schema, context) {
|
|
160
|
+
const executorName = '@nx/react:module-federation-static-server';
|
|
161
|
+
(0, assert_package_1.assertPackageIsInstalled)('@nx/module-federation', executorName);
|
|
162
|
+
(0, assert_package_1.assertPackageIsInstalled)('express', executorName);
|
|
163
|
+
(0, assert_package_1.assertPackageIsInstalled)('http-proxy-middleware', executorName);
|
|
164
|
+
const { buildStaticRemotes, getModuleFederationConfig, getRemotes, parseStaticRemotesConfig, } = await import('@nx/module-federation/internal');
|
|
160
165
|
(0, module_federation_deprecation_1.warnReactMfStaticServerExecutorDeprecation)();
|
|
161
166
|
// Force Node to resolve to look for the nx binary that is inside node_modules
|
|
162
167
|
const nxBin = require.resolve('nx/bin/nx');
|
|
163
168
|
// Get the remotes from the module federation config
|
|
164
169
|
const p = context.projectsConfigurations.projects[context.projectName];
|
|
165
170
|
const options = getBuildAndServeOptionsFromServeTarget(schema.serveTarget, context);
|
|
166
|
-
const moduleFederationConfig =
|
|
167
|
-
const remotes =
|
|
171
|
+
const moduleFederationConfig = getModuleFederationConfig(options.buildOptions.tsConfig, context.root, p.root, 'react');
|
|
172
|
+
const remotes = getRemotes([], options.serveOptions.skipRemotes, moduleFederationConfig, {
|
|
168
173
|
projectName: context.projectName,
|
|
169
174
|
projectGraph: context.projectGraph,
|
|
170
175
|
root: context.root,
|
|
171
176
|
}, options.pathToManifestFile);
|
|
172
|
-
const staticRemotesConfig =
|
|
177
|
+
const staticRemotesConfig = parseStaticRemotesConfig([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
|
173
178
|
options.serveOptions.staticRemotesPort ??= remotes.staticRemotePort;
|
|
174
|
-
const mappedLocationsOfStaticRemotes = await
|
|
179
|
+
const mappedLocationsOfStaticRemotes = await buildStaticRemotes(staticRemotesConfig, nxBin, context, options.serveOptions);
|
|
175
180
|
// Build the host
|
|
176
181
|
const hostUrlSegment = (0, path_1.basename)(options.buildOptions.outputPath);
|
|
177
182
|
const mappedLocationOfHost = `http${options.serveOptions.ssl ? 's' : ''}://${options.serveOptions.host}:${options.serveOptions.staticRemotesPort}/${hostUrlSegment}`;
|
|
@@ -179,7 +184,7 @@ async function* moduleFederationStaticServer(schema, context) {
|
|
|
179
184
|
// Move to a temporary directory
|
|
180
185
|
const commonOutputDirectory = moveToTmpDirectory(staticRemotesConfig, options.buildOptions.outputPath, hostUrlSegment);
|
|
181
186
|
// File Serve the temporary directory
|
|
182
|
-
const staticFileServerIter = (0,
|
|
187
|
+
const staticFileServerIter = (0, internal_3.fileServerExecutor)({
|
|
183
188
|
cors: true,
|
|
184
189
|
watch: false,
|
|
185
190
|
staticFilePath: commonOutputDirectory,
|
|
@@ -205,7 +210,7 @@ async function* moduleFederationStaticServer(schema, context) {
|
|
|
205
210
|
const baseUrl = `http${options.serveOptions.ssl ? 's' : ''}://${host}:${options.serveOptions.port}`;
|
|
206
211
|
if (remotes.remotePorts.length === 0) {
|
|
207
212
|
const portsToWaitFor = [options.serveOptions.staticRemotesPort];
|
|
208
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
213
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_3.waitForPortOpen)(port, {
|
|
209
214
|
retries: 480,
|
|
210
215
|
retryDelay: 2500,
|
|
211
216
|
host: host,
|
|
@@ -219,7 +224,7 @@ async function* moduleFederationStaticServer(schema, context) {
|
|
|
219
224
|
const portsToWaitFor = staticFileServerIter && options.serveOptions.staticRemotesPort
|
|
220
225
|
? [options.serveOptions.staticRemotesPort, ...remotes.remotePorts]
|
|
221
226
|
: [...remotes.remotePorts];
|
|
222
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
227
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_3.waitForPortOpen)(port, {
|
|
223
228
|
retries: 480,
|
|
224
229
|
retryDelay: 2500,
|
|
225
230
|
host: host,
|
|
@@ -11,10 +11,10 @@ const get_in_source_vitest_tests_template_1 = require("../../../utils/get-in-sou
|
|
|
11
11
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
12
12
|
const has_webpack_plugin_1 = require("../../../utils/has-webpack-plugin");
|
|
13
13
|
const get_app_tests_1 = require("./get-app-tests");
|
|
14
|
-
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
15
14
|
const has_rspack_plugin_1 = require("../../../utils/has-rspack-plugin");
|
|
16
15
|
const internal_1 = require("@nx/js/internal");
|
|
17
16
|
const versions_1 = require("../../../utils/versions");
|
|
17
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
18
18
|
function getDefaultTemplateVariables(host, options) {
|
|
19
19
|
const hasStyleFile = ['scss', 'css'].includes(options.style);
|
|
20
20
|
const appTests = (0, get_app_tests_1.getAppTests)(options);
|
|
@@ -69,9 +69,9 @@ async function createApplicationFiles(host, options) {
|
|
|
69
69
|
else {
|
|
70
70
|
styleSolutionSpecificAppFiles = '../files/style-css-module';
|
|
71
71
|
}
|
|
72
|
-
const onBoardingStatus = await (0,
|
|
72
|
+
const onBoardingStatus = await (0, internal_2.createNxCloudOnboardingURLForWelcomeApp)(host, options.nxCloudToken);
|
|
73
73
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
74
|
-
(await (0,
|
|
74
|
+
(await (0, internal_2.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
75
75
|
const relativePathToRootTsConfig = (0, js_1.getRelativePathToRootTsConfig)(host, options.appProjectRoot);
|
|
76
76
|
const templateVariables = getDefaultTemplateVariables(host, options);
|
|
77
77
|
if (options.bundler === 'vite' && !options.useReactRouter) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tree } from 'nx/
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
2
|
export declare function findFreePort(host: Tree): number;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addFiles = addFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
const versions_1 = require("nx/src/utils/versions");
|
|
7
6
|
const ct_utils_1 = require("../../../utils/ct-utils");
|
|
8
7
|
const component_test_1 = require("../../component-test/component-test");
|
|
8
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
9
9
|
async function addFiles(tree, projectConfig, options, found) {
|
|
10
10
|
// must dynamicaly import to prevent packages not using cypress from erroring out
|
|
11
11
|
// when importing react
|
|
@@ -24,11 +24,11 @@ async function addFiles(tree, projectConfig, options, found) {
|
|
|
24
24
|
tree.write(commandFile, `import { mount } from '${moduleSpecifier}';\n${updatedCommandFile}`);
|
|
25
25
|
if (options.bundler === 'webpack' ||
|
|
26
26
|
(!options.bundler && actualBundler === 'webpack')) {
|
|
27
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/webpack':
|
|
27
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/webpack': internal_2.nxVersion }, undefined, true);
|
|
28
28
|
}
|
|
29
29
|
if (options.bundler === 'vite' ||
|
|
30
30
|
(!options.bundler && actualBundler === 'vite')) {
|
|
31
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/vite':
|
|
31
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/vite': internal_2.nxVersion }, undefined, true);
|
|
32
32
|
}
|
|
33
33
|
if (options.generateTests) {
|
|
34
34
|
const filePaths = [];
|
|
@@ -130,6 +130,14 @@ async function hostGenerator(host, schema) {
|
|
|
130
130
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, { '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion }, {
|
|
131
131
|
'@nx/web': versions_1.nxVersion,
|
|
132
132
|
'@nx/module-federation': versions_1.nxVersion,
|
|
133
|
+
// The webpack path also generates a `serve-static` target running the
|
|
134
|
+
// `module-federation-static-server` executor, which proxies via express.
|
|
135
|
+
...(options.bundler !== 'rspack'
|
|
136
|
+
? {
|
|
137
|
+
express: versions_1.expressVersion,
|
|
138
|
+
'http-proxy-middleware': versions_1.httpProxyMiddlewareVersion,
|
|
139
|
+
}
|
|
140
|
+
: {}),
|
|
133
141
|
}, undefined, true);
|
|
134
142
|
tasks.push(installTask);
|
|
135
143
|
if (!options.skipFormat) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Tree } from 'nx/
|
|
2
|
-
import { GeneratorCallback } from '@nx/devkit';
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
3
2
|
import { NormalizedSchema } from '../schema';
|
|
4
3
|
export declare function addLinting(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = addLinting;
|
|
4
4
|
const eslint_1 = require("@nx/eslint");
|
|
5
|
-
const path_1 = require("nx/src/utils/path");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const lint_1 = require("../../../utils/lint");
|
|
8
7
|
const internal_1 = require("@nx/eslint/internal");
|
|
@@ -13,7 +12,7 @@ async function addLinting(host, options) {
|
|
|
13
12
|
linter: options.linter,
|
|
14
13
|
project: options.name,
|
|
15
14
|
tsConfigPaths: [
|
|
16
|
-
(0,
|
|
15
|
+
(0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.lib.json'),
|
|
17
16
|
],
|
|
18
17
|
unitTestRunner: options.unitTestRunner,
|
|
19
18
|
skipFormat: true,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Tree } from 'nx/
|
|
2
|
-
import { GeneratorCallback } from '@nx/devkit';
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
3
2
|
import { NormalizedSchema } from '../schema';
|
|
4
3
|
export declare function addRollupBuildTarget(host: Tree, options: NormalizedSchema & {
|
|
5
4
|
format?: Array<'esm' | 'cjs'>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { PackageJson } from 'nx/src/utils/package-json';
|
|
2
1
|
import type { NormalizedSchema } from '../schema';
|
|
2
|
+
import { type PackageJson } from '@nx/devkit/internal';
|
|
3
3
|
export declare function determineEntryFields(options: NormalizedSchema): Pick<PackageJson, 'main' | 'types' | 'exports'>;
|
|
@@ -4,10 +4,11 @@ exports.setupTspathForRemote = setupTspathForRemote;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const maybe_js_1 = require("../../../utils/maybe-js");
|
|
7
|
-
const
|
|
7
|
+
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
function setupTspathForRemote(tree, options) {
|
|
9
|
+
const { normalizeProjectName } = (0, devkit_1.ensurePackage)('@nx/module-federation', versions_1.nxVersion);
|
|
9
10
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
10
11
|
const exportPath = (0, maybe_js_1.maybeJs)(options, './src/remote-entry.ts');
|
|
11
12
|
const exportName = 'Module';
|
|
12
|
-
(0, js_1.addTsConfigPath)(tree, `${
|
|
13
|
+
(0, js_1.addTsConfigPath)(tree, `${normalizeProjectName(options.projectName)}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
|
|
13
14
|
}
|
|
@@ -173,6 +173,14 @@ async function remoteGenerator(host, schema) {
|
|
|
173
173
|
'@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
|
|
174
174
|
'@nx/web': versions_1.nxVersion,
|
|
175
175
|
'@nx/module-federation': versions_1.nxVersion,
|
|
176
|
+
// The webpack path also generates a `serve-static` target running the
|
|
177
|
+
// `module-federation-static-server` executor, which proxies via express.
|
|
178
|
+
...(options.bundler !== 'rspack'
|
|
179
|
+
? {
|
|
180
|
+
express: versions_1.expressVersion,
|
|
181
|
+
'http-proxy-middleware': versions_1.httpProxyMiddlewareVersion,
|
|
182
|
+
}
|
|
183
|
+
: {}),
|
|
176
184
|
}, undefined, true);
|
|
177
185
|
tasks.push(installTask);
|
|
178
186
|
if (!options.skipFormat) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = addOptionalModuleFederationPackages;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
|
+
const moduleFederationExecutors = new Set([
|
|
7
|
+
'@nx/react:module-federation-dev-server',
|
|
8
|
+
'@nx/react:module-federation-ssr-dev-server',
|
|
9
|
+
'@nx/react:module-federation-static-server',
|
|
10
|
+
]);
|
|
11
|
+
const staticServerExecutor = '@nx/react:module-federation-static-server';
|
|
12
|
+
function collectExecutors(targetDefaults) {
|
|
13
|
+
// targetDefaults are keyed by target name or executor, and a default can set
|
|
14
|
+
// an executor that an empty project target inherits, so scan the keys and any
|
|
15
|
+
// executor on the default (both the object and array forms).
|
|
16
|
+
const executors = [];
|
|
17
|
+
for (const [targetOrExecutor, config] of Object.entries(targetDefaults ?? {})) {
|
|
18
|
+
executors.push(targetOrExecutor);
|
|
19
|
+
for (const entry of Array.isArray(config) ? config : [config]) {
|
|
20
|
+
if (entry.executor != null) {
|
|
21
|
+
executors.push(entry.executor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return executors;
|
|
26
|
+
}
|
|
27
|
+
async function addOptionalModuleFederationPackages(tree) {
|
|
28
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
29
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
30
|
+
let needsModuleFederation = false;
|
|
31
|
+
let needsStaticServer = false;
|
|
32
|
+
for (const [, project] of projects) {
|
|
33
|
+
for (const target of Object.values(project.targets ?? {})) {
|
|
34
|
+
needsModuleFederation ||= moduleFederationExecutors.has(target.executor);
|
|
35
|
+
needsStaticServer ||= target.executor === staticServerExecutor;
|
|
36
|
+
}
|
|
37
|
+
// Remotes get a plain dev-server (no Module Federation executor) but still
|
|
38
|
+
// generate a module-federation.config that requires @nx/module-federation
|
|
39
|
+
// at build time, so detect them by that config file too. This covers
|
|
40
|
+
// remotes whose host lives in a different workspace.
|
|
41
|
+
needsModuleFederation ||=
|
|
42
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
|
43
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js'));
|
|
44
|
+
}
|
|
45
|
+
for (const executor of collectExecutors(nxJson?.targetDefaults)) {
|
|
46
|
+
needsModuleFederation ||= moduleFederationExecutors.has(executor);
|
|
47
|
+
needsStaticServer ||= executor === staticServerExecutor;
|
|
48
|
+
}
|
|
49
|
+
if (!needsModuleFederation && !needsStaticServer) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
53
|
+
...(needsModuleFederation ? { '@nx/module-federation': versions_1.nxVersion } : {}),
|
|
54
|
+
...(needsStaticServer
|
|
55
|
+
? {
|
|
56
|
+
express: versions_1.expressVersion,
|
|
57
|
+
'http-proxy-middleware': versions_1.httpProxyMiddlewareVersion,
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
}, undefined, true);
|
|
61
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#### Add Optional Module Federation Packages
|
|
2
|
+
|
|
3
|
+
Adds `@nx/module-federation`, `express`, and `http-proxy-middleware` to the workspace when existing targets require them.
|
|
4
|
+
|
|
5
|
+
These packages are no longer direct dependencies of `@nx/react`; they are now optional peer dependencies, so installing `@nx/react` no longer pulls the Module Federation toolchain into workspaces that never use it. This migration backfills them for workspaces that already use Module Federation so those builds keep working after upgrading. Packages that are already present are left untouched.
|
|
6
|
+
|
|
7
|
+
A package is added only when a matching target exists:
|
|
8
|
+
|
|
9
|
+
- `@nx/module-federation`: an `@nx/react:module-federation-dev-server`, `@nx/react:module-federation-ssr-dev-server`, or `@nx/react:module-federation-static-server` target, or a project with a `module-federation.config.{js,ts}` file (covers remotes whose host lives in another workspace).
|
|
10
|
+
- `express` and `http-proxy-middleware`: an `@nx/react:module-federation-static-server` target, which proxies the static remotes.
|
|
11
|
+
|
|
12
|
+
Targets that inherit their executor from an `nx.json` `targetDefaults` entry are detected too.
|
|
13
|
+
|
|
14
|
+
#### Examples
|
|
15
|
+
|
|
16
|
+
For a workspace with an `@nx/react:module-federation-dev-server` serve target, the migration adds the Module Federation packages to `devDependencies`.
|
|
17
|
+
|
|
18
|
+
##### Before
|
|
19
|
+
|
|
20
|
+
```jsonc title="package.json"
|
|
21
|
+
{
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@nx/react": "23.1.0",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
##### After
|
|
29
|
+
|
|
30
|
+
```jsonc title="package.json"
|
|
31
|
+
{
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@nx/module-federation": "23.2.0",
|
|
34
|
+
"@nx/react": "23.1.0",
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = addSvgrWebpackIfUsed;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
|
+
// The Nx 22 `add-svgr-to-webpack-config` migration inlined a `withSvgr` helper
|
|
7
|
+
// that resolves `@svgr/webpack` into user webpack configs, but never added the
|
|
8
|
+
// package to the workspace - it only resolved transitively through `@nx/react`.
|
|
9
|
+
// Now that `@nx/react` no longer depends on it, backfill it where a webpack
|
|
10
|
+
// config actually references it.
|
|
11
|
+
const webpackConfigFileNames = [
|
|
12
|
+
'webpack.config.js',
|
|
13
|
+
'webpack.config.ts',
|
|
14
|
+
'webpack.config.cjs',
|
|
15
|
+
'webpack.config.mjs',
|
|
16
|
+
'webpack.config.prod.js',
|
|
17
|
+
'webpack.config.prod.ts',
|
|
18
|
+
'webpack.server.config.js',
|
|
19
|
+
'webpack.server.config.ts',
|
|
20
|
+
];
|
|
21
|
+
async function addSvgrWebpackIfUsed(tree) {
|
|
22
|
+
let needsSvgr = false;
|
|
23
|
+
for (const [, project] of (0, devkit_1.getProjects)(tree)) {
|
|
24
|
+
// Configs referenced by executor targets can live anywhere.
|
|
25
|
+
for (const target of Object.values(project.targets ?? {})) {
|
|
26
|
+
for (const options of [
|
|
27
|
+
target.options,
|
|
28
|
+
...Object.values(target.configurations ?? {}),
|
|
29
|
+
]) {
|
|
30
|
+
const webpackConfig = options?.webpackConfig;
|
|
31
|
+
if (typeof webpackConfig === 'string') {
|
|
32
|
+
needsSvgr ||= referencesSvgrWebpack(tree, webpackConfig);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Inferred setups have no executor options pointing at a config, so also
|
|
37
|
+
// check the conventional config file names at the project root.
|
|
38
|
+
for (const fileName of webpackConfigFileNames) {
|
|
39
|
+
needsSvgr ||= referencesSvgrWebpack(tree, (0, devkit_1.joinPathFragments)(project.root, fileName));
|
|
40
|
+
}
|
|
41
|
+
if (needsSvgr) {
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!needsSvgr) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@svgr/webpack': versions_1.svgrWebpackVersion }, undefined, true);
|
|
49
|
+
}
|
|
50
|
+
function referencesSvgrWebpack(tree, path) {
|
|
51
|
+
if (!tree.exists(path)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
return tree.read(path, 'utf-8').includes('@svgr/webpack');
|
|
55
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#### Add `@svgr/webpack` If Used
|
|
2
|
+
|
|
3
|
+
Adds `@svgr/webpack` to the workspace when a webpack config references it.
|
|
4
|
+
|
|
5
|
+
`@svgr/webpack` is no longer a dependency of `@nx/react`, so workspaces whose webpack configs resolve it - which is what the Nx 22 `add-svgr-to-webpack-config` migration inlined - must declare it themselves. This migration backfills it for those workspaces. Configs referenced by executor targets are checked, as well as the conventional config file names at each project root. Workspaces that already have `@svgr/webpack` are left untouched.
|
|
6
|
+
|
|
7
|
+
#### Examples
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```jsonc title="package.json"
|
|
12
|
+
{
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@nx/react": "23.1.0",
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
##### After
|
|
20
|
+
|
|
21
|
+
```jsonc title="package.json"
|
|
22
|
+
{
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@nx/react": "23.1.0",
|
|
25
|
+
"@svgr/webpack": "^8.0.1",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
```
|
|
@@ -5,18 +5,16 @@ const internal_1 = require("@nx/devkit/internal");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
9
8
|
const js_1 = require("@nx/js");
|
|
10
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
11
9
|
const internal_2 = require("@nx/js/internal");
|
|
12
10
|
const pmCommand = (0, devkit_1.getPackageManagerCommand)();
|
|
13
11
|
const reactRouterConfigBlob = '**/react-router.config.{ts,js,cjs,cts,mjs,mts}';
|
|
14
12
|
exports.createNodes = [
|
|
15
13
|
reactRouterConfigBlob,
|
|
16
14
|
async (configFiles, options, context) => {
|
|
17
|
-
const optionsHash = (0,
|
|
15
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
18
16
|
const normalizedOptions = normalizeOptions(options);
|
|
19
|
-
const cachePath = (0, path_1.join)(
|
|
17
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, `react-router-${optionsHash}.hash`);
|
|
20
18
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
21
19
|
const isUsingTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
22
20
|
const { roots: projectRoots, configFiles: validConfigFiles } = configFiles.reduce((acc, configFile) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertPackageIsInstalled(packageName: string, requiredBy: string): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertPackageIsInstalled = assertPackageIsInstalled;
|
|
4
|
+
function assertPackageIsInstalled(packageName, requiredBy) {
|
|
5
|
+
try {
|
|
6
|
+
require.resolve(packageName);
|
|
7
|
+
}
|
|
8
|
+
catch (e) {
|
|
9
|
+
// Only a missing module means "not installed"; surface other resolution
|
|
10
|
+
// errors (e.g. a malformed package's exports) as-is instead of mislabeling.
|
|
11
|
+
const code = e.code;
|
|
12
|
+
if (code !== 'MODULE_NOT_FOUND' && code !== 'ERR_MODULE_NOT_FOUND') {
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
throw new Error(`The "${packageName}" package is required by "${requiredBy}" but is not installed. Please install it and try again.`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -4,8 +4,8 @@ exports.createTsConfig = createTsConfig;
|
|
|
4
4
|
exports.extractTsConfigBase = extractTsConfigBase;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const shared = tslib_1.__importStar(require("@nx/js"));
|
|
7
|
-
const json_1 = require("nx/src/generators/utils/json");
|
|
8
7
|
const internal_1 = require("@nx/js/internal");
|
|
8
|
+
const devkit_1 = require("@nx/devkit");
|
|
9
9
|
function createTsConfig(host, projectRoot, type, options, relativePathToRootTsConfig) {
|
|
10
10
|
if ((0, internal_1.isUsingTsSolutionSetup)(host)) {
|
|
11
11
|
createTsConfigForTsSolution(host, projectRoot, type, options, relativePathToRootTsConfig);
|
|
@@ -43,10 +43,10 @@ function createTsConfigForTsSolution(host, projectRoot, type, options, relativeP
|
|
|
43
43
|
else {
|
|
44
44
|
json.extends = relativePathToRootTsConfig;
|
|
45
45
|
}
|
|
46
|
-
(0,
|
|
46
|
+
(0, devkit_1.writeJson)(host, `${projectRoot}/tsconfig.json`, json);
|
|
47
47
|
const tsconfigProjectPath = `${projectRoot}/tsconfig.${type}.json`;
|
|
48
48
|
if (host.exists(tsconfigProjectPath)) {
|
|
49
|
-
(0,
|
|
49
|
+
(0, devkit_1.updateJson)(host, tsconfigProjectPath, (json) => {
|
|
50
50
|
if (options.bundler === 'vite') {
|
|
51
51
|
json.compilerOptions ??= {};
|
|
52
52
|
const types = new Set(json.compilerOptions.types ?? []);
|
|
@@ -92,10 +92,10 @@ function createTsConfigForNonTsSolution(host, projectRoot, type, options, relati
|
|
|
92
92
|
else {
|
|
93
93
|
json.extends = relativePathToRootTsConfig;
|
|
94
94
|
}
|
|
95
|
-
(0,
|
|
95
|
+
(0, devkit_1.writeJson)(host, `${projectRoot}/tsconfig.json`, json);
|
|
96
96
|
const tsconfigProjectPath = `${projectRoot}/tsconfig.${type}.json`;
|
|
97
97
|
if (options.bundler === 'vite' && host.exists(tsconfigProjectPath)) {
|
|
98
|
-
(0,
|
|
98
|
+
(0, devkit_1.updateJson)(host, tsconfigProjectPath, (json) => {
|
|
99
99
|
json.compilerOptions ??= {};
|
|
100
100
|
const types = new Set(json.compilerOptions.types ?? []);
|
|
101
101
|
types.add('node');
|
|
@@ -33,6 +33,7 @@ export declare const postcssVersion = "8.4.38";
|
|
|
33
33
|
export declare const autoprefixerVersion = "10.4.13";
|
|
34
34
|
export declare const expressVersion = "^4.21.2";
|
|
35
35
|
export declare const typesExpressVersion = "^4.17.21";
|
|
36
|
+
export declare const httpProxyMiddlewareVersion = "^3.0.5";
|
|
36
37
|
export declare const isbotVersion = "^3.6.5";
|
|
37
38
|
export declare const corsVersion = "~2.8.5";
|
|
38
39
|
export declare const typesCorsVersion = "~2.8.12";
|
|
@@ -41,3 +42,4 @@ export declare const moduleFederationEnhancedVersion = "^2.1.0";
|
|
|
41
42
|
export declare const sassVersion = "^1.97.2";
|
|
42
43
|
export declare const rollupPluginUrlVersion = "^8.0.2";
|
|
43
44
|
export declare const svgrRollupVersion = "^8.1.0";
|
|
45
|
+
export declare const svgrWebpackVersion = "^8.0.1";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.sassVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.tsLibVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryDomVersion = exports.testingLibraryReactVersion = exports.reactRouterIsBotVersion = exports.reactRouterVersion = exports.reactRouterDomVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactIsV18Version = exports.typesReactDomVersion = exports.typesReactDomV18Version = exports.typesReactVersion = exports.typesReactV18Version = exports.swcLoaderVersion = exports.reactIsV18Version = exports.reactIsVersion = exports.reactDomV18Version = exports.reactDomVersion = exports.reactV18Version = exports.reactVersion = exports.minSupportedReactVersion = exports.nxVersion = void 0;
|
|
3
|
+
exports.svgrWebpackVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.sassVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.httpProxyMiddlewareVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.postcssVersion = exports.tsLibVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryDomVersion = exports.testingLibraryReactVersion = exports.reactRouterIsBotVersion = exports.reactRouterVersion = exports.reactRouterDomVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactIsV18Version = exports.typesReactDomVersion = exports.typesReactDomV18Version = exports.typesReactVersion = exports.typesReactV18Version = exports.swcLoaderVersion = exports.reactIsV18Version = exports.reactIsVersion = exports.reactDomV18Version = exports.reactDomVersion = exports.reactV18Version = exports.reactVersion = exports.minSupportedReactVersion = exports.nxVersion = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
exports.nxVersion = require((0, path_1.join)('@nx/react', 'package.json')).version;
|
|
6
6
|
exports.minSupportedReactVersion = '18.0.0';
|
|
@@ -41,6 +41,7 @@ exports.autoprefixerVersion = '10.4.13';
|
|
|
41
41
|
// SSR and Module Federation
|
|
42
42
|
exports.expressVersion = '^4.21.2';
|
|
43
43
|
exports.typesExpressVersion = '^4.17.21';
|
|
44
|
+
exports.httpProxyMiddlewareVersion = '^3.0.5';
|
|
44
45
|
exports.isbotVersion = '^3.6.5';
|
|
45
46
|
exports.corsVersion = '~2.8.5';
|
|
46
47
|
exports.typesCorsVersion = '~2.8.12';
|
|
@@ -51,3 +52,4 @@ exports.sassVersion = '^1.97.2';
|
|
|
51
52
|
// rollup plugins (if needed)
|
|
52
53
|
exports.rollupPluginUrlVersion = '^8.0.2';
|
|
53
54
|
exports.svgrRollupVersion = '^8.1.0';
|
|
55
|
+
exports.svgrWebpackVersion = '^8.0.1';
|
package/migrations.json
CHANGED
|
@@ -39,6 +39,18 @@
|
|
|
39
39
|
"description": "Create AI instructions to help migrate workspaces from React 18 to 19.",
|
|
40
40
|
"prompt": "./dist/src/migrations/update-23-1-0/ai-instructions-for-react-19.md",
|
|
41
41
|
"documentation": "./dist/src/migrations/update-23-1-0/upgrade-to-react-19.md"
|
|
42
|
+
},
|
|
43
|
+
"update-23-2-0-add-optional-module-federation-packages": {
|
|
44
|
+
"version": "23.2.0-beta.4",
|
|
45
|
+
"description": "Add optional Module Federation packages when existing targets require them.",
|
|
46
|
+
"implementation": "./dist/src/migrations/update-23-2-0/add-optional-module-federation-packages",
|
|
47
|
+
"documentation": "./dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.md"
|
|
48
|
+
},
|
|
49
|
+
"update-23-2-0-add-svgr-webpack-if-used": {
|
|
50
|
+
"version": "23.2.0-beta.4",
|
|
51
|
+
"description": "Add `@svgr/webpack` when a webpack config references it.",
|
|
52
|
+
"implementation": "./dist/src/migrations/update-23-2-0/add-svgr-webpack-if-used",
|
|
53
|
+
"documentation": "./dist/src/migrations/update-23-2-0/add-svgr-webpack-if-used.md"
|
|
42
54
|
}
|
|
43
55
|
},
|
|
44
56
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "23.2.0-beta.
|
|
3
|
+
"version": "23.2.0-beta.5",
|
|
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": {
|
|
@@ -93,40 +93,52 @@
|
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
95
95
|
"react": ">=18.0.0 <20.0.0",
|
|
96
|
-
"react-dom": ">=18.0.0 <20.0.0"
|
|
96
|
+
"react-dom": ">=18.0.0 <20.0.0",
|
|
97
|
+
"express": "^4.21.2",
|
|
98
|
+
"http-proxy-middleware": "^3.0.5",
|
|
99
|
+
"@nx/module-federation": "23.2.0-beta.5"
|
|
97
100
|
},
|
|
98
101
|
"peerDependenciesMeta": {
|
|
99
102
|
"babel-plugin-react-compiler": {
|
|
100
103
|
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"@nx/module-federation": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"express": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"http-proxy-middleware": {
|
|
112
|
+
"optional": true
|
|
101
113
|
}
|
|
102
114
|
},
|
|
103
115
|
"dependencies": {
|
|
116
|
+
"@babel/preset-react": "^7.22.5",
|
|
104
117
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
105
|
-
"@svgr/webpack": "^8.0.1",
|
|
106
118
|
"minimatch": "10.2.5",
|
|
107
119
|
"tslib": "^2.3.0",
|
|
108
|
-
"express": "^4.21.2",
|
|
109
|
-
"http-proxy-middleware": "^3.0.5",
|
|
110
120
|
"semver": "^7.6.3",
|
|
111
|
-
"@nx/devkit": "23.2.0-beta.
|
|
112
|
-
"@nx/js": "23.2.0-beta.
|
|
113
|
-
"@nx/eslint": "23.2.0-beta.
|
|
114
|
-
"@nx/web": "23.2.0-beta.
|
|
115
|
-
"@nx/module-federation": "23.2.0-beta.4",
|
|
116
|
-
"@nx/rollup": "23.2.0-beta.4"
|
|
121
|
+
"@nx/devkit": "23.2.0-beta.5",
|
|
122
|
+
"@nx/js": "23.2.0-beta.5",
|
|
123
|
+
"@nx/eslint": "23.2.0-beta.5",
|
|
124
|
+
"@nx/web": "23.2.0-beta.5"
|
|
117
125
|
},
|
|
118
126
|
"devDependencies": {
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"@nx/
|
|
122
|
-
"@nx/
|
|
123
|
-
"@nx/
|
|
124
|
-
"@nx/
|
|
125
|
-
"@nx/
|
|
126
|
-
"nx": "23.2.0-beta.
|
|
127
|
+
"express": "^4.21.2",
|
|
128
|
+
"http-proxy-middleware": "^3.0.5",
|
|
129
|
+
"@nx/cypress": "23.2.0-beta.5",
|
|
130
|
+
"@nx/module-federation": "23.2.0-beta.5",
|
|
131
|
+
"@nx/playwright": "23.2.0-beta.5",
|
|
132
|
+
"@nx/rollup": "23.2.0-beta.5",
|
|
133
|
+
"@nx/rsbuild": "23.2.0-beta.5",
|
|
134
|
+
"@nx/vite": "23.2.0-beta.5",
|
|
135
|
+
"@nx/vitest": "23.2.0-beta.5",
|
|
136
|
+
"@nx/webpack": "23.2.0-beta.5",
|
|
137
|
+
"@nx/storybook": "23.2.0-beta.5",
|
|
138
|
+
"nx": "23.2.0-beta.5"
|
|
127
139
|
},
|
|
128
140
|
"optionalDependencies": {
|
|
129
|
-
"@nx/vite": "23.2.0-beta.
|
|
141
|
+
"@nx/vite": "23.2.0-beta.5"
|
|
130
142
|
},
|
|
131
143
|
"publishConfig": {
|
|
132
144
|
"access": "public"
|