@nx/react 23.3.0-pr.36958.5270397 → 23.3.0-pr.37036.f6e3fb2
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/src/generators/_utils/mf-dependencies.js +2 -0
- package/dist/src/generators/_utils/mf-versions.d.ts +2 -0
- package/dist/src/generators/_utils/mf-versions.js +4 -1
- package/dist/src/generators/application/lib/install-common-dependencies.js +6 -0
- package/dist/src/generators/consumer/consumer.js +8 -0
- package/dist/src/generators/consumer/files/rspack/package.json__tmpl__ +2 -0
- package/dist/src/generators/consumer/files/rspack/rspack.config.ts__tmpl__ +6 -2
- package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +9 -7
- package/dist/src/generators/host/host.js +5 -0
- package/dist/src/generators/library/lib/install-common-dependencies.js +8 -2
- package/dist/src/generators/provider/files/rspack/package.json__tmpl__ +2 -0
- package/dist/src/generators/provider/files/rspack/rspack.config.ts__tmpl__ +6 -2
- package/dist/src/generators/provider/provider.js +8 -0
- package/dist/src/generators/remote/remote.js +5 -0
- package/dist/src/plugins/router-plugin.js +15 -10
- package/dist/src/utils/ct-utils.d.ts +10 -2
- package/dist/src/utils/ct-utils.js +12 -4
- package/package.json +19 -19
- package/readme-template.md +18 -0
|
@@ -72,6 +72,8 @@ function bundlerDeps(bundler) {
|
|
|
72
72
|
'@rspack/cli': mfVersions.rspackCliVersion,
|
|
73
73
|
'@rspack/core': mfVersions.rspackCoreVersion,
|
|
74
74
|
'@rspack/dev-server': mfVersions.rspackDevServerVersion,
|
|
75
|
+
'@rspack/plugin-react-refresh': mfVersions.rspackPluginReactRefreshVersion,
|
|
76
|
+
'react-refresh': mfVersions.reactRefreshVersion,
|
|
75
77
|
},
|
|
76
78
|
};
|
|
77
79
|
}
|
|
@@ -8,4 +8,6 @@ export declare const rsbuildPluginReactVersion = "^1.3.0";
|
|
|
8
8
|
export declare const moduleFederationRsbuildPluginVersion = "^2.5.0";
|
|
9
9
|
export declare const rspackCoreVersion = "^2.0.3";
|
|
10
10
|
export declare const rspackCliVersion = "^2.0.3";
|
|
11
|
+
export declare const rspackPluginReactRefreshVersion = "^2.0.0";
|
|
12
|
+
export declare const reactRefreshVersion = "~0.14.0";
|
|
11
13
|
export declare const rspackDevServerVersion = "2.0.1";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// versions (react, react-dom, @types/*, typescript) are owned by @nx/react
|
|
4
4
|
// (../../utils/versions) and @nx/js so each dep has a single source of truth.
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.rspackDevServerVersion = exports.rspackCliVersion = exports.rspackCoreVersion = exports.moduleFederationRsbuildPluginVersion = exports.rsbuildPluginReactVersion = exports.rsbuildCoreVersion = exports.vitejsPluginReactVersion = exports.viteVersion = exports.moduleFederationRuntimeVersion = exports.moduleFederationVitePluginVersion = exports.moduleFederationEnhancedVersion = void 0;
|
|
6
|
+
exports.rspackDevServerVersion = exports.reactRefreshVersion = exports.rspackPluginReactRefreshVersion = exports.rspackCliVersion = exports.rspackCoreVersion = exports.moduleFederationRsbuildPluginVersion = exports.rsbuildPluginReactVersion = exports.rsbuildCoreVersion = exports.vitejsPluginReactVersion = exports.viteVersion = exports.moduleFederationRuntimeVersion = exports.moduleFederationVitePluginVersion = exports.moduleFederationEnhancedVersion = void 0;
|
|
7
7
|
// Module Federation runtime packages. Keep `runtime` on the same major as
|
|
8
8
|
// `enhanced` / the `vite` plugin (both pull runtime 2.4.x). A 0.x runtime in
|
|
9
9
|
// the consumer would mismatch the 2.x runtime baked into the providers.
|
|
@@ -23,6 +23,9 @@ exports.moduleFederationRsbuildPluginVersion = '^2.5.0';
|
|
|
23
23
|
// Rspack stack.
|
|
24
24
|
exports.rspackCoreVersion = '^2.0.3';
|
|
25
25
|
exports.rspackCliVersion = '^2.0.3';
|
|
26
|
+
// @rspack/plugin-react-refresh 2.x peers react-refresh >=0.10 <1.
|
|
27
|
+
exports.rspackPluginReactRefreshVersion = '^2.0.0';
|
|
28
|
+
exports.reactRefreshVersion = '~0.14.0';
|
|
26
29
|
// Pinned (no ^) to dodge the broken 2.0.2 publish, which ships no dist/ so
|
|
27
30
|
// @rspack/cli can't load it for `rspack serve`. Re-float to ^ once upstream
|
|
28
31
|
// republishes a fixed 2.0.3+.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const versions_1 = require("../../../utils/versions");
|
|
6
7
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
7
8
|
async function installCommonDependencies(host, options) {
|
|
@@ -33,6 +34,11 @@ async function installCommonDependencies(host, options) {
|
|
|
33
34
|
// `@nx/webpack` installs them automatically for now.
|
|
34
35
|
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
|
|
35
36
|
if (options.style === 'scss') {
|
|
37
|
+
// sass pulls in @parcel/watcher, whose install script only builds from
|
|
38
|
+
// source when npm_config_build_from_source is set.
|
|
39
|
+
(0, internal_1.acknowledgeBuildScripts)(host, (0, devkit_1.detectPackageManager)(host.root), {
|
|
40
|
+
'@parcel/watcher': false,
|
|
41
|
+
});
|
|
36
42
|
devDependencies['sass'] = versions_1.sassVersion;
|
|
37
43
|
}
|
|
38
44
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.consumerGenerator = consumerGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const assert_supported_react_version_1 = require("../../utils/assert-supported-react-version");
|
|
7
8
|
const versions_1 = require("@nx/js/src/utils/versions");
|
|
8
9
|
const versions_2 = require("../../utils/versions");
|
|
@@ -130,6 +131,13 @@ async function consumerGenerator(tree, schema) {
|
|
|
130
131
|
// Write deps into the workspace root package.json so bare bundler bins
|
|
131
132
|
// resolve when nx invokes the generated run-commands serve target.
|
|
132
133
|
const deps = (0, mf_dependencies_1.getConsumerDeps)(opts.bundler);
|
|
134
|
+
if (opts.bundler === 'rsbuild') {
|
|
135
|
+
// @rsbuild/core v1 depends on core-js, whose install script only prints a
|
|
136
|
+
// funding message.
|
|
137
|
+
(0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
|
|
138
|
+
'core-js': false,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
133
141
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, deps.dependencies, deps.devDependencies, undefined, true));
|
|
134
142
|
await (0, devkit_1.formatFiles)(tree);
|
|
135
143
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
@@ -16,8 +16,10 @@
|
|
|
16
16
|
"@rspack/cli": "<%= versions.rspackCliVersion %>",
|
|
17
17
|
"@rspack/core": "<%= versions.rspackCoreVersion %>",
|
|
18
18
|
"@rspack/dev-server": "<%= versions.rspackDevServerVersion %>",
|
|
19
|
+
"@rspack/plugin-react-refresh": "<%= versions.rspackPluginReactRefreshVersion %>",
|
|
19
20
|
"@types/react": "<%= versions.typesReactVersion %>",
|
|
20
21
|
"@types/react-dom": "<%= versions.typesReactDomVersion %>",
|
|
22
|
+
"react-refresh": "<%= versions.reactRefreshVersion %>",
|
|
21
23
|
"typescript": "<%= versions.typescriptVersion %>"
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from '@rspack/cli';
|
|
2
2
|
import { rspack } from '@rspack/core';
|
|
3
3
|
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
4
|
+
import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';
|
|
4
5
|
import * as path from 'node:path';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
7
|
|
|
@@ -38,7 +39,9 @@ export default defineConfig((_env, argv) => {
|
|
|
38
39
|
options: {
|
|
39
40
|
jsc: {
|
|
40
41
|
parser: { syntax: 'typescript', tsx: true },
|
|
41
|
-
transform: {
|
|
42
|
+
transform: {
|
|
43
|
+
react: { runtime: 'automatic', development: isDev, refresh: isDev },
|
|
44
|
+
},
|
|
42
45
|
},
|
|
43
46
|
env: { targets: 'Chrome >= 87, Firefox >= 78, Edge >= 88, Safari >= 14' },
|
|
44
47
|
},
|
|
@@ -47,6 +50,7 @@ export default defineConfig((_env, argv) => {
|
|
|
47
50
|
],
|
|
48
51
|
},
|
|
49
52
|
plugins: [
|
|
53
|
+
isDev && new ReactRefreshRspackPlugin(),
|
|
50
54
|
new rspack.HtmlRspackPlugin({ template: './index.html' }),
|
|
51
55
|
new ModuleFederationPlugin({
|
|
52
56
|
name: NAME,
|
|
@@ -54,6 +58,6 @@ export default defineConfig((_env, argv) => {
|
|
|
54
58
|
// src/mf.ts at module load time.
|
|
55
59
|
shared: ['react', 'react-dom'],
|
|
56
60
|
}),
|
|
57
|
-
],
|
|
61
|
+
].filter(Boolean),
|
|
58
62
|
};
|
|
59
63
|
});
|
package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js
CHANGED
|
@@ -26,13 +26,7 @@ async function cypressComponentConfigGeneratorInternal(tree, options) {
|
|
|
26
26
|
nxJson.useInferencePlugins !== false;
|
|
27
27
|
options.addPlugin ??= addPlugin;
|
|
28
28
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
29
|
-
const
|
|
30
|
-
project: options.project,
|
|
31
|
-
skipFormat: true,
|
|
32
|
-
jsx: true,
|
|
33
|
-
addPlugin: options.addPlugin,
|
|
34
|
-
});
|
|
35
|
-
const found = await (0, ct_utils_1.configureCypressCT)(tree, {
|
|
29
|
+
const { found, bundler } = await (0, ct_utils_1.resolveCypressCTTarget)(tree, {
|
|
36
30
|
project: options.project,
|
|
37
31
|
buildTarget: options.buildTarget,
|
|
38
32
|
bundler: options.bundler,
|
|
@@ -41,6 +35,14 @@ async function cypressComponentConfigGeneratorInternal(tree, options) {
|
|
|
41
35
|
'@nx/vite:build',
|
|
42
36
|
]),
|
|
43
37
|
});
|
|
38
|
+
const installTask = await baseCyCtConfig(tree, {
|
|
39
|
+
project: options.project,
|
|
40
|
+
skipFormat: true,
|
|
41
|
+
jsx: true,
|
|
42
|
+
addPlugin: options.addPlugin,
|
|
43
|
+
bundler,
|
|
44
|
+
});
|
|
45
|
+
await (0, ct_utils_1.configureCypressCT)(tree, { project: options.project, found, bundler });
|
|
44
46
|
await (0, add_files_1.addFiles)(tree, projectConfig, options, found);
|
|
45
47
|
if (!options.skipFormat) {
|
|
46
48
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -143,6 +143,11 @@ async function hostGenerator(host, schema) {
|
|
|
143
143
|
: {}),
|
|
144
144
|
}, undefined, true);
|
|
145
145
|
tasks.push(installTask);
|
|
146
|
+
// The TS config templates use extensionless relative imports and
|
|
147
|
+
// `__dirname`, which Node's native type stripping cannot load.
|
|
148
|
+
if (options.typescriptConfiguration) {
|
|
149
|
+
tasks.push((0, internal_3.addSwcRegisterDependencies)(host));
|
|
150
|
+
}
|
|
146
151
|
if (!options.skipFormat) {
|
|
147
152
|
await (0, devkit_1.formatFiles)(host);
|
|
148
153
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.installCommonDependencies = installCommonDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/js/internal");
|
|
6
7
|
const version_utils_1 = require("../../../utils/version-utils");
|
|
7
8
|
const versions_1 = require("../../../utils/versions");
|
|
8
9
|
async function installCommonDependencies(host, options) {
|
|
@@ -22,6 +23,11 @@ async function installCommonDependencies(host, options) {
|
|
|
22
23
|
// TODO(jack): Once we clean up webpack we can remove this check
|
|
23
24
|
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
|
|
24
25
|
if (options.style === 'scss') {
|
|
26
|
+
// sass pulls in @parcel/watcher, whose install script only builds from
|
|
27
|
+
// source when npm_config_build_from_source is set.
|
|
28
|
+
(0, internal_1.acknowledgeBuildScripts)(host, (0, devkit_1.detectPackageManager)(host.root), {
|
|
29
|
+
'@parcel/watcher': false,
|
|
30
|
+
});
|
|
25
31
|
devDependencies['sass'] = versions_1.sassVersion;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
@@ -32,7 +38,7 @@ async function installCommonDependencies(host, options) {
|
|
|
32
38
|
const baseInstallTask = (0, devkit_1.addDependenciesToPackageJson)(host, dependencies, devDependencies, undefined, true);
|
|
33
39
|
tasks.push(baseInstallTask);
|
|
34
40
|
if (options.compiler === 'swc') {
|
|
35
|
-
tasks.push((0,
|
|
41
|
+
tasks.push((0, internal_2.addSwcDependencies)(host));
|
|
36
42
|
}
|
|
37
43
|
else if (options.compiler === 'babel') {
|
|
38
44
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
"@rspack/cli": "<%= versions.rspackCliVersion %>",
|
|
16
16
|
"@rspack/core": "<%= versions.rspackCoreVersion %>",
|
|
17
17
|
"@rspack/dev-server": "<%= versions.rspackDevServerVersion %>",
|
|
18
|
+
"@rspack/plugin-react-refresh": "<%= versions.rspackPluginReactRefreshVersion %>",
|
|
18
19
|
"@types/react": "<%= versions.typesReactVersion %>",
|
|
19
20
|
"@types/react-dom": "<%= versions.typesReactDomVersion %>",
|
|
21
|
+
"react-refresh": "<%= versions.reactRefreshVersion %>",
|
|
20
22
|
"typescript": "<%= versions.typescriptVersion %>"
|
|
21
23
|
}
|
|
22
24
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineConfig } from '@rspack/cli';
|
|
2
2
|
import { rspack } from '@rspack/core';
|
|
3
3
|
import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
4
|
+
import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';
|
|
4
5
|
import * as path from 'node:path';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
7
|
|
|
@@ -43,7 +44,9 @@ export default defineConfig((_env, argv) => {
|
|
|
43
44
|
options: {
|
|
44
45
|
jsc: {
|
|
45
46
|
parser: { syntax: 'typescript', tsx: true },
|
|
46
|
-
transform: {
|
|
47
|
+
transform: {
|
|
48
|
+
react: { runtime: 'automatic', development: isDev, refresh: isDev },
|
|
49
|
+
},
|
|
47
50
|
},
|
|
48
51
|
env: { targets: 'Chrome >= 87, Firefox >= 78, Edge >= 88, Safari >= 14' },
|
|
49
52
|
},
|
|
@@ -52,6 +55,7 @@ export default defineConfig((_env, argv) => {
|
|
|
52
55
|
],
|
|
53
56
|
},
|
|
54
57
|
plugins: [
|
|
58
|
+
isDev && new ReactRefreshRspackPlugin(),
|
|
55
59
|
// excludeChunks is REQUIRED on a provider: without it the federation
|
|
56
60
|
// remoteEntry chunk gets injected into the standalone HTML and breaks
|
|
57
61
|
// direct serves.
|
|
@@ -64,6 +68,6 @@ export default defineConfig((_env, argv) => {
|
|
|
64
68
|
},
|
|
65
69
|
shared: ['react', 'react-dom'],
|
|
66
70
|
}),
|
|
67
|
-
],
|
|
71
|
+
].filter(Boolean),
|
|
68
72
|
};
|
|
69
73
|
});
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.providerGenerator = providerGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
7
|
const assert_supported_react_version_1 = require("../../utils/assert-supported-react-version");
|
|
7
8
|
const versions_1 = require("@nx/js/src/utils/versions");
|
|
8
9
|
const versions_2 = require("../../utils/versions");
|
|
@@ -87,6 +88,13 @@ async function providerGenerator(tree, schema) {
|
|
|
87
88
|
// resolve when nx invokes the generated run-commands serve target. The
|
|
88
89
|
// per-project package.json template still ships for pnpm-workspace setups.
|
|
89
90
|
const deps = (0, mf_dependencies_1.getProviderDeps)(opts.bundler);
|
|
91
|
+
if (opts.bundler === 'rsbuild') {
|
|
92
|
+
// @rsbuild/core v1 depends on core-js, whose install script only prints a
|
|
93
|
+
// funding message.
|
|
94
|
+
(0, internal_1.acknowledgeBuildScripts)(tree, (0, devkit_1.detectPackageManager)(tree.root), {
|
|
95
|
+
'core-js': false,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
90
98
|
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, deps.dependencies, deps.devDependencies, undefined, true);
|
|
91
99
|
await (0, devkit_1.formatFiles)(tree);
|
|
92
100
|
return (0, devkit_1.runTasksInSerial)(installTask);
|
|
@@ -188,6 +188,11 @@ async function remoteGenerator(host, schema) {
|
|
|
188
188
|
: {}),
|
|
189
189
|
}, undefined, true);
|
|
190
190
|
tasks.push(installTask);
|
|
191
|
+
// The TS config templates use extensionless relative imports and
|
|
192
|
+
// `__dirname`, which Node's native type stripping cannot load.
|
|
193
|
+
if (options.typescriptConfiguration) {
|
|
194
|
+
tasks.push((0, internal_3.addSwcRegisterDependencies)(host));
|
|
195
|
+
}
|
|
191
196
|
if (!options.skipFormat) {
|
|
192
197
|
await (0, devkit_1.formatFiles)(host);
|
|
193
198
|
}
|
|
@@ -73,9 +73,9 @@ async function buildReactRouterTargets(configFilePath, projectRoot, options, con
|
|
|
73
73
|
const { buildDirectory, serverBuildPath } = await getBuildPaths(reactRouterConfig, isLibMode);
|
|
74
74
|
const targets = {};
|
|
75
75
|
targets[options.buildTargetName] = await getBuildTargetConfig(options.buildTargetName, projectRoot, buildDirectory, serverBuildPath, namedInputs, isUsingTsSolutionSetup);
|
|
76
|
-
targets[options.devTargetName] = await devTarget(projectRoot, isUsingTsSolutionSetup);
|
|
76
|
+
targets[options.devTargetName] = await devTarget(projectRoot, namedInputs, isUsingTsSolutionSetup);
|
|
77
77
|
if (serverBuildPath) {
|
|
78
|
-
targets[options.startTargetName] = await startTarget(projectRoot, serverBuildPath, options.buildTargetName, isUsingTsSolutionSetup);
|
|
78
|
+
targets[options.startTargetName] = await startTarget(projectRoot, serverBuildPath, options.buildTargetName, namedInputs, isUsingTsSolutionSetup);
|
|
79
79
|
}
|
|
80
80
|
targets[options.typecheckTargetName] = await typecheckTarget(projectRoot, options.typecheckTargetName, namedInputs, siblingFiles, isUsingTsSolutionSetup);
|
|
81
81
|
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmCommand);
|
|
@@ -99,12 +99,7 @@ async function getBuildTargetConfig(buildTargetName, projectRoot, buildDirectory
|
|
|
99
99
|
const buildTarget = {
|
|
100
100
|
cache: true,
|
|
101
101
|
dependsOn: [`^${buildTargetName}`],
|
|
102
|
-
inputs:
|
|
103
|
-
...('production' in namedInputs
|
|
104
|
-
? ['production', '^production']
|
|
105
|
-
: ['default', '^default']),
|
|
106
|
-
{ externalDependencies: ['@react-router/dev'] },
|
|
107
|
-
],
|
|
102
|
+
inputs: buildInputs(namedInputs),
|
|
108
103
|
outputs,
|
|
109
104
|
command: 'react-router build',
|
|
110
105
|
options: { cwd: projectRoot },
|
|
@@ -126,9 +121,18 @@ async function getBuildPaths(reactRouterConfig, isLibMode) {
|
|
|
126
121
|
}),
|
|
127
122
|
};
|
|
128
123
|
}
|
|
129
|
-
|
|
124
|
+
function buildInputs(namedInputs) {
|
|
125
|
+
return [
|
|
126
|
+
...('production' in namedInputs
|
|
127
|
+
? ['production', '^production']
|
|
128
|
+
: ['default', '^default']),
|
|
129
|
+
{ externalDependencies: ['@react-router/dev'] },
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
async function devTarget(projectRoot, namedInputs, isUsingTsSolutionSetup) {
|
|
130
133
|
const devTarget = {
|
|
131
134
|
continuous: true,
|
|
135
|
+
inputs: buildInputs(namedInputs),
|
|
132
136
|
command: 'react-router dev',
|
|
133
137
|
options: { cwd: projectRoot },
|
|
134
138
|
};
|
|
@@ -137,13 +141,14 @@ async function devTarget(projectRoot, isUsingTsSolutionSetup) {
|
|
|
137
141
|
}
|
|
138
142
|
return devTarget;
|
|
139
143
|
}
|
|
140
|
-
async function startTarget(projectRoot, serverBuildPath, buildTargetName, isUsingTsSolutionSetup) {
|
|
144
|
+
async function startTarget(projectRoot, serverBuildPath, buildTargetName, namedInputs, isUsingTsSolutionSetup) {
|
|
141
145
|
const serverPath = serverBuildPath === 'build/server'
|
|
142
146
|
? `${serverBuildPath}/index.js`
|
|
143
147
|
: serverBuildPath;
|
|
144
148
|
const startTarget = {
|
|
145
149
|
continuous: true,
|
|
146
150
|
dependsOn: [buildTargetName],
|
|
151
|
+
inputs: buildInputs(namedInputs),
|
|
147
152
|
command: `react-router-serve ${serverPath}`,
|
|
148
153
|
options: { cwd: projectRoot },
|
|
149
154
|
};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { type FoundTarget } from '@nx/cypress/internal';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function resolveCypressCTTarget(tree: Tree, options: {
|
|
4
4
|
project: string;
|
|
5
5
|
buildTarget: string;
|
|
6
6
|
bundler: 'vite' | 'webpack';
|
|
7
7
|
validExecutorNames: Set<string>;
|
|
8
|
-
}): Promise<
|
|
8
|
+
}): Promise<{
|
|
9
|
+
found: FoundTarget;
|
|
10
|
+
bundler: 'vite' | 'webpack';
|
|
11
|
+
}>;
|
|
12
|
+
export declare function configureCypressCT(tree: Tree, options: {
|
|
13
|
+
project: string;
|
|
14
|
+
found: FoundTarget;
|
|
15
|
+
bundler: 'vite' | 'webpack';
|
|
16
|
+
}): Promise<void>;
|
|
9
17
|
export declare function getBundlerFromTarget(found: FoundTarget, tree: Tree): Promise<'vite' | 'webpack'>;
|
|
10
18
|
export declare function getActualBundler(tree: Tree, options: {
|
|
11
19
|
buildTarget?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveCypressCTTarget = resolveCypressCTTarget;
|
|
3
4
|
exports.configureCypressCT = configureCypressCT;
|
|
4
5
|
exports.getBundlerFromTarget = getBundlerFromTarget;
|
|
5
6
|
exports.getActualBundler = getActualBundler;
|
|
@@ -10,9 +11,9 @@ const ast_utils_1 = require("./ast-utils");
|
|
|
10
11
|
let tsModule;
|
|
11
12
|
const allowedFileExt = new RegExp(/\.[jt]sx?/);
|
|
12
13
|
const isSpecFile = new RegExp(/(spec|test)\./);
|
|
13
|
-
|
|
14
|
+
// Resolved before the shared cypress generator runs, so the bundler reaches it.
|
|
15
|
+
async function resolveCypressCTTarget(tree, options) {
|
|
14
16
|
let found = { target: options.buildTarget, config: undefined };
|
|
15
|
-
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
16
17
|
// Specifically undefined as a workaround for Remix to pass an empty string as the buildTarget
|
|
17
18
|
if (options.buildTarget === undefined) {
|
|
18
19
|
const { findBuildConfig, } = require('@nx/cypress/internal');
|
|
@@ -32,9 +33,17 @@ async function configureCypressCT(tree, options) {
|
|
|
32
33
|
throw new Error(`Cypress Component Testing is not currently supported for this project. Either 'executer' is not defined in '${target} target' of '${project} project.json' or executer present is not valid one. Valid ones are ${JSON.stringify([...options.validExecutorNames])}. Please check https://github.com/nrwl/nx/issues/21546 for more information.`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
36
|
+
return {
|
|
37
|
+
found,
|
|
38
|
+
bundler: options.bundler ?? (await getActualBundler(tree, options, found)),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async function configureCypressCT(tree, options) {
|
|
42
|
+
const { found } = options;
|
|
43
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
35
44
|
const { addDefaultCTConfig, getProjectCypressConfigPath, getInstalledCypressMajorVersion, } = require('@nx/cypress/internal');
|
|
36
45
|
const ctConfigOptions = {
|
|
37
|
-
bundler: options.bundler
|
|
46
|
+
bundler: options.bundler,
|
|
38
47
|
};
|
|
39
48
|
if (projectConfig.targets?.['component-test']?.executor ===
|
|
40
49
|
'@nx/cypress:cypress') {
|
|
@@ -51,7 +60,6 @@ async function configureCypressCT(tree, options) {
|
|
|
51
60
|
const cypressConfigFilePath = getProjectCypressConfigPath(tree, projectConfig.root);
|
|
52
61
|
const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigFilePath, 'utf-8'), ctConfigOptions, '@nx/react/plugins/component-testing', getInstalledCypressMajorVersion(tree));
|
|
53
62
|
tree.write(cypressConfigFilePath, updatedCyConfig);
|
|
54
|
-
return found;
|
|
55
63
|
}
|
|
56
64
|
function assertValidConfig(config) {
|
|
57
65
|
if (!config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "23.3.0-pr.
|
|
3
|
+
"version": "23.3.0-pr.37036.f6e3fb2",
|
|
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": {
|
|
@@ -94,9 +94,9 @@
|
|
|
94
94
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
95
95
|
"react": ">=18.0.0 <20.0.0",
|
|
96
96
|
"react-dom": ">=18.0.0 <20.0.0",
|
|
97
|
+
"@nx/module-federation": "23.3.0-pr.37036.f6e3fb2",
|
|
97
98
|
"express": "^4.21.2",
|
|
98
|
-
"http-proxy-middleware": "^3.0.7"
|
|
99
|
-
"@nx/module-federation": "23.3.0-pr.36958.5270397"
|
|
99
|
+
"http-proxy-middleware": "^3.0.7"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
102
|
"babel-plugin-react-compiler": {
|
|
@@ -117,28 +117,28 @@
|
|
|
117
117
|
"@phenomnomnominal/tsquery": "~6.2.0",
|
|
118
118
|
"minimatch": "10.2.5",
|
|
119
119
|
"tslib": "^2.3.0",
|
|
120
|
-
"
|
|
121
|
-
"@nx/
|
|
122
|
-
"@nx/
|
|
123
|
-
"@nx/
|
|
124
|
-
"
|
|
120
|
+
"@nx/devkit": "23.3.0-pr.37036.f6e3fb2",
|
|
121
|
+
"@nx/js": "23.3.0-pr.37036.f6e3fb2",
|
|
122
|
+
"@nx/eslint": "23.3.0-pr.37036.f6e3fb2",
|
|
123
|
+
"@nx/web": "23.3.0-pr.37036.f6e3fb2",
|
|
124
|
+
"semver": "^7.6.3"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|
|
127
|
+
"@nx/cypress": "23.3.0-pr.37036.f6e3fb2",
|
|
128
|
+
"@nx/module-federation": "23.3.0-pr.37036.f6e3fb2",
|
|
129
|
+
"@nx/playwright": "23.3.0-pr.37036.f6e3fb2",
|
|
130
|
+
"@nx/rollup": "23.3.0-pr.37036.f6e3fb2",
|
|
131
|
+
"@nx/rsbuild": "23.3.0-pr.37036.f6e3fb2",
|
|
132
|
+
"@nx/vite": "23.3.0-pr.37036.f6e3fb2",
|
|
133
|
+
"@nx/vitest": "23.3.0-pr.37036.f6e3fb2",
|
|
134
|
+
"@nx/webpack": "23.3.0-pr.37036.f6e3fb2",
|
|
135
|
+
"@nx/storybook": "23.3.0-pr.37036.f6e3fb2",
|
|
127
136
|
"express": "^4.21.2",
|
|
128
137
|
"http-proxy-middleware": "^3.0.7",
|
|
129
|
-
"
|
|
130
|
-
"@nx/module-federation": "23.3.0-pr.36958.5270397",
|
|
131
|
-
"@nx/playwright": "23.3.0-pr.36958.5270397",
|
|
132
|
-
"@nx/rollup": "23.3.0-pr.36958.5270397",
|
|
133
|
-
"@nx/rsbuild": "23.3.0-pr.36958.5270397",
|
|
134
|
-
"@nx/vite": "23.3.0-pr.36958.5270397",
|
|
135
|
-
"@nx/vitest": "23.3.0-pr.36958.5270397",
|
|
136
|
-
"@nx/webpack": "23.3.0-pr.36958.5270397",
|
|
137
|
-
"@nx/storybook": "23.3.0-pr.36958.5270397",
|
|
138
|
-
"nx": "23.3.0-pr.36958.5270397"
|
|
138
|
+
"nx": "23.3.0-pr.37036.f6e3fb2"
|
|
139
139
|
},
|
|
140
140
|
"optionalDependencies": {
|
|
141
|
-
"@nx/vite": "23.3.0-pr.
|
|
141
|
+
"@nx/vite": "23.3.0-pr.37036.f6e3fb2"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<p style="text-align: center;">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
+
<img alt="Nx - Smart Monorepos · Fast Builds" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
{{links}}
|
|
9
|
+
|
|
10
|
+
<hr>
|
|
11
|
+
|
|
12
|
+
# Nx: Smart Monorepos · Fast Builds
|
|
13
|
+
|
|
14
|
+
Get to green PRs in half the time. Nx optimizes your builds, scales your CI, and fixes failed PRs. Built for developers and AI agents.
|
|
15
|
+
|
|
16
|
+
This package is a [React plugin for Nx](https://nx.dev/nx-api/react).
|
|
17
|
+
|
|
18
|
+
{{content}}
|